FreeCalypso > hg > gsm-codec-lib
comparison libgsmefr/syn_filt.c @ 53:49dd1ac8e75b
libgsmefr: import most *.c files from ETSI source
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 25 Nov 2022 16:18:21 +0000 |
parents | |
children | bb71c5414e71 |
comparison
equal
deleted
inserted
replaced
52:988fd7ff514f | 53:49dd1ac8e75b |
---|---|
1 /************************************************************************* | |
2 * | |
3 * FUNCTION: Syn_filt: | |
4 * | |
5 * PURPOSE: Perform synthesis filtering through 1/A(z). | |
6 * | |
7 *************************************************************************/ | |
8 | |
9 #include "typedef.h" | |
10 #include "basic_op.h" | |
11 #include "count.h" | |
12 | |
13 /* m = LPC order == 10 */ | |
14 #define m 10 | |
15 | |
16 void Syn_filt ( | |
17 Word16 a[], /* (i) : a[m+1] prediction coefficients (m=10) */ | |
18 Word16 x[], /* (i) : input signal */ | |
19 Word16 y[], /* (o) : output signal */ | |
20 Word16 lg, /* (i) : size of filtering */ | |
21 Word16 mem[], /* (i/o) : memory associated with this filtering. */ | |
22 Word16 update /* (i) : 0=no update, 1=update of memory. */ | |
23 ) | |
24 { | |
25 Word16 i, j; | |
26 Word32 s; | |
27 Word16 tmp[80]; /* This is usually done by memory allocation (lg+m) */ | |
28 Word16 *yy; | |
29 | |
30 /* Copy mem[] to yy[] */ | |
31 | |
32 yy = tmp; move16 (); | |
33 | |
34 for (i = 0; i < m; i++) | |
35 { | |
36 *yy++ = mem[i]; move16 (); | |
37 } | |
38 | |
39 /* Do the filtering. */ | |
40 | |
41 for (i = 0; i < lg; i++) | |
42 { | |
43 s = L_mult (x[i], a[0]); | |
44 for (j = 1; j <= m; j++) | |
45 { | |
46 s = L_msu (s, a[j], yy[-j]); | |
47 } | |
48 s = L_shl (s, 3); | |
49 *yy++ = round (s); move16 (); | |
50 } | |
51 | |
52 for (i = 0; i < lg; i++) | |
53 { | |
54 y[i] = tmp[i + m]; move16 (); | |
55 } | |
56 | |
57 /* Update of memory if update==1 */ | |
58 | |
59 test (); | |
60 if (update != 0) | |
61 { | |
62 for (i = 0; i < m; i++) | |
63 { | |
64 mem[i] = y[lg - m + i]; move16 (); | |
65 } | |
66 } | |
67 return; | |
68 } |