3 * Copyright 2002 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 2, 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.
26 #include <gr_fir_fff_generic.h>
31 gr_fir_fff_generic::filter (const float input[])
33 static const int N_UNROLL = 4;
42 unsigned n = (ntaps () / N_UNROLL) * N_UNROLL;
44 for (i = 0; i < n; i += N_UNROLL){
45 acc0 += d_taps[i + 0] * input[i + 0];
46 acc1 += d_taps[i + 1] * input[i + 1];
47 acc2 += d_taps[i + 2] * input[i + 2];
48 acc3 += d_taps[i + 3] * input[i + 3];
51 for (; i < ntaps (); i++)
52 acc0 += d_taps[i] * input[i];
54 return (float) (acc0 + acc1 + acc2 + acc3);
60 gr_fir_fff_generic::filter (const float input[])
62 static const int N_UNROLL = 2;
68 unsigned n = (ntaps () / N_UNROLL) * N_UNROLL;
70 for (i = 0; i < n; i += N_UNROLL){
71 acc0 += d_taps[i + 0] * input[i + 0];
72 acc1 += d_taps[i + 1] * input[i + 1];
75 for (; i < ntaps (); i++)
76 acc0 += d_taps[i] * input[i];
78 return (float) (acc0 + acc1);
84 gr_fir_fff_generic::filterN (float output[],
88 for (unsigned i = 0; i < n; i++)
89 output[i] = filter (&input[i]);
93 gr_fir_fff_generic::filterNdec (float output[],
99 for (unsigned i = 0; i < n; i++){
100 output[i] = filter (&input[j]);