Resampler seems to be working for all values of rate
authorTom <trondeau@vt.edu>
Tue, 20 Oct 2009 03:49:11 +0000 (23:49 -0400)
committerTom <trondeau@vt.edu>
Tue, 20 Oct 2009 03:49:11 +0000 (23:49 -0400)
gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h

index 392f38a8f5f999683a908e07655c9f91bbd4bf3e..d00ba67398543b2713b471675ca9810872d690cf 100644 (file)
@@ -64,6 +64,8 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
 
   // Store the last filter between calls to work
   d_last_filter = 0;
+
+  d_start_index = 0;
   
   d_filters = std::vector<gr_fir_ccf*>(d_int_rate);
 
@@ -148,7 +150,7 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
     return 0;               // history requirements may have changed.
   }
 
-  int i = 0, j, count = 0;
+  int i = 0, j, count = d_start_index;
   gr_complex o0, o1;
 
   // Restore the last filter position
@@ -190,9 +192,11 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
     }
   }
 
-  // Store the current filter position
+  // Store the current filter position and start of next sample
   d_last_filter = j;
+  d_start_index = std::max(0, count - ninput_items[0]);
 
-  consume_each(count);
+  // consume all we've processed but no more than we can
+  consume_each(std::min(count, ninput_items[0]));
   return i;
 }
index d4c886ec378b439458914ca51c15e1ab6e0cc9be..bc5b91a5ecba420dc0495feae201992cafe51d50 100644 (file)
@@ -118,6 +118,7 @@ class gr_pfb_arb_resampler_ccf : public gr_block
   float                    d_flt_rate;          // residual rate for the linear interpolation
   float                    d_acc;
   unsigned int             d_last_filter;
+  int                      d_start_index;
   unsigned int             d_taps_per_filter;
   bool                    d_updated;