FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/syn_filt.c @ 394:2af94ba0c075
libtwamr: integrate syn_filt.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 06 May 2024 18:49:17 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
393:a2351f2ad4f8 | 394:2af94ba0c075 |
---|---|
1 /* | |
2 ******************************************************************************** | |
3 * | |
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 | |
5 * R99 Version 3.3.0 | |
6 * REL-4 Version 4.1.0 | |
7 * | |
8 ******************************************************************************** | |
9 * | |
10 * File : syn_filt.c | |
11 * Purpose : Perform synthesis filtering through 1/A(z). | |
12 * | |
13 ******************************************************************************** | |
14 */ | |
15 /* | |
16 ******************************************************************************** | |
17 * MODULE INCLUDE FILE AND VERSION ID | |
18 ******************************************************************************** | |
19 */ | |
20 #include "namespace.h" | |
21 #include "syn_filt.h" | |
22 | |
23 /* | |
24 ******************************************************************************** | |
25 * INCLUDE FILES | |
26 ******************************************************************************** | |
27 */ | |
28 #include "typedef.h" | |
29 #include "basic_op.h" | |
30 #include "no_count.h" | |
31 #include "cnst.h" | |
32 | |
33 /* | |
34 ******************************************************************************** | |
35 * LOCAL VARIABLES AND TABLES | |
36 ******************************************************************************** | |
37 */ | |
38 /* | |
39 *--------------------------------------* | |
40 * Constants (defined in cnst.h * | |
41 *--------------------------------------* | |
42 * M : LPC order * | |
43 *--------------------------------------* | |
44 */ | |
45 | |
46 /* | |
47 ******************************************************************************** | |
48 * PUBLIC PROGRAM CODE | |
49 ******************************************************************************** | |
50 */ | |
51 void Syn_filt ( | |
52 Word16 a[], /* (i) : a[M+1] prediction coefficients (M=10) */ | |
53 Word16 x[], /* (i) : input signal */ | |
54 Word16 y[], /* (o) : output signal */ | |
55 Word16 lg, /* (i) : size of filtering */ | |
56 Word16 mem[], /* (i/o) : memory associated with this filtering. */ | |
57 Word16 update /* (i) : 0=no update, 1=update of memory. */ | |
58 ) | |
59 { | |
60 Word16 i, j; | |
61 Word32 s; | |
62 Word16 tmp[80]; /* This is usually done by memory allocation (lg+M) */ | |
63 Word16 *yy; | |
64 | |
65 /* Copy mem[] to yy[] */ | |
66 | |
67 yy = tmp; move16 (); | |
68 | |
69 for (i = 0; i < M; i++) | |
70 { | |
71 *yy++ = mem[i]; move16 (); | |
72 } | |
73 | |
74 /* Do the filtering. */ | |
75 | |
76 for (i = 0; i < lg; i++) | |
77 { | |
78 s = L_mult (x[i], a[0]); | |
79 for (j = 1; j <= M; j++) | |
80 { | |
81 s = L_msu (s, a[j], yy[-j]); | |
82 } | |
83 s = L_shl (s, 3); | |
84 *yy++ = round (s); move16 (); | |
85 } | |
86 | |
87 for (i = 0; i < lg; i++) | |
88 { | |
89 y[i] = tmp[i + M]; move16 (); | |
90 } | |
91 | |
92 /* Update of memory if update==1 */ | |
93 | |
94 test (); | |
95 if (update != 0) | |
96 { | |
97 for (i = 0; i < M; i++) | |
98 { | |
99 mem[i] = y[lg - M + i]; move16 (); | |
100 } | |
101 } | |
102 return; | |
103 } |