annotate libtwamr/qgain795.h @ 430:edbbbf1c4ab1

implement twamr-tseq-dec test program
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 May 2024 23:35:41 +0000
parents 2aa98051d445
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
376
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 * R99 Version 3.3.0
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 * REL-4 Version 4.1.0
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 * File : qgain795.h
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 * Purpose : (pre-) quantization of pitch gain for MR795
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #ifndef qgain795_h
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 #define qgain795_h "$Id $"
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 /*
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 * INCLUDE FILES
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 #include "typedef.h"
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 #include "g_adapt.h"
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /*
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 * DECLARATION OF PROTOTYPES
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 ********************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 /*************************************************************************
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 * FUNCTION: MR795_gain_quant
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 * PURPOSE: pitch and codebook quantization for MR795
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 *
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 *************************************************************************/
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 void
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 MR795_gain_quant(
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 GainAdaptState *adapt_st, /* i/o: gain adapter state structure */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 Word16 res[], /* i : LP residual, Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 Word16 exc[], /* i : LTP excitation (unfiltered), Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 Word16 code[], /* i : CB innovation (unfiltered), Q13 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 Word16 frac_coeff[], /* i : coefficients (5), Q15 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 Word16 exp_coeff[], /* i : energy coefficients (5), Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 /* coefficients from calc_filt_ener() */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 Word16 exp_code_en, /* i : innovation energy (exponent), Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 Word16 frac_code_en, /* i : innovation energy (fraction), Q15 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 Word16 L_subfr, /* i : Subframe length */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 Word16 cod_gain_frac, /* i : opt. codebook gain (fraction),Q15 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 Word16 cod_gain_exp, /* i : opt. codebook gain (exponent), Q0 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 Word16 gp_limit, /* i : pitch gain limit */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 Word16 *gain_pit, /* i/o: Pitch gain (unquant/quant), Q14 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 Word16 *gain_cod, /* o : Code gain, Q1 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 Word16 *qua_ener_MR122, /* o : quantized energy error, Q10 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 /* (for MR122 MA predictor update) */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 Word16 *qua_ener, /* o : quantized energy error, Q10 */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 /* (for other MA predictor update) */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 Word16 **anap /* o : Index of quantization */
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 /* (first gain pitch, then code pitch)*/
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 );
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65
2aa98051d445 libtwamr: integrate qgain795.c
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 #endif