FreeCalypso > hg > gsm-codec-lib
comparison libgsmefr/d_homing.c @ 62:c87ccddf3fd1
libgsmefr: d_homing.c compiles
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 26 Nov 2022 00:53:14 +0000 |
parents | 49dd1ac8e75b |
children | d80e9f12a1d1 |
comparison
equal
deleted
inserted
replaced
61:a18782a7d270 | 62:c87ccddf3fd1 |
---|---|
16 * variables for the decoder, and for | 16 * variables for the decoder, and for |
17 * the receive DTX and Comfort Noise. | 17 * the receive DTX and Comfort Noise. |
18 * | 18 * |
19 **************************************************************************/ | 19 **************************************************************************/ |
20 | 20 |
21 #include "gsm_efr.h" | |
21 #include "typedef.h" | 22 #include "typedef.h" |
23 #include "namespace.h" | |
22 #include "cnst.h" | 24 #include "cnst.h" |
23 #include "dtx.h" | 25 #include "dtx.h" |
24 #include "codec.h" | 26 #include "codec.h" |
27 #include "memops.h" | |
28 #include "dec_state.h" | |
25 #include "d_homing.h" | 29 #include "d_homing.h" |
26 #include "q_plsf_5.tab" | 30 #include "q_plsf_5.tab" |
27 | 31 |
28 #define PRM_NO 57 | 32 #define PRM_NO 57 |
29 | 33 |
205 * RETURN: | 209 * RETURN: |
206 * None | 210 * None |
207 * | 211 * |
208 **************************************************************************/ | 212 **************************************************************************/ |
209 | 213 |
210 void decoder_reset (void) | 214 void decoder_reset (struct EFR_decoder_state *st) |
211 { | 215 { |
212 /* External declarations for decoder variables which need to be reset */ | |
213 | |
214 /* variable defined in decoder.c */ | |
215 /* ----------------------------- */ | |
216 extern Word16 synth_buf[L_FRAME + M]; | |
217 | |
218 /* variable defined in agc.c */ | |
219 /* -------------------------- */ | |
220 extern Word16 past_gain; | |
221 | |
222 /* variables defined in d_gains.c */ | |
223 /* ------------------------------ */ | |
224 /* Error concealment */ | |
225 extern Word16 pbuf[5], past_gain_pit, prev_gp, gbuf[5], past_gain_code, | |
226 prev_gc; | |
227 | |
228 /* CNI */ | |
229 extern Word16 gcode0_CN, gain_code_old_CN, gain_code_new_CN; | |
230 extern Word16 gain_code_muting_CN; | |
231 | |
232 /* Memories of gain dequantization: */ | |
233 extern Word16 past_qua_en[4], pred[4]; | |
234 | |
235 /* variables defined in d_plsf_5.c */ | |
236 /* ------------------------------ */ | |
237 /* Past quantized prediction error */ | |
238 extern Word16 past_r2_q[M]; | |
239 | |
240 /* Past dequantized lsfs */ | |
241 extern Word16 past_lsf_q[M]; | |
242 | |
243 /* CNI */ | |
244 extern Word16 lsf_p_CN[M], lsf_new_CN[M], lsf_old_CN[M]; | |
245 | |
246 /* variables defined in dec_lag6.c */ | |
247 /* ------------------------------ */ | |
248 extern Word16 old_T0; | |
249 | |
250 /* variable defined in preemph.c */ | |
251 /* ------------------------------ */ | |
252 extern Word16 mem_pre; | |
253 | |
254 Word16 i; | 216 Word16 i; |
255 | 217 |
256 /* reset all the decoder state variables */ | 218 /* reset all the decoder state variables */ |
257 /* ------------------------------------- */ | 219 /* ------------------------------------- */ |
258 | 220 |
259 /* Variable in decoder.c: */ | 221 /* Variable in decoder.c: */ |
260 for (i = 0; i < M; i++) | 222 Set_zero (st->synth_buf, M); |
261 { | |
262 synth_buf[i] = 0; | |
263 } | |
264 | 223 |
265 /* Variables in dec_12k2.c: */ | 224 /* Variables in dec_12k2.c: */ |
266 Init_Decoder_12k2 (); | 225 Init_Decoder_12k2 (st); |
267 | 226 |
268 /* Variable in agc.c: */ | 227 /* Variable in agc.c: */ |
269 past_gain = 4096; | 228 st->past_gain = 4096; |
270 | 229 |
271 /* Variables in d_gains.c: */ | 230 /* Variables in d_gains.c: */ |
272 for (i = 0; i < 5; i++) | 231 for (i = 0; i < 5; i++) |
273 { | 232 { |
274 pbuf[i] = 410; /* Error concealment */ | 233 st->pbuf[i] = 410; /* Error concealment */ |
275 gbuf[i] = 1; /* Error concealment */ | 234 st->gbuf[i] = 1; /* Error concealment */ |
276 } | 235 } |
277 | 236 |
278 past_gain_pit = 0; /* Error concealment */ | 237 st->past_gain_pit = 0; /* Error concealment */ |
279 prev_gp = 4096; /* Error concealment */ | 238 st->prev_gp = 4096; /* Error concealment */ |
280 past_gain_code = 0; /* Error concealment */ | 239 st->past_gain_code = 0; /* Error concealment */ |
281 prev_gc = 1; /* Error concealment */ | 240 st->prev_gc = 1; /* Error concealment */ |
282 gcode0_CN = 0; /* CNI */ | 241 st->gcode0_CN = 0; /* CNI */ |
283 gain_code_old_CN = 0; /* CNI */ | 242 st->gain_code_old_CN = 0; /* CNI */ |
284 gain_code_new_CN = 0; /* CNI */ | 243 st->gain_code_new_CN = 0; /* CNI */ |
285 gain_code_muting_CN = 0; /* CNI */ | 244 st->gain_code_muting_CN = 0; /* CNI */ |
286 | 245 |
287 for (i = 0; i < 4; i++) | 246 for (i = 0; i < 4; i++) |
288 { | 247 { |
289 past_qua_en[i] = -2381; /* past quantized energies */ | 248 st->past_qua_en[i] = -2381; /* past quantized energies */ |
290 } | 249 } |
291 | 250 |
292 pred[0] = 44; /* MA prediction coeff */ | 251 st->pred[0] = 44; /* MA prediction coeff */ |
293 pred[1] = 37; /* MA prediction coeff */ | 252 st->pred[1] = 37; /* MA prediction coeff */ |
294 pred[2] = 22; /* MA prediction coeff */ | 253 st->pred[2] = 22; /* MA prediction coeff */ |
295 pred[3] = 12; /* MA prediction coeff */ | 254 st->pred[3] = 12; /* MA prediction coeff */ |
296 | 255 |
297 /* Variables in d_plsf_5.c: */ | 256 /* Variables in d_plsf_5.c: */ |
298 for (i = 0; i < M; i++) | 257 for (i = 0; i < M; i++) |
299 { | 258 { |
300 past_r2_q[i] = 0; /* Past quantized prediction error */ | 259 st->past_r2_q[i] = 0; /* Past quantized prediction error */ |
301 past_lsf_q[i] = mean_lsf[i]; /* Past dequantized lsfs */ | 260 st->past_lsf_q[i] = mean_lsf[i]; /* Past dequantized lsfs */ |
302 lsf_p_CN[i] = mean_lsf[i]; /* CNI */ | 261 st->lsf_p_CN[i] = mean_lsf[i]; /* CNI */ |
303 lsf_new_CN[i] = mean_lsf[i]; /* CNI */ | 262 st->lsf_new_CN[i] = mean_lsf[i]; /* CNI */ |
304 lsf_old_CN[i] = mean_lsf[i]; /* CNI */ | 263 st->lsf_old_CN[i] = mean_lsf[i]; /* CNI */ |
305 } | 264 } |
306 | 265 |
307 /* Variable in dec_lag6.c: */ | 266 /* Variable in dec_lag6.c: */ |
308 old_T0 = 40; /* Old integer lag */ | 267 st->old_T0 = 40; /* Old integer lag */ |
309 | 268 |
310 /* Variable in preemph.c: */ | 269 /* Variable in preemph.c: */ |
311 mem_pre = 0; /* Filter memory */ | 270 st->mem_pre = 0; /* Filter memory */ |
312 | 271 |
313 /* Variables in pstfilt2.c: */ | 272 /* Variables in pstfilt2.c: */ |
314 Init_Post_Filter (); | 273 Init_Post_Filter (st); |
315 | 274 |
316 return; | 275 return; |
317 } | 276 } |
318 | 277 |
319 /*************************************************************************** | 278 /*************************************************************************** |
333 * RETURN: | 292 * RETURN: |
334 * None | 293 * None |
335 * | 294 * |
336 **************************************************************************/ | 295 **************************************************************************/ |
337 | 296 |
338 void reset_dec (void) | 297 void EFR_decoder_reset (struct EFR_decoder_state *st) |
339 { | 298 { |
340 decoder_reset (); /* reset all the state variables in the speech decoder*/ | 299 st->reset_flag_old = 1; |
341 reset_rx_dtx (); /* reset all the receive DTX and CN state variables */ | 300 |
301 decoder_reset (st); /* reset all the state variables in the speech decoder*/ | |
302 reset_rx_dtx (st); /* reset all the receive DTX and CN state variables */ | |
342 | 303 |
343 return; | 304 return; |
344 } | 305 } |