annotate libtwamr/c2_11pf.h @ 514:67b13a6a63c9

libgsmhr1: implement validation for *.dec frames
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Aug 2024 19:14:40 +0000
parents 9bca350be398
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
319
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : c2_11pf.h
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Searches a 11 bit algebraic codebook containing 2 pulses
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * in a frame of 40 samples.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #ifndef c2_11pf_h
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define c2_11pf_h "$Id $"
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /*
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 * INCLUDE FILES
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "typedef.h"
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * LOCAL VARIABLES AND TABLES
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 /*
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 * DEFINITION OF DATA TYPES
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 /*
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 * DECLARATION OF PROTOTYPES
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 ********************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 /*************************************************************************
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 * FUNCTION: code_2i40_11bits()
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 * PURPOSE: Searches a 11 bit algebraic codebook containing 2 pulses
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 * in a frame of 40 samples.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 * DESCRIPTION:
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 * The code length is 40, containing 2 nonzero pulses: i0...i1.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 * All pulses can have two possible amplitudes: +1 or -1.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 * Pulse i0 can have 2x8=16 possible positions, pulse i1 can have
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 * 4x8=32 positions.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 * i0 : 1, 6, 11, 16, 21, 26, 31, 36.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 * 3, 8, 13, 18, 23, 28, 33, 38.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 * i1 : 0, 5, 10, 15, 20, 25, 30, 35.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 * 1, 6, 11, 16, 21, 26, 31, 36.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 * 2, 7, 12, 17, 22, 27, 32, 37.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 * 4, 9, 14, 19, 24, 29, 34, 39.
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 *
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 *************************************************************************/
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 Word16 code_2i40_11bits(
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 Word16 x[], /* i : target vector */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 Word16 h[], /* i : impulse response of weighted synthesis filter */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 /* h[-L_subfr..-1] must be set to zero. */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 Word16 T0, /* i : Pitch lag */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 Word16 pitch_sharp, /* i : Last quantized pitch gain */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 Word16 code[], /* o : Innovative codebook */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 Word16 y[], /* o : filtered fixed codebook excitation */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 Word16 * sign /* o : Signs of 2 pulses */
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 );
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75
9bca350be398 libtwamr: integrate c2_11pf.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 #endif