[xiph-cvs] cvs commit: ices/src audio.c audio.h resample.c resample.h

Karl Heyes karl at xiph.org
Fri Mar 14 18:24:18 PST 2003



karl        03/03/14 21:24:18

  Modified:    src      audio.c audio.h resample.c resample.h
  Log:
  rename the res_* calls/structures as res_init can conflict with a DNS
  resolver call (-lresolv)

Revision  Changes    Path
1.6       +7 -7      ices/src/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/audio.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- audio.c	17 Aug 2002 05:17:57 -0000	1.5
+++ audio.c	15 Mar 2003 02:24:18 -0000	1.6
@@ -2,7 +2,7 @@
  * stereo->mono downmixing
  * resampling
  *
- * $Id: audio.c,v 1.5 2002/08/17 05:17:57 msmith Exp $
+ * $Id: audio.c,v 1.6 2003/03/15 02:24:18 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -83,7 +83,7 @@
 {
     resample_state *state = calloc(1, sizeof(resample_state));
 
-    if(res_init(&state->resampler, channels, outfreq, infreq, RES_END)) {
+    if(resampler_init(&state->resampler, channels, outfreq, infreq, RES_END)) {
         LOG_ERROR0("Couldn't initialise resampler to specified frequency\n");
         return NULL;
     }
@@ -113,7 +113,7 @@
                 free(s->convbuf[c]);
             free(s->convbuf);
         }
-        res_clear(&s->resampler);
+        resampler_clear(&s->resampler);
         free(s);
     }
 }
@@ -156,9 +156,9 @@
     int c;
     int res;
 
-    s->buffill = res_push_check(&s->resampler, buflen);
+    s->buffill = resampler_push_check(&s->resampler, buflen);
     if(s->buffill <= 0) {
-        LOG_ERROR1("Fatal reencoding error: res_push_check returned %d", 
+        LOG_ERROR1("Fatal reencoding error: resampler_push_check returned %d", 
                 s->buffill);
     }
 
@@ -168,7 +168,7 @@
             s->buffers[c] = realloc(s->buffers[c], s->bufsize * sizeof(float));
     }
 
-    if((res = res_push(&s->resampler, s->buffers, (float const **)buf, buflen))
+    if((res = resampler_push(&s->resampler, s->buffers, (float const **)buf, buflen))
             != s->buffill) {
         LOG_ERROR2("Internal error in resampling: returned number of samples %d"
                    ", expected %d", res, s->buffill);
@@ -185,7 +185,7 @@
     if(!s->buffers[0])
         return;
 
-    ret = res_drain(&s->resampler, s->buffers);
+    ret = resampler_drain(&s->resampler, s->buffers);
 
     if(ret > s->bufsize) {
         LOG_ERROR0("Fatal error in resampler: buffers too small");

<p><p>1.3       +2 -2      ices/src/audio.h

Index: audio.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/audio.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- audio.h	3 Aug 2002 14:41:10 -0000	1.2
+++ audio.h	15 Mar 2003 02:24:18 -0000	1.3
@@ -2,7 +2,7 @@
  * - stereo->mono downmixing
  * - resampling
  *
- * $Id: audio.h,v 1.2 2002/08/03 14:41:10 msmith Exp $
+ * $Id: audio.h,v 1.3 2003/03/15 02:24:18 karl Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -23,7 +23,7 @@
 } downmix_state;
 
 typedef struct {
-    res_state resampler;
+    resampler_state resampler;
     int channels;
 
     float **buffers;

<p><p>1.2       +11 -11    ices/src/resample.c

Index: resample.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/resample.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- resample.c	3 Aug 2002 08:21:33 -0000	1.1
+++ resample.c	15 Mar 2003 02:24:18 -0000	1.2
@@ -125,7 +125,7 @@
 }
 
 
-int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...)
+int resampler_init(resampler_state *state, int channels, int outfreq, int infreq, resampler_parameter op1, ...)
 {
         double beta = 16.0,
                 cutoff = 0.80,
@@ -173,7 +173,7 @@
                                 assert("arglist" == "valid");
                                 return -1;
                         }
-			op1 = va_arg(argp, res_parameter);
+			op1 = va_arg(argp, resampler_parameter);
                 } while (op1 != RES_END);
                 va_end(argp);
         }
@@ -236,7 +236,7 @@
 }
 
 
-static int push(res_state const * const state, SAMPLE *pool, int * const poolfill, int * const offset, SAMPLE *dest, int dststep, SAMPLE const *source, int srcstep, size_t srclen)
+static int push(resampler_state const * const state, SAMPLE *pool, int * const poolfill, int * const offset, SAMPLE *dest, int dststep, SAMPLE const *source, int srcstep, size_t srclen)
 {
         SAMPLE	* const destbase = dest,
                 *poolhead = pool + *poolfill,
@@ -254,7 +254,7 @@
 
         assert(state->poolfill != -1);
         
-	lencheck = res_push_check(state, srclen);
+	lencheck = resampler_push_check(state, srclen);
 
         /* fill the pool before diving in */
         while (poolhead < poolend && srclen > 0)
@@ -315,13 +315,13 @@
 }
 
 
