[MPlayer-cvslog] CVS: main/libaf af_hrtf.c, 1.3, 1.4 af_resample.c, 1.22, 1.23 af_sub.c, 1.3, 1.4 af_surround.c, 1.5, 1.6 filter.c, 1.6, 1.7 filter.h, 1.4, 1.5

Alex Beregszaszi syncmail at mplayerhq.hu
Wed Dec 29 20:50:47 CET 2004


CVS change done by Alex Beregszaszi

Update of /cvsroot/mplayer/main/libaf
In directory mail:/var2/tmp/cvs-serv8115

Modified Files:
	af_hrtf.c af_resample.c af_sub.c af_surround.c filter.c 
	filter.h 
Log Message:
less namespace pollution #2 (prefixed globals in filter.c with af_filter_)

Index: af_hrtf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_hrtf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- af_hrtf.c	27 Dec 2004 17:30:13 -0000	1.3
+++ af_hrtf.c	29 Dec 2004 19:50:44 -0000	1.4
@@ -49,10 +49,10 @@
     int k = offset >= 0 ? offset % nx : nx + (offset % nx);
 
     if(nk + k <= nx)
-	return fir(nk, sx + k, sk);
+	return af_filter_fir(nk, sx + k, sk);
     else
-	return fir(nk + k - nx, sx, sk + nx - k) +
-	    fir(nx - k, sx + k, sk);
+	return af_filter_fir(nk + k - nx, sx, sk + nx - k) +
+	    af_filter_fir(nx - k, sx + k, sk);
 }
 
 /* Detect when the impulse response starts (significantly) */
@@ -392,7 +392,7 @@
 	return AF_ERROR;
     }
     fc = 2.0 * BASSFILTFREQ / (float)af->data->rate;
-    if(design_fir(s->basslen, s->ba_ir, &fc, LP | KAISER, 4 * M_PI) ==
+    if(af_filter_design_fir(s->basslen, s->ba_ir, &fc, LP | KAISER, 4 * M_PI) ==
        -1) {
 	af_msg(AF_MSG_ERROR, "[hrtf] Unable to design low-pass "
 	       "filter.\n");

Index: af_resample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_resample.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- af_resample.c	27 Dec 2004 17:30:13 -0000	1.22
+++ af_resample.c	29 Dec 2004 19:50:44 -0000	1.23
@@ -245,7 +245,7 @@
 
       // Design prototype filter type using Kaiser window with beta = 10
       if(NULL == w || NULL == s->w || 
-	 -1 == design_fir(s->up*L, w, &fc, LP|KAISER , 10.0)){
+	 -1 == af_filter_design_fir(s->up*L, w, &fc, LP|KAISER , 10.0)){
 	af_msg(AF_MSG_ERROR,"[resample] Unable to design prototype filter.\n");
 	return AF_ERROR;
       }

Index: af_sub.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_sub.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- af_sub.c	27 Dec 2004 17:30:13 -0000	1.3
+++ af_sub.c	29 Dec 2004 19:50:44 -0000	1.4
@@ -66,9 +66,9 @@
 
     // Design low-pass filter
     s->k = 1.0;
-    if((-1 == szxform(sp[0].a, sp[0].b, Q, s->fc,
+    if((-1 == af_filter_szxform(sp[0].a, sp[0].b, Q, s->fc,
        (float)af->data->rate, &s->k, s->w[0])) ||
-       (-1 == szxform(sp[1].a, sp[1].b, Q, s->fc,
+       (-1 == af_filter_szxform(sp[1].a, sp[1].b, Q, s->fc,
        (float)af->data->rate, &s->k, s->w[1])))
       return AF_ERROR;
     return af_test_output(af,(af_data_t*)arg);

Index: af_surround.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_surround.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- af_surround.c	27 Dec 2004 17:30:13 -0000	1.5
+++ af_surround.c	29 Dec 2004 19:50:44 -0000	1.6
@@ -102,7 +102,7 @@
     }
     // Surround filer coefficients
     fc = 2.0 * 7000.0/(float)af->data->rate;
-    if (-1 == design_fir(L, s->w, &fc, LP|HAMMING, 0)){
+    if (-1 == af_filter_design_fir(L, s->w, &fc, LP|HAMMING, 0)){
       af_msg(AF_MSG_ERROR,"[surround] Unable to design low-pass filter.\n");
       return AF_ERROR;
     }

Index: filter.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/filter.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- filter.c	29 Dec 2004 19:41:21 -0000	1.6
+++ filter.c	29 Dec 2004 19:50:44 -0000	1.7
@@ -25,7 +25,7 @@
    w filter taps
    x input signal must be a circular buffer which is indexed backwards 
 */
-inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x)
+inline _ftype_t af_filter_fir(register unsigned int n, _ftype_t* w, _ftype_t* x)
 {
   register _ftype_t y; // Output
   y = 0.0; 
@@ -46,13 +46,13 @@
    y  output buffer
    s  output buffer stride
 */
-inline _ftype_t* pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s)
+inline _ftype_t* af_filter_pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s)
 {
   register _ftype_t* xt = *x + xi;
   register _ftype_t* wt = *w;
   register int    nt = 2*n;
   while(d-- > 0){
-    *y = fir(n,wt,xt);
+    *y = af_filter_fir(n,wt,xt);
     wt+=n;
     xt+=nt;
     y+=s;
@@ -65,7 +65,7 @@
    at the new samples, xi current index in xq and n the length of the
    filter. xq must be n*2 by k big, s is the index for in.
 */
-inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s)  
+inline int af_filter_updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s)  
 {
   register _ftype_t* txq = *xq + xi;
   register int nt = n*2;
@@ -95,7 +95,7 @@
    
    returns 0 if OK, -1 if fail
 */
-int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt)
+int af_filter_design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt)
 {
   unsigned int	o   = n & 1;          	// Indicator for odd filter length
   unsigned int	end = ((n + 1) >> 1) - o;       // Loop end
@@ -233,7 +233,7 @@
 
    returns 0 if OK, -1 if fail
 */
-int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags)
+int af_filter_design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags)
 {
   int l = (int)n/k;	// Length of individual FIR filters
   int i;     	// Counters
@@ -274,7 +274,7 @@
    Note that a0 is assumed to be 1, so there is no wrapping
    of it.  
 */
-void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs)
+void af_filter_prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs)
 {
   _ftype_t wp;
   wp = 2.0 * fs * tan(M_PI * fc / fs);
@@ -310,7 +310,7 @@
    Return: On return, set coef z-domain coefficients and k to the gain
    required to maintain overall gain = 1.0;
 */
-void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef)
+void af_filter_bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef)
 {
   _ftype_t ad, bd;
 
@@ -410,7 +410,7 @@
 
    return -1 if fail 0 if success.
 */
-int szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef)
+int af_filter_szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef)
 {
   _ftype_t at[3];
   _ftype_t bt[3];
@@ -424,10 +424,10 @@
   bt[1]/=Q;
 
   /* Calculate a and b and overwrite the original values */
-  prewarp(at, fc, fs);
-  prewarp(bt, fc, fs);
+  af_filter_prewarp(at, fc, fs);
+  af_filter_prewarp(bt, fc, fs);
   /* Execute bilinear transform */
-  bilinear(at, bt, k, fs, coef);
+  af_filter_bilinear(at, bt, k, fs, coef);
 
   return 0;
 }

