annotate libtwamr/c3_14pf.h @ 542:f2d0f2f15d5f

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