Imported Upstream version 3.0.4
[debian/gnuradio] / gnuradio-core / src / lib / filter / complex_dotprod_generic.cc
1 /* -*- c -*- */
2 /*
3  * Copyright 2002 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
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)
10  * any later version.
11  * 
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.
16  * 
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.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 #include <gr_complex.h>
27 #include "gr_fir_scc_simd.h"
28 #include "complex_dotprod_generic.h"
29
30
31 void
32 complex_dotprod_generic (const short *input,
33                        const float *taps, unsigned n_2_complex_blocks,
34                        float *result)
35 {
36   gr_complex sum0(0,0);
37   gr_complex sum1(0,0);
38
39   do {
40     const gr_complex tap0(taps[0], taps[1]);
41     const gr_complex tap1(taps[2], taps[3]);
42
43     sum0 += (float)input[0] * tap0;
44     sum1 += (float)input[1] * tap1;
45
46     input += 4;
47     taps += 8;
48
49   } while (--n_2_complex_blocks != 0);
50
51
52   sum0 += sum1;
53   result[0] = sum0.real();
54   result[1] = sum0.imag();
55 }