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