summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libaf/af_hrtf.c8
-rw-r--r--libaf/af_resample.c2
-rw-r--r--libaf/af_sub.c4
-rw-r--r--libaf/af_surround.c2
-rw-r--r--libaf/filter.c24
-rw-r--r--libaf/filter.h16
6 files changed, 28 insertions, 28 deletions
diff --git a/libaf/af_hrtf.c b/libaf/af_hrtf.c
index d516494943..7228fc9729 100644
--- a/libaf/af_hrtf.c
+++ b/libaf/af_hrtf.c
@@ -49,10 +49,10 @@ static float conv(const int nx, const int nk, float *sx, float *sk,
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 @@ static int open(af_instance_t* af)
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");
diff --git a/libaf/af_resample.c b/libaf/af_resample.c
index 00d06fa8ec..4611d103da 100644
--- a/libaf/af_resample.c
+++ b/libaf/af_resample.c
@@ -245,7 +245,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// 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;
}
diff --git a/libaf/af_sub.c b/libaf/af_sub.c
index e57c99dca1..4b767397b4 100644
--- a/libaf/af_sub.c
+++ b/libaf/af_sub.c
@@ -66,9 +66,9 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
// 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);
diff --git a/libaf/af_surround.c b/libaf/af_surround.c
index e00c23f727..76b1b318e6 100644
--- a/libaf/af_surround.c
+++ b/libaf/af_surround.c
@@ -102,7 +102,7 @@ static int control(struct af_instance_s* af, int cmd, void* arg)
}
// 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;
}
diff --git a/libaf/filter.c b/libaf/filter.c
index 460049f0af..4352a34d7c 100644
--- a/libaf/filter.c
+++ b/libaf/filter.c
@@ -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 @@ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x)
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 @@ inline _ftype_t* pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t*
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 @@ inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t**
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 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
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 @@ int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _fty
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 @@ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs)
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 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef
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 @@ int szxform(_ftype_t* a, _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftype_t fs, _fty
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;
}
diff --git a/libaf/filter.h b/libaf/filter.h
index 31ccbaf3c8..9b882c85d2 100644
--- a/libaf/filter.h
+++ b/libaf/filter.h
@@ -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);