8258bb8242f921532c65d41da74950c8a70dad93
[debian/gnuradio] / gnuradio-core / src / lib / filter / gri_fft_filter_fff_sse.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2010 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 #ifndef INCLUDED_GRI_FFT_FILTER_FFF_SSE_H
24 #define INCLUDED_GRI_FFT_FILTER_FFF_SSE_H
25
26 #include <gr_complex.h>
27 #include <vector>
28
29 class gri_fft_real_fwd;
30 class gri_fft_real_rev;
31
32 class gri_fft_filter_fff_sse
33 {
34  private:
35   int                      d_ntaps;
36   int                      d_nsamples;
37   int                      d_fftsize;           // fftsize = ntaps + nsamples - 1
38   int                      d_decimation;
39   gri_fft_real_fwd        *d_fwdfft;            // forward "plan"
40   gri_fft_real_rev        *d_invfft;            // inverse "plan"
41   std::vector<float>       d_tail;              // state carried between blocks for overlap-add
42   //std::vector<gr_complex>  d_xformed_taps;    // Fourier xformed taps
43   gr_complex              *d_xformed_taps;
44   std::vector<float>       d_new_taps;
45
46
47   void compute_sizes(int ntaps);
48   int tailsize() const { return d_ntaps - 1; }
49   
50  public:
51   /*!
52    * \brief Construct a FFT filter for float vectors with the given taps and decimation rate.
53    *
54    * This is the basic implementation for performing FFT filter for fast convolution
55    * in other blocks for floating point vectors (such as gr_fft_filter_fff).
56    * \param decimation The decimation rate of the filter (int)
57    * \param taps       The filter taps (float)
58    */
59   gri_fft_filter_fff_sse (int decimation, const std::vector<float> &taps);
60   ~gri_fft_filter_fff_sse ();
61
62   /*!
63    * \brief Set new taps for the filter.
64    *
65    * Sets new taps and resets the class properties to handle different sizes
66    * \param taps       The filter taps (float)
67    */
68   int set_taps (const std::vector<float> &taps);
69   
70   /*!
71    * \brief Perform the filter operation
72    *
73    * \param nitems  The number of items to produce
74    * \param input   The input vector to be filtered
75    * \param output  The result of the filter operation
76    */
77   int filter (int nitems, const float *input, float *output);
78
79 };
80
81 #endif /* INCLUDED_GRI_FFT_FILTER_FFF_SSE_H */