comparison src/convolve.c @ 0:56410792419a

src: original EFR source from ETSI
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 03 Apr 2024 05:31:37 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:56410792419a
1 /*************************************************************************
2 *
3 * FUNCTION: Convolve
4 *
5 * PURPOSE:
6 * Perform the convolution between two vectors x[] and h[] and
7 * write the result in the vector y[]. All vectors are of length L
8 * and only the first L samples of the convolution are computed.
9 *
10 * DESCRIPTION:
11 * The convolution is given by
12 *
13 * y[n] = sum_{i=0}^{n} x[i] h[n-i], n=0,...,L-1
14 *
15 *************************************************************************/
16
17 #include "typedef.h"
18 #include "basic_op.h"
19 #include "count.h"
20
21 void Convolve (
22 Word16 x[], /* (i) : input vector */
23 Word16 h[], /* (i) : impulse response */
24 Word16 y[], /* (o) : output vector */
25 Word16 L /* (i) : vector size */
26 )
27 {
28 Word16 i, n;
29 Word32 s;
30
31 for (n = 0; n < L; n++)
32 {
33 s = 0; move32 ();
34 for (i = 0; i <= n; i++)
35 {
36 s = L_mac (s, x[i], h[n - i]);
37 }
38 s = L_shl (s, 3);
39 y[n] = extract_h (s); move16 ();
40 }
41
42 return;
43 }