GNU Radio's FILTER_AVX2 Package
pfb_channelizer_ccf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 <+YOU OR YOUR COMPANY+>.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef INCLUDED_FILTER_AVX2_PFB_CHANNELIZER_CCF_H
23 #define INCLUDED_FILTER_AVX2_PFB_CHANNELIZER_CCF_H
24 
25 #include <filter_avx2/api.h>
26 #include <gnuradio/block.h>
27 
28 namespace gr {
29  namespace filter_avx2 {
30 
31  /*!
32  * \brief <+description of block+>
33  * \ingroup filter_avx2
34  *
35  */
36  class FILTER_AVX2_API pfb_channelizer_ccf : virtual public gr::block
37  {
38  public:
39  // gr::filter::pfb_channelizer_ccf::sptr
40  typedef boost::shared_ptr<pfb_channelizer_ccf> sptr;
41 
42  /*!
43  * Build the polyphase filterbank decimator.
44  * \param numchans (unsigned integer) Specifies the number of
45  * channels <EM>M</EM>
46  * \param taps (vector/list of floats) The prototype filter to
47  * populate the filterbank.
48  * \param oversample_rate (float) The over sampling rate is the
49  * ratio of the the actual output
50  * sampling rate to the normal
51  * output sampling rate. It must
52  * be rationally related to the
53  * number of channels as N/i for
54  * i in [1,N], which gives an
55  * outputsample rate of [fs/N,
56  * fs] where fs is the input
57  * sample rate and N is the
58  * number of channels.
59  *
60  * For example, for 6 channels
61  * with fs = 6000 Hz, the normal
62  * rateis 6000/6 = 1000
63  * Hz. Allowable oversampling
64  * rates are 6/6, 6/5, 6/4, 6/3,
65  * 6/2, and 6/1 where the output
66  * sample rate of a 6/1
67  * oversample ratio is 6000 Hz,
68  * or 6 times the normal 1000 Hz.
69  */
70  static sptr make(unsigned int numchans,
71  const std::vector<float> &taps,
72  float oversample_rate);
73 
74  /*!
75  * Resets the filterbank's filter taps with the new prototype filter
76  * \param taps (vector/list of floats) The prototype filter to populate the filterbank.
77  */
78  virtual void set_taps(const std::vector<float> &taps) = 0;
79 
80  /*!
81  * Print all of the filterbank taps to screen.
82  */
83  virtual void print_taps() = 0;
84 
85  /*!
86  * Return a vector<vector<>> of the filterbank taps
87  */
88  virtual std::vector<std::vector<float> > taps() const = 0;
89 
90  /*!
91  * Set the channel map. Channels are numbers as:
92  *
93  * N/2+1 | ... | N-1 | 0 | 1 | 2 | ... | N/2
94  * <------------------- 0 -------------------->
95  * freq
96  *
97  * So output stream 0 comes from channel 0, etc. Setting a new
98  * channel map allows the user to specify which channel in frequency
99  * he/she wants to got to which output stream.
100  *
101  * The map should have the same number of elements as the number
102  * of output connections from the block. The minimum value of
103  * the map is 0 (for the 0th channel) and the maximum number is
104  * N-1 where N is the number of channels.
105  *
106  * We specify M as the number of output connections made where M
107  * <= N, so only M out of N channels are driven to an output
108  * stream. The number of items in the channel map should be at
109  * least M long. If there are more channels specified, any value
110  * in the map over M-1 will be ignored. If the size of the map
111  * is less than M the behavior is unknown (we don't wish to
112  * check every entry into the work function).
113  *
114  * This means that if the channelizer is splitting the signal up
115  * into N channels but only M channels are specified in the map
116  * (where M <= N), then M output streams must be connected and
117  * the map and the channel numbers used must be less than
118  * N-1. Output channel number can be reused, too. By default,
119  * the map is [0...M-1] with M = N.
120  */
121  virtual void set_channel_map(const std::vector<int> &map) = 0;
122 
123  /*!
124  * Gets the current channel map.
125  */
126  virtual std::vector<int> channel_map() const = 0;
127  };
128 
129  } // namespace filter_avx2
130 } // namespace gr
131 
132 #endif /* INCLUDED_FILTER_AVX2_PFB_CHANNELIZER_CCF_H */
133 
boost::shared_ptr< pfb_channelizer_ccf > sptr
Definition: pfb_channelizer_ccf.h:40
<+description of block+>
Definition: pfb_channelizer_ccf.h:36
#define FILTER_AVX2_API
Definition: api.h:30