view libgsmefr/dec_state.h @ 242:f081a6850fb5

libgsmfrp: new refined implementation The previous implementation exhibited the following defects, which are now fixed: 1) The last received valid SID was cached forever for the purpose of handling future invalid SIDs - we could have received some valid SID ages ago, then lots of speech or NO_DATA, and if we then get an invalid SID, we would resurrect the last valid SID from ancient history - a bad design. In our new design, we handle invalid SID based on the current state, much like BFI. 2) GSM 06.11 spec says clearly that after the second lost SID (received BFI=1 && TAF=1 in CN state) we need to gradually decrease the output level, rather than jump directly to emitting silence frames - we previously failed to implement such logic. 3) Per GSM 06.12 section 5.2, Xmaxc should be the same in all 4 subframes in a SID frame. What should we do if we receive an otherwise valid SID frame with different Xmaxc? Our previous approach would replicate this Xmaxc oddity in every subsequent generated CN frame, which is rather bad. In our new design, the very first CN frame (which can be seen as a transformation of the SID frame itself) retains the original 4 distinct Xmaxc, but all subsequent CN frames are based on the Xmaxc from the last subframe of the most recent SID.
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 09 May 2023 05:16:31 +0000
parents eefef9f6d533
children
line wrap: on
line source

/*
 * In this header file we define our decoder state structure.
 * This decoder state structure is internal to libgsmefr,
 * NOT part of our external public interface!
 */

struct EFR_decoder_state {
	/* from agc.c */
	Word16 past_gain;
	/* from decoder.c */
	Word16 synth_buf[L_FRAME + M];
	Word16 reset_flag_old;
	/* from dec_12k2.c */
	Word16 old_exc[L_FRAME + PIT_MAX + L_INTERPOL];
	Word16 lsp_old[M];
	Word16 mem_syn[M];
	Word16 prev_bf;
	Word16 bf_state;
	/* from d_plsf_5.c */
	Word16 past_r2_q[M];
	Word16 past_lsf_q[M];
	Word16 lsf_p_CN[M];
	Word16 lsf_old_CN[M];
	Word16 lsf_new_CN[M];
	/* from d_gains.c */
	Word16 pbuf[5];
	Word16 past_gain_pit;
	Word16 prev_gp;
	Word16 gbuf[5];
	Word16 past_gain_code;
	Word16 prev_gc;
	Word16 gcode0_CN;
	Word16 gain_code_old_CN;
	Word16 gain_code_new_CN;
	Word16 gain_code_muting_CN;
	Word16 past_qua_en[4];
	Word16 pred[4];
	/* from dtx.c */
	Word16 rxdtx_ctrl;
	Word32 L_pn_seed_rx;
	Word16 rx_dtx_state;
	Word16 rxdtx_aver_period;
	Word16 rxdtx_N_elapsed;
	Word16 prev_SID_frames_lost;
	Word16 buf_p_rx;
	Word16 lsf_old_rx[DTX_HANGOVER][M];
	Word16 gain_code_old_rx[4 * DTX_HANGOVER];
	/* from dec_lag6.c */
	Word16 old_T0;
	/* from preemph.c */
	Word16 mem_pre;
	/* from pstfilt2.c */
	Word16 res2[L_SUBFR];
	Word16 mem_syn_pst[M];
	/* our own addition */
	Word32 L_pn_seed_nodata;
};