FreeCalypso > hg > gsm-codec-lib
comparison libtwamr/gc_pred.h @ 336:7f99b8ed30e5
libtwamr: integrate gc_pred.c
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 18 Apr 2024 23:02:35 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
335:03198f6b0427 | 336:7f99b8ed30e5 |
---|---|
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 : gc_pred.h | |
11 * Purpose : codebook gain MA prediction | |
12 * | |
13 ******************************************************************************** | |
14 */ | |
15 | |
16 #ifndef gc_pred_h | |
17 #define gc_pred_h "$Id $" | |
18 | |
19 /* | |
20 ******************************************************************************** | |
21 * INCLUDE FILES | |
22 ******************************************************************************** | |
23 */ | |
24 #include "tw_amr.h" | |
25 #include "typedef.h" | |
26 | |
27 /* | |
28 ******************************************************************************** | |
29 * LOCAL VARIABLES AND TABLES | |
30 ******************************************************************************** | |
31 */ | |
32 | |
33 /* | |
34 ******************************************************************************** | |
35 * DEFINITION OF DATA TYPES | |
36 ******************************************************************************** | |
37 */ | |
38 typedef struct { | |
39 Word16 past_qua_en[4]; /* normal MA predictor memory, Q10 */ | |
40 /* (contains 20*log10(qua_err)) */ | |
41 Word16 past_qua_en_MR122[4]; /* MA predictor memory for MR122 mode, Q10 */ | |
42 /* (contains log2(qua_err)) */ | |
43 } gc_predState; | |
44 | |
45 /* | |
46 ******************************************************************************** | |
47 * DECLARATION OF PROTOTYPES | |
48 ******************************************************************************** | |
49 */ | |
50 | |
51 void gc_pred_reset (gc_predState *st); | |
52 /* reset of codebook gain MA predictor state (i.e. set state memory to zero) | |
53 returns 0 on success | |
54 */ | |
55 | |
56 void | |
57 gc_pred_copy( | |
58 gc_predState *st_src, /* i : State struct */ | |
59 gc_predState *st_dest /* o : State struct */ | |
60 ); | |
61 | |
62 /************************************************************************* | |
63 * | |
64 * FUNCTION: gc_pred() | |
65 * | |
66 * PURPOSE: MA prediction of the innovation energy | |
67 * (in dB/(20*log10(2))) with mean removed). | |
68 * | |
69 *************************************************************************/ | |
70 void gc_pred( | |
71 gc_predState *st, /* i/o: State struct */ | |
72 enum Mode mode, /* i : AMR mode */ | |
73 Word16 *code, /* i : innovative codebook vector (L_SUBFR) */ | |
74 /* MR122: Q12, other modes: Q13 */ | |
75 Word16 *exp_gcode0, /* o : exponent of predicted gain factor, Q0 */ | |
76 Word16 *frac_gcode0,/* o : fraction of predicted gain factor Q15 */ | |
77 Word16 *exp_en, /* o : exponent of innovation energy, Q0 */ | |
78 /* (only calculated for MR795) */ | |
79 Word16 *frac_en /* o : fraction of innovation energy, Q15 */ | |
80 /* (only calculated for MR795) */ | |
81 ); | |
82 | |
83 /************************************************************************* | |
84 * | |
85 * FUNCTION: gc_pred_update() | |
86 * | |
87 * PURPOSE: update MA predictor with last quantized energy | |
88 * | |
89 *************************************************************************/ | |
90 void gc_pred_update( | |
91 gc_predState *st, /* i/o: State struct */ | |
92 Word16 qua_ener_MR122, /* i : quantized energy for update, Q10 */ | |
93 /* (log2(qua_err)) */ | |
94 Word16 qua_ener /* i : quantized energy for update, Q10 */ | |
95 /* (20*log10(qua_err)) */ | |
96 ); | |
97 | |
98 /************************************************************************* | |
99 * | |
100 * FUNCTION: gc_pred_average_limited() | |
101 * | |
102 * PURPOSE: get average of MA predictor state values (with a lower limit) | |
103 * [used in error concealment] | |
104 * | |
105 *************************************************************************/ | |
106 void gc_pred_average_limited( | |
107 gc_predState *st, /* i: State struct */ | |
108 Word16 *ener_avg_MR122, /* o: averaged quantized energy, Q10 */ | |
109 /* (log2(qua_err)) */ | |
110 Word16 *ener_avg /* o: averaged quantized energy, Q10 */ | |
111 /* (20*log10(qua_err)) */ | |
112 ); | |
113 | |
114 #endif |