discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] I think I solved a bug in gri_iir.h


From: Martin Dvh
Subject: [Discuss-gnuradio] I think I solved a bug in gri_iir.h
Date: Fri, 13 Jul 2007 19:23:13 +0200
User-agent: Icedove 1.5.0.12 (X11/20070607)

Hi all,
I think I solved a bug in gri_iir.h
I think the index numbers are wrong when you decrement the latest_n and 
latest_m after you set prev_output and prev_input.
I created a simple standalone program to test the index numbers.
The patch and the test program are at:
http://www.olifantasia.com/pub/projects/gnuradio/mdvh/mypatches/gri_iir/

Because these things are tricky to understand I would appreciate some feedback 
if the algorithm is correct now.
If it is, let me know and I can apply the patch.

I think gri_iir is only used in gr_iir_filter_ffd which is only used in the 
emphasis filter of the wfm modulator.
And there it isn't even used properly because the filter taps are not set.


Greetings,
Martin

Index: gri_iir.h
===================================================================
--- gri_iir.h   (revision 5766)
+++ gri_iir.h   (working copy)
@@ -143,12 +143,6 @@
   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 @@
   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;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]