GNU Radio Manual and C++ API Reference  3.7.4
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  * 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_FILTER_FILTERBANK_H
25 #define INCLUDED_FILTER_FILTERBANK_H
26 
27 #include <gnuradio/filter/api.h>
29 
30 namespace gr {
31  namespace filter {
32  namespace kernel {
33 
34  /*!
35  * \brief A filter bank with generic taps.
36  *
37  * This block takes in a vector of N complex inputs, passes
38  * them through N FIR filters, and outputs a vector of N complex
39  * outputs.
40  *
41  * The only advantage of using this block over N individual
42  * FIR filter blocks is that it places less of a load on the
43  * scheduler.
44  *
45  * The number of filters cannot be changed dynamically, however
46  * filters can be deactivated (i.e. no processing is done for
47  * them) by passing a vector of filter taps containing all zeros
48  * to them. In this case their entry in the output vector is a
49  * zero.
50  *
51  */
52 
54  {
55  protected:
56  unsigned int d_nfilts;
57  unsigned int d_ntaps;
58  std::vector<kernel::fir_filter_ccf*> d_fir_filters;
59  std::vector< std::vector<float> > d_taps;
60  std::vector<bool> d_active;
61  unsigned int d_taps_per_filter;
62 
63  public:
64  /*!
65  * Build the filterbank.
66  *
67  * \param taps (vector of vector of floats / list of list of floats)
68  * Populates the filters.
69  */
70  filterbank(const std::vector<std::vector<float> > &taps);
71 
72  ~filterbank();
73 
74  /*!
75  * Update the filterbank's filter taps.
76  *
77  * \param taps (vector of vector of floats / list of list of floats)
78  * The prototype filter to populate the filterbank.
79  */
80  virtual void set_taps(const std::vector<std::vector<float> > &taps);
81 
82  /*!
83  * Print all of the filterbank taps to screen.
84  */
85  void print_taps();
86 
87  /*!
88  * Return a vector<vector<>> of the filterbank taps
89  */
90  std::vector<std::vector<float> > taps() const;
91  };
92 
93  } /* namespace kernel */
94  } /* namespace filter */
95 } /* namespace gr */
96 
97 #endif /* INCLUDED_FILTER_FILTERBANK_H */
std::vector< bool > d_active
Definition: filterbank.h:60
unsigned int d_ntaps
Definition: filterbank.h:57
unsigned int d_taps_per_filter
Definition: filterbank.h:61
static const float taps[NSTEPS+1][NTAPS]
Definition: interpolator_taps.h:9
A filter bank with generic taps.
Definition: filterbank.h:53
std::vector< std::vector< float > > d_taps
Definition: filterbank.h:59
std::vector< kernel::fir_filter_ccf * > d_fir_filters
Definition: filterbank.h:58
#define FILTER_API
Definition: gr-filter/include/gnuradio/filter/api.h:30
unsigned int d_nfilts
Definition: filterbank.h:56