FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/int_lpc.c @ 451:614ae8dc6807
README: update for libgsmfr2+libgsmefr+libtwamr set
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 10 May 2024 02:36:34 +0000 |
parents | 32bc48faec4b |
children |
rev | line source |
---|---|
381
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : int_lpc.c |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 * MODULE INCLUDE FILE AND VERSION ID |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 #include "namespace.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 #include "int_lpc.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 * INCLUDE FILES |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "typedef.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "basic_op.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "no_count.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "cnst.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "lsp_az.h" |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 * LOCAL VARIABLES AND TABLES |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 *--------------------------------------* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 * Constants (defined in cnst.h) * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 *--------------------------------------* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 * M : LPC order * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 * MP1 : LPC order + 1 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 *--------------------------------------* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * PUBLIC PROGRAM CODE |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 ******************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 ************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 * Function : Int_lpc_1and3 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 * Purpose : Interpolates the LSPs and converts to LPC parameters |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 * to get a different LP filter in each subframe. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 * Description : The 20 ms speech frame is divided into 4 subframes. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 * The LSPs are quantized and transmitted at the 2nd and |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 * 4th subframes (twice per frame) and interpolated at the |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 * 1st and 3rd subframe. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 * |------|------|------|------| |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * sf1 sf2 sf3 sf4 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 * F0 Fm F1 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 * sf1: 1/2 Fm + 1/2 F0 sf3: 1/2 F1 + 1/2 Fm |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 * sf2: Fm sf4: F1 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 * Returns : void |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 ************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 void Int_lpc_1and3 ( |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 Word16 lsp_mid[], /* i : LSP vector at the 2nd subfr. of |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 present frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 Word16 lsp_new[], /* i : LSP vector at the 4th subfr. of |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 present frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 Word16 Az[] /* o : interpolated LP parameters in all subfr. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 (AZ_SIZE) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 ) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 Word16 i; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 Word16 lsp[M]; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 /* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 for (i = 0; i < M; i++) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 lsp[i] = add (shr (lsp_mid[i], 1), shr (lsp_old[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 Lsp_Az (lsp, Az); /* Subframe 1 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 Lsp_Az (lsp_mid, Az); /* Subframe 2 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 for (i = 0; i < M; i++) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 lsp[i] = add (shr (lsp_mid[i], 1), shr (lsp_new[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 Lsp_Az (lsp, Az); /* Subframe 3 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 Lsp_Az (lsp_new, Az); /* Subframe 4 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 return; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 /* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 ************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 * Function : Int_lpc_1and3_2 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 * Purpose : Interpolation of the LPC parameters. Same as the Int_lpc |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 * function but we do not recompute Az() for subframe 2 and |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 * 4 because it is already available. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 * Returns : void |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 ************************************************************************** |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 void Int_lpc_1and3_2 ( |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 Word16 lsp_old[], /* i : LSP vector at the 4th subfr. of past frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 Word16 lsp_mid[], /* i : LSP vector at the 2nd subframe of |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 present frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 Word16 lsp_new[], /* i : LSP vector at the 4th subframe of |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 present frame (M) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 Word16 Az[] /* o :interpolated LP parameters |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 in subframes 1 and 3 (AZ_SIZE) */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 ) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 Word16 i; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 Word16 lsp[M]; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 /* lsp[i] = lsp_mid[i] * 0.5 + lsp_old[i] * 0.5 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 for (i = 0; i < M; i++) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 lsp[i] = add (shr (lsp_mid[i], 1), shr (lsp_old[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 Lsp_Az (lsp, Az); /* Subframe 1 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 Az += MP1 * 2; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 for (i = 0; i < M; i++) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 lsp[i] = add (shr (lsp_mid[i], 1), shr (lsp_new[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 Lsp_Az (lsp, Az); /* Subframe 3 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 return; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 /************************************************************************* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 * FUNCTION: Int_lpc_1to3() |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 * PURPOSE: Interpolates the LSPs and convert to LP parameters to get |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 * a different LP filter in each subframe. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 * DESCRIPTION: |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 * The 20 ms speech frame is divided into 4 subframes. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
166 * The LSPs are quantized and transmitted at the 4th subframe |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
167 * (once per frame) and interpolated at the 1st, 2nd and 3rd subframe. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
168 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
169 * |------|------|------|------| |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
170 * sf1 sf2 sf3 sf4 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
171 * F0 F1 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
172 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
173 * sf1: 3/4 F0 + 1/4 F1 sf3: 1/4 F0 + 3/4 F1 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
174 * sf2: 1/2 F0 + 1/2 F1 sf4: F1 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
175 * |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
176 *************************************************************************/ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
177 void Int_lpc_1to3( |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
178 Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
179 Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
180 Word16 Az[] /* output: interpolated LP parameters in all SFs */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
181 ) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
182 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
183 Word16 i; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
184 Word16 lsp[M]; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
185 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
186 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
187 lsp[i] = add(shr(lsp_new[i], 2), sub(lsp_old[i], shr(lsp_old[i], 2))); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
188 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
189 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
190 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
191 Lsp_Az(lsp, Az); /* Subframe 1 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
192 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
193 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
194 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
195 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
196 lsp[i] = add(shr(lsp_old[i], 1), shr(lsp_new[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
197 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
198 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
199 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
200 Lsp_Az(lsp, Az); /* Subframe 2 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
201 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
202 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
203 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
204 lsp[i] = add(shr(lsp_old[i], 2), sub(lsp_new[i], shr(lsp_new[i], 2))); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
205 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
206 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
207 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
208 Lsp_Az(lsp, Az); /* Subframe 3 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
209 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
210 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
211 Lsp_Az(lsp_new, Az); /* Subframe 4 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
212 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
213 return; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
214 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
215 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
216 /************************************************************************* |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
217 * Function Int_lpc_1to3_2() |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
218 * Interpolation of the LPC parameters. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
219 * Same as the previous function but we do not recompute Az() for |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
220 * subframe 4 because it is already available. |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
221 *************************************************************************/ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
222 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
223 void Int_lpc_1to3_2( |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
224 Word16 lsp_old[], /* input : LSP vector at the 4th SF of past frame */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
225 Word16 lsp_new[], /* input : LSP vector at the 4th SF of present frame */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
226 Word16 Az[] /* output: interpolated LP parameters in SFs 1,2,3 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
227 ) |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
228 { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
229 Word16 i; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
230 Word16 lsp[M]; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
231 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
232 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
233 lsp[i] = add(shr(lsp_new[i], 2), sub(lsp_old[i], shr(lsp_old[i], 2))); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
234 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
235 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
236 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
237 Lsp_Az(lsp, Az); /* Subframe 1 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
238 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
239 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
240 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
241 lsp[i] = add(shr(lsp_old[i], 1), shr(lsp_new[i], 1)); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
242 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
243 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
244 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
245 Lsp_Az(lsp, Az); /* Subframe 2 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
246 Az += MP1; move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
247 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
248 for (i = 0; i < M; i++) { |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
249 lsp[i] = add(shr(lsp_old[i], 2), sub(lsp_new[i], shr(lsp_new[i], 2))); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
250 move16 (); |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
251 } |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
252 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
253 Lsp_Az(lsp, Az); /* Subframe 3 */ |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
254 |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
255 return; |
32bc48faec4b
libtwamr: integrate int_lpc.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
256 } |