FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/lsp_avg.h @ 443:526a7f0e027d
amrtest: implement twamr-encode
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 May 2024 21:00:33 +0000 |
parents | 9cd332a94c97 |
children |
rev | line source |
---|---|
389
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : lsp_avg.h |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose: : LSP averaging and history |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * The LSPs are averaged over 8 frames |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #ifndef lsp_avg_h |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #define lsp_avg_h "$Id $" |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 * INCLUDE FILES |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "typedef.h" |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "cnst.h" |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 * LOCAL VARIABLES AND TABLES |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #define EXPCONST 5243 /* 0.16 in Q15 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 * DEFINITION OF DATA TYPES |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 typedef struct { |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 Word16 lsp_meanSave[M]; /* Averaged LSPs saved for efficiency */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } lsp_avgState; |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * DECLARATION OF PROTOTYPES |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 ******************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 ************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * Function : lsp_history_reset |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * Purpose : Resets state memory |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 ************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 void lsp_avg_reset ( |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 lsp_avgState *state |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 ); |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 /* |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 ************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 * Function : lsp_avg |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 * Purpose : Calculate the LSP averages |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 * |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 ************************************************************************** |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 void lsp_avg ( |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 lsp_avgState *st, /* i/o : State struct Q15 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 Word16 *lsp /* i : LSP vector Q15 */ |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 ); |
9cd332a94c97
libtwamr: integrate lsp_avg.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 #endif |