summaryrefslogtreecommitdiff
path: root/gr-filter/include
diff options
context:
space:
mode:
Diffstat (limited to 'gr-filter/include')
-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
4 files changed, 107 insertions, 62 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 */