commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r11574 - gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter
Date: Tue, 11 Aug 2009 16:54:32 -0600 (MDT)

Author: trondeau
Date: 2009-08-11 16:54:32 -0600 (Tue, 11 Aug 2009)
New Revision: 11574

Modified:
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
   
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
Log:
Bug fixes for PFB interpolator and added documenation of its behavior.

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
   2009-08-11 22:11:33 UTC (rev 11573)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
   2009-08-11 22:54:32 UTC (rev 11574)
@@ -75,13 +75,21 @@
   // Create d_numchan vectors to store each channel's taps
   //std::vector< std::vector<float> > vtaps(d_rate);
   d_taps.resize(d_rate);
+
+  // Make a vector of the taps plus fill it out with 0's to fill
+  // each polyphase filter with exactly d_taps_per_filter
+  std::vector<float> tmp_taps;
+  tmp_taps = taps;
+  while((float)(tmp_taps.size()) < d_rate*d_taps_per_filter) {
+    tmp_taps.push_back(0.0);
+  }
   
   // Partition the filter
   for(i = 0; i < d_rate; i++) {
     // Each channel uses all d_taps_per_filter with 0's if not enough taps to 
fill out
     d_taps[i] = std::vector<float>(d_taps_per_filter, 0);
     for(j = 0; j < d_taps_per_filter; j++) {
-      d_taps[i][j] = taps[i + j*d_rate];  // add taps to channels in reverse 
order
+      d_taps[i][j] = tmp_taps[i + j*d_rate];  // add taps to channels in 
reverse order
     }
     
     // Build a filter for each channel and add it's taps to it
@@ -103,7 +111,7 @@
     for(j = 0; j < d_taps_per_filter; j++) {
       printf(" %.4e", d_taps[i][j]);
     }
-    printf("]\n");
+    printf("]\n\n");
   }
 }
 

Modified: 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
===================================================================
--- 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
    2009-08-11 22:11:33 UTC (rev 11573)
+++ 
gnuradio/branches/developers/trondeau/pfb/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.h
    2009-08-11 22:54:32 UTC (rev 11574)
@@ -34,12 +34,60 @@
 class gr_fir_ccf;
 
 /*!
- * \brief FIR filter with gr_complex input, gr_complex output and float taps
+ * \class gr_pfb_interpolator_ccf
+ * \brief Polyphase filterbank interpolator with gr_complex input,
+ * gr_complex output and float taps
+ *
  * \ingroup filter_blk
+ * 
+ * This block takes in a signal stream and performs interger up-
+ * sampling (interpolation) with a polyphase filterbank. The first
+ * input is the integer specifying how much to interpolate by. The
+ * second input is a vector (Python list) of floating-point taps of
+ * the prototype filter.
+ *
+ * The filter's taps should be based on the interpolation rate
+ * specified. That is, the bandwidth specified is relative to the
+ * bandwidth after interpolation.
+ *
+ * For example, using the GNU Radio's firdes utility to building
+ * filters, we build a low-pass filter with a sampling rate of
+ * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
+ * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
+ * attenuation to use, ATT, and the filter window function (a
+ * Blackman-harris window in this case). The first input is the gain,
+ * which is also specified as the interpolation rate so that the
+ * output levels are the same as the input (this creates an overall
+ * increase in power).
+ *
+ *      <B><EM>self._taps = gr.firdes.low_pass_2(interp, interp*fs, BW, TB, 
+ *           attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
+ *
+ * The PFB interpolator code takes the taps generated above and builds
+ * a set of filters. The set contains <EM>interp</EM> number of
+ * filters and each filter contains ceil(taps.size()/interp) number of
+ * taps. Each tap from the filter prototype is sequentially inserted
+ * into the next filter. When all of the input taps are used, the
+ * remaining filters in the filterbank are filled out with 0's to make
+ * sure each filter has the same number of taps.
+ *
+ * The theory behind this block can be found in Chapter 7.1 of the
+ * following book.
+ *
+ *    <B><EM>f. harris, <EM>Multirate Signal Processing for Communication
+ *       Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
+ *       Inc. 2004.</EM></B>
  */
+
 class gr_pfb_interpolator_ccf : public gr_sync_interpolator
 {
  private:
+  /*!
+   * Build the polyphase filterbank interpolator.
+   * \param interp  (unsigned integer) Specifies the interpolation rate to use
+   * \param taps    (vector/list of floats) The prototype filter to populate 
the filterbank. The taps
+   *                                        should be generated at the 
interpolated sampling rate.
+   */
   friend gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned 
int interp,
                                                                    const 
std::vector<float> &taps);
 
@@ -50,8 +98,10 @@
   bool                    d_updated;
 
   /*!
-   * Construct a Polyphase filterbank for channelization with the given 
-   * number of channels and taps
+   * Construct a Polyphase filterbank interpolator
+   * \param interp  (unsigned integer) Specifies the interpolation rate to use
+   * \param taps    (vector/list of floats) The prototype filter to populate 
the filterbank. The taps
+   *                                        should be generated at the 
interpolated sampling rate.
    */
   gr_pfb_interpolator_ccf (unsigned int interp, 
                           const std::vector<float> &taps);
@@ -59,7 +109,16 @@
 public:
   ~gr_pfb_interpolator_ccf ();
   
+  /*!
+   * Resets the filterbank's filter taps with the new prototype filter
+   * \param taps    (vector/list of floats) The prototype filter to populate 
the filterbank. The taps
+   *                                        should be generated at the 
interpolated sampling rate.
+   */
   void set_taps (const std::vector<float> &taps);
+
+  /*!
+   * Print all of the filterbank taps to screen.
+   */
   void print_taps();
   
   int work (int noutput_items,





reply via email to

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