commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11320 - gnuradio/branches/developers/trondeau/pfb/gnu


From: trondeau
Subject: [Commit-gnuradio] r11320 - gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter
Date: Tue, 30 Jun 2009 20:43:03 -0600 (MDT)

Author: trondeau
Date: 2009-06-30 20:43:03 -0600 (Tue, 30 Jun 2009)
New Revision: 11320

Modified:
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
Log:
Changing block type to better reflect behavior of decimator

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
      2009-06-30 22:22:44 UTC (rev 11319)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.cc
      2009-07-01 02:43:03 UTC (rev 11320)
@@ -42,9 +42,10 @@
 gr_pfb_decimator_ccf::gr_pfb_decimator_ccf (unsigned int decim, 
                                            const std::vector<float> &taps,
                                            unsigned int channel)
-  : gr_block ("pfb_decimator_ccf",
-             gr_make_io_signature (decim, decim, sizeof(gr_complex)),
-             gr_make_io_signature (1, 1, sizeof(gr_complex))),
+  : gr_sync_decimator ("pfb_decimator_ccf",
+                      gr_make_io_signature (decim, decim, sizeof(gr_complex)),
+                      gr_make_io_signature (1, 1, sizeof(gr_complex)),
+                      decim),
     d_updated (false)
 {
   d_rate = decim;
@@ -101,10 +102,9 @@
 }
 
 int
-gr_pfb_decimator_ccf::general_work (int noutput_items,
-                                   gr_vector_int &ninput_items,
-                                   gr_vector_const_void_star &input_items,
-                                   gr_vector_void_star &output_items)
+gr_pfb_decimator_ccf::work (int noutput_items,
+                           gr_vector_const_void_star &input_items,
+                           gr_vector_void_star &output_items)
 {
   gr_complex *in = (gr_complex *) input_items[0];
   gr_complex *out = (gr_complex *) output_items[0];
@@ -115,8 +115,8 @@
     return 0;               // history requirements may have changed.
   }
 
-  int i = 0, count = 0;
-  while((i < noutput_items) && (count < ninput_items[0])) {
+  int i = 0;
+  for(i = 0; i < noutput_items; i++) {
     // Move through filters from bottom to top
     out[i] = 0;
     for(int j = d_rate-1; j >= 0; j--) {
@@ -128,8 +128,8 @@
       // (the decimation rate) and k is the channel number to extract
       
       // This is the real math that goes on; we abuse the FFT to do this 
quickly
-      // for decimation rates > N where N is a small number (~5).
-      //out[i] += d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate);
+      // for decimation rates > N where N is a small number (~5):
+      //       out[i] += 
d_filters[j]->filter(&in[i])*gr_expj(j*d_chan*2*M_PI/d_rate);
 
       d_fft->get_inbuf()[j] = d_filters[j]->filter(&in[i]);
     }
@@ -139,11 +139,7 @@
 
     // Select only the desired channel out
     out[i] = d_fft->get_outbuf()[d_chan];
-
-    i++;
-    count++;
   }
   
-  consume_each(count);
-  return i;
+  return noutput_items;
 }

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
       2009-06-30 22:22:44 UTC (rev 11319)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.h
       2009-07-01 02:43:03 UTC (rev 11320)
@@ -24,7 +24,7 @@
 #ifndef INCLUDED_GR_PFB_DECIMATOR_CCF_H
 #define        INCLUDED_GR_PFB_DECIMATOR_CCF_H
 
-#include <gr_block.h>
+#include <gr_sync_decimator.h>
 
 class gr_pfb_decimator_ccf;
 typedef boost::shared_ptr<gr_pfb_decimator_ccf> gr_pfb_decimator_ccf_sptr;
@@ -39,7 +39,7 @@
  * \brief FIR filter with gr_complex input, gr_complex output and float taps
  * \ingroup filter_blk
  */
-class gr_pfb_decimator_ccf : public gr_block
+class gr_pfb_decimator_ccf : public gr_sync_decimator
 {
  private:
   friend gr_pfb_decimator_ccf_sptr gr_make_pfb_decimator_ccf (unsigned int 
decim,
@@ -67,10 +67,9 @@
   void set_taps (const std::vector<float> &taps);
   //void set_channel (unsigned int channel);
 
-  int general_work (int noutput_items,
-                   gr_vector_int &ninput_items,
-                   gr_vector_const_void_star &input_items,
-                   gr_vector_void_star &output_items);
+  int work (int noutput_items,
+           gr_vector_const_void_star &input_items,
+           gr_vector_void_star &output_items);
 };
 
 #endif

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
       2009-06-30 22:22:44 UTC (rev 11319)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_decimator_ccf.i
       2009-07-01 02:43:03 UTC (rev 11320)
@@ -26,7 +26,7 @@
                                                     const std::vector<float> 
&taps,
                                                     unsigned int channel);
 
-class gr_pfb_decimator_ccf : public gr_block
+class gr_pfb_decimator_ccf : public gr_sync_decimator
 {
  private:
   gr_pfb_decimator_ccf (unsigned int decim,





reply via email to

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