PFB resampler: fix it this way to avoid the signed/unsigned warning.
[debian/gnuradio] / gnuradio-core / src / lib / filter / gr_pfb_arb_resampler_ccf.cc
index 48eb849ab1f32ca54bdd47c003ce8674edbc8e28..add106b69b20704a49b054a9fa2a968182658a75 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2009 Free Software Foundation, Inc.
+ * Copyright 2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -34,7 +34,7 @@ gr_pfb_arb_resampler_ccf_sptr gr_make_pfb_arb_resampler_ccf (float rate,
                                                             const std::vector<float> &taps,
                                                             unsigned int filter_size)
 {
-  return gr_pfb_arb_resampler_ccf_sptr (new gr_pfb_arb_resampler_ccf (rate, taps,
+  return gnuradio::get_initial_sptr(new gr_pfb_arb_resampler_ccf (rate, taps,
                                                                      filter_size));
 }
 
@@ -79,8 +79,8 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
   // Now, actually set the filters' taps
   std::vector<float> dtaps;
   create_diff_taps(taps, dtaps);
-  set_taps(taps, d_taps, d_filters);
-  set_taps(dtaps, d_dtaps, d_diff_filters);
+  create_taps(taps, d_taps, d_filters);
+  create_taps(dtaps, d_dtaps, d_diff_filters);
 }
 
 gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
@@ -91,9 +91,9 @@ gr_pfb_arb_resampler_ccf::~gr_pfb_arb_resampler_ccf ()
 }
 
 void
-gr_pfb_arb_resampler_ccf::set_taps (const std::vector<float> &newtaps,
-                                   std::vector< std::vector<float> > &ourtaps,
-                                   std::vector<gr_fir_ccf*> &ourfilter)
+gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
+                                      std::vector< std::vector<float> > &ourtaps,
+                                      std::vector<gr_fir_ccf*> &ourfilter)
 {
   int i,j;
 
@@ -178,7 +178,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)) {