3 * Copyright 2009 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
24 #ifndef INCLUDED_GR_PFB_INTERPOLATOR_CCF_H
25 #define INCLUDED_GR_PFB_INTERPOLATOR_CCF_H
27 #include <gr_sync_interpolator.h>
29 class gr_pfb_interpolator_ccf;
30 typedef boost::shared_ptr<gr_pfb_interpolator_ccf> gr_pfb_interpolator_ccf_sptr;
31 gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
32 const std::vector<float> &taps);
37 * \class gr_pfb_interpolator_ccf
38 * \brief Polyphase filterbank interpolator with gr_complex input,
39 * gr_complex output and float taps
43 * This block takes in a signal stream and performs interger up-
44 * sampling (interpolation) with a polyphase filterbank. The first
45 * input is the integer specifying how much to interpolate by. The
46 * second input is a vector (Python list) of floating-point taps of
47 * the prototype filter.
49 * The filter's taps should be based on the interpolation rate
50 * specified. That is, the bandwidth specified is relative to the
51 * bandwidth after interpolation.
53 * For example, using the GNU Radio's firdes utility to building
54 * filters, we build a low-pass filter with a sampling rate of
55 * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
56 * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
57 * attenuation to use, ATT, and the filter window function (a
58 * Blackman-harris window in this case). The first input is the gain,
59 * which is also specified as the interpolation rate so that the
60 * output levels are the same as the input (this creates an overall
63 * <B><EM>self._taps = gr.firdes.low_pass_2(interp, interp*fs, BW, TB,
64 * attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
66 * The PFB interpolator code takes the taps generated above and builds
67 * a set of filters. The set contains <EM>interp</EM> number of
68 * filters and each filter contains ceil(taps.size()/interp) number of
69 * taps. Each tap from the filter prototype is sequentially inserted
70 * into the next filter. When all of the input taps are used, the
71 * remaining filters in the filterbank are filled out with 0's to make
72 * sure each filter has the same number of taps.
74 * The theory behind this block can be found in Chapter 7.1 of the
77 * <B><EM>f. harris, <EM>Multirate Signal Processing for Communication
78 * Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
82 class gr_pfb_interpolator_ccf : public gr_sync_interpolator
86 * Build the polyphase filterbank interpolator.
87 * \param interp (unsigned integer) Specifies the interpolation rate to use
88 * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
89 * should be generated at the interpolated sampling rate.
91 friend gr_pfb_interpolator_ccf_sptr gr_make_pfb_interpolator_ccf (unsigned int interp,
92 const std::vector<float> &taps);
94 std::vector<gr_fir_ccf*> d_filters;
95 std::vector< std::vector<float> > d_taps;
97 unsigned int d_taps_per_filter;
101 * Construct a Polyphase filterbank interpolator
102 * \param interp (unsigned integer) Specifies the interpolation rate to use
103 * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
104 * should be generated at the interpolated sampling rate.
106 gr_pfb_interpolator_ccf (unsigned int interp,
107 const std::vector<float> &taps);
110 ~gr_pfb_interpolator_ccf ();
113 * Resets the filterbank's filter taps with the new prototype filter
114 * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
115 * should be generated at the interpolated sampling rate.
117 void set_taps (const std::vector<float> &taps);
120 * Print all of the filterbank taps to screen.
124 int work (int noutput_items,
125 gr_vector_const_void_star &input_items,
126 gr_vector_void_star &output_items);