From 84614fd69da71e72fe25181b9b49c0f50f431f42 Mon Sep 17 00:00:00 2001 From: Admir Memic Date: Tue, 7 Jul 2015 01:22:34 +0200 Subject: [PATCH] Implemented decimating FIR filter I didn't understand what is mean by "This function retains the address of the delay filter memory containing the previous delayed values to allow consecutive processing of blocks." --- src/dsp/p_firdec.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/dsp/p_firdec.c b/src/dsp/p_firdec.c index f5d7623..912840d 100644 --- a/src/dsp/p_firdec.c +++ b/src/dsp/p_firdec.c @@ -24,7 +24,19 @@ void p_firdec_f32(const float *x, const float *h, float *r, int nx, int nh, int df) { + int t; + int i; + for (t = 0; t < nh; ++t) + { + r[t] = 0; + for (i = 0; i <= t && t * df < nx; ++i) + r[t] += h[i] * x[t * df - i]; + } - /*PLACE CODE HERE*/ - + for (t = nh; t < nx; ++t) + { + r[t] = 0; + for (i = 0; i < nh && t * df < nx; ++i) + r[t] += h[i] * x[t * df - i]; + } }