Merge branch 'makefile_var_ordering'
[debian/gnuradio] / gnuradio-core / src / lib / filter / gr_pfb_channelizer_ccf.h
index 7d0a31c5985c24bbc20a94733bf07f0fcf71e725..751673bc7a4066746e5623eb68cd64a604b25a8b 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
  * 
 #ifndef INCLUDED_GR_PFB_CHANNELIZER_CCF_H
 #define        INCLUDED_GR_PFB_CHANNELIZER_CCF_H
 
-#include <gr_sync_block.h>
+#include <gr_block.h>
 
 class gr_pfb_channelizer_ccf;
 typedef boost::shared_ptr<gr_pfb_channelizer_ccf> gr_pfb_channelizer_ccf_sptr;
 gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans, 
-                                                        const std::vector<float> &taps);
+                                                        const std::vector<float> &taps,
+                                                        float oversample_rate=1);
 
 class gr_fir_ccf;
 class gri_fft_complex;
@@ -88,39 +89,71 @@ class gri_fft_complex;
  *      <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB, 
  *           attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
  *
+ * The filter output can also be overs ampled. The over sampling rate 
+ * is the ratio of the the actual output sampling rate to the normal 
+ * output sampling rate. It must be rationally related to the number 
+ * of channels as N/i for i in [1,N], which gives an outputsample rate
+ * of [fs/N, fs] where fs is the input sample rate and N is the number
+ * of channels.
+ *
+ * For example, for 6 channels with fs = 6000 Hz, the normal rate is 
+ * 6000/6 = 1000 Hz. Allowable oversampling rates are 6/6, 6/5, 6/4, 
+ * 6/3, 6/2, and 6/1 where the output sample rate of a 6/1 oversample
+ * ratio is 6000 Hz, or 6 times the normal 1000 Hz. A rate of 6/5 = 1.2,
+ * so the output rate would be 1200 Hz.
+ *
  * The theory behind this block can be found in Chapter 6 of 
  * the following book.
  *
- *    <B><EM>f. harris, Multirate Signal Processing for Communication 
- *       Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.
+ *    <B><EM>f. harris, "Multirate Signal Processing for Communication 
+ *       Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
  *
  */
 
-class gr_pfb_channelizer_ccf : public gr_sync_block
+class gr_pfb_channelizer_ccf : public gr_block
 {
  private:
   /*!
    * Build the polyphase filterbank decimator.
    * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM>
    * \param taps    (vector/list of floats) The prototype filter to populate the filterbank.
+   * \param oversample_rate (float)   The over sampling rate is the ratio of the the actual
+   *                                  output sampling rate to the normal output sampling rate.
+   *                                   It must be rationally related to the number of channels
+   *                                 as N/i for i in [1,N], which gives an outputsample rate 
+   *                                 of [fs/N, fs] where fs is the input sample rate and N is
+   *                                 the number of channels.
+   *                                 
+   *                                 For example, for 6 channels with fs = 6000 Hz, the normal
+   *                                 rate is 6000/6 = 1000 Hz. Allowable oversampling rates
+   *                                 are 6/6, 6/5, 6/4, 6/3, 6/2, and 6/1 where the output
+   *                                 sample rate of a 6/1 oversample ratio is 6000 Hz, or
+   *                                 6 times the normal 1000 Hz.
    */
   friend gr_pfb_channelizer_ccf_sptr gr_make_pfb_channelizer_ccf (unsigned int numchans,
-                                                                 const std::vector<float> &taps);
+                                                                 const std::vector<float> &taps,
+                                                                 float oversample_rate);
 
+  bool                    d_updated;
+  unsigned int             d_numchans;
+  float                    d_oversample_rate;
   std::vector<gr_fir_ccf*> d_filters;
   std::vector< std::vector<float> > d_taps;
-  gri_fft_complex         *d_fft;
-  unsigned int             d_numchans;
   unsigned int             d_taps_per_filter;
-  bool                    d_updated;
+  gri_fft_complex         *d_fft;
+  int                     *d_idxlut;
+  int                      d_rate_ratio;
+  int                      d_output_multiple;
 
   /*!
    * Build the polyphase filterbank decimator.
    * \param numchans (unsigned integer) Specifies the number of channels <EM>M</EM>
    * \param taps    (vector/list of floats) The prototype filter to populate the filterbank.
+   * \param oversample_rate (float)   The output over sampling rate.
    */
   gr_pfb_channelizer_ccf (unsigned int numchans, 
-                         const std::vector<float> &taps);
+                         const std::vector<float> &taps,
+                         float oversample_rate);
 
 public:
   ~gr_pfb_channelizer_ccf ();
@@ -136,9 +169,10 @@ public:
    */
   void print_taps();
   
-  int work (int noutput_items,
-           gr_vector_const_void_star &input_items,
-           gr_vector_void_star &output_items);
+  int general_work (int noutput_items,
+                   gr_vector_int &ninput_items,
+                   gr_vector_const_void_star &input_items,
+                   gr_vector_void_star &output_items);
 };
 
 #endif