GNU Radio 3.6.5.1 C++ API
fir_filter.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2010,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_FILTER_FIR_FILTER_H
24 #define INCLUDED_FILTER_FIR_FILTER_H
25 
26 #include <filter/api.h>
27 #include <vector>
28 #include <gr_complex.h>
29 
30 namespace gr {
31  namespace filter {
32  namespace kernel {
33 
35  {
36  public:
37  fir_filter_fff(int decimation,
38  const std::vector<float> &taps);
39  ~fir_filter_fff();
40 
41  void set_taps(const std::vector<float> &taps);
42  std::vector<float> taps() const;
43  unsigned int ntaps() const;
44 
45  float filter(const float input[]);
46  void filterN(float output[],
47  const float input[],
48  unsigned long n);
49  void filterNdec(float output[],
50  const float input[],
51  unsigned long n,
52  unsigned int decimate);
53 
54  protected:
55  std::vector<float> d_taps;
56  unsigned int d_ntaps;
57  float **d_aligned_taps;
58  float *d_output;
59  int d_align;
61  };
62 
63  /**************************************************************/
64 
66  {
67  public:
68  fir_filter_ccf(int decimation,
69  const std::vector<float> &taps);
70  ~fir_filter_ccf();
71 
72  void set_taps(const std::vector<float> &taps);
73  std::vector<float> taps() const;
74  unsigned int ntaps() const;
75 
76  gr_complex filter(const gr_complex input[]);
77  void filterN(gr_complex output[],
78  const gr_complex input[],
79  unsigned long n);
80  void filterNdec(gr_complex output[],
81  const gr_complex input[],
82  unsigned long n,
83  unsigned int decimate);
84 
85  protected:
86  std::vector<float> d_taps;
87  unsigned int d_ntaps;
88  float **d_aligned_taps;
90  int d_align;
92  };
93 
94  /**************************************************************/
95 
97  {
98  public:
99  fir_filter_fcc(int decimation,
100  const std::vector<gr_complex> &taps);
101  ~fir_filter_fcc();
102 
103  void set_taps(const std::vector<gr_complex> &taps);
104  std::vector<gr_complex> taps() const;
105  unsigned int ntaps() const;
106 
107  gr_complex filter(const float input[]);
108  void filterN(gr_complex output[],
109  const float input[],
110  unsigned long n);
111  void filterNdec(gr_complex output[],
112  const float input[],
113  unsigned long n,
114  unsigned int decimate);
115 
116  protected:
117  std::vector<gr_complex> d_taps;
118  unsigned int d_ntaps;
121  int d_align;
123  };
124 
125  /**************************************************************/
126 
128  {
129  public:
130  fir_filter_ccc(int decimation,
131  const std::vector<gr_complex> &taps);
132  ~fir_filter_ccc();
133 
134  void set_taps(const std::vector<gr_complex> &taps);
135  std::vector<gr_complex> taps() const;
136  unsigned int ntaps() const;
137 
138  gr_complex filter(const gr_complex input[]);
139  void filterN(gr_complex output[],
140  const gr_complex input[],
141  unsigned long n);
142  void filterNdec(gr_complex output[],
143  const gr_complex input[],
144  unsigned long n,
145  unsigned int decimate);
146 
147  protected:
148  std::vector<gr_complex> d_taps;
149  unsigned int d_ntaps;
152  int d_align;
154  };
155 
156  /**************************************************************/
157 
159  {
160  public:
161  fir_filter_scc(int decimation,
162  const std::vector<gr_complex> &taps);
163  ~fir_filter_scc();
164 
165  void set_taps(const std::vector<gr_complex> &taps);
166  std::vector<gr_complex> taps() const;
167  unsigned int ntaps() const;
168 
169  gr_complex filter(const short input[]);
170  void filterN(gr_complex output[],
171  const short input[],
172  unsigned long n);
173  void filterNdec(gr_complex output[],
174  const short input[],
175  unsigned long n,
176  unsigned int decimate);
177 
178  protected:
179  std::vector<gr_complex> d_taps;
180  unsigned int d_ntaps;
183  int d_align;
185  };
186 
187  /**************************************************************/
188 
190  {
191  public:
192  fir_filter_fsf(int decimation,
193  const std::vector<float> &taps);
194  ~fir_filter_fsf();
195 
196  void set_taps(const std::vector<float> &taps);
197  std::vector<float> taps() const;
198  unsigned int ntaps() const;
199 
200  short filter(const float input[]);
201  void filterN(short output[],
202  const float input[],
203  unsigned long n);
204  void filterNdec(short output[],
205  const float input[],
206  unsigned long n,
207  unsigned int decimate);
208 
209  protected:
210  std::vector<float> d_taps;
211  unsigned int d_ntaps;
212  float **d_aligned_taps;
213  short *d_output;
214  int d_align;
216  };
217 
218  } /* namespace kernel */
219  } /* namespace filter */
220 } /* namespace gr */
221 
222 #endif /* INCLUDED_FILTER_FIR_FILTER_H */