GNU Radio v3.6.2-149-ga6d285d9 C++ API
fft_filter_ccc.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_CCC_H
00024 #define INCLUDED_FILTER_FFT_FILTER_CCC_H
00025 
00026 #include <filter/api.h>
00027 #include <gr_sync_decimator.h>
00028 
00029 namespace gr {
00030   namespace filter {
00031 
00032     class FILTER_API fft_filter_ccc : virtual public gr_sync_decimator
00033     {
00034     public:
00035       // gr::filter::fft_filter_ccc::sptr
00036       typedef boost::shared_ptr<fft_filter_ccc> sptr;
00037 
00038       /*!
00039        * \brief Fast FFT filter with gr_complex input, gr_complex output and gr_complex taps
00040        * \ingroup filter_blk
00041        *
00042        * This block implements a complex decimating filter using the
00043        * fast convolution method via an FFT. The decimation factor is
00044        * an interger that is greater than or equal to 1.
00045        *
00046        * The filter takes a set of complex (or real) taps to use in
00047        * the filtering operation. These taps can be defined as
00048        * anything that satisfies the user's filtering needs. For
00049        * standard filters such as lowpass, highpass, bandpass, etc.,
00050        * the filter.firdes and filter.optfir classes provide
00051        * convenient generating methods.
00052        *
00053        * This filter is implemented by using the FFTW package to
00054        * perform the required FFTs. An optional argument, nthreads,
00055        * may be passed to the constructor (or set using the
00056        * set_nthreads member function) to split the FFT among N number
00057        * of threads. This can improve performance on very large FFTs
00058        * (that is, if the number of taps used is very large) if you
00059        * have enough threads/cores to support it.
00060        * 
00061        * \param decimation  >= 1
00062        * \param taps        complex filter taps
00063        * \param nthreads    number of threads for the FFT to use
00064        */
00065       static sptr make(int decimation,
00066                                   const std::vector<gr_complex> &taps,
00067                                   int nthreads=1);
00068 
00069       virtual void set_taps(const std::vector<gr_complex> &taps) = 0;
00070       virtual std::vector<gr_complex> taps() const = 0;
00071 
00072       /*!
00073        * \brief Set number of threads to use.
00074        */
00075       virtual void set_nthreads(int n) = 0;
00076 
00077       /*!
00078        * \brief Get number of threads being used.
00079        */
00080       virtual int nthreads() const = 0;
00081     };
00082 
00083   } /* namespace filter */
00084 } /* namespace gr */
00085 
00086 #endif /* INCLUDED_FILTER_FFT_FILTER_CCC_H */