FreeCalypso > hg > gsm-codec-lib
annotate libtwamr/dec_lag3.h @ 521:68fe269b4316
gsmx-to-tw5a: actually write to the output file
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 19 Sep 2024 02:21:08 +0000 |
parents | fb001496ca8c |
children |
rev | line source |
---|---|
357
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 * R99 Version 3.3.0 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 * REL-4 Version 4.1.0 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 * File : dec_lag3.h |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 * Purpose : Decoding of fractional pitch lag with 1/3 resolution. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 * Extract the integer and fraction parts of the pitch lag from |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 * the received adaptive codebook index. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 #ifndef dec_lag3_h |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 #define dec_lag3_h "$Id $" |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 /* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 * INCLUDE FILES |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 #include "typedef.h" |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 /* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 * LOCAL VARIABLES AND TABLES |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 /* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 * DEFINITION OF DATA TYPES |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 /* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 * DECLARATION OF PROTOTYPES |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 ******************************************************************************** |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 /************************************************************************* |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 * FUNCTION: Dec_lag3 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 * PURPOSE: Decoding of fractional pitch lag with 1/3 resolution. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 * Extract the integer and fraction parts of the pitch lag from |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 * the received adaptive codebook index. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 * See "Enc_lag3.c" for more details about the encoding procedure. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 * The fractional lag in 1st and 3rd subframes is encoded with 8 bits |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 * while that in 2nd and 4th subframes is relatively encoded with 4, 5 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 * and 6 bits depending on the mode. |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 * |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 *************************************************************************/ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 void Dec_lag3(Word16 index, /* i : received pitch index */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 Word16 T0_min, /* i : minimum of search range */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 Word16 T0_max, /* i : maximum of search range */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 Word16 i_subfr, /* i : subframe flag */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 Word16 T0_prev, /* i : integer pitch delay of last subframe |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 used in 2nd and 4th subframes */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 Word16 * T0, /* o : integer part of pitch lag */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 Word16 * T0_frac, /* o : fractional part of pitch lag */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 Word16 flag4 /* i : flag for encoding with 4 bits */ |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 ); |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 |
fb001496ca8c
libtwamr: integrate dec_lag3.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 #endif |