GNU Radio 3.6.5.1 C++ API
gr_pfb_decimator_ccf.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2009 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_GR_PFB_DECIMATOR_CCF_H
25
#define INCLUDED_GR_PFB_DECIMATOR_CCF_H
26
27
#include <
gr_core_api.h
>
28
#include <
gr_sync_block.h
>
29
30
class
gr_pfb_decimator_ccf
;
31
typedef
boost::shared_ptr<gr_pfb_decimator_ccf>
gr_pfb_decimator_ccf_sptr
;
32
GR_CORE_API
gr_pfb_decimator_ccf_sptr
gr_make_pfb_decimator_ccf
(
unsigned
int
decim,
33
const
std::vector<float> &
taps
,
34
unsigned
int
channel=0);
35
36
class
gr_fir_ccf;
37
class
gri_fft_complex
;
38
39
/*!
40
* \brief Polyphase filterbank bandpass decimator with gr_complex
41
* input, gr_complex output and float taps
42
*
43
* This block takes in a signal stream and performs interger down-
44
* sampling (decimation) with a polyphase filterbank. The first input
45
* is the integer specifying how much to decimate by. The second
46
* input is a vector (Python list) of floating-point taps of the
47
* prototype filter. The third input specifies the channel to extract.
48
* By default, the zeroth channel is used, which is the baseband
49
* channel (first Nyquist zone).
50
*
51
* The <EM>channel</EM> parameter specifies which channel to use since
52
* this class is capable of bandpass decimation. Given a complex input
53
* stream at a sampling rate of <EM>fs</EM> and a decimation rate of
54
* <EM>decim</EM>, the input frequency domain is split into
55
* <EM>decim</EM> channels that represent the Nyquist zones. Using the
56
* polyphase filterbank, we can select any one of these channels to
57
* decimate.
58
*
59
* The output signal will be the basebanded and decimated signal from
60
* that channel. This concept is very similar to the PFB channelizer
61
* (see #gr_pfb_channelizer_ccf) where only a single channel is
62
* extracted at a time.
63
*
64
* The filter's taps should be based on the sampling rate before
65
* decimation.
66
*
67
* For example, using the GNU Radio's firdes utility to building
68
* filters, we build a low-pass filter with a sampling rate of
69
* <EM>fs</EM>, a 3-dB bandwidth of <EM>BW</EM> and a transition
70
* bandwidth of <EM>TB</EM>. We can also specify the out-of-band
71
* attenuation to use, <EM>ATT</EM>, and the filter window
72
* function (a Blackman-harris window in this case). The first input
73
* is the gain of the filter, which we specify here as unity.
74
*
75
* <B><EM>self._taps = gr.firdes.low_pass_2(1, fs, BW, TB,
76
* attenuation_dB=ATT, window=gr.firdes.WIN_BLACKMAN_hARRIS)</EM></B>
77
*
78
* The PFB decimator code takes the taps generated above and builds a
79
* set of filters. The set contains <EM>decim</EM> number of filters
80
* and each filter contains ceil(taps.size()/decim) number of taps.
81
* Each tap from the filter prototype is sequentially inserted into
82
* the next filter. When all of the input taps are used, the remaining
83
* filters in the filterbank are filled out with 0's to make sure each
84
* filter has the same number of taps.
85
*
86
* The theory behind this block can be found in Chapter 6 of
87
* the following book.
88
*
89
* <B><EM>f. harris, "Multirate Signal Processing for Communication
90
* Systems," Upper Saddle River, NJ: Prentice Hall, Inc. 2004.</EM></B>
91
*/
92
93
class
GR_CORE_API
gr_pfb_decimator_ccf
:
public
gr_sync_block
94
{
95
private
:
96
/*!
97
* Build the polyphase filterbank decimator.
98
* \param decim (unsigned integer) Specifies the decimation rate to use
99
* \param taps (vector/list of floats) The prototype filter to populate the filterbank.
100
* \param channel (unsigned integer) Selects the channel to return [default=0].
101
*/
102
friend
GR_CORE_API
gr_pfb_decimator_ccf_sptr
gr_make_pfb_decimator_ccf
(
unsigned
int
decim,
103
const
std::vector<float> &
taps
,
104
unsigned
int
channel);
105
106
std::vector<gr_fir_ccf*> d_filters;
107
std::vector< std::vector<float> > d_taps;
108
gri_fft_complex
*d_fft;
109
unsigned
int
d_rate;
110
unsigned
int
d_chan;
111
unsigned
int
d_taps_per_filter;
112
bool
d_updated;
113
gr_complex
*d_rotator;
114
115
/*!
116
* Build the polyphase filterbank decimator.
117
* \param decim (unsigned integer) Specifies the decimation rate to use
118
* \param taps (vector/list of floats) The prototype filter to populate the filterbank.
119
* \param channel (unsigned integer) Selects the channel to return [default=0].
120
*/
121
gr_pfb_decimator_ccf
(
unsigned
int
decim,
122
const
std::vector<float> &taps,
123
unsigned
int
channel);
124
125
public
:
126
~
gr_pfb_decimator_ccf
();
127
128
/*!
129
* Resets the filterbank's filter taps with the new prototype filter
130
* \param taps (vector/list of floats) The prototype filter to populate the filterbank.
131
*/
132
void
set_taps (
const
std::vector<float> &taps);
133
134
/*!
135
* Print all of the filterbank taps to screen.
136
*/
137
void
print_taps();
138
139
//void set_channel (unsigned int channel);
140
141
int
work
(
int
noutput_items,
142
gr_vector_const_void_star
&input_items,
143
gr_vector_void_star
&output_items);
144
};
145
146
#endif
gnuradio-core
src
lib
filter
gr_pfb_decimator_ccf.h
Generated on Mon Aug 19 2013 15:37:30 for GNU Radio 3.6.5.1 C++ API by
1.8.1.2