annotate libtwamr/c2_9pf.h @ 342:e42075184628

libtwamr: integrate q_plsf_3.tab
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Apr 2024 00:57:15 +0000
parents ee64aabcc7a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
320
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : c2_9pf.h
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Searches a 9 bit algebraic codebook containing
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * 2 pulses in a frame of 40 samples.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #ifndef c2_9pf_h
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define c2_9pf_h "$Id $"
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /*
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 * INCLUDE FILES
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "typedef.h"
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * LOCAL VARIABLES AND TABLES
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 /*
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 * DEFINITION OF DATA TYPES
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /*
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 * DECLARATION OF PROTOTYPES
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 *****************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*************************************************************************
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 * FUNCTION: code_2i40_9bits()
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 * PURPOSE: Searches a 9 bit algebraic codebook containing 2 pulses
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * in a frame of 40 samples.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 * DESCRIPTION:
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 * The code length is 40, containing 2 nonzero pulses: i0...i1.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * All pulses can have two possible amplitudes: +1 or -1.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 * Pulse i0 can have 8 possible positions, pulse i1 can have
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * 8 positions. Also coded is which track pair should be used,
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 * i.e. first or second pair. Where each pair contains 2 tracks.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * First subframe:
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * first i0 : 0, 5, 10, 15, 20, 25, 30, 35.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * i1 : 2, 7, 12, 17, 22, 27, 32, 37.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 * second i0 : 1, 6, 11, 16, 21, 26, 31, 36.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * i1 : 3, 8, 13, 18, 23, 28, 33, 38.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 * Second subframe:
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 * first i0 : 0, 5, 10, 15, 20, 25, 30, 35.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 * i1 : 3, 8, 13, 18, 23, 28, 33, 38.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 * second i0 : 2, 7, 12, 17, 22, 27, 32, 37.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 * i1 : 4, 9, 14, 19, 24, 29, 34, 39.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 * Third subframe:
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 * first i0 : 0, 5, 10, 15, 20, 25, 30, 35.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 * i1 : 2, 7, 12, 17, 22, 27, 32, 37.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 * second i0 : 1, 6, 11, 16, 21, 26, 31, 36.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 * i1 : 4, 9, 14, 19, 24, 29, 34, 39.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 * Fourth subframe:
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 * first i0 : 0, 5, 10, 15, 20, 25, 30, 35.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 * i1 : 3, 8, 13, 18, 23, 28, 33, 38.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 * second i0 : 1, 6, 11, 16, 21, 26, 31, 36.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 * i1 : 4, 9, 14, 19, 24, 29, 34, 39.
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 *
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 *************************************************************************/
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 Word16 code_2i40_9bits(
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84 Word16 subNr, /* i : subframe number */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 Word16 x[], /* i : target vector */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 Word16 h[], /* i : impulse response of weighted synthesis filter */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 /* h[-L_subfr..-1] must be set to zero. */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 Word16 T0, /* i : Pitch lag */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 Word16 pitch_sharp, /* i : Last quantized pitch gain */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 Word16 code[], /* o : Innovative codebook */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 Word16 y[], /* o : filtered fixed codebook excitation */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 Word16 * sign /* o : Signs of 2 pulses */
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 );
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94
ee64aabcc7a0 libtwamr: integrate c2_9pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 #endif