Index: filter.h
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/filter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- filter.h	10 Oct 2004 14:20:42 -0000	1.4
+++ filter.h	29 Dec 2004 19:50:44 -0000	1.5
@@ -44,25 +44,25 @@
 #define ODD         0x00000010 // Make filter HP
 
 // Exported functions
-extern _ftype_t fir(unsigned int n, _ftype_t* w, _ftype_t* x);
+extern _ftype_t af_filter_fir(unsigned int n, _ftype_t* w, _ftype_t* x);
 
-extern _ftype_t* pfir(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s);
+extern _ftype_t* af_filter_pfir(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** w, _ftype_t** x, _ftype_t* y, unsigned int s);
 
-extern int updateq(unsigned int n, unsigned int xi, _ftype_t* xq, _ftype_t* in);
-extern int updatepq(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s);
+//extern int af_filter_updateq(unsigned int n, unsigned int xi, _ftype_t* xq, _ftype_t* in);
+extern int af_filter_updatepq(unsigned int n, unsigned int k, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s);
 
-extern int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt);
+extern int af_filter_design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt);
 
-extern int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags);
+extern int af_filter_design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags);
 
-extern int szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef);
+extern int af_filter_szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _ftype_t *k, _ftype_t *coef);
 
 /* Add new data to circular queue designed to be used with a FIR
    filter. xq is the circular queue, in pointing at the new sample, xi
    current index for xq and n the length of the filter. xq must be n*2
    long. 
 */
-#define updateq(n,xi,xq,in)\
+#define af_filter_updateq(n,xi,xq,in)\
   xq[xi]=(xq)[(xi)+(n)]=*(in);\
   xi=(++(xi))&((n)-1);
 




More information about the MPlayer-cvslog mailing list