FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/cod_amr.h @ 483:4f13db3a7086
doc/Utils-overview: document new utilities
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 20 May 2024 01:26:12 +0000 |
parents | 93d6c6960a46 |
children |
rev | line source |
---|---|
418
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : cod_amr.h |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Main encoder routine operating on a frame basis. |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #ifndef cod_amr_h |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define cod_amr_h "$Id $" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 * INCLUDE FILES |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "tw_amr.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "typedef.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "cnst.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "lpc.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 #include "lsp.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 #include "cl_ltp.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 #include "gain_q.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 #include "p_ol_wgh.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 #include "ton_stab.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 #include "vad.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 #include "dtx_enc.h" |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 /* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 * DEFINITION OF DATA TYPES |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 ***************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 /*-----------------------------------------------------------* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 * Coder constant parameters (defined in "cnst.h") * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 *-----------------------------------------------------------* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 * L_WINDOW : LPC analysis window size. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 * L_NEXT : Samples of next frame needed for autocor. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 * L_FRAME : Frame size. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * L_FRAME_BY2 : Half the frame size. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * L_SUBFR : Sub-frame size. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * M : LPC order. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * MP1 : LPC order+1 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 * L_TOTAL7k4 : Total size of speech buffer. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * PIT_MIN7k4 : Minimum pitch lag. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * PIT_MAX : Maximum pitch lag. * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * L_INTERPOL : Length of filter for interpolation * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 *-----------------------------------------------------------*/ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 typedef struct { |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 /* Speech vector */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 Word16 old_speech[L_TOTAL]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 Word16 *speech, *p_window, *p_window_12k2; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Word16 *new_speech; /* Global variable */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 /* Weight speech vector */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 Word16 old_wsp[L_FRAME + PIT_MAX]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 Word16 *wsp; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 /* OL LTP states */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 Word16 old_lags[5]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 Word16 ol_gain_flg[2]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 /* Excitation vector */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 Word16 old_exc[L_FRAME + PIT_MAX + L_INTERPOL]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 Word16 *exc; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 /* Zero vector */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 Word16 ai_zero[L_SUBFR + MP1]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 Word16 *zero; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 /* Impulse response vector */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 Word16 *h1; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 Word16 hvec[L_SUBFR * 2]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 /* Substates */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 lpcState lpcSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
83 lspState lspSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
84 clLtpState clLtpSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
85 gainQuantState gainQuantSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
86 pitchOLWghtState pitchOLWghtSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
87 tonStabState tonStabSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
88 vadState vadSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 Flag dtx; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 dtx_encState dtx_encSt; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 /* Filter's memory */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 Word16 mem_syn[M], mem_w0[M], mem_w[M]; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 Word16 mem_err[M + L_SUBFR], *error; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 Word16 sharp; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 } cod_amrState; |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 /* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 ******************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 * DECLARATION OF PROTOTYPES |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 ******************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 /* |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 ************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 * Function : cod_amr_reset |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 * Purpose : Resets state memory |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 * Returns : 0 on success |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 ************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 void cod_amr_reset (cod_amrState *st, Flag dtx, Flag use_vad2); |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 /*************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 * FUNCTION: cod_amr_first |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 * PURPOSE: Copes with look-ahead. |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 * INPUTS: |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 * No input argument are passed to this function. However, before |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 * calling this function, 40 new speech data should be copied to the |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
124 * vector new_speech[]. This is a global pointer which is declared in |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
125 * this file (it points to the end of speech buffer minus 200). |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
126 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
127 ***************************************************************************/ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
128 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
129 int cod_amr_first(cod_amrState *st, /* i/o : State struct */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
130 Word16 new_speech[] /* i : speech input (L_FRAME) */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
131 ); |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
132 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 /*************************************************************************** |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
134 * FUNCTION: cod_amr |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
135 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
136 * PURPOSE: Main encoder routine. |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
137 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
138 * DESCRIPTION: This function is called every 20 ms speech frame, |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
139 * operating on the newly read 160 speech samples. It performs the |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
140 * principle encoding functions to produce the set of encoded parameters |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 * which include the LSP, adaptive codebook, and fixed codebook |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 * quantization indices (addresses and gains). |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 * INPUTS: |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 * No input argument are passed to this function. However, before |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 * calling this function, 160 new speech data should be copied to the |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 * vector new_speech[]. This is a global pointer which is declared in |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 * this file (it points to the end of speech buffer minus 160). |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
149 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
150 * OUTPUTS: |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
151 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
152 * ana[]: vector of analysis parameters. |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
153 * synth[]: Local synthesis speech (for debugging purposes) |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
154 * |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
155 ***************************************************************************/ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
156 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
157 int cod_amr(cod_amrState *st, /* i/o : State struct */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
158 enum Mode mode, /* i : AMR mode */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
159 Word16 new_speech[], /* i : speech input (L_FRAME) */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
160 Word16 ana[], /* o : Analysis parameters */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
161 enum Mode *usedMode, /* o : used mode */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
162 Word16 synth[] /* o : Local synthesis */ |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
163 ); |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
164 |
93d6c6960a46
libtwamr: integrate cod_amr.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
165 #endif |