bugfix for indexnumbers in IIR filter
authornldudok1 <nldudok1@221aa14e-8319-0410-a670-987f0aec2ac5>
Sun, 9 Dec 2007 17:40:08 +0000 (17:40 +0000)
committernldudok1 <nldudok1@221aa14e-8319-0410-a670-987f0aec2ac5>
Sun, 9 Dec 2007 17:40:08 +0000 (17:40 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@7089 221aa14e-8319-0410-a670-987f0aec2ac5

gnuradio-core/src/lib/filter/gri_iir.h

index 5bc67df5380c8a2bd018304da4baece8d50f6f91..61d3be44de73826dd0aedaf9ca76378fc031f63e 100644 (file)
@@ -143,12 +143,6 @@ gri_iir<i_type, o_type, tap_type>::filter (const i_type input)
   for (i = 1; i < m; i ++)
     acc += (d_fbtaps[i] * d_prev_output[latest_m + i]);
 
-  // store the values twice to avoid having to handle wrap-around in the loop
-  d_prev_output[latest_m] = acc;
-  d_prev_output[latest_m+m] = acc;
-  d_prev_input[latest_n] = input;
-  d_prev_input[latest_n+n] = input;
-
   latest_n--;
   latest_m--;
   if (latest_n < 0)
@@ -156,6 +150,13 @@ gri_iir<i_type, o_type, tap_type>::filter (const i_type input)
   if (latest_m < 0)
     latest_m += m;
 
+  // store the values twice to avoid having to handle wrap-around in the loop
+  d_prev_output[latest_m] = acc;
+  d_prev_output[latest_m+m] = acc;
+  d_prev_input[latest_n] = input;
+  d_prev_input[latest_n+n] = input;
+
+
   d_latest_m = latest_m;
   d_latest_n = latest_n;
   return (o_type) acc;