diff options
author | Tom Rondeau <trondeau@vt.edu> | 2012-05-02 12:43:18 -0400 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2012-05-02 12:43:18 -0400 |
commit | 417337cd4a6cef95bbec7c5d04bbacdab0eb9f47 (patch) | |
tree | d97711d86b868f2348a7e5a6760cdbcddf81779d /gr-filter | |
parent | 38120d6ba5b805f522e74c0e440e487f673cb82e (diff) |
filter: fixing up fir_filter_fff to handle taps appropriately, also does decimation.
Diffstat (limited to 'gr-filter')
-rw-r--r-- | gr-filter/lib/fir_filter_fff_impl.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gr-filter/lib/fir_filter_fff_impl.cc b/gr-filter/lib/fir_filter_fff_impl.cc index 4a1233a244..15ccb4d077 100644 --- a/gr-filter/lib/fir_filter_fff_impl.cc +++ b/gr-filter/lib/fir_filter_fff_impl.cc @@ -48,6 +48,7 @@ namespace gr { gr_make_io_signature (1, 1, sizeof(float)), decimation) { + d_taps = NULL; set_taps(taps); d_updated = false; set_history(d_ntaps+1); @@ -55,11 +56,21 @@ namespace gr { fir_filter_fff_impl::~fir_filter_fff_impl() { + if(d_taps != NULL) { + fft::free(d_taps); + d_taps = NULL; + } } void fir_filter_fff_impl::set_taps(const std::vector<float> &taps) { + // Free the taps if already allocated + if(d_taps != NULL) { + fft::free(d_taps); + d_taps = NULL; + } + d_ntaps = (int)taps.size(); d_taps = fft::malloc_float(d_ntaps); for(int i = 0; i < d_ntaps; i++) { @@ -95,11 +106,13 @@ namespace gr { for(int i = 0; i < noutput_items; i++) { volk_32f_x2_dot_prod_32f_u(&out[i], &in[i], d_taps, d_ntaps); } - - //d_fir->filterN(out, in, noutput_items); } else { - //d_fir->filterNdec(out, in, noutput_items, decimation()); + int j = 0; + for(int i = 0; i < noutput_items; i++) { + volk_32f_x2_dot_prod_32f_u(&out[i], &in[j], d_taps, d_ntaps); + j += decimation(); + } } return noutput_items; |