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.
27 #include <gri_fir_filter_with_buffer_ccf.h>
29 gri_fir_filter_with_buffer_ccf::gri_fir_filter_with_buffer_ccf(const std::vector<float> &taps)
35 gri_fir_filter_with_buffer_ccf::~gri_fir_filter_with_buffer_ccf()
42 gri_fir_filter_with_buffer_ccf::set_taps (const std::vector<float> &taps)
44 d_taps = gr_reverse(taps);
46 if(d_buffer != NULL) {
51 // FIXME: memalign this to 16-byte boundaries for SIMD later
52 size_t t = sizeof(gr_complex) * 2 * d_taps.size();
53 d_buffer = (gr_complex*)malloc(t);
54 memset(d_buffer, 0x00, t);
59 gri_fir_filter_with_buffer_ccf::filter (gr_complex input)
63 d_buffer[d_idx] = input;
64 d_buffer[d_idx+ntaps()] = input;
66 // using the later for the case when ntaps=0;
67 // profiling shows this doesn't make a difference
68 //d_idx = (d_idx + 1) % ntaps();
74 for(i = 0; i < ntaps(); i++) {
75 out += d_buffer[d_idx + i] * d_taps[i];
81 gri_fir_filter_with_buffer_ccf::filterN (gr_complex output[],
82 const gr_complex input[],
85 for(unsigned long i = 0; i < n; i++) {
86 output[i] = filter(input[i]);