23 #ifndef INCLUDED_GRI_IIR_H
24 #define INCLUDED_GRI_IIR_H
33 template<
class i_type,
class o_type,
class tap_type>
59 gri_iir (
const std::vector<tap_type>& fftaps,
60 const std::vector<tap_type>& fbtaps)
throw (std::invalid_argument)
73 o_type
filter (
const i_type input);
79 void filter_n (o_type output[],
const i_type input[],
long n);
90 void set_taps (
const std::vector<tap_type> &fftaps,
91 const std::vector<tap_type> &fbtaps)
throw (std::invalid_argument)
100 int n = fftaps.size ();
101 int m = fbtaps.size ();
105 for (
int i = 0; i < 2 * n; i++){
108 for (
int i = 0; i < 2 * m; i++){
126 template<
class i_type,
class o_type,
class tap_type>
132 unsigned n = ntaps_ff ();
133 unsigned m = ntaps_fb ();
138 int latest_n = d_latest_n;
139 int latest_m = d_latest_m;
141 acc = d_fftaps[0] * input;
142 for (i = 1; i < n; i ++)
143 acc += (d_fftaps[i] * d_prev_input[latest_n + i]);
144 for (i = 1; i < m; i ++)
145 acc += (d_fbtaps[i] * d_prev_output[latest_m + i]);
148 d_prev_output[latest_m] = acc;
149 d_prev_output[latest_m+m] = acc;
150 d_prev_input[latest_n] = input;
151 d_prev_input[latest_n+n] = input;
160 d_latest_m = latest_m;
161 d_latest_n = latest_n;
166 template<
class i_type,
class o_type,
class tap_type>
169 const i_type input[],
172 for (
int i = 0; i < n; i++)
173 output[i] = filter (input[i]);