GNU Radio Manual and C++ API Reference  3.7.13.4
The Free & Open Software Radio Ecosystem
pfb_decimator_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_DECIMATOR_CCF_H
25 #define INCLUDED_PFB_DECIMATOR_CCF_H
26 
27 #include <gnuradio/filter/api.h>
28 #include <gnuradio/sync_block.h>
29 
30 namespace gr {
31  namespace filter {
32 
33  /*!
34  * \brief Polyphase filterbank bandpass decimator with gr_complex
35  * input, gr_complex output and float taps
36  * \ingroup channelizers_blk
37  *
38  * \details
39  * This block takes in a signal stream and performs integer down-
40  * sampling (decimation) with a polyphase filterbank. The first
41  * input is the integer specifying how much to decimate by. The
42  * second input is a vector (Python list) of floating-point taps
43  * of the prototype filter. The third input specifies the channel
44  * to extract. By default, the zeroth channel is used, which is
45  * the baseband channel (first Nyquist zone).
46  *
47  * The <EM>channel</EM> parameter specifies which channel to use
48  * since this class is capable of bandpass decimation. Given a
49  * complex input stream at a sampling rate of <EM>fs</EM> and a
50  * decimation rate of <EM>decim</EM>, the input frequency domain
51  * is split into <EM>decim</EM> channels that represent the
52  * Nyquist zones. Using the polyphase filterbank, we can select
53  * any one of these channels to decimate.
54  *
55  * The output signal will be the basebanded and decimated signal
56  * from that channel. This concept is very similar to the PFB
57  * channelizer (see #gr::filter::pfb_channelizer_ccf) where only a single
58  * channel is extracted at a time.
59  *
60  * The filter's taps should be based on the sampling rate before
61  * decimation.
62  *
63  * For example, using the GNU Radio's firdes utility to building
64  * filters, we build a low-pass filter with a sampling rate of
65  * <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
66  * bandwidth of <EM>TB</EM>. We can also specify the out-of-band
67  * attenuation to use, <EM>ATT</EM>, and the filter window
68  * function (a Blackman-harris window in this case). The first
69  * input is the gain of the filter, which we specify here as
70  * unity.
71  *
72  * <B><EM>self._taps = filter.firdes.low_pass_2(1, fs, BW, TB,
73  * attenuation_dB=ATT, window=filter.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
74  *
75  * The PFB decimator code takes the taps generated above and
76  * builds a set of filters. The set contains <EM>decim</EM>
77  * filters and each filter contains ceil(taps.size()/decim)
78  * taps. Each tap from the filter prototype is
79  * sequentially inserted into the next filter. When all of the
80  * input taps are used, the remaining filters in the filterbank
81  * are filled out with 0's to make sure each filter has the same
82  * number of taps.
83  *
84  * The theory behind this block can be found in Chapter 6 of
85  * the following book:
86  *
87  * <B><EM>f. harris, "Multirate Signal Processing for Communication
88  * Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
89  */
90 
91  class FILTER_API pfb_decimator_ccf : virtual public sync_block
92  {
93  public:
94  // gr::filter::pfb_decimator_ccf::sptr
95  typedef boost::shared_ptr<pfb_decimator_ccf> sptr;
96 
97  /*!
98  * Build the polyphase filterbank decimator.
99  * \param decim (unsigned integer) Specifies the decimation rate to use
100  * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
101  * \param channel (unsigned integer) Selects the channel to return [default=0].
102  * \param use_fft_rotator (bool) Rotate channels using FFT method instead of exp(phi).
103  * For larger values of \p channel, the FFT method will perform better.
104  * Generally, this value of \p channel is small (~5), but could be
105  * architecture-specific (Default: true).
106  * \param use_fft_filters (bool) Use FFT filters (fast convolution) instead of FIR filters.
107  * FFT filters perform better for larger numbers of taps but is
108  * architecture-specific (Default: true).
109  */
110  static sptr make(unsigned int decim,
111  const std::vector<float> &taps,
112  unsigned int channel,
113  bool use_fft_rotator=true,
114  bool use_fft_filters=true);
115 
116  /*!
117  * Resets the filterbank's filter taps with the new prototype filter
118  * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
119  */
120  virtual void set_taps(const std::vector<float> &taps) = 0;
121 
122  /*!
123  * Return a vector<vector<>> of the filterbank taps
124  */
125  virtual std::vector<std::vector<float> > taps() const = 0;
126 
127  /*!
128  * Print all of the filterbank taps to screen.
129  */
130  virtual void print_taps() = 0;
131 
132  virtual void set_channel(const unsigned int channel) = 0;
133  };
134 
135  } /* namespace filter */
136 } /* namespace gr */
137 
138 #endif /* INCLUDED_PFB_DECIMATOR_CCF_H */
boost::shared_ptr< pfb_decimator_ccf > sptr
Definition: pfb_decimator_ccf.h:95
Polyphase filterbank bandpass decimator with gr_complex input, gr_complex output and float taps...
Definition: pfb_decimator_ccf.h:91
Include this header to use the message passing features.
Definition: logger.h:695
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
static const float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
#define FILTER_API
Definition: gr-filter/include/gnuradio/filter/api.h:30