3 * Copyright 2010 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
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.
24 * WARNING: This file is automatically generated by generate_gr_fir_XXX.py
25 * Any changes made to this file will be overwritten.
29 #ifndef INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_H
30 #define INCLUDED_GRI_FIR_FILTER_WITH_BUFFER_H
34 #include <gr_reverse.h>
38 * \brief FIR with internal buffer for gr_complex input,
39 gr_complex output and float taps
44 class gri_fir_filter_with_buffer_ccf {
47 std::vector<float> d_taps; // reversed taps
56 * \brief construct new FIR with given taps.
58 * Note that taps must be in forward order, e.g., coefficient 0 is
59 * stored in new_taps[0], coefficient 1 is stored in
62 gri_fir_filter_with_buffer_ccf (const std::vector<float> &taps);
64 ~gri_fir_filter_with_buffer_ccf ();
69 * \brief compute a single output value.
71 * \p input must have ntaps() valid entries.
72 * input[0] .. input[ntaps() - 1] are referenced to compute the output value.
74 * \returns the filtered input value.
76 gr_complex filter (gr_complex input);
79 * \brief compute an array of N output values.
81 * \p input must have (n - 1 + ntaps()) valid entries.
82 * input[0] .. input[n - 1 + ntaps() - 1] are referenced to compute the output values.
84 void filterN (gr_complex output[], const gr_complex input[],
88 * \brief compute an array of N output values, decimating the input
90 * \p input must have (decimate * (n - 1) + ntaps()) valid entries.
91 * input[0] .. input[decimate * (n - 1) + ntaps() - 1] are referenced to
92 * compute the output values.
94 void filterNdec (gr_complex output[], const gr_complex input[],
95 unsigned long n, unsigned decimate);
98 * \brief install \p new_taps as the current taps.
100 void set_taps (const std::vector<float> &taps)
102 d_taps = gr_reverse(taps);
108 // FIXME: memalign this to 16-byte boundaries for SIMD later
109 d_buffer = (gr_complex*)malloc(sizeof(gr_complex) * 2 * d_taps.size());
110 memset(d_buffer, 0x00, sizeof(gr_complex) * 2 * d_taps.size());
117 * \return number of taps in filter.
119 unsigned ntaps () const { return d_taps.size (); }
122 * \return current taps
124 const std::vector<float> get_taps () const
126 return gr_reverse(d_taps);
130 #endif /* INCLUDED_GR_GR_FIR_FILTER_WITH_BUFFER_CCF_H */