GNU Radio 3.7.0 C++ API
fft_filter_fff.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2005,2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_FILTER_FFT_FILTER_FFF_H
00024 #define INCLUDED_FILTER_FFT_FILTER_FFF_H
00025 
00026 #include <gnuradio/filter/api.h>
00027 #include <gnuradio/sync_decimator.h>
00028 
00029 namespace gr {
00030   namespace filter {
00031 
00032     /*!
00033      * \brief Fast FFT filter with float input, float output and float taps
00034      * \ingroup filter_blk
00035      *
00036      * \details
00037      * This block implements a real-value decimating filter using the
00038      * fast convolution method via an FFT. The decimation factor is an
00039      * interger that is greater than or equal to 1.
00040      *
00041      * The filter takes a set of real-valued taps to use in the
00042      * filtering operation. These taps can be defined as anything that
00043      * satisfies the user's filtering needs. For standard filters such
00044      * as lowpass, highpass, bandpass, etc., the filter.firdes and
00045      * filter.optfir classes provide convenient generating methods.
00046      *
00047      * This filter is implemented by using the FFTW package to perform
00048      * the required FFTs. An optional argument, nthreads, may be
00049      * passed to the constructor (or set using the set_nthreads member
00050      * function) to split the FFT among N number of threads. This can
00051      * improve performance on very large FFTs (that is, if the number
00052      * of taps used is very large) if you have enough threads/cores to
00053      * support it.
00054      */
00055     class FILTER_API fft_filter_fff : virtual public sync_decimator
00056     {
00057     public:
00058       // gr::filter::fft_filter_fff::sptr
00059       typedef boost::shared_ptr<fft_filter_fff> sptr;
00060 
00061       /*!
00062        * Build an FFT filter block.
00063        * 
00064        * \param decimation  >= 1
00065        * \param taps        float filter taps
00066        * \param nthreads    number of threads for the FFT to use
00067        */
00068       static sptr make(int decimation,
00069                        const std::vector<float> &taps,
00070                        int nthreads=1);
00071 
00072       virtual void set_taps(const std::vector<float> &taps) = 0;
00073       virtual std::vector<float> taps() const = 0;
00074 
00075       /*!
00076        * \brief Set number of threads to use.
00077        */
00078       virtual void set_nthreads(int n) = 0;
00079 
00080       /*!
00081        * \brief Get number of threads being used.
00082        */
00083       virtual int nthreads() const = 0;
00084     };
00085 
00086   } /* namespace filter */
00087 } /* namespace gr */
00088 
00089 #endif /* INCLUDED_FILTER_FFT_FILTER_FFF_H */