-int res_push_max_input(res_state const * const state, size_t maxoutput)
+int resampler_push_max_input(resampler_state const * const state, size_t maxoutput)
 {
         return maxoutput * state->infreq / state->outfreq;
 }
 
 
-int res_push_check(res_state const * const state, size_t srclen)
+int resampler_push_check(resampler_state const * const state, size_t srclen)
 {
         if (state->poolfill < state->taps)
                 srclen -= state->taps - state->poolfill;
@@ -330,7 +330,7 @@
 }
 
 
-int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen)
+int resampler_push(resampler_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen)
 {
         int result = -1, poolfill = -1, offset = -1, i;
 
@@ -352,7 +352,7 @@
 }
 
 
-int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen)
+int resampler_push_interleaved(resampler_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen)
 {
         int result = -1, poolfill = -1, offset = -1, i;
         
@@ -374,7 +374,7 @@
 }
 
 
-int res_drain(res_state *state, SAMPLE **dstlist)
+int resampler_drain(resampler_state *state, SAMPLE **dstlist)
 {
         SAMPLE *tail;
         int result = -1, poolfill = -1, offset = -1, i;
@@ -401,7 +401,7 @@
 }
 
 
-int res_drain_interleaved(res_state *state, SAMPLE *dest)
+int resampler_drain_interleaved(resampler_state *state, SAMPLE *dest)
 {
         SAMPLE *tail;
         int result = -1, poolfill = -1, offset = -1, i;
@@ -428,7 +428,7 @@
 }
 
 
-void res_clear(res_state *state)
+void resampler_clear(resampler_state *state)
 {
         assert(state);
         assert(state->table);

<p><p>1.2       +15 -15    ices/src/resample.h

Index: resample.h
===================================================================
RCS file: /usr/local/cvsroot/ices/src/resample.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- resample.h	3 Aug 2002 08:21:33 -0000	1.1
+++ resample.h	15 Mar 2003 02:24:18 -0000	1.2
@@ -31,7 +31,7 @@
         /* dynamic bits */
         int poolfill;
         int offset;
-} res_state;
+} resampler_state;
 
 typedef enum
 {
@@ -40,15 +40,15 @@
         RES_CUTOFF,	/* (double)0.80 */ 
         RES_TAPS,	/* (int)45 */
         RES_BETA	/* (double)16.0 */
-} res_parameter;
+} resampler_parameter;
 
-int res_init(res_state *state, int channels, int outfreq, int infreq, res_parameter op1, ...);
+int resampler_init(resampler_state *state, int channels, int outfreq, int infreq, resampler_parameter op1, ...);
 /*
  * Configure *state to manage a data stream with the specified parameters.  The
  * string 'params' is currently unspecified, but will configure the parameters
  * of the filter.
  *
- * This function allocates memory, and requires that res_clear() be called when
+ * This function allocates memory, and requires that resampler_clear() be called when
  * the buffer is no longer needed.
  *
  *
@@ -58,7 +58,7 @@
  */
 
 
-int res_push_max_input(res_state const *state, size_t maxoutput);
+int resampler_push_max_input(resampler_state const *state, size_t maxoutput);
 /*
  *  Returns the maximum number of input elements that may be provided without
  *  risk of flooding an output buffer of size maxoutput.  maxoutput is
@@ -66,39 +66,39 @@
  */
 
 
-int res_push_check(res_state const *state, size_t srclen);
+int resampler_push_check(resampler_state const *state, size_t srclen);
 /*
  * Returns the number of elements that will be returned if the given srclen
- * is used in the next call to res_push().
+ * is used in the next call to resampler_push().
  */
 
 
-int res_push(res_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen);
-int res_push_interleaved(res_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen);
+int resampler_push(resampler_state *state, SAMPLE **dstlist, SAMPLE const **srclist, size_t srclen);
+int resampler_push_interleaved(resampler_state *state, SAMPLE *dest, SAMPLE const *source, size_t srclen);
 /*
  * Pushes srclen samples into the front end of the filter, and returns the
  * number of resulting samples.
  *
- * res_push(): srclist and dstlist point to lists of pointers, each of which
+ * resampler_push(): srclist and dstlist point to lists of pointers, each of which
  * indicates the beginning of a list of samples.
  *
- * res_push_interleaved(): source and dest point to the beginning of a list of
+ * resampler_push_interleaved(): source and dest point to the beginning of a list of
  * interleaved samples.
  */
 
 
-int res_drain(res_state *state, SAMPLE **dstlist);
-int res_drain_interleaved(res_state *state, SAMPLE *dest);
+int resampler_drain(resampler_state *state, SAMPLE **dstlist);
+int resampler_drain_interleaved(resampler_state *state, SAMPLE *dest);
 /*
  * Recover the remaining elements by flushing the internal pool with 0 values,
  * and storing the resulting samples.
  *
  * After either of these functions are called, *state should only re-used in a
- * final call to res_clear().
+ * final call to resampler_clear().
  */
 
 
-void res_clear(res_state *state);
+void resampler_clear(resampler_state *state);
 /*
  * Free allocated buffers, etc.
  */

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list