comparison libtwamr/ec_gains.h @ 362:9cbd1b5d061f

libtwamr: integrate ec_gains.c
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 06 May 2024 02:08:43 +0000
parents
children
comparison
equal deleted inserted replaced
361:9aa554f8cf39 362:9cbd1b5d061f
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 : ec_gains.h
11 * Purpose: : Error concealment for pitch and codebook gains
12 *
13 ********************************************************************************
14 */
15 #ifndef ec_gains_h
16 #define ec_gains_h "$Id $"
17
18 /*
19 ********************************************************************************
20 * INCLUDE FILES
21 ********************************************************************************
22 */
23 #include "typedef.h"
24 #include "gc_pred.h"
25
26 /*
27 ********************************************************************************
28 * LOCAL VARIABLES AND TABLES
29 ********************************************************************************
30 */
31
32 /*
33 ********************************************************************************
34 * DEFINITION OF DATA TYPES
35 ********************************************************************************
36 */
37 typedef struct {
38 Word16 pbuf[5];
39 Word16 past_gain_pit;
40 Word16 prev_gp;
41 } ec_gain_pitchState;
42
43 typedef struct {
44 Word16 gbuf[5];
45 Word16 past_gain_code;
46 Word16 prev_gc;
47 } ec_gain_codeState;
48 /*
49 ********************************************************************************
50 * DECLARATION OF PROTOTYPES
51 ********************************************************************************
52 */
53
54 /*
55 **************************************************************************
56 *
57 * Function : ec_gain_code_reset
58 * Purpose : Resets state memory
59 *
60 **************************************************************************
61 */
62 void ec_gain_code_reset (
63 ec_gain_codeState *state
64 );
65
66 /*
67 **************************************************************************
68 *
69 * Function : ec_gain_code
70 * Purpose : conceal the codebook gain
71 * Call this function only in BFI (instead of normal gain
72 * decoding function)
73 *
74 **************************************************************************
75 */
76 void ec_gain_code (
77 ec_gain_codeState *st, /* i/o : State struct */
78 gc_predState *pred_state, /* i/o : MA predictor state */
79 Word16 state, /* i : state of the state machine */
80 Word16 *gain_code /* o : decoded innovation gain */
81 );
82
83 /*
84 **************************************************************************
85 *
86 * Function : ec_gain_code_update
87 * Purpose : update the codebook gain concealment state;
88 * limit gain_code if the previous frame was bad
89 * Call this function always after decoding (or concealing)
90 * the gain
91 *
92 **************************************************************************
93 */
94 void ec_gain_code_update (
95 ec_gain_codeState *st, /* i/o : State struct */
96 Word16 bfi, /* i : flag: frame is bad */
97 Word16 prev_bf, /* i : flag: previous frame was bad */
98 Word16 *gain_code /* i/o : decoded innovation gain */
99 );
100
101 /*
102 **************************************************************************
103 *
104 * Function: ec_gain_pitch_reset
105 * Purpose: Resets state memory
106 *
107 **************************************************************************
108 */
109 void ec_gain_pitch_reset (
110 ec_gain_pitchState *state
111 );
112
113 /*
114 **************************************************************************
115 *
116 * Function : ec_gain_pitch
117 * Purpose : conceal the pitch gain
118 * Call this function only in BFI (instead of normal gain
119 * decoding function)
120 *
121 **************************************************************************
122 */
123 void ec_gain_pitch (
124 ec_gain_pitchState *st, /* i/o : state variables */
125 Word16 state, /* i : state of the state machine */
126 Word16 *gain_pitch /* o : pitch gain (Q14) */
127 );
128
129 /*
130 **************************************************************************
131 *
132 * Function : ec_gain_pitch_update
133 * Purpose : update the pitch gain concealment state;
134 * limit gain_pitch if the previous frame was bad
135 * Call this function always after decoding (or concealing)
136 * the gain
137 *
138 **************************************************************************
139 */
140 void ec_gain_pitch_update (
141 ec_gain_pitchState *st, /* i/o : state variables */
142 Word16 bfi, /* i : flag: frame is bad */
143 Word16 prev_bf, /* i : flag: previous frame was bad */
144 Word16 *gain_pitch /* i/o : pitch gain */
145 );
146
147 #endif