summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-filter/include/filter/fft_filter.h70
-rw-r--r--gr-filter/include/filter/fft_filter_ccc.h2
-rw-r--r--gr-filter/include/filter/fft_filter_fff.h95
-rw-r--r--gr-filter/include/filter/fir_filter.h2
-rw-r--r--gr-filter/lib/CMakeLists.txt1
-rw-r--r--gr-filter/lib/fft_filter.cc145
-rw-r--r--gr-filter/lib/fft_filter_ccc_impl.h10
-rw-r--r--gr-filter/lib/fft_filter_fff_impl.cc187
-rw-r--r--gr-filter/lib/fft_filter_fff_impl.h109
-rw-r--r--gr-filter/lib/fir_filter.cc2
-rwxr-xr-xgr-filter/python/qa_fft_filter.py18
-rw-r--r--gr-filter/swig/filter_swig.i3
12 files changed, 402 insertions, 242 deletions
diff --git a/gr-filter/include/filter/fft_filter.h b/gr-filter/include/filter/fft_filter.h
index fccea595f..8c7d6cf78 100644
--- a/gr-filter/include/filter/fft_filter.h
+++ b/gr-filter/include/filter/fft_filter.h
@@ -31,6 +31,72 @@
namespace gr {
namespace filter {
namespace kernel {
+ /*!
+ * \brief Fast FFT filter with float input, float output and float taps
+ * \ingroup filter_blk
+ */
+ class FILTER_API fft_filter_fff
+ {
+ private:
+ int d_ntaps;
+ int d_nsamples;
+ int d_fftsize; // fftsize = ntaps + nsamples - 1
+ int d_decimation;
+ fft::fft_real_fwd *d_fwdfft; // forward "plan"
+ fft::fft_real_rev *d_invfft; // inverse "plan"
+ int d_nthreads; // number of FFTW threads to use
+ std::vector<float> d_tail; // state carried between blocks for overlap-add
+ std::vector<float> d_new_taps;
+ gr_complex *d_xformed_taps; // Fourier xformed taps
+
+ void compute_sizes(int ntaps);
+ int tailsize() const { return d_ntaps - 1; }
+
+ public:
+ /*!
+ * \brief Construct an FFT filter for float vectors with the given taps and decimation rate.
+ *
+ * This is the basic implementation for performing FFT filter for fast convolution
+ * in other blocks for complex vectors (such as fft_filter_ccc).
+ *
+ * \param decimation The decimation rate of the filter (int)
+ * \param taps The filter taps (complex)
+ * \param nthreads The number of threads for the FFT to use (int)
+ */
+ fft_filter_fff(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
+
+ ~fft_filter_fff();
+
+ /*!
+ * \brief Set new taps for the filter.
+ *
+ * Sets new taps and resets the class properties to handle different sizes
+ * \param taps The filter taps (complex)
+ */
+ int set_taps(const std::vector<float> &taps);
+
+ /*!
+ * \brief Set number of threads to use.
+ */
+ void set_nthreads(int n);
+
+ /*!
+ * \brief Get number of threads being used.
+ */
+ int nthreads() const;
+
+ /*!
+ * \brief Perform the filter operation
+ *
+ * \param nitems The number of items to produce
+ * \param input The input vector to be filtered
+ * \param output The result of the filter operation
+ */
+ int filter(int nitems, const float *input, float *output);
+ };
+
/*!
* \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
@@ -58,7 +124,7 @@ namespace gr {
* \brief Construct an FFT filter for complex vectors with the given taps and decimation rate.
*
* This is the basic implementation for performing FFT filter for fast convolution
- * in other blocks for complex vectors (such as gr_fft_filter_ccc).
+ * in other blocks for complex vectors (such as fft_filter_ccc).
*
* \param decimation The decimation rate of the filter (int)
* \param taps The filter taps (complex)
@@ -98,7 +164,7 @@ namespace gr {
int filter(int nitems, const gr_complex *input, gr_complex *output);
};
- } /* namespace impl */
+ } /* namespace kernel */
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/include/filter/fft_filter_ccc.h b/gr-filter/include/filter/fft_filter_ccc.h
index a309ffc22..29fd54713 100644
--- a/gr-filter/include/filter/fft_filter_ccc.h
+++ b/gr-filter/include/filter/fft_filter_ccc.h
@@ -32,7 +32,7 @@ namespace gr {
class FILTER_API fft_filter_ccc : virtual public gr_sync_decimator
{
public:
- // gr::filter::fft_filter::sptr
+ // gr::filter::fft_filter_ccc::sptr
typedef boost::shared_ptr<fft_filter_ccc> sptr;
/*!
diff --git a/gr-filter/include/filter/fft_filter_fff.h b/gr-filter/include/filter/fft_filter_fff.h
index 309a55135..8eb0a1c83 100644
--- a/gr-filter/include/filter/fft_filter_fff.h
+++ b/gr-filter/include/filter/fft_filter_fff.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -19,70 +19,49 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_FFT_FILTER_FFF_H
-#define INCLUDED_GR_FFT_FILTER_FFF_H
-#include <gr_core_api.h>
-#include <gr_sync_decimator.h>
-
-class gr_fft_filter_fff;
-typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr;
-GR_CORE_API gr_fft_filter_fff_sptr
-gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads=1);
-
-class gri_fft_filter_fff_generic;
-//class gri_fft_filter_fff_sse;
+#ifndef INCLUDED_FILTER_FFT_FILTER_FFF_H
+#define INCLUDED_FILTER_FFT_FILTER_FFF_H
-/*!
- * \brief Fast FFT filter with float input, float output and float taps
- * \ingroup filter_blk
- */
-class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator
-{
- private:
- friend GR_CORE_API gr_fft_filter_fff_sptr
- gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads);
+#include <filter/api.h>
+#include <gr_sync_decimator.h>
- int d_nsamples;
- bool d_updated;
-#if 1 // don't enable the sse version until handling it is worked out
- gri_fft_filter_fff_generic *d_filter;
-#else
- gri_fft_filter_fff_sse *d_filter;
-#endif
- std::vector<float> d_new_taps;
+namespace gr {
+ namespace filter {
- /*!
- * Construct a FFT filter with the given taps
- *
- * \param decimation >= 1
- * \param taps float filter taps
- * \param nthreads number of threads for the FFT to use
- */
- gr_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads=1);
+ class FILTER_API fft_filter_fff : virtual public gr_sync_decimator
+ {
+ public:
+ // gr::filter::fft_filter_fff::sptr
+ typedef boost::shared_ptr<fft_filter_fff> sptr;
- public:
- ~gr_fft_filter_fff ();
+ /*!
+ * \brief Fast FFT filter with float input, float output and float taps
+ * \ingroup filter_blk
+ *
+ * \param decimation >= 1
+ * \param taps float filter taps
+ * \param nthreads number of threads for the FFT to use
+ */
+ static FILTER_API sptr make(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
- void set_taps (const std::vector<float> &taps);
- std::vector<float> taps () const;
+ virtual void set_taps(const std::vector<float> &taps) = 0;
+ virtual std::vector<float> taps() const = 0;
- /*!
- * \brief Set number of threads to use.
- */
- void set_nthreads(int n);
+ /*!
+ * \brief Set number of threads to use.
+ */
+ virtual void set_nthreads(int n) = 0;
- /*!
- * \brief Get number of threads being used.
- */
- int nthreads() const;
+ /*!
+ * \brief Get number of threads being used.
+ */
+ virtual int nthreads() const = 0;
+ };
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
+ } /* namespace filter */
+} /* namespace gr */
-#endif /* INCLUDED_GR_FFT_FILTER_FFF_H */
+#endif /* INCLUDED_FILTER_FFT_FILTER_FFF_H */
diff --git a/gr-filter/include/filter/fir_filter.h b/gr-filter/include/filter/fir_filter.h
index 525532fe6..76b00cae9 100644
--- a/gr-filter/include/filter/fir_filter.h
+++ b/gr-filter/include/filter/fir_filter.h
@@ -110,7 +110,7 @@ namespace gr {
gr_complex *d_taps;
};
- } /* namespace impl */
+ } /* namespace kernel */
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/CMakeLists.txt b/gr-filter/lib/CMakeLists.txt
index aa03c4615..e0af76700 100644
--- a/gr-filter/lib/CMakeLists.txt
+++ b/gr-filter/lib/CMakeLists.txt
@@ -109,6 +109,7 @@ list(APPEND filter_sources
fft_filter.cc
${generated_sources}
fft_filter_ccc_impl.cc
+ fft_filter_fff_impl.cc
)
list(APPEND filter_libs
diff --git a/gr-filter/lib/fft_filter.cc b/gr-filter/lib/fft_filter.cc
index 86b2a2fdb..130886d7f 100644
--- a/gr-filter/lib/fft_filter.cc
+++ b/gr-filter/lib/fft_filter.cc
@@ -33,6 +33,146 @@ namespace gr {
namespace kernel {
#define VERBOSE 0
+
+ fft_filter_fff::fft_filter_fff(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : d_fftsize(-1), d_decimation(decimation), d_fwdfft(0),
+ d_invfft(0), d_nthreads(nthreads)
+ {
+ set_taps(taps);
+ }
+
+ fft_filter_fff::~fft_filter_fff()
+ {
+ delete d_fwdfft;
+ delete d_invfft;
+ fft::free(d_xformed_taps);
+ }
+
+ /*
+ * determines d_ntaps, d_nsamples, d_fftsize, d_xformed_taps
+ */
+ int
+ fft_filter_fff::set_taps(const std::vector<float> &taps)
+ {
+ int i = 0;
+ compute_sizes(taps.size());
+
+ d_tail.resize(tailsize());
+ for(i = 0; i < tailsize(); i++)
+ d_tail[i] = 0;
+
+ float *in = d_fwdfft->get_inbuf();
+ gr_complex *out = d_fwdfft->get_outbuf();
+
+ float scale = 1.0 / d_fftsize;
+
+ // Compute forward xform of taps.
+ // Copy taps into first ntaps slots, then pad with zeros
+ for (i = 0; i < d_ntaps; i++)
+ in[i] = taps[i] * scale;
+
+ for (; i < d_fftsize; i++)
+ in[i] = 0;
+
+ d_fwdfft->execute(); // do the xform
+
+ // now copy output to d_xformed_taps
+ for (i = 0; i < d_fftsize/2+1; i++)
+ d_xformed_taps[i] = out[i];
+
+ return d_nsamples;
+ }
+
+ // determine and set d_ntaps, d_nsamples, d_fftsize
+ void
+ fft_filter_fff::compute_sizes(int ntaps)
+ {
+ int old_fftsize = d_fftsize;
+ d_ntaps = ntaps;
+ d_fftsize = (int) (2 * pow(2.0, ceil(log(double(ntaps)) / log(2.0))));
+ d_nsamples = d_fftsize - d_ntaps + 1;
+
+ if(VERBOSE) {
+ std::cerr << "fft_filter_fff: ntaps = " << d_ntaps
+ << " fftsize = " << d_fftsize
+ << " nsamples = " << d_nsamples << std::endl;
+ }
+
+ // compute new plans
+ if(d_fftsize != old_fftsize) {
+ delete d_fwdfft;
+ delete d_invfft;
+ d_fwdfft = new fft::fft_real_fwd(d_fftsize);
+ d_invfft = new fft::fft_real_rev(d_fftsize);
+ d_xformed_taps = fft::malloc_complex(d_fftsize/2+1);
+ }
+ }
+
+ void
+ fft_filter_fff::set_nthreads(int n)
+ {
+ d_nthreads = n;
+ if(d_fwdfft)
+ d_fwdfft->set_nthreads(n);
+ if(d_invfft)
+ d_invfft->set_nthreads(n);
+ }
+
+ int
+ fft_filter_fff::nthreads() const
+ {
+ return d_nthreads;
+ }
+
+ int
+ fft_filter_fff::filter(int nitems, const float *input, float *output)
+ {
+ int dec_ctr = 0;
+ int j = 0;
+ int ninput_items = nitems * d_decimation;
+
+ for (int i = 0; i < ninput_items; i += d_nsamples){
+
+ memcpy(d_fwdfft->get_inbuf(), &input[i], d_nsamples * sizeof(float));
+
+ for (j = d_nsamples; j < d_fftsize; j++)
+ 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;
+ gr_complex *c = d_invfft->get_inbuf();
+
+ volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1);
+
+ d_invfft->execute(); // compute inv xform
+
+ // add in the overlapping tail
+ for (j = 0; j < tailsize(); j++)
+ d_invfft->get_outbuf()[j] += d_tail[j];
+
+ // copy nsamples to output
+ j = dec_ctr;
+ while (j < d_nsamples) {
+ *output++ = d_invfft->get_outbuf()[j];
+ j += d_decimation;
+ }
+ dec_ctr = (j - d_nsamples);
+
+ // stash the tail
+ memcpy(&d_tail[0], d_invfft->get_outbuf() + d_nsamples,
+ tailsize() * sizeof(float));
+ }
+
+ return nitems;
+ }
+
+
+ /**************************************************************/
+
fft_filter_ccc::fft_filter_ccc(int decimation,
const std::vector<gr_complex> &taps,
@@ -127,7 +267,7 @@ namespace gr {
}
int
- fft_filter_ccc::filter (int nitems, const gr_complex *input, gr_complex *output)
+ fft_filter_ccc::filter(int nitems, const gr_complex *input, gr_complex *output)
{
int dec_ctr = 0;
int j = 0;
@@ -169,6 +309,7 @@ namespace gr {
return nitems;
}
- } /* namespace impl */
+
+ } /* namespace kernel */
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/lib/fft_filter_ccc_impl.h b/gr-filter/lib/fft_filter_ccc_impl.h
index 2d8d61c5e..82be00915 100644
--- a/gr-filter/lib/fft_filter_ccc_impl.h
+++ b/gr-filter/lib/fft_filter_ccc_impl.h
@@ -39,8 +39,8 @@ namespace gr {
public:
fft_filter_ccc_impl(int decimation,
- const std::vector<gr_complex> &taps,
- int nthreads=1);
+ const std::vector<gr_complex> &taps,
+ int nthreads=1);
~fft_filter_ccc_impl();
@@ -50,9 +50,9 @@ namespace gr {
void set_nthreads(int n);
int nthreads() const;
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
};
} /* namespace filter */
diff --git a/gr-filter/lib/fft_filter_fff_impl.cc b/gr-filter/lib/fft_filter_fff_impl.cc
index a09feb7f1..95b82aae5 100644
--- a/gr-filter/lib/fft_filter_fff_impl.cc
+++ b/gr-filter/lib/fft_filter_fff_impl.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2010 Free Software Foundation, Inc.
+ * Copyright 2005,2010,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,100 +24,97 @@
#include "config.h"
#endif
-#include <gr_fft_filter_fff.h>
-#include <gri_fft_filter_fff_generic.h>
+#include "fft_filter_fff_impl.h"
#include <gr_io_signature.h>
+
+#include <math.h>
#include <assert.h>
#include <stdexcept>
-
-#include <cstdio>
-#include <iostream>
-#include <string.h>
-
-gr_fft_filter_fff_sptr gr_make_fft_filter_fff (int decimation,
- const std::vector<float> &taps,
- int nthreads)
-{
- return gnuradio::get_initial_sptr(new gr_fft_filter_fff (decimation, taps, nthreads));
-}
-
-
-gr_fft_filter_fff::gr_fft_filter_fff (int decimation,
- const std::vector<float> &taps,
- int nthreads)
- : gr_sync_decimator ("fft_filter_fff",
- gr_make_io_signature (1, 1, sizeof (float)),
- gr_make_io_signature (1, 1, sizeof (float)),
- decimation),
- d_updated(false)
-{
- set_history(1);
-
-#if 1 // don't enable the sse version until handling it is worked out
- d_filter = new gri_fft_filter_fff_generic(decimation, taps, nthreads);
-#else
- d_filter = new gri_fft_filter_fff_sse(decimation, taps);
-#endif
-
- d_new_taps = taps;
- d_nsamples = d_filter->set_taps(taps);
- set_output_multiple(d_nsamples);
-}
-
-gr_fft_filter_fff::~gr_fft_filter_fff ()
-{
- delete d_filter;
-}
-
-void
-gr_fft_filter_fff::set_taps (const std::vector<float> &taps)
-{
- d_new_taps = taps;
- d_updated = true;
-}
-
-std::vector<float>
-gr_fft_filter_fff::taps () const
-{
- return d_new_taps;
-}
-
-void
-gr_fft_filter_fff::set_nthreads(int n)
-{
- if(d_filter)
- d_filter->set_nthreads(n);
-}
-
-int
-gr_fft_filter_fff::nthreads() const
-{
- if(d_filter)
- return d_filter->nthreads();
- else
- return 0;
-}
-
-int
-gr_fft_filter_fff::work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items)
-{
- const float *in = (const float *) input_items[0];
- float *out = (float *) output_items[0];
-
- if (d_updated){
- d_nsamples = d_filter->set_taps(d_new_taps);
- d_updated = false;
- set_output_multiple(d_nsamples);
- return 0; // output multiple may have changed
- }
-
- assert(noutput_items % d_nsamples == 0);
-
- d_filter->filter(noutput_items, in, out);
-
- //assert((out - (float *) output_items[0]) == noutput_items);
-
- return noutput_items;
-}
+#include <gr_firdes.h>
+
+namespace gr {
+ namespace filter {
+
+ fft_filter_fff::sptr fft_filter_fff::make(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ {
+ return gnuradio::get_initial_sptr(new fft_filter_fff_impl
+ (decimation, taps, nthreads));
+ }
+
+
+ fft_filter_fff_impl::fft_filter_fff_impl(int decimation,
+ const std::vector<float> &taps,
+ int nthreads)
+ : gr_sync_decimator("fft_filter_fff",
+ gr_make_io_signature (1, 1, sizeof(float)),
+ gr_make_io_signature (1, 1, sizeof(float)),
+ decimation),
+ d_updated(false)
+ {
+ set_history(1);
+
+ d_filter = new kernel::fft_filter_fff(decimation, taps, nthreads);
+
+ d_new_taps = taps;
+ d_nsamples = d_filter->set_taps(taps);
+ set_output_multiple(d_nsamples);
+ }
+
+ fft_filter_fff_impl::~fft_filter_fff_impl()
+ {
+ delete d_filter;
+ }
+
+ void
+ fft_filter_fff_impl::set_taps(const std::vector<float> &taps)
+ {
+ d_new_taps = taps;
+ d_updated = true;
+ }
+
+ std::vector<float>
+ fft_filter_fff_impl::taps() const
+ {
+ return d_new_taps;
+ }
+
+ void
+ fft_filter_fff_impl::set_nthreads(int n)
+ {
+ if(d_filter)
+ d_filter->set_nthreads(n);
+ }
+
+ int
+ fft_filter_fff_impl::nthreads() const
+ {
+ if(d_filter)
+ return d_filter->nthreads();
+ else
+ return 0;
+ }
+
+ int
+ fft_filter_fff_impl::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+ {
+ const float *in = (const float *)input_items[0];
+ float *out = (float *)output_items[0];
+
+ if (d_updated){
+ d_nsamples = d_filter->set_taps(d_new_taps);
+ d_updated = false;
+ set_output_multiple(d_nsamples);
+ return 0; // output multiple may have changed
+ }
+
+ d_filter->filter(noutput_items, in, out);
+
+ return noutput_items;
+ }
+
+ } /* namespace filter */
+} /* namespace gr */
diff --git a/gr-filter/lib/fft_filter_fff_impl.h b/gr-filter/lib/fft_filter_fff_impl.h
index 309a55135..df35d3df7 100644
--- a/gr-filter/lib/fft_filter_fff_impl.h
+++ b/gr-filter/lib/fft_filter_fff_impl.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005 Free Software Foundation, Inc.
+ * Copyright 2005,2012 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -19,70 +19,43 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
-#ifndef INCLUDED_GR_FFT_FILTER_FFF_H
-#define INCLUDED_GR_FFT_FILTER_FFF_H
-
-#include <gr_core_api.h>
-#include <gr_sync_decimator.h>
-
-class gr_fft_filter_fff;
-typedef boost::shared_ptr<gr_fft_filter_fff> gr_fft_filter_fff_sptr;
-GR_CORE_API gr_fft_filter_fff_sptr
-gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads=1);
-
-class gri_fft_filter_fff_generic;
-//class gri_fft_filter_fff_sse;
-
-/*!
- * \brief Fast FFT filter with float input, float output and float taps
- * \ingroup filter_blk
- */
-class GR_CORE_API gr_fft_filter_fff : public gr_sync_decimator
-{
- private:
- friend GR_CORE_API gr_fft_filter_fff_sptr
- gr_make_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads);
-
- int d_nsamples;
- bool d_updated;
-#if 1 // don't enable the sse version until handling it is worked out
- gri_fft_filter_fff_generic *d_filter;
-#else
- gri_fft_filter_fff_sse *d_filter;
-#endif
- std::vector<float> d_new_taps;
-
- /*!
- * Construct a FFT filter with the given taps
- *
- * \param decimation >= 1
- * \param taps float filter taps
- * \param nthreads number of threads for the FFT to use
- */
- gr_fft_filter_fff (int decimation, const std::vector<float> &taps,
- int nthreads=1);
-
- public:
- ~gr_fft_filter_fff ();
-
- void set_taps (const std::vector<float> &taps);
- std::vector<float> taps () const;
-
- /*!
- * \brief Set number of threads to use.
- */
- void set_nthreads(int n);
-
- /*!
- * \brief Get number of threads being used.
- */
- int nthreads() const;
-
- int work (int noutput_items,
- gr_vector_const_void_star &input_items,
- gr_vector_void_star &output_items);
-};
-
-#endif /* INCLUDED_GR_FFT_FILTER_FFF_H */
+#ifndef INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H
+#define INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H
+
+#include <filter/api.h>
+#include <filter/fft_filter.h>
+#include <filter/fft_filter_fff.h>
+
+namespace gr {
+ namespace filter {
+
+ class FILTER_API fft_filter_fff_impl : public fft_filter_fff
+ {
+ private:
+ int d_nsamples;
+ bool d_updated;
+ kernel::fft_filter_fff *d_filter;
+ std::vector<float> d_new_taps;
+
+ public:
+ fft_filter_fff_impl(int decimation,
+ const std::vector<float> &taps,
+ int nthreads=1);
+
+ ~fft_filter_fff_impl();
+
+ void set_taps(const std::vector<float> &taps);
+ std::vector<float> taps() const;
+
+ void set_nthreads(int n);
+ int nthreads() const;
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+ };
+
+ } /* namespace filter */
+} /* namespace gr */
+
+#endif /* INCLUDED_FILTER_FFT_FILTER_FFF_IMPL_H */
diff --git a/gr-filter/lib/fir_filter.cc b/gr-filter/lib/fir_filter.cc
index 321f6981e..b45209aa7 100644
--- a/gr-filter/lib/fir_filter.cc
+++ b/gr-filter/lib/fir_filter.cc
@@ -263,6 +263,6 @@ namespace gr {
}
}
- } /* namespace impl */
+ } /* namespace kernel */
} /* namespace filter */
} /* namespace gr */
diff --git a/gr-filter/python/qa_fft_filter.py b/gr-filter/python/qa_fft_filter.py
index 33d3d870b..87d64df36 100755
--- a/gr-filter/python/qa_fft_filter.py
+++ b/gr-filter/python/qa_fft_filter.py
@@ -216,7 +216,7 @@ class test_fft_filter(gr_unittest.TestCase):
taps = (1,)
expected_result = tuple([float(x) for x in (0,1,2,3,4,5,6,7)])
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(1, taps)
+ op = filter.fft_filter_fff(1, taps)
dst = gr.vector_sink_f()
tb.connect(src, op, dst)
tb.run()
@@ -232,7 +232,7 @@ class test_fft_filter(gr_unittest.TestCase):
taps = (2,)
expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(1, taps)
+ op = filter.fft_filter_fff(1, taps)
dst = gr.vector_sink_f()
tb.connect(src, op, dst)
tb.run()
@@ -249,7 +249,7 @@ class test_fft_filter(gr_unittest.TestCase):
nthreads = 2
expected_result = tuple([2 * float(x) for x in (0,1,2,3,4,5,6,7)])
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(1, taps, nthreads)
+ op = filter.fft_filter_fff(1, taps, nthreads)
dst = gr.vector_sink_f()
tb.connect(src, op, dst)
tb.run()
@@ -267,7 +267,7 @@ class test_fft_filter(gr_unittest.TestCase):
expected_result = reference_filter_fff(1, taps, src_data)
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(1, taps)
+ op = filter.fft_filter_fff(1, taps)
dst = gr.vector_sink_f()
tb = gr.top_block()
tb.connect(src, op, dst)
@@ -297,7 +297,7 @@ class test_fft_filter(gr_unittest.TestCase):
expected_result = reference_filter_fff(1, taps, src_data)
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(1, taps)
+ op = filter.fft_filter_fff(1, taps)
dst = gr.vector_sink_f()
tb = gr.top_block()
tb.connect(src, op, dst)
@@ -318,7 +318,7 @@ class test_fft_filter(gr_unittest.TestCase):
expected_result = reference_filter_fff(dec, taps, src_data)
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(dec, taps)
+ op = filter.fft_filter_fff(dec, taps)
dst = gr.vector_sink_f()
tb = gr.top_block()
tb.connect(src, op, dst)
@@ -341,7 +341,7 @@ class test_fft_filter(gr_unittest.TestCase):
expected_result = reference_filter_fff(dec, taps, src_data)
src = gr.vector_source_f(src_data)
- op = gr.fft_filter_fff(dec, taps, nthreads)
+ op = filter.fft_filter_fff(dec, taps, nthreads)
dst = gr.vector_sink_f()
tb = gr.top_block()
tb.connect(src, op, dst)
@@ -356,7 +356,7 @@ class test_fft_filter(gr_unittest.TestCase):
ntaps = int(random.uniform(2, 100))
taps = make_random_float_tuple(ntaps)
- op = gr.fft_filter_fff(1, taps)
+ op = filter.fft_filter_fff(1, taps)
result_data = op.taps()
#print result_data
@@ -368,7 +368,7 @@ class test_fft_filter(gr_unittest.TestCase):
ntaps = int(random.uniform(2, 100))
taps = make_random_complex_tuple(ntaps)
- op = gr.fft_filter_ccc(1, taps)
+ op = filter.fft_filter_ccc(1, taps)
result_data = op.taps()
#print result_data
diff --git a/gr-filter/swig/filter_swig.i b/gr-filter/swig/filter_swig.i
index 94ad9cd64..6010455b7 100644
--- a/gr-filter/swig/filter_swig.i
+++ b/gr-filter/swig/filter_swig.i
@@ -32,14 +32,17 @@
#include "filter/fir_filter_ccf.h"
#include "filter/fir_filter_ccc.h"
#include "filter/fft_filter_ccc.h"
+#include "filter/fft_filter_fff.h"
%}
%include "filter/fir_filter_fff.h"
%include "filter/fir_filter_ccf.h"
%include "filter/fir_filter_ccc.h"
%include "filter/fft_filter_ccc.h"
+%include "filter/fft_filter_fff.h"
GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_fff);
GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccf);
GR_SWIG_BLOCK_MAGIC2(filter, fir_filter_ccc);
GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_ccc);
+GR_SWIG_BLOCK_MAGIC2(filter, fft_filter_fff);