1
1
/* -*- c++ -*- */
2
2
/*
3
- * Copyright 2010,2012 Free Software Foundation, Inc.
3
+ * Copyright 2010,2012,2014 Free Software Foundation, Inc.
4
4
*
5
5
* This file is part of GNU Radio
6
6
*
@@ -49,7 +49,7 @@ namespace gr {
49
49
std::vector<float > d_tail; // state carried between blocks for overlap-add
50
50
std::vector<float > d_taps; // stores time domain taps
51
51
gr_complex *d_xformed_taps; // Fourier xformed taps
52
-
52
+
53
53
void compute_sizes (int ntaps);
54
54
int tailsize () const { return d_ntaps - 1 ; }
55
55
@@ -77,7 +77,7 @@ namespace gr {
77
77
* \param taps The filter taps (complex)
78
78
*/
79
79
int set_taps (const std::vector<float > &taps);
80
-
80
+
81
81
/* !
82
82
* \brief Set number of threads to use.
83
83
*/
@@ -92,12 +92,12 @@ namespace gr {
92
92
* \brief Returns the number of taps in the filter.
93
93
*/
94
94
unsigned int ntaps () const ;
95
-
95
+
96
96
/* !
97
97
* \brief Get number of threads being used.
98
98
*/
99
99
int nthreads () const ;
100
-
100
+
101
101
/* !
102
102
l * \brief Perform the filter operation
103
103
*
@@ -108,7 +108,7 @@ l * \brief Perform the filter operation
108
108
int filter (int nitems, const float *input, float *output);
109
109
};
110
110
111
-
111
+
112
112
/* !
113
113
* \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
114
114
* \ingroup filter_blk
@@ -126,7 +126,7 @@ l * \brief Perform the filter operation
126
126
std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add
127
127
std::vector<gr_complex> d_taps; // stores time domain taps
128
128
gr_complex *d_xformed_taps; // Fourier xformed taps
129
-
129
+
130
130
void compute_sizes (int ntaps);
131
131
int tailsize () const { return d_ntaps - 1 ; }
132
132
@@ -154,12 +154,12 @@ l * \brief Perform the filter operation
154
154
* \param taps The filter taps (complex)
155
155
*/
156
156
int set_taps (const std::vector<gr_complex> &taps);
157
-
157
+
158
158
/* !
159
159
* \brief Set number of threads to use.
160
160
*/
161
161
void set_nthreads (int n);
162
-
162
+
163
163
/* !
164
164
* \brief Returns the taps.
165
165
*/
@@ -169,12 +169,100 @@ l * \brief Perform the filter operation
169
169
* \brief Returns the number of taps in the filter.
170
170
*/
171
171
unsigned int ntaps () const ;
172
-
172
+
173
+ /* !
174
+ * \brief Get number of threads being used.
175
+ */
176
+ int nthreads () const ;
177
+
178
+ /* !
179
+ * \brief Perform the filter operation
180
+ *
181
+ * \param nitems The number of items to produce
182
+ * \param input The input vector to be filtered
183
+ * \param output The result of the filter operation
184
+ */
185
+ int filter (int nitems, const gr_complex *input, gr_complex *output);
186
+ };
187
+
188
+
189
+
190
+ /* !
191
+ * \brief Fast FFT filter with gr_complex input, gr_complex output and float taps
192
+ * \ingroup filter_blk
193
+ */
194
+ class FILTER_API fft_filter_ccf
195
+ {
196
+ private:
197
+ int d_ntaps;
198
+ int d_nsamples;
199
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
200
+ int d_decimation;
201
+ fft::fft_complex *d_fwdfft; // forward "plan"
202
+ fft::fft_complex *d_invfft; // inverse "plan"
203
+ int d_nthreads; // number of FFTW threads to use
204
+ std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add
205
+ std::vector<float > d_taps; // stores time domain taps
206
+ gr_complex *d_xformed_taps; // Fourier xformed taps
207
+
208
+ void compute_sizes (int ntaps);
209
+ int tailsize () const { return d_ntaps - 1 ; }
210
+
211
+ public:
212
+ /* !
213
+ * \brief Construct an FFT filter for complex vectors with the given taps and decimation rate.
214
+ *
215
+ * This is the basic implementation for performing FFT filter for fast convolution
216
+ * in other blocks for complex vectors (such as fft_filter_ccf).
217
+ *
218
+ * \param decimation The decimation rate of the filter (int)
219
+ * \param taps The filter taps (complex)
220
+ * \param nthreads The number of threads for the FFT to use (int)
221
+ */
222
+ fft_filter_ccf (int decimation,
223
+ const std::vector<float > &taps,
224
+ int nthreads=1 );
225
+
226
+ ~fft_filter_ccf ();
227
+
228
+ /* !
229
+ * \brief Set new taps for the filter.
230
+ *
231
+ * Sets new taps and resets the class properties to handle different sizes
232
+ * \param taps The filter taps (complex)
233
+ */
234
+ int set_taps (const std::vector<float > &taps);
235
+
236
+ /* !
237
+ * \brief Set number of threads to use.
238
+ */
239
+ void set_nthreads (int n);
240
+
241
+ /* !
242
+ * \brief Returns the taps.
243
+ */
244
+ std::vector<float > taps () const ;
245
+
246
+ /* !
247
+ * \brief Returns the number of taps in the filter.
248
+ */
249
+ unsigned int ntaps () const ;
250
+
251
+ /* !
252
+ * \brief Returns the actual size of the filter.
253
+ *
254
+ * \details This value could be equal to ntaps, but we ofter
255
+ * build a longer filter to allow us to calculate a more
256
+ * efficient FFT. This value is the actual size of the filters
257
+ * used in the calculation of the overlap-and-save operation.
258
+ */
259
+ unsigned int filtersize () const ;
260
+
173
261
/* !
174
262
* \brief Get number of threads being used.
175
263
*/
176
264
int nthreads () const ;
177
-
265
+
178
266
/* !
179
267
* \brief Perform the filter operation
180
268
*
0 commit comments