annotate libgsmfr2/table.c @ 418:93d6c6960a46

libtwamr: integrate cod_amr.c
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 May 2024 03:50:25 +0000
parents 19db59c9dc07
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This C source file has been adapted from TU-Berlin libgsm source,
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * original notice follows:
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 *
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * Universitaet Berlin. See the accompanying file "COPYRIGHT" for
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdint.h>
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "tw_gsmfr.h"
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "typedef.h"
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "ed_state.h"
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "ed_internal.h"
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 /* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 * CODER AND DECODER
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 *
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 * (Most of them inlined, so watch out.)
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /* Table 4.1 Quantization of the Log.-Area Ratios
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* i 1 2 3 4 5 6 7 8 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036};
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144};
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 /* Table 4.2 Tabulation of 1/A[1..8]
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 /* Table 4.3a Decision level of the LTP gain quantizer
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /* bc 0 1 2 3 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 word gsm_DLB[4] = { 6554, 16384, 26214, 32767 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 /* Table 4.3b Quantization levels of the LTP gain quantizer
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 /* bc 0 1 2 3 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 word gsm_QLB[4] = { 3277, 11469, 21299, 32767 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 /* Table 4.4 Coefficients of the weighting filter
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 /* i 0 1 2 3 4 5 6 7 8 9 10 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 /* Table 4.5 Normalized inverse mantissa used to compute xM/xmax
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 /* i 0 1 2 3 4 5 6 7 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 };
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 /* Table 4.6 Normalized direct mantissa used to compute xM/xmax
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 /* i 0 1 2 3 4 5 6 7 */
19db59c9dc07 libgsmfr2: integrate table.c from libgsm
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 };