FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/cl_ltp.h @ 478:936a08cc73ce
doc/AMR-library-API: describe the decoder
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 May 2024 21:32:31 +0000 |
parents | 85e9768d497f |
children |
rev | line source |
---|---|
406
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : cl_ltp.h |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Closed-loop fractional pitch search |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 #ifndef cl_ltp_h |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 #define cl_ltp_h "$Id $" |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /* |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 * INCLUDE FILES |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 #include "tw_amr.h" |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 #include "typedef.h" |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "pitch_fr.h" |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 #include "ton_stab.h" |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 /* |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 * LOCAL VARIABLES AND TABLES |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 /* |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 * DEFINITION OF DATA TYPES |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 /* state variable */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 typedef struct { |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 Pitch_frState pitchSt; |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } clLtpState; |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /* |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * DECLARATION OF PROTOTYPES |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 ******************************************************************************** |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 void cl_ltp_reset (clLtpState *st); |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 /* reset of pre processing state (i.e. set state memory to zero) |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 returns 0 on success |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 int cl_ltp( |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 clLtpState *clSt, /* i/o : State struct */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 tonStabState *tonSt, /* i/o : State struct */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 enum Mode mode, /* i : coder mode */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 Word16 frameOffset, /* i : Offset to subframe */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 Word16 T_op[], /* i : Open loop pitch lags */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 Word16 *h1, /* i : Impulse response vector Q12 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 Word16 *exc, /* i/o : Excitation vector Q0 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 Word16 res2[], /* i/o : Long term prediction residual Q0 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 Word16 xn[], /* i : Target vector for pitch search Q0 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 Word16 lsp_flag, /* i : LSP resonance flag */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 Word16 xn2[], /* o : Target vector for codebook search Q0 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 Word16 y1[], /* o : Filtered adaptive excitation Q0 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 Word16 *T0, /* o : Pitch delay (integer part) */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 Word16 *T0_frac, /* o : Pitch delay (fractional part) */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 Word16 *gain_pit, /* o : Pitch gain Q14 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 Word16 g_coeff[], /* o : Correlations between xn, y1, & y2 */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 Word16 **anap, /* o : Analysis parameters */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 Word16 *gp_limit /* o : pitch gain limit */ |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 ); |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 |
85e9768d497f
libtwamr: integrate cl_ltp.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 #endif |