annotate libtwamr/c4_17pf.h @ 422:1ceda5586d01

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