GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
filterbank.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012, 2014 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_FILTER_FILTERBANK_H
13 #define INCLUDED_FILTER_FILTERBANK_H
14 
15 #include <gnuradio/filter/api.h>
17 
18 namespace gr {
19 namespace filter {
20 namespace kernel {
21 
22 /*!
23  * \brief A filter bank with generic taps.
24  *
25  * This block takes in a vector of N complex inputs, passes
26  * them through N FIR filters, and outputs a vector of N complex
27  * outputs.
28  *
29  * The only advantage of using this block over N individual
30  * FIR filter blocks is that it places less of a load on the
31  * scheduler.
32  *
33  * The number of filters cannot be changed dynamically, however
34  * filters can be deactivated (i.e. no processing is done for
35  * them) by passing a vector of filter taps containing all zeros
36  * to them. In this case their entry in the output vector is a
37  * zero.
38  *
39  */
40 
42 {
43 protected:
44  std::vector<std::vector<float>> d_taps;
45  unsigned int d_nfilts;
46  unsigned int d_ntaps;
47  std::vector<kernel::fir_filter_ccf> d_fir_filters;
48  std::vector<bool> d_active;
49  unsigned int d_taps_per_filter;
50 
51 public:
52  /*!
53  * Build the filterbank.
54  *
55  * \param taps (vector of vector of floats / list of list of floats)
56  * Populates the filters.
57  */
58  filterbank(const std::vector<std::vector<float>>& taps);
59  filterbank(filterbank&&) = default;
60  virtual ~filterbank() = default;
61 
62  /*!
63  * Update the filterbank's filter taps.
64  *
65  * \param taps (vector of vector of floats / list of list of floats)
66  * The prototype filter to populate the filterbank.
67  */
68  virtual void set_taps(const std::vector<std::vector<float>>& taps);
69 
70  /*!
71  * Print all of the filterbank taps to screen.
72  */
73  void print_taps();
74 
75  /*!
76  * Return a vector<vector<>> of the filterbank taps
77  */
78  std::vector<std::vector<float>> taps() const;
79 };
80 
81 } /* namespace kernel */
82 } /* namespace filter */
83 } /* namespace gr */
84 
85 #endif /* INCLUDED_FILTER_FILTERBANK_H */
A filter bank with generic taps.
Definition: filterbank.h:42
filterbank(const std::vector< std::vector< float >> &taps)
std::vector< std::vector< float > > d_taps
Definition: filterbank.h:44
virtual ~filterbank()=default
unsigned int d_taps_per_filter
Definition: filterbank.h:49
virtual void set_taps(const std::vector< std::vector< float >> &taps)
std::vector< bool > d_active
Definition: filterbank.h:48
unsigned int d_ntaps
Definition: filterbank.h:46
std::vector< std::vector< float > > taps() const
filterbank(filterbank &&)=default
unsigned int d_nfilts
Definition: filterbank.h:45
std::vector< kernel::fir_filter_ccf > d_fir_filters
Definition: filterbank.h:47
#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