From: Tom Date: Tue, 20 Oct 2009 03:49:11 +0000 (-0400) Subject: Resampler seems to be working for all values of rate X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3f60c94858810b605c2f8a343375c57c78a660dc;p=debian%2Fgnuradio Resampler seems to be working for all values of rate --- diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 392f38a8..d00ba673 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -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(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; } diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h index d4c886ec..bc5b91a5 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h @@ -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;