GNU Radio 3.6.5 C++ API

fir_filter.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2004,2010,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_FIR_FILTER_H
00024 #define INCLUDED_FILTER_FIR_FILTER_H
00025 
00026 #include <filter/api.h>
00027 #include <vector>
00028 #include <gr_complex.h>
00029 
00030 namespace gr {
00031   namespace filter {
00032     namespace kernel {
00033     
00034       class FILTER_API fir_filter_fff
00035       {
00036       public:
00037         fir_filter_fff(int decimation,
00038                        const std::vector<float> &taps);
00039         ~fir_filter_fff();
00040 
00041         void set_taps(const std::vector<float> &taps);
00042         std::vector<float> taps() const;
00043         unsigned int ntaps() const;
00044         
00045         float filter(const float input[]);
00046         void  filterN(float output[],
00047                       const float input[],
00048                       unsigned long n);
00049         void  filterNdec(float output[],
00050                          const float input[],
00051                          unsigned long n,
00052                          unsigned int decimate);
00053 
00054       protected:
00055         std::vector<float> d_taps;
00056         unsigned int  d_ntaps;
00057         float       **d_aligned_taps;
00058         float        *d_output;
00059         int           d_align;
00060         int           d_naligned;
00061       };
00062 
00063       /**************************************************************/
00064       
00065       class FILTER_API fir_filter_ccf
00066       {
00067       public:
00068         fir_filter_ccf(int decimation,
00069                        const std::vector<float> &taps);
00070         ~fir_filter_ccf();
00071 
00072         void set_taps(const std::vector<float> &taps);
00073         std::vector<float> taps() const;
00074         unsigned int ntaps() const;
00075 
00076         gr_complex filter(const gr_complex input[]);
00077         void filterN(gr_complex output[],
00078                      const gr_complex input[],
00079                      unsigned long n);
00080         void filterNdec(gr_complex output[],
00081                         const gr_complex input[],
00082                         unsigned long n,
00083                         unsigned int decimate);
00084 
00085       protected:
00086         std::vector<float> d_taps;
00087         unsigned int d_ntaps;
00088         float      **d_aligned_taps;
00089         gr_complex  *d_output;
00090         int          d_align;
00091         int          d_naligned;
00092       };
00093 
00094       /**************************************************************/
00095       
00096       class FILTER_API fir_filter_fcc
00097       {
00098       public:
00099         fir_filter_fcc(int decimation,
00100                        const std::vector<gr_complex> &taps);
00101         ~fir_filter_fcc();
00102 
00103         void set_taps(const std::vector<gr_complex> &taps);
00104         std::vector<gr_complex> taps() const;
00105         unsigned int ntaps() const;
00106 
00107         gr_complex filter(const float input[]);
00108         void filterN(gr_complex output[],
00109                      const float input[],
00110                      unsigned long n);
00111         void filterNdec(gr_complex output[],
00112                         const float input[],
00113                         unsigned long n,
00114                         unsigned int decimate);
00115 
00116       protected:
00117         std::vector<gr_complex> d_taps;
00118         unsigned int d_ntaps;
00119         gr_complex **d_aligned_taps;
00120         gr_complex  *d_output;
00121         int          d_align;
00122         int          d_naligned;
00123       };
00124 
00125       /**************************************************************/
00126       
00127       class FILTER_API fir_filter_ccc
00128       {
00129       public:
00130         fir_filter_ccc(int decimation,
00131                        const std::vector<gr_complex> &taps);
00132         ~fir_filter_ccc();
00133 
00134         void set_taps(const std::vector<gr_complex> &taps);
00135         std::vector<gr_complex> taps() const;
00136         unsigned int ntaps() const;
00137 
00138         gr_complex filter(const gr_complex input[]);
00139         void filterN(gr_complex output[],
00140                      const gr_complex input[],
00141                      unsigned long n);
00142         void filterNdec(gr_complex output[],
00143                         const gr_complex input[],
00144                         unsigned long n,
00145                         unsigned int decimate);
00146 
00147       protected:
00148         std::vector<gr_complex> d_taps;
00149         unsigned int d_ntaps;
00150         gr_complex **d_aligned_taps;
00151         gr_complex  *d_output;
00152         int          d_align;
00153         int          d_naligned;
00154       };
00155 
00156       /**************************************************************/
00157       
00158       class FILTER_API fir_filter_scc
00159       {
00160       public:
00161         fir_filter_scc(int decimation,
00162                        const std::vector<gr_complex> &taps);
00163         ~fir_filter_scc();
00164 
00165         void set_taps(const std::vector<gr_complex> &taps);
00166         std::vector<gr_complex> taps() const;
00167         unsigned int ntaps() const;
00168 
00169         gr_complex filter(const short input[]);
00170         void filterN(gr_complex output[],
00171                      const short input[],
00172                      unsigned long n);
00173         void filterNdec(gr_complex output[],
00174                         const short input[],
00175                         unsigned long n,
00176                         unsigned int decimate);
00177 
00178       protected:
00179         std::vector<gr_complex> d_taps;
00180         unsigned int d_ntaps;
00181         gr_complex **d_aligned_taps;
00182         gr_complex  *d_output;
00183         int          d_align;
00184         int          d_naligned;
00185       };
00186 
00187       /**************************************************************/
00188       
00189       class FILTER_API fir_filter_fsf
00190       {
00191       public:
00192         fir_filter_fsf(int decimation,
00193                        const std::vector<float> &taps);
00194         ~fir_filter_fsf();
00195 
00196         void set_taps(const std::vector<float> &taps);
00197         std::vector<float> taps() const;
00198         unsigned int ntaps() const;
00199 
00200         short filter(const float input[]);
00201         void filterN(short output[],
00202                      const float input[],
00203                      unsigned long n);
00204         void filterNdec(short output[],
00205                         const float input[],
00206                         unsigned long n,
00207                         unsigned int decimate);
00208 
00209       protected:
00210         std::vector<float> d_taps;
00211         unsigned int d_ntaps;
00212         float      **d_aligned_taps;
00213         short       *d_output;
00214         int          d_align;
00215         int          d_naligned;
00216       };
00217 
00218     } /* namespace kernel */
00219   } /* namespace filter */
00220 } /* namespace gr */
00221 
00222 #endif /* INCLUDED_FILTER_FIR_FILTER_H */