comparison libtwamr/residu.c @ 393:a2351f2ad4f8

libtwamr: integrate residu.c
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 06 May 2024 18:44:13 +0000
parents
children
comparison
equal deleted inserted replaced
392:a0f914a28371 393:a2351f2ad4f8
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 : residu.c
11 * Purpose : Computes the LP residual.
12 * Description : The LP residual is computed by filtering the input
13 * : speech through the LP inverse filter A(z).
14 *
15 ********************************************************************************
16 */
17 /*
18 ********************************************************************************
19 * MODULE INCLUDE FILE AND VERSION ID
20 ********************************************************************************
21 */
22 #include "namespace.h"
23 #include "residu.h"
24
25 /*
26 ********************************************************************************
27 * INCLUDE FILES
28 ********************************************************************************
29 */
30 #include "typedef.h"
31 #include "basic_op.h"
32 #include "no_count.h"
33 #include "cnst.h"
34
35 /*
36 ********************************************************************************
37 * LOCAL VARIABLES AND TABLES
38 ********************************************************************************
39 */
40 /*
41 *--------------------------------------*
42 * Constants (defined in cnst.h *
43 *--------------------------------------*
44 * M : LPC order *
45 *--------------------------------------*
46 */
47
48 /*
49 ********************************************************************************
50 * PUBLIC PROGRAM CODE
51 ********************************************************************************
52 */
53 void Residu (
54 Word16 a[], /* (i) : prediction coefficients */
55 Word16 x[], /* (i) : speech signal */
56 Word16 y[], /* (o) : residual signal */
57 Word16 lg /* (i) : size of filtering */
58 )
59 {
60 Word16 i, j;
61 Word32 s;
62
63 for (i = 0; i < lg; i++)
64 {
65 s = L_mult (x[i], a[0]);
66 for (j = 1; j <= M; j++)
67 {
68 s = L_mac (s, a[j], x[i - j]);
69 }
70 s = L_shl (s, 3);
71 y[i] = round (s); move16 ();
72 }
73 return;
74 }