gr-baz Package
pfb_interpolator_ccf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2009,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
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)
10  * any later version.
11  *
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.
16  *
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.
21  */
22 
23 
24 #ifndef INCLUDED_PFB_INTERPOLATOR_CCF_H
25 #define INCLUDED_PFB_INTERPOLATOR_CCF_H
26 
27 #include <filter/api.h>
28 #include <gr_sync_interpolator.h>
29 
30 namespace gr {
31  namespace filter {
32 
33  /*!
34  * \class gr_pfb_interpolator_ccf
35  *
36  * \brief Polyphase filterbank interpolator with gr_complex input,
37  * gr_complex output and float taps
38  *
39  * \ingroup filter_blk
40  * \ingroup pfb_blk
41  *
42  * This block takes in a signal stream and performs interger up-
43  * sampling (interpolation) with a polyphase filterbank. The first
44  * input is the integer specifying how much to interpolate by. The
45  * second input is a vector (Python list) of floating-point taps
46  * of the prototype filter.
47  *
48  * The filter's taps should be based on the interpolation rate
49  * specified. That is, the bandwidth specified is relative to the
50  * bandwidth after interpolation.
51  *
52  * For example, using the GNU Radio's firdes utility to building
53  * filters, we build a low-pass filter with a sampling rate of
54  * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
55  * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
56  * attenuation to use, ATT, and the filter window function (a
57  * Blackman-harris window in this case). The first input is the
58  * gain, which is also specified as the interpolation rate so that
59  * the output levels are the same as the input (this creates an
60  * overall increase in power).
61  *
62  * <B><EM>self._taps = filter.firdes.low_pass_2(interp, interp*fs, BW, TB,
63  * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
64  *
65  * The PFB interpolator code takes the taps generated above and
66  * builds a set of filters. The set contains <EM>interp</EM>
67  * number of filters and each filter contains
68  * ceil(taps.size()/interp) number of taps. Each tap from the
69  * filter prototype is sequentially inserted into the next
70  * filter. When all of the input taps are used, the remaining
71  * filters in the filterbank are filled out with 0's to make sure
72  * each filter has the same number of taps.
73  *
74  * The theory behind this block can be found in Chapter 7.1 of the
75  * following book.
76  *
77  * <B><EM>f. harris, "Multirate Signal Processing for Communication
78  * Systems</EM>," Upper Saddle River, NJ: Prentice Hall,
79  * Inc. 2004.</EM></B>
80  */
81 
83  {
84  public:
85  // gr::filter::pfb_interpolator_ccf::sptr
87 
88  /*!
89  * Build the polyphase filterbank interpolator.
90  * \param interp (unsigned integer) Specifies the interpolation rate to use
91  * \param taps (vector/list of floats) The prototype filter to populate the filterbank. The taps
92  * should be generated at the interpolated sampling rate.
93  */
94  static sptr make(unsigned int interp,
95  const std::vector<float> &taps);
96 
97  /*!
98  * Resets the filterbank's filter taps with the new prototype filter
99  * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
100  * The taps should be generated at the interpolated sampling rate.
101  */
102  virtual void set_taps(const std::vector<float> &taps) = 0;
103 
104  /*!
105  * Return a vector<vector<>> of the filterbank taps
106  */
107  virtual std::vector<std::vector<float> > taps() const = 0;
108 
109  /*!
110  * Print all of the filterbank taps to screen.
111  */
112  virtual void print_taps() = 0;
113  };
114 
115  } /* namespace filter */
116 } /* namespace gr */
117 
118 #endif /* INCLUDED_FILTER_PFB_INTERPOLATOR_CCF_H */