diff options
author | Tom Rondeau | 2010-03-11 22:54:50 -0500 |
---|---|---|
committer | Tom Rondeau | 2010-03-11 22:54:50 -0500 |
commit | 1933148ce1c78a81b1299c05d540a77b31325d92 (patch) | |
tree | d3e4bb4b8424626ae4ee457fd32599c80761560d /gnuradio-core | |
parent | bc8a3bde9b1e6c30ec5fd3d18fea299ac613f404 (diff) | |
download | gnuradio-1933148ce1c78a81b1299c05d540a77b31325d92.tar.gz gnuradio-1933148ce1c78a81b1299c05d540a77b31325d92.tar.bz2 gnuradio-1933148ce1c78a81b1299c05d540a77b31325d92.zip |
Adding SSE version of fft filters. Complex (ccc) version working.
Diffstat (limited to 'gnuradio-core')
-rw-r--r-- | gnuradio-core/src/lib/filter/Makefile.am | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gr_fft_filter_fff.h | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc (renamed from gnuradio-core/src/lib/filter/gri_fft_filter_ccc.cc) | 22 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h (renamed from gnuradio-core/src/lib/filter/gri_fft_filter_ccc.h) | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc (renamed from gnuradio-core/src/lib/filter/gri_fft_filter_fff.cc) | 20 | ||||
-rw-r--r-- | gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h (renamed from gnuradio-core/src/lib/filter/gri_fft_filter_fff.h) | 13 |
9 files changed, 53 insertions, 42 deletions
diff --git a/gnuradio-core/src/lib/filter/Makefile.am b/gnuradio-core/src/lib/filter/Makefile.am index 2d7fb0db8..7ea8c582e 100644 --- a/gnuradio-core/src/lib/filter/Makefile.am +++ b/gnuradio-core/src/lib/filter/Makefile.am @@ -184,8 +184,10 @@ libfilter_la_common_SOURCES = \ $(GENERATED_CC) \ gr_adaptive_fir_ccf.cc \ gr_cma_equalizer_cc.cc \ - gri_fft_filter_fff.cc \ - gri_fft_filter_ccc.cc \ + gri_fft_filter_fff_generic.cc \ + gri_fft_filter_ccc_generic.cc \ + gri_fft_filter_fff_sse.cc \ + gri_fft_filter_ccc_sse.cc \ gr_fft_filter_ccc.cc \ gr_fft_filter_fff.cc \ gr_goertzel_fc.cc \ @@ -261,8 +263,10 @@ grinclude_HEADERS = \ gr_altivec.h \ gr_cma_equalizer_cc.h \ gr_cpu.h \ - gri_fft_filter_fff.h \ - gri_fft_filter_ccc.h \ + gri_fft_filter_fff_generic.h \ + gri_fft_filter_fff_sse.h \ + gri_fft_filter_ccc_generic.h \ + gri_fft_filter_ccc_sse.h \ gr_fft_filter_ccc.h \ gr_fft_filter_fff.h \ gr_filter_delay_fc.h \ diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc index b1f04fd0f..ad514ee37 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.cc @@ -30,7 +30,7 @@ #endif #include <gr_fft_filter_ccc.h> -#include <gri_fft_filter_ccc.h> +#include <gri_fft_filter_ccc_sse.h> #include <gr_io_signature.h> #include <gri_fft.h> #include <math.h> @@ -56,7 +56,7 @@ gr_fft_filter_ccc::gr_fft_filter_ccc (int decimation, const std::vector<gr_compl d_updated(false) { set_history(1); - d_filter = new gri_fft_filter_ccc(decimation, taps); + d_filter = new gri_fft_filter_ccc_sse(decimation, taps); d_nsamples = d_filter->set_taps(taps); set_output_multiple(d_nsamples); } diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h index cfb9ff35d..18c10dfd3 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_ccc.h @@ -28,7 +28,7 @@ class gr_fft_filter_ccc; typedef boost::shared_ptr<gr_fft_filter_ccc> gr_fft_filter_ccc_sptr; gr_fft_filter_ccc_sptr gr_make_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); -class gri_fft_filter_ccc; +class gri_fft_filter_ccc_sse; /*! * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps @@ -41,7 +41,7 @@ class gr_fft_filter_ccc : public gr_sync_decimator int d_nsamples; bool d_updated; - gri_fft_filter_ccc *d_filter; + gri_fft_filter_ccc_sse *d_filter; std::vector<gr_complex> d_new_taps; /*! diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc index 08c2c022f..eda3d2147 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.cc @@ -25,7 +25,7 @@ #endif #include <gr_fft_filter_fff.h> -#include <gri_fft_filter_fff.h> +#include <gri_fft_filter_fff_generic.h> #include <gr_io_signature.h> #include <assert.h> #include <stdexcept> @@ -49,7 +49,7 @@ gr_fft_filter_fff::gr_fft_filter_fff (int decimation, const std::vector<float> & { set_history(1); - d_filter = new gri_fft_filter_fff(decimation, taps); + d_filter = new gri_fft_filter_fff_generic(decimation, taps); d_nsamples = d_filter->set_taps(taps); set_output_multiple(d_nsamples); } diff --git a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h index 04cb3c8f0..6c9fcc04b 100644 --- a/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h +++ b/gnuradio-core/src/lib/filter/gr_fft_filter_fff.h @@ -28,7 +28,7 @@ class gr_fft_filter_fff; typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr; gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps); -class gri_fft_filter_fff; +class gri_fft_filter_fff_generic; /*! * \brief Fast FFT filter with float input, float output and float taps @@ -41,7 +41,7 @@ class gr_fft_filter_fff : public gr_sync_decimator int d_nsamples; bool d_updated; - gri_fft_filter_fff *d_filter; + gri_fft_filter_fff_generic *d_filter; std::vector<float> d_new_taps; /*! diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc index 4c596630c..91049a92a 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc @@ -24,19 +24,22 @@ #include "config.h" #endif -#include <gri_fft_filter_ccc.h> +#include <gri_fft_filter_ccc_generic.h> #include <gri_fft.h> #include <assert.h> #include <stdexcept> #include <cstdio> +#include <xmmintrin.h> +#include <fftw3.h> -gri_fft_filter_ccc::gri_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps) +gri_fft_filter_ccc_generic::gri_fft_filter_ccc_generic (int decimation, + const std::vector<gr_complex> &taps) : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) { set_taps(taps); } -gri_fft_filter_ccc::~gri_fft_filter_ccc () +gri_fft_filter_ccc_generic::~gri_fft_filter_ccc_generic () { delete d_fwdfft; delete d_invfft; @@ -58,7 +61,7 @@ print_vector_complex(const std::string label, const std::vector<gr_complex> &x) * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps */ int -gri_fft_filter_ccc::set_taps (const std::vector<gr_complex> &taps) +gri_fft_filter_ccc_generic::set_taps (const std::vector<gr_complex> &taps) { int i = 0; compute_sizes(taps.size()); @@ -92,7 +95,7 @@ gri_fft_filter_ccc::set_taps (const std::vector<gr_complex> &taps) // determine and set d_ntaps, d_nsamples, d_fftsize void -gri_fft_filter_ccc::compute_sizes(int ntaps) +gri_fft_filter_ccc_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; @@ -100,7 +103,7 @@ gri_fft_filter_ccc::compute_sizes(int ntaps) d_nsamples = d_fftsize - d_ntaps + 1; if (0) - fprintf(stderr, "gri_fft_filter_ccc: ntaps = %d, fftsize = %d, nsamples = %d\n", + fprintf(stderr, "gri_fft_filter_ccc_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", d_ntaps, d_fftsize, d_nsamples); assert(d_fftsize == d_ntaps + d_nsamples -1 ); @@ -115,7 +118,7 @@ gri_fft_filter_ccc::compute_sizes(int ntaps) } int -gri_fft_filter_ccc::filter (int nitems, const gr_complex *input, gr_complex *output) +gri_fft_filter_ccc_generic::filter (int nitems, const gr_complex *input, gr_complex *output) { int dec_ctr = 0; int j = 0; @@ -129,13 +132,14 @@ gri_fft_filter_ccc::filter (int nitems, const gr_complex *input, gr_complex *out d_fwdfft->get_inbuf()[j] = 0; d_fwdfft->execute(); // compute fwd xform - + gr_complex *a = d_fwdfft->get_outbuf(); gr_complex *b = &d_xformed_taps[0]; gr_complex *c = d_invfft->get_inbuf(); - for (j = 0; j < d_fftsize; j++) // filter in the freq domain + for (j = 0; j < d_fftsize; j+=1) { // filter in the freq domain c[j] = a[j] * b[j]; + } d_invfft->execute(); // compute inv xform diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h index a857e5ab1..3cd9105c7 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GRI_FFT_FILTER_CCC_H -#define INCLUDED_GRI_FFT_FILTER_CCC_H +#ifndef INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H +#define INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H #include <gr_complex.h> #include <vector> @@ -32,7 +32,7 @@ class gri_fft_complex; * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps * \ingroup filter_blk */ -class gri_fft_filter_ccc +class gri_fft_filter_ccc_generic { private: int d_ntaps; @@ -57,8 +57,8 @@ class gri_fft_filter_ccc * \param decimation The decimation rate of the filter (int) * \param taps The filter taps (complex) */ - gri_fft_filter_ccc (int decimation, const std::vector<gr_complex> &taps); - ~gri_fft_filter_ccc (); + gri_fft_filter_ccc_generic (int decimation, const std::vector<gr_complex> &taps); + ~gri_fft_filter_ccc_generic (); /*! * \brief Set new taps for the filter. @@ -79,4 +79,4 @@ class gri_fft_filter_ccc }; -#endif /* INCLUDED_GRI_FFT_FILTER_CCC_H */ +#endif /* INCLUDED_GRI_FFT_FILTER_CCC_GENERIC_H */ diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc index 246d876b2..5a0916669 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc @@ -24,19 +24,20 @@ #include "config.h" #endif -#include <gri_fft_filter_fff.h> +#include <gri_fft_filter_fff_generic.h> #include <gri_fft.h> #include <assert.h> #include <stdexcept> #include <cstdio> -gri_fft_filter_fff::gri_fft_filter_fff (int decimation, const std::vector<float> &taps) +gri_fft_filter_fff_generic::gri_fft_filter_fff_generic (int decimation, + const std::vector<float> &taps) : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0), d_invfft(0) { set_taps(taps); } -gri_fft_filter_fff::~gri_fft_filter_fff () +gri_fft_filter_fff_generic::~gri_fft_filter_fff_generic () { delete d_fwdfft; delete d_invfft; @@ -46,7 +47,7 @@ gri_fft_filter_fff::~gri_fft_filter_fff () * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps */ int -gri_fft_filter_fff::set_taps (const std::vector<float> &taps) +gri_fft_filter_fff_generic::set_taps (const std::vector<float> &taps) { int i = 0; compute_sizes(taps.size()); @@ -80,7 +81,7 @@ gri_fft_filter_fff::set_taps (const std::vector<float> &taps) // determine and set d_ntaps, d_nsamples, d_fftsize void -gri_fft_filter_fff::compute_sizes(int ntaps) +gri_fft_filter_fff_generic::compute_sizes(int ntaps) { int old_fftsize = d_fftsize; d_ntaps = ntaps; @@ -88,7 +89,7 @@ gri_fft_filter_fff::compute_sizes(int ntaps) d_nsamples = d_fftsize - d_ntaps + 1; if (0) - fprintf(stderr, "gri_fft_filter_fff: ntaps = %d, fftsize = %d, nsamples = %d\n", + fprintf(stderr, "gri_fft_filter_fff_generic: ntaps = %d, fftsize = %d, nsamples = %d\n", d_ntaps, d_fftsize, d_nsamples); assert(d_fftsize == d_ntaps + d_nsamples -1 ); @@ -103,7 +104,7 @@ gri_fft_filter_fff::compute_sizes(int ntaps) } int -gri_fft_filter_fff::filter (int nitems, const float *input, float *output) +gri_fft_filter_fff_generic::filter (int nitems, const float *input, float *output) { int dec_ctr = 0; int j = 0; @@ -122,9 +123,10 @@ gri_fft_filter_fff::filter (int nitems, const float *input, float *output) gr_complex *b = &d_xformed_taps[0]; gr_complex *c = d_invfft->get_inbuf(); - for (j = 0; j < d_fftsize/2+1; j++) // filter in the freq domain + for (j = 0; j < d_fftsize/2+1; j++) { // filter in the freq domain c[j] = a[j] * b[j]; - + } + d_invfft->execute(); // compute inv xform // add in the overlapping tail diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h index 2f6b7e45a..6c31632d5 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GRI_FFT_FILTER_FFF_H -#define INCLUDED_GRI_FFT_FILTER_FFF_H +#ifndef INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H +#define INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H #include <gr_complex.h> #include <vector> @@ -29,7 +29,7 @@ class gri_fft_real_fwd; class gri_fft_real_rev; -class gri_fft_filter_fff +class gri_fft_filter_fff_generic { private: int d_ntaps; @@ -42,6 +42,7 @@ class gri_fft_filter_fff std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps std::vector<float> d_new_taps; + void compute_sizes(int ntaps); int tailsize() const { return d_ntaps - 1; } @@ -54,8 +55,8 @@ class gri_fft_filter_fff * \param decimation The decimation rate of the filter (int) * \param taps The filter taps (float) */ - gri_fft_filter_fff (int decimation, const std::vector<float> &taps); - ~gri_fft_filter_fff (); + gri_fft_filter_fff_generic (int decimation, const std::vector<float> &taps); + ~gri_fft_filter_fff_generic (); /*! * \brief Set new taps for the filter. @@ -76,4 +77,4 @@ class gri_fft_filter_fff }; -#endif /* INCLUDED_GRI_FFT_FILTER_FFF_H */ +#endif /* INCLUDED_GRI_FFT_FILTER_FFF_GENERIC_H */ |