annotate libtwamr/q_gain_c.h @ 513:03a40ac2e931

libgsmhr1: implement validation for *.cod frames
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Aug 2024 19:00:03 +0000
parents 3a25bdfad0d8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
368
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : q_gain_c.h
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : Scalar quantization of the innovative
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 * : codebook gain.
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #ifndef q_gain_c_h
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #define q_gain_c_h "$Id $"
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 /*
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 * INCLUDE FILES
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "tw_amr.h"
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 #include "typedef.h"
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 #include "gc_pred.h"
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /*
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 * DECLARATION OF PROTOTYPES
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 ********************************************************************************
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /*--------------------------------------------------------------------------*
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 * Function q_gain_code() *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 * Scalar quantization of the innovative codebook gain. *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 * *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 * gc_pred() is used for MA prediction of the innovation energy *
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 *--------------------------------------------------------------------------*/
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 Word16 q_gain_code ( /* o : quantization index, Q0 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 enum Mode mode, /* i : AMR mode */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 Word16 *gain, /* i/o: quantized fixed codebook gain, Q1 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 /* (for MR122 MA predictor update) */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 Word16 *qua_ener /* o : quantized energy error, Q10 */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 /* (for other MA predictor update) */
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 );
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
3a25bdfad0d8 libtwamr: integrate q_gain_c.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 #endif