comparison libtwamr/qgain475.h @ 375:1d2b39027b70

libtwamr: integrate qgain475.c
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 06 May 2024 04:14:52 +0000
parents
children
comparison
equal deleted inserted replaced
374:61047a2912a2 375:1d2b39027b70
1 /*
2 ********************************************************************************
3 *
4 * GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
5 * R99 Version 3.3.0
6 * REL-4 Version 4.1.0
7 *
8 ********************************************************************************
9 *
10 * File : qgain475.h
11 * Purpose : Quantization of pitch and codebook gains for MR475.
12 *
13 ********************************************************************************
14 */
15 #ifndef qgain475_h
16 #define qgain475_h "$Id $"
17
18 /*
19 ********************************************************************************
20 * INCLUDE FILES
21 ********************************************************************************
22 */
23 #include "typedef.h"
24 #include "gc_pred.h"
25
26 /*
27 ********************************************************************************
28 * DECLARATION OF PROTOTYPES
29 ********************************************************************************
30 */
31
32 /*************************************************************************
33 *
34 * FUNCTION: MR475_update_unq_pred()
35 *
36 * PURPOSE: use optimum codebook gain and update "unquantized"
37 * gain predictor with the (bounded) prediction error
38 *
39 *************************************************************************/
40 void
41 MR475_update_unq_pred(
42 gc_predState *pred_st, /* i/o: gain predictor state struct */
43 Word16 exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
44 Word16 frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
45 Word16 cod_gain_exp, /* i : optimum codebook gain (exponent), Q0 */
46 Word16 cod_gain_frac /* i : optimum codebook gain (fraction), Q15 */
47 );
48
49 /*************************************************************************
50 *
51 * FUNCTION: MR475_gain_quant()
52 *
53 * PURPOSE: Quantization of pitch and codebook gains for two subframes
54 * (using predicted codebook gain)
55 *
56 *************************************************************************/
57
58 Word16
59 MR475_gain_quant( /* o : index of quantization. */
60 gc_predState *pred_st, /* i/o: gain predictor state struct */
61
62 /* data from subframe 0 (or 2) */
63 Word16 sf0_exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
64 Word16 sf0_frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
65 Word16 sf0_exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
66 Word16 sf0_frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
67 /* (frac_coeff and exp_coeff computed in */
68 /* calc_filt_energies()) */
69 Word16 sf0_exp_target_en, /* i : exponent of target energy, Q0 */
70 Word16 sf0_frac_target_en, /* i : fraction of target energy, Q15 */
71
72 /* data from subframe 1 (or 3) */
73 Word16 sf1_code_nosharp[], /* i : innovative codebook vector (L_SUBFR) */
74 /* (whithout pitch sharpening) */
75 Word16 sf1_exp_gcode0, /* i : predicted CB gain (exponent), Q0 */
76 Word16 sf1_frac_gcode0, /* i : predicted CB gain (fraction), Q15 */
77 Word16 sf1_exp_coeff[], /* i : energy coeff. (5), exponent part, Q0 */
78 Word16 sf1_frac_coeff[], /* i : energy coeff. (5), fraction part, Q15 */
79 /* (frac_coeff and exp_coeff computed in */
80 /* calc_filt_energies()) */
81 Word16 sf1_exp_target_en, /* i : exponent of target energy, Q0 */
82 Word16 sf1_frac_target_en, /* i : fraction of target energy, Q15 */
83
84 Word16 gp_limit, /* i : pitch gain limit */
85
86 Word16 *sf0_gain_pit, /* o : Pitch gain, Q14 */
87 Word16 *sf0_gain_cod, /* o : Code gain, Q1 */
88
89 Word16 *sf1_gain_pit, /* o : Pitch gain, Q14 */
90 Word16 *sf1_gain_cod /* o : Code gain, Q1 */
91 );
92 #endif