summaryrefslogtreecommitdiff
path: root/gnuradio-core
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-core')
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc9
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h7
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i1
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py9
4 files changed, 17 insertions, 9 deletions
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 59b76a6f0..834450436 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
@@ -58,8 +58,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
process.
*/
d_int_rate = filter_size;
- d_dec_rate = (unsigned int)floor(d_int_rate/rate);
- d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_rate(rate);
// Store the last filter between calls to work
d_last_filter = 0;
@@ -81,8 +80,6 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
create_diff_taps(taps, dtaps);
create_taps(taps, d_taps, d_filters);
create_taps(dtaps, d_dtaps, d_diff_filters);
-
- set_relative_rate(rate);
}
gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
@@ -179,8 +176,8 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
j = d_last_filter;
// produce output as long as we can and there are enough input samples
- while((i < noutput_items) && (count < ninput_items[0]-1)) {
-
+ int max_input = ninput_items[0]-(int)d_taps_per_filter;
+ while((i < noutput_items) && (count < max_input)) {
// start j by wrapping around mod the number of channels
while((j < d_int_rate) && (i < noutput_items)) {
// Take the current filter and derivative filter output
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 cf5a79d4e..2c36c95f9 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
@@ -161,7 +161,12 @@ public:
* Print all of the filterbank taps to screen.
*/
void print_taps();
-
+ void set_rate (float rate) {
+ d_dec_rate = (unsigned int)floor(d_int_rate/rate);
+ d_flt_rate = (d_int_rate/rate) - d_dec_rate;
+ set_relative_rate(rate);
+ }
+
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
index 4f07af861..77f28acdf 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.i
@@ -38,4 +38,5 @@ class gr_pfb_arb_resampler_ccf : public gr_block
//void set_taps (const std::vector<float> &taps);
void print_taps();
+ void set_rate (float rate);
};
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
index cd9289fa5..74eae58dc 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
@@ -48,9 +48,14 @@ class pfb_arb_resampler_ccf(gr.hier_block2):
self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
-
+ #print "PFB has %d taps\n" % (len(self._taps),)
+
self.connect(self, self.pfb)
self.connect(self.pfb, self)
-
+
+ # Note -- set_taps not implemented in base class yet
def set_taps(self, taps):
self.pfb.set_taps(taps)
+
+ def set_rate(self, rate):
+ self.pfb.set_rate(rate)