From 6bacf666b1affeb7398ad6a61ba12ef5a2188925 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 27 Mar 2024 21:26:48 +0530 Subject: [PATCH] Integration of fixed point sub-functions 10 [x] Add integeration changes for delay_signal_fx [x] Stereo_switching dec update [x] Removes redundant flags/variables from Decoder_struct. --- lib_com/cnst.h | 1 + lib_com/float_to_fix_ops.c | 4 +- lib_dec/FEC_fx.c | 2 +- lib_dec/acelp_core_dec.c | 28 +- lib_dec/acelp_core_dec_fx.c | 36 +-- lib_dec/acelp_core_dec_ivas_fx.c | 170 +++++------ lib_dec/acelp_core_switch_dec_fx.c | 16 +- lib_dec/amr_wb_dec_fx.c | 6 +- lib_dec/core_switching_dec.c | 2 +- lib_dec/core_switching_dec_fx.c | 18 +- lib_dec/dec_LPD_fx.c | 16 +- lib_dec/dec_acelp_tcx_main_fx.c | 2 +- lib_dec/dec_higher_acelp_fx.c | 4 +- lib_dec/dec_pit_exc_fx.c | 12 +- lib_dec/dec_prm_fx.c | 28 +- lib_dec/dec_tcx_fx.c | 6 +- lib_dec/dec_uv_fx.c | 4 +- lib_dec/decision_matrix_dec_fx.c | 18 +- lib_dec/dlpc_stoch_fx.c | 2 +- lib_dec/evs_dec_fx.c | 26 +- lib_dec/gs_dec_fx.c | 54 ++-- lib_dec/init_dec_fx.c | 66 ++-- lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_cpe_dec.c | 3 +- lib_dec/ivas_cpe_dec_fx.c | 50 ++++ lib_dec/ivas_omasa_dec.c | 10 + lib_dec/ivas_stat_dec.h | 7 +- lib_dec/ivas_stereo_ica_dec.c | 444 +++++++++++++-------------- lib_dec/ivas_stereo_switching_dec.c | 449 ++++++++++++++++++++++++---- lib_dec/ivas_td_low_rate_dec.c | 14 +- lib_dec/lsf_dec_fx.c | 28 +- lib_dec/stat_dec.h | 38 +-- lib_dec/stat_noise_uv_dec_fx.c | 10 +- lib_dec/swb_tbe_dec.c | 10 +- lib_dec/swb_tbe_dec_fx.c | 20 +- lib_dec/updt_dec_fx.c | 18 +- lib_dec/voiced_dec_fx.c | 2 +- lib_enc/stat_enc.h | 10 +- 38 files changed, 1022 insertions(+), 614 deletions(-) diff --git a/lib_com/cnst.h b/lib_com/cnst.h index c04e8f890..e1da85ca6 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -223,6 +223,7 @@ enum{ #define INV_LOG_2 1.442695040888963f /* 1/log(2) */ #define INV_SQRT_2 0.70710676908493f /* 1/sqrt(2) */ #define INV_SQRT_2_Q15 23170 /* 1/sqrt(2) in Q15 */ +#define INV_SQRT_2_Q31 1.51850022e+09 /* 1/sqrt(2) in Q31 */ #define MAX_V_MULT_MAT 100 /* maximum array length for the function v_mult_mat() */ diff --git a/lib_com/float_to_fix_ops.c b/lib_com/float_to_fix_ops.c index bdf66d46a..30a0f5767 100644 --- a/lib_com/float_to_fix_ops.c +++ b/lib_com/float_to_fix_ops.c @@ -1916,8 +1916,8 @@ void fixed_to_float_stereo_tcx_core_dec( if ( st->lpcQuantization ) { - st->safety_net = st->safety_net_fx; - st->mid_lsf_int = st->mid_lsf_int_fx; + st->safety_net = st->safety_net; + st->mid_lsf_int = st->mid_lsf_int; } for ( int p = 0; p < M; p++ ) diff --git a/lib_dec/FEC_fx.c b/lib_dec/FEC_fx.c index 2c608b254..6098e531b 100644 --- a/lib_dec/FEC_fx.c +++ b/lib_dec/FEC_fx.c @@ -534,7 +534,7 @@ void FEC_exc_estim_fx( test(); IF( EQ_16(st_fx->last_coder_type,AUDIO)||(EQ_16(st_fx->last_good,INACTIVE_CLAS)&&LE_32(st_fx->total_brate, MAX_GSC_INACTIVE_BRATE)&&!st_fx->Opt_AMR_WB)) { - st_fx->GSC_noisy_speech_fx = st_fx->Last_GSC_noisy_speech_flag_fx; + st_fx->GSC_noisy_speech = st_fx->Last_GSC_noisy_speech_flag; move16(); /* Replication of the last spectrum, with a slight downscaling of its dynamic */ if (st_fx->element_mode == EVS_MONO) { diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 4a4372d33..03805a296 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -2709,18 +2709,18 @@ ivas_error acelp_core_dec( floatToFixed_arr(lsp_new, tmp_lsp_new_fx, Q15, M); floatToFixed_arr(voice_factors, tmp_voice_factors_fx, Q15, NB_SUBFR16k); floatToFixed_arr(gain_buf, tmp_voice_factors_fx, Q14, NB_SUBFR16k); - st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; st->coder_type = st->coder_type; if (st->hGSCDec != NULL) { st->hGSCDec->Last_GSC_pit_band_idx_fx = st->hGSCDec->Last_GSC_pit_band_idx; st->hGSCDec->seed_tcx_fx = st->hGSCDec->seed_tcx; } - st->GSC_noisy_speech_fx = st->GSC_noisy_speech; - st->last_ppp_mode_dec_fx = st->last_ppp_mode_dec; - st->ppp_mode_dec_fx = st->ppp_mode_dec; - st->nelp_mode_dec_fx = st->nelp_mode_dec; - st->vbr_hw_BWE_disable_dec_fx = st->vbr_hw_BWE_disable_dec; + st->GSC_noisy_speech = st->GSC_noisy_speech; + st->last_ppp_mode_dec = st->last_ppp_mode_dec; + st->ppp_mode_dec = st->ppp_mode_dec; + st->nelp_mode_dec = st->nelp_mode_dec; + st->vbr_hw_BWE_disable_dec = st->vbr_hw_BWE_disable_dec; // just outputs: if (st->hGSCDec != NULL) { @@ -2729,13 +2729,13 @@ ivas_error acelp_core_dec( floatToFixed_arr(st->hGSCDec->Last_GSC_spectrum, st->hGSCDec->Last_GSC_spectrum_fx, Q10, M); } st->last_coder_type = st->last_coder_type; - st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; if (st->hHQ_core != NULL) st->hHQ_core->HqVoicing_fx = st->hHQ_core->HqVoicing; - st->old_ppp_mode_fx = st->old_ppp_mode; - st->last_ppp_mode_dec_fx = st->last_ppp_mode_dec; + st->old_ppp_mode = st->old_ppp_mode; + st->last_ppp_mode_dec = st->last_ppp_mode_dec; st->last_nelp_mode_dec = st->last_nelp_mode_dec; - st->last_vbr_hw_BWE_disable_dec_fx = st->last_vbr_hw_BWE_disable_dec; + st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; floatToFixed_arr(st->old_exc, st->old_exc_fx, tmp_Q_exc, L_EXC_MEM_DEC); for (i = 0; i < M; i++) { @@ -2763,13 +2763,13 @@ ivas_error acelp_core_dec( st->hGSCDec->noise_lev = st->hGSCDec->noise_lev_fx; st->hGSCDec->Last_GSC_pit_band_idx = st->hGSCDec->Last_GSC_pit_band_idx_fx; } - st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag_fx; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; if (st->hHQ_core != NULL) st->hHQ_core->HqVoicing = st->hHQ_core->HqVoicing_fx; - st->old_ppp_mode = st->old_ppp_mode_fx; - st->last_ppp_mode_dec = st->last_ppp_mode_dec_fx; + st->old_ppp_mode = st->old_ppp_mode; + st->last_ppp_mode_dec = st->last_ppp_mode_dec; st->last_nelp_mode_dec = st->last_nelp_mode_dec; - st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec_fx; + st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; fixedToFloat_arr(st->old_exc_fx, st->old_exc, tmp_Q_exc, L_EXC_MEM_DEC); IF(!st->Opt_AMR_WB && st->hBWE_TD != NULL) fixedToFloat_arr(st->hBWE_TD->old_bwe_exc_fx, st->hBWE_TD->old_bwe_exc, tmp_Q_exc, PIT16k_MAX * 2); diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 6969b891d..5a954cf34 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -303,9 +303,9 @@ ivas_error acelp_core_dec_fx( move16(); do_WI_fx = 0; move16(); - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); - st_fx->relax_prev_lsf_interp_fx = 0; + st_fx->relax_prev_lsf_interp = 0; move16(); set16_fx( gain_buf, 0, NB_SUBFR16k ); @@ -724,7 +724,7 @@ ivas_error acelp_core_dec_fx( uc_two_stage_flag = 0; move16(); move16(); move16(); test(); - IF (!st_fx->nelp_mode_dec_fx && !st_fx->ppp_mode_dec_fx) + IF (!st_fx->nelp_mode_dec && !st_fx->ppp_mode_dec) { Word16 tc_subfr_tmp; @@ -742,7 +742,7 @@ ivas_error acelp_core_dec_fx( move16(); } - config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); + config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st_fx->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); test(); test(); test(); IF (EQ_16(st_fx->coder_type, TRANSITION) && LT_16(tc_subfr_fx, L_SUBFR) && EQ_16(st_fx->L_frame, L_FRAME)) @@ -771,7 +771,7 @@ ivas_error acelp_core_dec_fx( { st_fx->mem_preemp_preQ_fx = 0; move16(); - st_fx->last_nq_preQ_fx = 0; + st_fx->last_nq_preQ = 0; move16(); #ifdef IVAS_CODE st_fx->last_code_preq = 0; @@ -912,7 +912,7 @@ ivas_error acelp_core_dec_fx( test(); test(); IF( st_fx->stab_fac_fx == 0 && st_fx->old_bfi_cnt > 0 && NE_16(st_fx->clas_dec,VOICED_CLAS) && NE_16(st_fx->clas_dec,ONSET) && - st_fx->relax_prev_lsf_interp_fx==0 && !(EQ_16(st_fx->element_mode, IVAS_CPE_TD) && EQ_16(st_fx->idchan, 1))) + st_fx->relax_prev_lsf_interp==0 && !(EQ_16(st_fx->element_mode, IVAS_CPE_TD) && EQ_16(st_fx->idchan, 1))) { int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid_fx, lsp_new_fx, Aq_fx, M, 2 ); } @@ -951,7 +951,7 @@ ivas_error acelp_core_dec_fx( } else #endif - IF( EQ_16(st_fx->nelp_mode_dec_fx,1)) + IF( EQ_16(st_fx->nelp_mode_dec,1)) { /* SC-VBR - NELP frames */ Scale_sig(exc_fx-L_EXC_MEM, L_EXC_MEM, -st_fx->Q_exc); @@ -966,7 +966,7 @@ ivas_error acelp_core_dec_fx( /* UNVOICED frames */ decod_unvoiced_fx( st_fx, Aq_fx, st_fx->coder_type, &tmp_noise_fx, pitch_buf_fx, voice_factors, exc_fx, exc2_fx, bwe_exc_fx, gain_buf ); } - ELSE IF ( EQ_16(st_fx->ppp_mode_dec_fx,1)) + ELSE IF ( EQ_16(st_fx->ppp_mode_dec,1)) { Scale_sig(exc_fx-L_EXC_MEM, L_EXC_MEM, -st_fx->Q_exc); st_fx->Q_exc = 0; @@ -1021,7 +1021,7 @@ ivas_error acelp_core_dec_fx( * Decode information and modify the excitation signal of stationary unvoiced frames *------------------------------------------------------------*/ test(); test(); test(); - IF (!(EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD)) && NE_16(st_fx->nelp_mode_dec_fx, 1) && !(EQ_16(st_fx->element_mode, IVAS_SCE) && tdm_low_rate_mode)) + IF (!(EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD)) && NE_16(st_fx->nelp_mode_dec, 1) && !(EQ_16(st_fx->element_mode, IVAS_SCE) && tdm_low_rate_mode)) { stat_noise_uv_dec_fx( st_fx, lsp_new_fx, lsp_mid_fx, Aq_fx, exc2_fx, uc_two_stage_flag); } @@ -1039,12 +1039,12 @@ ivas_error acelp_core_dec_fx( Copy(hMusicPF->dct_post_old_exc_fx, exc_buffer_fx, DCT_L_POST - OFFSET2); } test(); - IF(hMusicPF != NULL && ((EQ_16(st_fx->coder_type, AUDIO) && EQ_16(st_fx->GSC_noisy_speech_fx, 0)) || (GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->L_frame, L_FRAME)))) + IF(hMusicPF != NULL && ((EQ_16(st_fx->coder_type, AUDIO) && EQ_16(st_fx->GSC_noisy_speech, 0)) || (GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->L_frame, L_FRAME)))) { Word16 last_coder_type = st_fx->last_coder_type; - if ( (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD)) || (GE_16(st_fx->GSC_IVAS_mode, 1) && st_fx->GSC_noisy_speech_fx == 0)) + if ( (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD)) || (GE_16(st_fx->GSC_IVAS_mode, 1) && st_fx->GSC_noisy_speech == 0)) { last_coder_type = AUDIO; } @@ -1154,7 +1154,7 @@ ivas_error acelp_core_dec_fx( /* SC-VBR */ if ( EQ_16(st_fx->last_nelp_mode_dec,1)) { - st_fx->nelp_mode_dec_fx = 1; + st_fx->nelp_mode_dec = 1; move16(); } @@ -1174,7 +1174,7 @@ ivas_error acelp_core_dec_fx( FEC_lsf2lsp_interp( st_fx, st_fx->L_frame, Aq_fx, lsf_new_fx, lsp_new_fx ); - IF ( st_fx->nelp_mode_dec_fx == 1 ) + IF ( st_fx->nelp_mode_dec == 1 ) { /* SC-VBR */ Scale_sig(exc_fx-L_EXC_MEM, L_EXC_MEM, -st_fx->Q_exc); @@ -1292,11 +1292,11 @@ ivas_error acelp_core_dec_fx( /* fer_energy( st_fx->L_frame, st_fx->last_good, syn_fx, FEC_pitch_fx, &st_fx->enr_old_fx, st_fx->L_frame ); */ frame_ener_fx( st_fx->L_frame, st_fx->last_good, syn_fx, shr(add(FEC_pitch_fx,32),6), &st_fx->enr_old_fx, st_fx->L_frame, st_fx->Q_syn, 3, 0 ); - IF ( st_fx->nelp_mode_dec_fx !=1 ) + IF ( st_fx->nelp_mode_dec !=1 ) { /* modify the excitation signal of stationary unvoiced frames */ stat_noise_uv_mod_fx( st_fx->coder_type, 0, st_fx->lsp_old_fx, lsp_new_fx, lsp_new_fx, Aq_fx, exc2_fx, st_fx->Q_exc, 1, &st_fx->ge_sm_fx, - &st_fx->uv_count_fx, &st_fx->act_count_fx, st_fx->lspold_s_fx, &st_fx->noimix_seed_fx, &st_fx->min_alpha_fx, + &st_fx->uv_count, &st_fx->act_count, st_fx->lspold_s_fx, &st_fx->noimix_seed, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, st_fx->core_brate,st_fx->bwidth, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); } @@ -1437,7 +1437,7 @@ ivas_error acelp_core_dec_fx( PMT("Code for IVAS_CODE_CNG_FIX185_PLC_FADEOUT not done") ApplyFdCng(syn, st_fx->Q_syn, NULL, realBuffer, imagBuffer, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); #else - ApplyFdCng(syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, (EQ_16(st_fx->coder_type, AUDIO) && st_fx->GSC_noisy_speech_fx == 0)); + ApplyFdCng(syn_fx, st_fx->Q_syn, realBuffer, imagBuffer, NULL, st_fx, 0, (EQ_16(st_fx->coder_type, AUDIO) && st_fx->GSC_noisy_speech == 0)); #endif } /* CNA: Generate additional comfort noise to mask potential coding artefacts */ @@ -1780,7 +1780,7 @@ ivas_error acelp_core_dec_fx( IF(hBWE_TD != NULL) { test(); test(); test(); test(); test(); test(); test(); test(); test(); test(); - IF((!st_fx->bfi && (st_fx->prev_bfi)) || ((EQ_16(st_fx->last_vbr_hw_BWE_disable_dec_fx, 1)) && (st_fx->vbr_hw_BWE_disable_dec_fx == 0)) || ((EQ_16(st_fx->extl, SWB_TBE) || EQ_16(st_fx->extl, WB_TBE) || EQ_16(st_fx->extl, FB_TBE)) + IF((!st_fx->bfi && (st_fx->prev_bfi)) || ((EQ_16(st_fx->last_vbr_hw_BWE_disable_dec, 1)) && (st_fx->vbr_hw_BWE_disable_dec == 0)) || ((EQ_16(st_fx->extl, SWB_TBE) || EQ_16(st_fx->extl, WB_TBE) || EQ_16(st_fx->extl, FB_TBE)) && NE_16(st_fx->last_extl, SWB_TBE) && NE_16(st_fx->last_extl, WB_TBE) && NE_16(st_fx->last_extl, FB_TBE)) || (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD) && !st_fx->tdm_LRTD_flag)) { @@ -1789,7 +1789,7 @@ ivas_error acelp_core_dec_fx( } - IF(!st_fx->ppp_mode_dec_fx && (st_fx->idchan == 0 || NE_16(st_fx->element_mode, IVAS_CPE_TD) || (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD) && st_fx->tdm_LRTD_flag))) + IF(!st_fx->ppp_mode_dec && (st_fx->idchan == 0 || NE_16(st_fx->element_mode, IVAS_CPE_TD) || (EQ_16(st_fx->idchan, 1) && EQ_16(st_fx->element_mode, IVAS_CPE_TD) && st_fx->tdm_LRTD_flag))) { non_linearity_fx(bwe_exc_fx, bwe_exc_extended, L_FRAME32k, &hBWE_TD->bwe_non_lin_prev_scale_fx, st_fx->Q_exc, st_fx->coder_type, voice_factors, st_fx->L_frame); diff --git a/lib_dec/acelp_core_dec_ivas_fx.c b/lib_dec/acelp_core_dec_ivas_fx.c index d7893bdbd..1ed215edf 100644 --- a/lib_dec/acelp_core_dec_ivas_fx.c +++ b/lib_dec/acelp_core_dec_ivas_fx.c @@ -407,9 +407,9 @@ ivas_error acelp_core_dec_ivas_fx( last_pulse_pos = 0; do_WI = 0; //st->GSC_noisy_speech = 0; - st->GSC_noisy_speech_fx = 0; + st->GSC_noisy_speech = 0; //st->relax_prev_lsf_interp = 0; - st->relax_prev_lsf_interp_fx = 0; + st->relax_prev_lsf_interp = 0; //set_zero( gain_buf, NB_SUBFR16k ); set_s( gain_buf_fx, 0, NB_SUBFR16k ); @@ -794,7 +794,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp - new_cngNoiseLevelExp); st->hFdCngDec->hFdCngCom->cngNoiseLevelExp = new_cngNoiseLevelExp; - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech_fx ) ); + ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); if (st->hFdCngDec->hFdCngCom->cngNoiseLevelExp < 0) { Scale_sig32(st->hFdCngDec->hFdCngCom->cngNoiseLevel, FFTCLDFBLEN, st->hFdCngDec->hFdCngCom->cngNoiseLevelExp); @@ -925,7 +925,7 @@ ivas_error acelp_core_dec_ivas_fx( st->acelp_cfg.FEC_mode = 0; uc_two_stage_flag = 0; - if ( !st->nelp_mode_dec_fx && !st->ppp_mode_dec_fx ) + if ( !st->nelp_mode_dec && !st->ppp_mode_dec ) { int16_t tc_subfr_tmp; @@ -940,7 +940,7 @@ ivas_error acelp_core_dec_ivas_fx( nb_bits = -1; } - config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech_fx, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); + config_acelp1_IVAS( DEC, st->total_brate, st->core_brate, st->core, st->extl_orig, st->extl_brate_orig, st->L_frame, st->GSC_noisy_speech, &( st->acelp_cfg ), st->next_bit_pos, st->coder_type, tc_subfr_tmp, 1, &nb_bits, unbits, st->element_mode, &uc_two_stage_flag, tdm_lp_reuse_flag, tdm_low_rate_mode, st->idchan, st->active_cnt, tdm_Pitch_reuse_flag, st->tdm_LRTD_flag, st->GSC_IVAS_mode ); if ( st->coder_type == TRANSITION && tc_subfr < L_SUBFR && st->L_frame == L_FRAME ) { @@ -969,7 +969,7 @@ ivas_error acelp_core_dec_ivas_fx( //st->mem_preemp_preQ = 0.0f; st->mem_preemp_preQ_fx = 0; //st->last_nq_preQ = 0; - st->last_nq_preQ_fx = 0; + st->last_nq_preQ = 0; st->last_code_preq = 0; } st->use_acelp_preq = 0; @@ -1104,7 +1104,7 @@ ivas_error acelp_core_dec_ivas_fx( * redo the LPC interpolation *------------------------------------------------------------*/ - if ( st->stab_fac_fx == 0 && st->old_bfi_cnt > 0 && st->clas_dec != VOICED_CLAS && st->clas_dec != ONSET && st->relax_prev_lsf_interp_fx == 0 && !( st->element_mode == IVAS_CPE_TD && st->idchan == 1 ) ) + if ( st->stab_fac_fx == 0 && st->old_bfi_cnt > 0 && st->clas_dec != VOICED_CLAS && st->clas_dec != ONSET && st->relax_prev_lsf_interp == 0 && !( st->element_mode == IVAS_CPE_TD && st->idchan == 1 ) ) { //int_lsp4( st->L_frame, st->lsp_old, lsp_mid, lsp_new, Aq, M, 2 ); int_lsp4_fx( st->L_frame, st->lsp_old_fx, lsp_mid_fx, lsp_new_fx, Aq_fx, M, 2 ); @@ -1144,7 +1144,7 @@ ivas_error acelp_core_dec_ivas_fx( } } } - else if ( st->nelp_mode_dec_fx ) + else if ( st->nelp_mode_dec ) { /* SC-VBR - NELP frames */ Scale_sig(exc_fx - L_EXC_MEM, L_EXC_MEM, -st->Q_exc); @@ -1163,7 +1163,7 @@ ivas_error acelp_core_dec_ivas_fx( decod_unvoiced_ivas_fx( st, Aq_fx, Es_pred_fx, uc_two_stage_flag, st->coder_type, &tmp_noise_fx, pitch_buf_fx, voice_factors_fx, exc_fx, exc2_fx, bwe_exc_fx, st->Q_exc, gain_buf_fx); tmp_noise_fx = shr_r(st->lp_gainc_fx, 3); /*Q0*/ } - else if ( st->ppp_mode_dec_fx) + else if ( st->ppp_mode_dec) { Scale_sig(exc_fx - L_EXC_MEM, L_EXC_MEM, -st->Q_exc); st->Q_exc = 0; @@ -1233,7 +1233,7 @@ ivas_error acelp_core_dec_ivas_fx( * Decode information and modify the excitation signal of stationary unvoiced frames *------------------------------------------------------------*/ - if ( !( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) && st->nelp_mode_dec_fx != 1 && !( st->element_mode == IVAS_SCE && tdm_low_rate_mode ) ) + if ( !( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) && st->nelp_mode_dec != 1 && !( st->element_mode == IVAS_SCE && tdm_low_rate_mode ) ) { //stat_noise_uv_dec( st, lsp_new, lsp_mid, Aq, exc2, uc_two_stage_flag ); stat_noise_uv_dec_fx(st, lsp_new_fx, lsp_mid_fx, Aq_fx, exc2_fx, uc_two_stage_flag); @@ -1255,11 +1255,11 @@ ivas_error acelp_core_dec_ivas_fx( Copy( st->hMusicPF->dct_post_old_exc_fx, exc_buffer_fx, DCT_L_POST - OFFSET2 ); } - if ( ( st->coder_type == AUDIO && !st->GSC_noisy_speech_fx ) || ( st->GSC_IVAS_mode >= 1 && st->L_frame == L_FRAME ) ) + if ( ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) || ( st->GSC_IVAS_mode >= 1 && st->L_frame == L_FRAME ) ) { int16_t last_coder_type = st->last_coder_type; - if ( ( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) || ( st->GSC_IVAS_mode >= 1 && st->GSC_noisy_speech_fx == 0 ) ) + if ( ( st->idchan == 1 && st->element_mode == IVAS_CPE_TD ) || ( st->GSC_IVAS_mode >= 1 && st->GSC_noisy_speech == 0 ) ) { last_coder_type = AUDIO; } @@ -1374,7 +1374,7 @@ ivas_error acelp_core_dec_ivas_fx( /* SC-VBR */ IF(EQ_16(st->last_nelp_mode_dec, 1)) { - st->nelp_mode_dec_fx = 1; + st->nelp_mode_dec = 1; move16(); } @@ -1395,7 +1395,7 @@ ivas_error acelp_core_dec_ivas_fx( Scale_sig(Aq_fx + (nsf * (M + 1)), M + 1, norm_s(Aq_fx[nsf * (M + 1)]) - Q2); Aq_fx[nsf * (M + 1)] = ONE_IN_Q12; } - if ( st->nelp_mode_dec_fx == 1 ) + if ( st->nelp_mode_dec == 1 ) { /* SC-VBR */ Scale_sig(exc_fx - L_EXC_MEM, L_EXC_MEM, -st->Q_exc); @@ -1519,12 +1519,12 @@ ivas_error acelp_core_dec_ivas_fx( //fer_energy( st->L_frame, st->last_good, syn, FEC_pitch, &st->enr_old, st->L_frame ); frame_ener_fx(st->L_frame, st->last_good, psyn_fx, shr(add(FEC_pitch_fx, 32), 6), &st->enr_old_fx, st->L_frame, st->Q_syn, 3, 0); - if ( st->nelp_mode_dec_fx != 1 ) + if ( st->nelp_mode_dec != 1 ) { /* modify the excitation signal of stationary unvoiced frames */ //stat_noise_uv_mod( st->coder_type, 0, st->lsp_old, lsp_new, lsp_new, Aq, exc2, 1, &st->ge_sm, &st->uv_count, &st->act_count, st->lspold_s, &st->noimix_seed, &st->min_alpha, &st->exc_pe, st->core_brate, st->bwidth ); stat_noise_uv_mod_fx(st->coder_type, 0, st->lsp_old_fx, lsp_new_fx, lsp_new_fx, Aq_fx, exc2_fx, st->Q_exc, 1, &st->ge_sm_fx, - &st->uv_count_fx, &st->act_count_fx, st->lspold_s_fx, &st->noimix_seed_fx, &st->min_alpha_fx, + &st->uv_count, &st->act_count, st->lspold_s_fx, &st->noimix_seed, &st->min_alpha_fx, &st->exc_pe_fx, st->core_brate, st->bwidth, &st->Q_stat_noise, &st->Q_stat_noise_ge); } } @@ -1825,7 +1825,7 @@ ivas_error acelp_core_dec_ivas_fx( /*==========================================================*/ //ApplyFdCng_fx( syn_fx + L_SUBFR, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, ( st->coder_type == AUDIO && !st->GSC_noisy_speech ) ); - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech_fx)); + ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); /*==========================================================*/ if (st->hFdCngDec->partNoiseShape_exp < 0) { Scale_sig32(st->hFdCngDec->partNoiseShape, NPART, st->hFdCngDec->partNoiseShape_exp); @@ -1957,7 +1957,7 @@ ivas_error acelp_core_dec_ivas_fx( if (!st->cna_dirac_flag) { /* CNA: Generate additional comfort noise to mask potential coding artefacts */ - if (st->flag_cna && !(st->coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->GSC_noisy_speech_fx))) + if (st->flag_cna && !(st->coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->GSC_noisy_speech))) { if (st->element_mode == IVAS_CPE_TD && nchan_out == 2) { @@ -2002,7 +2002,7 @@ ivas_error acelp_core_dec_ivas_fx( } } } - else if (st->flag_cna && st->coder_type == AUDIO && ((st->last_core == ACELP_CORE && !(st->last_coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag_fx))) || st->last_core == TCX_20_CORE)) + else if (st->flag_cna && st->coder_type == AUDIO && ((st->last_core == ACELP_CORE && !(st->last_coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag))) || st->last_core == TCX_20_CORE)) { if (st->element_mode == IVAS_CPE_TD && nchan_out == 2) { @@ -2070,7 +2070,7 @@ ivas_error acelp_core_dec_ivas_fx( //st->hFdCngDec->partNoiseShape_exp = 31 - Q4; // Q4 //floatToFixed_arrL(st->hFdCngDec->partNoiseShape_float, st->hFdCngDec->partNoiseShape, Q31 - st->hFdCngDec->partNoiseShape_exp, NPART); - ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech_fx)); + ApplyFdCng_fx(psyn_fx, st->Q_syn, NULL, realBuffer_fx, imagBuffer_fx, NULL, st, 0, (st->coder_type == AUDIO && !st->GSC_noisy_speech)); if (st->hFdCngDec->partNoiseShape_exp < 0) { Scale_sig32(st->hFdCngDec->partNoiseShape, NPART, -st->hFdCngDec->partNoiseShape_exp); st->hFdCngDec->partNoiseShape_exp = 0; @@ -2206,7 +2206,7 @@ ivas_error acelp_core_dec_ivas_fx( if (!st->cna_dirac_flag) { - if (st->flag_cna == 0 && st->L_frame == L_FRAME16k && st->last_flag_cna == 1 && ((st->last_core == ACELP_CORE && !(st->last_coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag_fx))) || st->last_core == AMR_WB_CORE)) + if (st->flag_cna == 0 && st->L_frame == L_FRAME16k && st->last_flag_cna == 1 && ((st->last_core == ACELP_CORE && !(st->last_coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->Last_GSC_noisy_speech_flag))) || st->last_core == AMR_WB_CORE)) { //v_multc(st->hFdCngDec->hFdCngCom->olapBufferSynth2_flt + 5 * st->L_frame / 4, 256.f, temp_buf, st->L_frame / 2); //v_add(temp_buf, syn, syn, st->L_frame / 2); @@ -2217,7 +2217,7 @@ ivas_error acelp_core_dec_ivas_fx( } } - if (st->flag_cna == 0 || (st->coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->GSC_noisy_speech_fx))) + if (st->flag_cna == 0 || (st->coder_type == AUDIO && !(st->element_mode > EVS_MONO && st->GSC_noisy_speech))) { if (st->idchan == 0) { @@ -3029,7 +3029,7 @@ ivas_error acelp_core_dec_ivas_fx( if (st->hBWE_TD != NULL) { - if ((!st->bfi && st->prev_bfi) || (st->last_vbr_hw_BWE_disable_dec_fx == 1 && st->vbr_hw_BWE_disable_dec_fx == 0) || ((st->extl == SWB_TBE || st->extl == WB_TBE || st->extl == FB_TBE) && st->last_extl != SWB_TBE && st->last_extl != WB_TBE && st->last_extl != FB_TBE) || (st->idchan == 1 && st->element_mode == IVAS_CPE_TD && !st->tdm_LRTD_flag)) + if ((!st->bfi && st->prev_bfi) || (st->last_vbr_hw_BWE_disable_dec == 1 && st->vbr_hw_BWE_disable_dec == 0) || ((st->extl == SWB_TBE || st->extl == WB_TBE || st->extl == FB_TBE) && st->last_extl != SWB_TBE && st->last_extl != WB_TBE && st->last_extl != FB_TBE) || (st->idchan == 1 && st->element_mode == IVAS_CPE_TD && !st->tdm_LRTD_flag)) { //st->hBWE_TD->bwe_non_lin_prev_scale = 0.0f; st->hBWE_TD->bwe_non_lin_prev_scale_fx = 0; @@ -3126,18 +3126,18 @@ ivas_error acelp_core_dec_ivas_fx( //floatToFixed_arr(lsp_new, tmp_lsp_new_fx, Q15, M); //floatToFixed_arr(voice_factors, tmp_voice_factors_fx, Q15, NB_SUBFR16k); //floatToFixed_arr(gain_buf, tmp_voice_factors_fx, Q14, NB_SUBFR16k); - //st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + //st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; //st->coder_type_fx = st->coder_type; //if (st->hGSCDec != NULL) //{ // st->hGSCDec->Last_GSC_pit_band_idx_fx = st->hGSCDec->Last_GSC_pit_band_idx; // st->hGSCDec->seed_tcx_fx = st->hGSCDec->seed_tcx; //} - //st->GSC_noisy_speech_fx = st->GSC_noisy_speech; - //st->last_ppp_mode_dec_fx = st->last_ppp_mode_dec; - //st->ppp_mode_dec_fx = st->ppp_mode_dec; - //st->nelp_mode_dec_fx = st->nelp_mode_dec; - //st->vbr_hw_BWE_disable_dec_fx = st->vbr_hw_BWE_disable_dec; + //st->GSC_noisy_speech = st->GSC_noisy_speech; + //st->last_ppp_mode_dec = st->last_ppp_mode_dec; + //st->ppp_mode_dec = st->ppp_mode_dec; + //st->nelp_mode_dec = st->nelp_mode_dec; + //st->vbr_hw_BWE_disable_dec = st->vbr_hw_BWE_disable_dec; //// just outputs: //if (st->hGSCDec != NULL) //{ @@ -3146,13 +3146,13 @@ ivas_error acelp_core_dec_ivas_fx( // floatToFixed_arr(st->hGSCDec->Last_GSC_spectrum, st->hGSCDec->Last_GSC_spectrum_fx, Q10, M); //} //st->last_coder_type_fx = st->last_coder_type; - //st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + //st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; //if (st->hHQ_core != NULL) // st->hHQ_core->HqVoicing_fx = st->hHQ_core->HqVoicing; - //st->old_ppp_mode_fx = st->old_ppp_mode; - //st->last_ppp_mode_dec_fx = st->last_ppp_mode_dec; + //st->old_ppp_mode = st->old_ppp_mode; + //st->last_ppp_mode_dec = st->last_ppp_mode_dec; //st->last_nelp_mode_dec_fx = st->last_nelp_mode_dec; - //st->last_vbr_hw_BWE_disable_dec_fx = st->last_vbr_hw_BWE_disable_dec; + //st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; //floatToFixed_arr(st->old_exc, st->old_exc_fx, tmp_Q_exc, L_EXC_MEM_DEC); //for (i = 0; i < M; i++) //{ @@ -3180,13 +3180,13 @@ ivas_error acelp_core_dec_ivas_fx( st->hGSCDec->noise_lev = st->hGSCDec->noise_lev_fx; st->hGSCDec->Last_GSC_pit_band_idx = st->hGSCDec->Last_GSC_pit_band_idx_fx; } - st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag_fx; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; if (st->hHQ_core != NULL) st->hHQ_core->HqVoicing = st->hHQ_core->HqVoicing_fx; - st->old_ppp_mode = st->old_ppp_mode_fx; - st->last_ppp_mode_dec = st->last_ppp_mode_dec_fx; + st->old_ppp_mode = st->old_ppp_mode; + st->last_ppp_mode_dec = st->last_ppp_mode_dec; st->last_nelp_mode_dec = st->last_nelp_mode_dec; - st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec_fx; + st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; fixedToFloat_arr(st->old_exc_fx, st->old_exc, tmp_Q_exc, L_EXC_MEM_DEC); IF(!st->Opt_AMR_WB && st->hBWE_TD != NULL) fixedToFloat_arr(st->hBWE_TD->old_bwe_exc_fx, st->hBWE_TD->old_bwe_exc, tmp_Q_exc, PIT16k_MAX * 2); @@ -3345,7 +3345,7 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->classifier_Q_mem_syn = 0; st->coder_type = st->coder_type; st->last_coder_type = st->last_coder_type; - st->last_core_bs_fx = st->last_core_from_bs; + st->last_core_from_bs = st->last_core_from_bs; #if 1 floatToFixed_arr(st->lsp_old, st->lsp_old_fx, Q15, M); floatToFixed_arr(st->lspCNG, st->lspCNG_fx, Q15, M); @@ -3376,19 +3376,19 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte floatToFixed_arr(st->Aq_cng_float, st->Aq_cng, Q12, M + 1); /*Flags (should be unified!)*/ - st->last_nq_preQ_fx = st->last_nq_preQ; - st->safety_net_fx = st->safety_net; - st->nelp_mode_dec_fx = st->nelp_mode_dec; - st->ppp_mode_dec_fx = st->ppp_mode_dec; - st->relax_prev_lsf_interp_fx = st->relax_prev_lsf_interp; - st->unv_cnt_fx = st->unv_cnt; - st->uv_count_fx = st->uv_count; - st->act_count_fx = st->act_count; - st->GSC_noisy_speech_fx = st->GSC_noisy_speech; - st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; - st->mid_lsf_int_fx = st->mid_lsf_int; - st->last_vbr_hw_BWE_disable_dec_fx = st->last_vbr_hw_BWE_disable_dec; - st->vbr_hw_BWE_disable_dec_fx = st->vbr_hw_BWE_disable_dec; + st->last_nq_preQ = st->last_nq_preQ; + st->safety_net = st->safety_net; + st->nelp_mode_dec = st->nelp_mode_dec; + st->ppp_mode_dec = st->ppp_mode_dec; + st->relax_prev_lsf_interp = st->relax_prev_lsf_interp; + st->unv_cnt = st->unv_cnt; + st->uv_count = st->uv_count; + st->act_count = st->act_count; + st->GSC_noisy_speech = st->GSC_noisy_speech; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; + st->mid_lsf_int = st->mid_lsf_int; + st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; + st->vbr_hw_BWE_disable_dec = st->vbr_hw_BWE_disable_dec; /* dec_exc */ st->lp_gainc_fx = float_to_fix16(st->lp_gainc, Q3); @@ -3645,20 +3645,20 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->stab_fac_fx = float_to_fix16(st->stab_fac, Q15); st->stab_fac_smooth_fx = float_to_fix16(st->stab_fac_smooth, Q15); floatToFixed_arr(st->agc_mem2, st->agc_mem_fx, st->Q_syn - 1, 2); - //st->mid_lsf_int_fx = st->mid_lsf_int; - st->safety_net_fx = st->safety_net; - //st->GSC_noisy_speech_fx = st->GSC_noisy_speech; - //st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + //st->mid_lsf_int = st->mid_lsf_int; + st->safety_net = st->safety_net; + //st->GSC_noisy_speech = st->GSC_noisy_speech; + //st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; st->gc_threshold_fx = floatToFixed(st->gc_threshold, Q16); st->dm_fx.prev_state = float_to_fix16(st->dispMem[0], 0); st->dm_fx.prev_gain_code = floatToFixed(st->dispMem[1], Q16); floatToFixed_arr(&(st->dispMem[2]), st->dm_fx.prev_gain_pit, Q14, 6); - //st->unv_cnt_fx = st->unv_cnt; - //st->uv_count_fx = st->uv_count; - //st->act_count_fx = st->act_count; + //st->unv_cnt = st->unv_cnt; + //st->uv_count = st->uv_count; + //st->act_count = st->act_count; st->ge_sm_fx = (Word16)floatToFixed(st->ge_sm, st->Q_stat_noise_ge); floatToFixed_arr(st->lspold_s, st->lspold_s_fx, Q15, M); - //st->noimix_seed_fx = st->noimix_seed; + //st->noimix_seed = st->noimix_seed; st->min_alpha_fx = float_to_fix16(st->min_alpha, Q15); st->exc_pe_fx = (Word16)floatToFixed(st->exc_pe, st->Q_stat_noise); st->lp_gainp_fx = float_to_fix16(st->lp_gainp, Q14); @@ -3672,7 +3672,7 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->old_enr_LP = float_to_fix16(st->old_enr_LP_float, st->Q_exc); //st->last_good = st->last_good; st->lp_ener_FER_fx = float_to_fix16(st->lp_ener_bfi, Q8); - //st->relax_prev_lsf_interp_fx = st->relax_prev_lsf_interp; + //st->relax_prev_lsf_interp = st->relax_prev_lsf_interp; floatToFixed_arr(st->mem_syn_clas_estim, st->mem_syn_clas_estim_fx, st->Q_syn, L_SYN_MEM_CLAS_ESTIM); // cldfbAna // cldfbBPF @@ -3681,7 +3681,7 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->avg_nrg_LT = floatToFixed(st->avg_nrg_LT_float, 0); st->Ng_ener_ST_fx = float_to_fix16(st->ng_ener_ST, Q8); st->mem_preemp_preQ_fx = float_to_fix16(st->mem_preemp_preQ, 0); - //st->last_nq_preQ_fx = st->last_nq_preQ; + //st->last_nq_preQ = st->last_nq_preQ; st->psf_lp_noise_fx = float_to_fix16(st->psf_lp_noise, Q8); st->last_voice_factor_fx = float_to_fix16(st->last_voice_factor, Q15); floatToFixed_arr(st->hTcxDec->old_syn_Overl_float, st->hTcxDec->old_syn_Overl, -1, st->L_frame / 2); @@ -3753,7 +3753,7 @@ void acelp_decoder_state_float2fix(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hStereoCng) { Word16 i; - st->last_core_from_bs = st->last_core_bs_fx; + st->last_core_from_bs = st->last_core_from_bs; st->prev_Q_syn = st->Q_syn; st->Q_syn2 = st->Q_syn; #if 1 @@ -3784,19 +3784,19 @@ void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte fixedToFloat_arr(st->Aq_cng, st->Aq_cng_float, Q14 - norm_s(st->Aq_cng[0]), M + 1); /*Flags (should be unified!)*/ - st->last_nq_preQ = st->last_nq_preQ_fx; - st->safety_net = st->safety_net_fx; - st->nelp_mode_dec = st->nelp_mode_dec_fx; - st->ppp_mode_dec = st->ppp_mode_dec_fx; - st->relax_prev_lsf_interp = st->relax_prev_lsf_interp_fx; - st->unv_cnt = st->unv_cnt_fx; - st->uv_count = st->uv_count_fx; - st->act_count = st->act_count_fx; - st->GSC_noisy_speech = st->GSC_noisy_speech_fx; - st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag_fx; - st->mid_lsf_int = st->mid_lsf_int_fx; - st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec_fx; - st->vbr_hw_BWE_disable_dec = st->vbr_hw_BWE_disable_dec_fx; + st->last_nq_preQ = st->last_nq_preQ; + st->safety_net = st->safety_net; + st->nelp_mode_dec = st->nelp_mode_dec; + st->ppp_mode_dec = st->ppp_mode_dec; + st->relax_prev_lsf_interp = st->relax_prev_lsf_interp; + st->unv_cnt = st->unv_cnt; + st->uv_count = st->uv_count; + st->act_count = st->act_count; + st->GSC_noisy_speech = st->GSC_noisy_speech; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; + st->mid_lsf_int = st->mid_lsf_int; + st->last_vbr_hw_BWE_disable_dec = st->last_vbr_hw_BWE_disable_dec; + st->vbr_hw_BWE_disable_dec = st->vbr_hw_BWE_disable_dec; /* dec_exc */ st->lp_gainc = fixedToFloat(st->lp_gainc_fx, Q3); @@ -4092,20 +4092,20 @@ void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->stab_fac = fixedToFloat(st->stab_fac_fx, Q15); st->stab_fac_smooth = fixedToFloat(st->stab_fac_smooth_fx, Q15); fixedToFloat_arr(st->agc_mem_fx, st->agc_mem2, st->Q_syn - 1, 2); - //st->mid_lsf_int = st->mid_lsf_int_fx; - st->safety_net = st->safety_net_fx; - //st->GSC_noisy_speech = st->GSC_noisy_speech_fx; - //st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag_fx; + //st->mid_lsf_int = st->mid_lsf_int; + st->safety_net = st->safety_net; + //st->GSC_noisy_speech = st->GSC_noisy_speech; + //st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; st->gc_threshold = fixedToFloat(st->gc_threshold_fx, Q16); st->dispMem[0] = fixedToFloat(st->dm_fx.prev_state, 0); st->dispMem[1] = fixedToFloat(st->dm_fx.prev_gain_code, Q16); fixedToFloat_arr(st->dm_fx.prev_gain_pit, &(st->dispMem[2]), Q14, 6); - //st->unv_cnt = st->unv_cnt_fx; - //st->uv_count = st->uv_count_fx; - //st->act_count = st->act_count_fx; + //st->unv_cnt = st->unv_cnt; + //st->uv_count = st->uv_count; + //st->act_count = st->act_count; st->ge_sm = fixedToFloat(st->ge_sm_fx, st->Q_stat_noise_ge); fixedToFloat_arr(st->lspold_s_fx, st->lspold_s, Q15, M); - //st->noimix_seed = st->noimix_seed_fx; + //st->noimix_seed = st->noimix_seed; st->min_alpha = fixedToFloat(st->min_alpha_fx, Q15); st->exc_pe = fixedToFloat(st->exc_pe_fx, st->Q_stat_noise); st->lp_gainp = fixedToFloat(st->lp_gainp_fx, Q14); @@ -4119,7 +4119,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->old_enr_LP_float = fixedToFloat(st->old_enr_LP, st->Q_exc); //st->last_good = st->last_good; st->lp_ener_bfi = fixedToFloat(st->lp_ener_FER_fx, Q8); - //st->relax_prev_lsf_interp = st->relax_prev_lsf_interp_fx; + //st->relax_prev_lsf_interp = st->relax_prev_lsf_interp; fixedToFloat_arr(st->mem_syn_clas_estim_fx, st->mem_syn_clas_estim, st->Q_syn, L_SYN_MEM_CLAS_ESTIM); // cldfbAna // cldfbBPF @@ -4128,7 +4128,7 @@ void acelp_decoder_state_fix2float(Decoder_State *st, STEREO_CNG_DEC_HANDLE hSte st->avg_nrg_LT_float = fixedToFloat(st->avg_nrg_LT, 0); st->ng_ener_ST = fixedToFloat(st->Ng_ener_ST_fx, Q8); st->mem_preemp_preQ = fixedToFloat(st->mem_preemp_preQ_fx, 0); - //st->last_nq_preQ = st->last_nq_preQ_fx; + //st->last_nq_preQ = st->last_nq_preQ; st->psf_lp_noise = fixedToFloat(st->psf_lp_noise_fx, Q8); st->last_voice_factor = fixedToFloat(st->last_voice_factor_fx, Q15); fixedToFloat_arr(st->hTcxDec->old_syn_Overl, st->hTcxDec->old_syn_Overl_float, -1, st->L_frame / 2); diff --git a/lib_dec/acelp_core_switch_dec_fx.c b/lib_dec/acelp_core_switch_dec_fx.c index 4df708639..04fa192e5 100644 --- a/lib_dec/acelp_core_switch_dec_fx.c +++ b/lib_dec/acelp_core_switch_dec_fx.c @@ -427,15 +427,15 @@ ivas_error acelp_core_switch_dec_bfi_fx( bwe_exc = NULL; } - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); - st_fx->relax_prev_lsf_interp_fx = 0; + st_fx->relax_prev_lsf_interp = 0; move16(); /* SC-VBR */ if( EQ_16(st_fx->last_nelp_mode_dec, 1)) { - st_fx->nelp_mode_dec_fx = 1; + st_fx->nelp_mode_dec = 1; move16(); } @@ -456,7 +456,7 @@ ivas_error acelp_core_switch_dec_bfi_fx( * Excitation decoding *----------------------------------------------------------------*/ - IF( EQ_16(st_fx->nelp_mode_dec_fx, 1)) + IF( EQ_16(st_fx->nelp_mode_dec, 1)) { Word16 gain_buf[NB_SUBFR16k]; Scale_sig(exc-L_EXC_MEM, L_EXC_MEM, -st_fx->Q_exc); @@ -667,15 +667,15 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( bwe_exc = NULL; } - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); - st_fx->relax_prev_lsf_interp_fx = 0; + st_fx->relax_prev_lsf_interp = 0; move16(); /* SC-VBR */ if( EQ_16(st_fx->last_nelp_mode_dec_fx, 1)) { - st_fx->nelp_mode_dec_fx = 1; + st_fx->nelp_mode_dec = 1; move16(); } @@ -696,7 +696,7 @@ ivas_error acelp_core_switch_dec_bfi_ivas_fx( * Excitation decoding *----------------------------------------------------------------*/ - IF( EQ_16(st_fx->nelp_mode_dec_fx, 1)) + IF( EQ_16(st_fx->nelp_mode_dec, 1)) { Word16 gain_buf[NB_SUBFR16k]; Scale_sig(exc-L_EXC_MEM, L_EXC_MEM, -st_fx->Q_exc); diff --git a/lib_dec/amr_wb_dec_fx.c b/lib_dec/amr_wb_dec_fx.c index a9f43dee2..6d062f3a9 100644 --- a/lib_dec/amr_wb_dec_fx.c +++ b/lib_dec/amr_wb_dec_fx.c @@ -490,7 +490,7 @@ ivas_error amr_wb_dec_fx( IF( EQ_16(st_fx->coder_type,INACTIVE)) { - IF( GT_16(st_fx->unv_cnt_fx,20)) + IF( GT_16(st_fx->unv_cnt,20)) { /*ftmp = st->lp_gainc * st->lp_gainc;*/ L_tmp1 = L_mult0(st_fx->lp_gainc_fx, st_fx->lp_gainc_fx); /* Q3*Q3 -> Q6*/ @@ -505,12 +505,12 @@ ivas_error amr_wb_dec_fx( } ELSE { - st_fx->unv_cnt_fx = add(st_fx->unv_cnt_fx,1); + st_fx->unv_cnt = add(st_fx->unv_cnt,1); } } ELSE { - st_fx->unv_cnt_fx = 0; + st_fx->unv_cnt = 0; move16(); } diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 44897c93f..de7ab4114 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -2184,7 +2184,7 @@ void ivas_bw_switching_pre_proc_fx( IF ( EQ_16( st->last_core, HQ_CORE ) || ( EQ_16( st->last_core, ACELP_CORE ) && !( EQ_16( st->last_extl, WB_TBE ) || EQ_16( st->last_extl, SWB_TBE ) || EQ_16( st->last_extl, FB_TBE ) ) && GT_32( st->core_brate, ACELP_8k00 ) ) ) { st->prev_fractive = 0; - st->prev_fractive_fx = 0; + st->prev_fractive = 0; } return; diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 8789cbd88..4dfafcd5d 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -322,7 +322,7 @@ void bw_switching_pre_proc_fx( || ( EQ_16(st_fx->last_core, ACELP_CORE) && !(EQ_16(st_fx->last_extl, WB_TBE) || EQ_16(st_fx->last_extl, SWB_TBE) || EQ_16(st_fx->last_extl, FB_TBE) ) && GT_32(st_fx->core_brate, ACELP_8k00) )) { - st_fx->prev_fractive_fx = 0; + st_fx->prev_fractive = 0; move16(); } return; @@ -523,11 +523,11 @@ ivas_error core_switching_pre_dec_fx( /* reset old HB synthesis buffer */ IF( EQ_16(st_fx->last_L_frame,L_FRAME)) { - st_fx->old_bwe_delay_fx = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS ); + st_fx->old_bwe_delay = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_12k8_NS ); } ELSE { - st_fx->old_bwe_delay_fx = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); + st_fx->old_bwe_delay = NS2SA_fx2( st_fx->output_Fs, MAX_DELAY_TBE_NS - DELAY_SWB_TBE_16k_NS ); } set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, NS2SA(48000, DELAY_BWE_TOTAL_NS) ); @@ -712,7 +712,7 @@ ivas_error core_switching_pre_dec_fx( test(); IF( EQ_16(st_fx->core, ACELP_CORE)&&(NE_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2))) { - st_fx->last_ppp_mode_dec_fx = 0; + st_fx->last_ppp_mode_dec = 0; move16(); st_fx->last_nelp_mode_dec =0; move16(); @@ -723,9 +723,9 @@ ivas_error core_switching_pre_dec_fx( test(); IF( EQ_16(st_fx->core, ACELP_CORE)&&(NE_16(st_fx->last_core,ACELP_CORE)||EQ_16(st_fx->last_codec_mode,MODE2)||LE_32(st_fx->last_total_brate,PPP_NELP_2k80))) { - st_fx->act_count_fx = 3; + st_fx->act_count = 3; move16(); - st_fx->uv_count_fx = 0; + st_fx->uv_count = 0; move16(); } @@ -830,7 +830,7 @@ ivas_error core_switching_pre_dec_fx( st_fx->last_voice_factor_fx = 0; move16(); - st_fx->Last_GSC_noisy_speech_flag_fx = 0; + st_fx->Last_GSC_noisy_speech_flag = 0; move16(); /* reset CLDFB memories */ @@ -1431,7 +1431,7 @@ ivas_error core_switching_post_dec_fx( test(); IF( (( EQ_16(st_fx->extl, SWB_TBE)||EQ_16(st_fx->extl,FB_TBE)||EQ_16(st_fx->extl,SWB_CNG))&& ( NE_16(st_fx->L_frame, st_fx->last_L_frame) || ( NE_16(st_fx->last_extl, SWB_TBE) && NE_16(st_fx->last_extl, FB_TBE) ) || EQ_16(st_fx->last_core, HQ_CORE) )) || - ( LT_16(st_fx->bwidth, st_fx->last_bwidth) && NE_16(st_fx->last_extl, SWB_TBE) ) || st_fx->old_ppp_mode_fx + ( LT_16(st_fx->bwidth, st_fx->last_bwidth) && NE_16(st_fx->last_extl, SWB_TBE) ) || st_fx->old_ppp_mode || ((EQ_16(st_fx->prev_coder_type, AUDIO) || EQ_16(st_fx->prev_coder_type, INACTIVE) ) && st_fx->bws_cnt > 0) || (st_fx->bws_cnt == 0 && EQ_16(st_fx->prev_bws_cnt, N_WS2N_FRAMES)) ) { @@ -2009,7 +2009,7 @@ ivas_error core_switching_post_dec_ivas_fx( test(); IF( ( ( EQ_16( st_fx->extl, SWB_TBE ) || EQ_16( st_fx->extl, FB_TBE ) || EQ_16( st_fx->extl, SWB_CNG ) ) && ( NE_16( st_fx->L_frame, st_fx->last_L_frame ) || ( NE_16( st_fx->last_extl, SWB_TBE ) && NE_16( st_fx->last_extl, FB_TBE ) ) || EQ_16( st_fx->last_core, HQ_CORE ) ) ) || - ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode_fx || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) + ( LT_16( st_fx->bwidth, st_fx->last_bwidth ) && NE_16( st_fx->last_extl, SWB_TBE ) ) || st_fx->old_ppp_mode || ( ( EQ_16( st_fx->prev_coder_type, AUDIO ) || EQ_16( st_fx->prev_coder_type, INACTIVE ) ) && st_fx->bws_cnt > 0 ) || ( st_fx->bws_cnt == 0 && EQ_16( st_fx->prev_bws_cnt, N_WS2N_FRAMES ) ) ) { swb_tbe_reset_fx( hBWE_TD->mem_csfilt_fx, hBWE_TD->mem_genSHBexc_filt_down_shb_fx, hBWE_TD->state_lpc_syn_fx, hBWE_TD->syn_overlap_fx, hBWE_TD->state_syn_shbexc_fx, &( hBWE_TD->tbe_demph_fx ), &( hBWE_TD->tbe_premph_fx ), hBWE_TD->mem_stp_swb_fx, &( hBWE_TD->gain_prec_swb_fx ) ); diff --git a/lib_dec/dec_LPD_fx.c b/lib_dec/dec_LPD_fx.c index dbad19cfb..d3f065e77 100644 --- a/lib_dec/dec_LPD_fx.c +++ b/lib_dec/dec_LPD_fx.c @@ -487,7 +487,7 @@ void decoder_LPD( test(); test(); test(); - IF( (bfi == 0) && ((EQ_16(st->dec_glr_idx, 1))||((st->safety_net_fx==0)&&(shr(enr_new,11)>0)&&(GT_16(shr(enr_new,1),enr_old))))&&(st->prev_bfi!=0)) + IF( (bfi == 0) && ((EQ_16(st->dec_glr_idx, 1))||((st->safety_net==0)&&(shr(enr_new,11)>0)&&(GT_16(shr(enr_new,1),enr_old))))&&(st->prev_bfi!=0)) { Word16 reset_q = 0; if( EQ_16(st->dec_glr_idx, 1)) @@ -507,14 +507,14 @@ void decoder_LPD( test(); IF ( bfi==0 && st->acelp_cfg.midLpc ) { - st->relax_prev_lsf_interp_fx = 0; + st->relax_prev_lsf_interp = 0; move16(); IF (st->prev_bfi) { /* check if LSP interpolation can be relaxed */ IF ( LT_16(enr_new, shr(enr_old, 2))) { - st->relax_prev_lsf_interp_fx = -1; + st->relax_prev_lsf_interp = -1; move16(); test(); test(); @@ -522,7 +522,7 @@ void decoder_LPD( test(); IF ( EQ_16(st->clas_dec, UNVOICED_CLAS)||EQ_16(st->clas_dec,SIN_ONSET)||EQ_16(st->clas_dec,INACTIVE_CLAS)||EQ_16(st->coder_type,GENERIC)||EQ_16(st->coder_type,TRANSITION)) { - st->relax_prev_lsf_interp_fx = 1; + st->relax_prev_lsf_interp = 1; move16(); } } @@ -532,12 +532,12 @@ void decoder_LPD( test(); test(); test(); - IF (st->stab_fac_fx == 0 && st->old_bfi_cnt > 0 && NE_16(st->clas_dec, VOICED_CLAS)&&NE_16(st->clas_dec,ONSET)&&st->relax_prev_lsf_interp_fx==0) + IF (st->stab_fac_fx == 0 && st->old_bfi_cnt > 0 && NE_16(st->clas_dec, VOICED_CLAS)&&NE_16(st->clas_dec,ONSET)&&st->relax_prev_lsf_interp==0) { - st->relax_prev_lsf_interp_fx = 2; + st->relax_prev_lsf_interp = 2; move16(); } - int_lsp4_fx( L_frame, &lsp[0], lspmid, &lsp[M], Aq, M, st->relax_prev_lsf_interp_fx ); + int_lsp4_fx( L_frame, &lsp[0], lspmid, &lsp[M], Aq, M, st->relax_prev_lsf_interp ); } ELSE { @@ -663,7 +663,7 @@ void decoder_LPD( test(); test(); test(); - IF( (bfi == 0) && (st->prev_bfi != 0 ) && (st->safety_net_fx==0) && (st->rate_switching_reset != 0) ) + IF( (bfi == 0) && (st->prev_bfi != 0 ) && (st->safety_net==0) && (st->rate_switching_reset != 0) ) { /* diffuse LPC power on rate switching*/ RecLpcSpecPowDiffuseLc( &lsp[M], &lsp[0], &lsf[M], st, 0 ); diff --git a/lib_dec/dec_acelp_tcx_main_fx.c b/lib_dec/dec_acelp_tcx_main_fx.c index fdff3de11..860cc7788 100644 --- a/lib_dec/dec_acelp_tcx_main_fx.c +++ b/lib_dec/dec_acelp_tcx_main_fx.c @@ -465,7 +465,7 @@ Word16 dec_acelp_tcx_frame( test(); if (st->hBWE_TD != NULL) { - IF((st->bfi == 0 && (EQ_16(st->prev_bfi, 1) || EQ_16(st->prev_use_partial_copy, 1))) || ((EQ_16(st->last_vbr_hw_BWE_disable_dec_fx, 1)) && (st->vbr_hw_BWE_disable_dec_fx == 0))) + IF((st->bfi == 0 && (EQ_16(st->prev_bfi, 1) || EQ_16(st->prev_use_partial_copy, 1))) || ((EQ_16(st->last_vbr_hw_BWE_disable_dec, 1)) && (st->vbr_hw_BWE_disable_dec == 0))) { hBWE_TD->bwe_non_lin_prev_scale_fx = 0; set16_fx(hBWE_TD->old_bwe_exc_extended_fx, 0, NL_BUFF_OFFSET); diff --git a/lib_dec/dec_higher_acelp_fx.c b/lib_dec/dec_higher_acelp_fx.c index de01c152b..5b9c65f97 100644 --- a/lib_dec/dec_higher_acelp_fx.c +++ b/lib_dec/dec_higher_acelp_fx.c @@ -178,13 +178,13 @@ void transf_cdbk_dec_fx( *--------------------------------------------------------------*/ /* in extreme cases at subframe boundaries, lower the preemphasis memory to avoid a saturation */ test(); - if( (nq[7] != 0) && (GT_16( sub(st_fx->last_nq_preQ_fx, nq[0]), 7))) + if( (nq[7] != 0) && (GT_16( sub(st_fx->last_nq_preQ, nq[0]), 7))) { /* *mem_preemp /= 16; */ st_fx->mem_preemp_preQ_fx= shr(st_fx->mem_preemp_preQ_fx,4); move16(); } - st_fx->last_nq_preQ_fx = nq[7]; + st_fx->last_nq_preQ = nq[7]; move16(); preemph_fx( code_preQ, FAC_PRE_AVQ_FX, L_SUBFR, &st_fx->mem_preemp_preQ_fx); diff --git a/lib_dec/dec_pit_exc_fx.c b/lib_dec/dec_pit_exc_fx.c index b954820ac..e92a41c5c 100644 --- a/lib_dec/dec_pit_exc_fx.c +++ b/lib_dec/dec_pit_exc_fx.c @@ -82,7 +82,7 @@ void dec_pit_exc_fx( use_fcb = 0; move16(); test(); test(); test(); - IF (GT_16(st_fx->GSC_IVAS_mode, 0) && (EQ_16(st_fx->GSC_noisy_speech_fx, 1) || GT_32(st_fx->core_brate, GSC_H_RATE_STG) ) ) + IF (GT_16(st_fx->GSC_IVAS_mode, 0) && (EQ_16(st_fx->GSC_noisy_speech, 1) || GT_32(st_fx->core_brate, GSC_H_RATE_STG) ) ) { Local_BR_fx = ACELP_8k00; Pitch_CT_fx = GENERIC; @@ -100,7 +100,7 @@ void dec_pit_exc_fx( move32(); } } - ELSE IF( EQ_16(st_fx->GSC_noisy_speech_fx,1)) + ELSE IF( EQ_16(st_fx->GSC_noisy_speech,1)) { Local_BR_fx = ACELP_7k20; move32(); @@ -138,7 +138,7 @@ void dec_pit_exc_fx( pitch_limit_flag = 1; move16();/* always extended pitch Q range */ test(); test(); test(); test(); test(); test(); - IF (((GE_32(st_fx->core_brate, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech_fx, 1) && ((EQ_16(st_fx->L_frame, L_FRAME) && GE_32(st_fx->core_brate, ACELP_13k20)) || (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr_fx, L_SUBFR))) + IF (((GE_32(st_fx->core_brate, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech, 1) && ((EQ_16(st_fx->L_frame, L_FRAME) && GE_32(st_fx->core_brate, ACELP_13k20)) || (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr_fx, L_SUBFR))) { use_fcb = 1; move16(); } @@ -477,7 +477,7 @@ void dec_pit_exc_ivas_fx( use_fcb = 0; move16(); test(); test(); test(); - IF(GT_16(st_fx->GSC_IVAS_mode, 0) && (EQ_16(st_fx->GSC_noisy_speech_fx, 1) || GT_32(st_fx->core_brate, GSC_H_RATE_STG))) + IF(GT_16(st_fx->GSC_IVAS_mode, 0) && (EQ_16(st_fx->GSC_noisy_speech, 1) || GT_32(st_fx->core_brate, GSC_H_RATE_STG))) { Local_BR_fx = ACELP_8k00; Pitch_CT_fx = GENERIC; @@ -495,7 +495,7 @@ void dec_pit_exc_ivas_fx( move32(); } } - ELSE IF(EQ_16(st_fx->GSC_noisy_speech_fx, 1)) + ELSE IF(EQ_16(st_fx->GSC_noisy_speech, 1)) { Local_BR_fx = ACELP_7k20; move32(); @@ -533,7 +533,7 @@ void dec_pit_exc_ivas_fx( pitch_limit_flag = 1; move16();/* always extended pitch Q range */ test(); test(); test(); test(); test(); test(); - IF(((GE_32(st_fx->core_brate, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech_fx, 1) && ((EQ_16(st_fx->L_frame, L_FRAME) && GE_32(st_fx->core_brate, ACELP_13k20)) || (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr_fx, L_SUBFR))) + IF(((GE_32(st_fx->core_brate, MIN_RATE_FCB) || (EQ_16(st_fx->GSC_noisy_speech, 1) && ((EQ_16(st_fx->L_frame, L_FRAME) && GE_32(st_fx->core_brate, ACELP_13k20)) || (EQ_16(st_fx->L_frame, L_FRAME16k) && GE_32(st_fx->core_brate, GSC_H_RATE_STG)) || st_fx->GSC_IVAS_mode == 0))) && EQ_16(L_subfr_fx, L_SUBFR))) { use_fcb = 1; move16(); } diff --git a/lib_dec/dec_prm_fx.c b/lib_dec/dec_prm_fx.c index ad2fa53cd..75fbef292 100644 --- a/lib_dec/dec_prm_fx.c +++ b/lib_dec/dec_prm_fx.c @@ -699,7 +699,7 @@ void dec_prm( test(); IF( ( NE_16(st->core, ACELP_CORE) || st->hTcxCfg->lfacNext > 0 ) && st->use_partial_copy == 0 ) { - st->last_core_bs_fx = get_next_indice(st, 1); + st->last_core_from_bs = get_next_indice(st, 1); move16(); /* @@ -709,15 +709,15 @@ void dec_prm( only for interpreting the bitstream and re-use the internal state for the proper transition handling; still, for voiced onsets rather stick to wrong windowing... */ - if( (!((st->last_total_brate == 0) && (sub(st->clas_dec, VOICED_CLAS) != 0))) && (sub(st->last_core_bs_fx, st->last_core) != 0) ) + if( (!((st->last_total_brate == 0) && (sub(st->clas_dec, VOICED_CLAS) != 0))) && (sub(st->last_core_from_bs, st->last_core) != 0) ) { - st->last_core = st->last_core_bs_fx; + st->last_core = st->last_core_from_bs; } /*for TCX 10 force last_core to be TCX since ACELP as previous core is forbidden*/ IF( EQ_16(st->core, TCX_10_CORE)) { st->last_core = TCX_20_CORE; - st->last_core_bs_fx = TCX_20_CORE; + st->last_core_from_bs = TCX_20_CORE; move16(); move16(); } @@ -1180,7 +1180,7 @@ void dec_prm( lgFB = st->hTcxCfg->tcx_coded_lines; move16(); - IF (st->last_core_bs_fx == ACELP_CORE ) + IF (st->last_core_from_bs == ACELP_CORE ) { /* ACE->TCX transition */ lg = add(lg, st->hTcxCfg->tcx_offset); @@ -1200,7 +1200,7 @@ void dec_prm( IF (st->hTcxCfg->fIsTNSAllowed) { - SetTnsConfig(st->hTcxCfg, 1, st->last_core_bs_fx == ACELP_CORE); + SetTnsConfig(st->hTcxCfg, 1, st->last_core_from_bs == ACELP_CORE); ReadTnsData(st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm+j, &nTnsParams); j = add(j, nTnsParams); @@ -1208,7 +1208,7 @@ void dec_prm( hm_size = shl(mult(st->TcxBandwidth, lg), 1); test(); - IF (hTcxDec->tcx_lpc_shaped_ari != 0 && NE_16(st->last_core_bs_fx, ACELP_CORE)) + IF (hTcxDec->tcx_lpc_shaped_ari != 0 && NE_16(st->last_core_from_bs, ACELP_CORE)) { dec_prm_hm(st, &prm[j], hm_size); } @@ -1221,7 +1221,7 @@ void dec_prm( /*Context HM flag*/ test(); - IF ( st->hTcxCfg->ctx_hm && NE_16(st->last_core_bs_fx, ACELP_CORE)) + IF ( st->hTcxCfg->ctx_hm && NE_16(st->last_core_from_bs, ACELP_CORE)) { prm[j] = get_next_indice(st, 1); move16(); @@ -1263,7 +1263,7 @@ void dec_prm( n = st->next_bit_pos; move16(); - IF (EQ_16(st->last_core_bs_fx, ACELP_CORE)) + IF (EQ_16(st->last_core_from_bs, ACELP_CORE)) { IGFDecReadLevel( st->hIGFDec, st, IGF_GRID_LB_TRAN, 1 ); IGFDecReadData( st->hIGFDec, st, IGF_GRID_LB_TRAN, 1 ); @@ -1484,7 +1484,7 @@ void dec_prm( lgFB = shr(st->hTcxCfg->tcx_coded_lines, 1); test(); - IF ( k == 0 && st->last_core_bs_fx == ACELP_CORE ) + IF ( k == 0 && st->last_core_from_bs == ACELP_CORE ) { /* ACE->TCX transition */ lg = add(lg, st->hTcxCfg->tcx_offset); @@ -1504,15 +1504,15 @@ void dec_prm( IF (st->hTcxCfg->fIsTNSAllowed) { - IF( EQ_16(st->last_core_bs_fx, ACELP_CORE)&&(k==0)) + IF( EQ_16(st->last_core_from_bs, ACELP_CORE)&&(k==0)) { st->BER_detect = 1; st->last_core = TCX_20_CORE; move16(); - st->last_core_bs_fx = TCX_20_CORE; move16(); + st->last_core_from_bs = TCX_20_CORE; move16(); } test(); test(); - SetTnsConfig(st->hTcxCfg, 0, (st->last_core_bs_fx == ACELP_CORE) && (k == 0)); + SetTnsConfig(st->hTcxCfg, 0, (st->last_core_from_bs == ACELP_CORE) && (k == 0)); ReadTnsData(st->hTcxCfg->pCurrentTnsConfig, st, &nTnsBits, prm+j, &nTnsParams); j = add(j, nTnsParams); @@ -1526,7 +1526,7 @@ void dec_prm( /*Context HM flag*/ test(); test(); - IF ( st->hTcxCfg->ctx_hm && !(st->last_core_bs_fx == ACELP_CORE && k == 0) ) + IF ( st->hTcxCfg->ctx_hm && !(st->last_core_from_bs == ACELP_CORE && k == 0) ) { prm[j] = get_next_indice_fx(st, 1); move16(); diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index fa596afba..b0ce60e1d 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -204,7 +204,7 @@ void decoder_tcx( move16(); } - IF ( frame_cnt == 0 && EQ_16(st->last_core_bs_fx, ACELP_CORE) ) + IF ( frame_cnt == 0 && EQ_16(st->last_core_from_bs, ACELP_CORE) ) { L_spec += st->hTcxCfg->tcx_coded_lines >> 2; } @@ -329,7 +329,7 @@ void decoder_tcx( *-----------------------------------------------------------*/ test(); test(); - IF(hTcxCfg->ctx_hm != 0 && ( (st->last_core_bs_fx != ACELP_CORE) || (frame_cnt > 0) ) ) + IF(hTcxCfg->ctx_hm != 0 && ( (st->last_core_from_bs != ACELP_CORE) || (frame_cnt > 0) ) ) { st->last_ctx_hm_enabled = prm_hm[0]; move16(); @@ -357,7 +357,7 @@ void decoder_tcx( tmp8 = 1; move16(); - if (EQ_16(st->last_core_bs_fx, ACELP_CORE)) + if (EQ_16(st->last_core_from_bs, ACELP_CORE)) { tmp8 = 0; move16(); diff --git a/lib_dec/dec_uv_fx.c b/lib_dec/dec_uv_fx.c index 861201dcb..d31cda7a0 100644 --- a/lib_dec/dec_uv_fx.c +++ b/lib_dec/dec_uv_fx.c @@ -51,7 +51,7 @@ void decod_unvoiced_fx( Word16 *pt_pitch_fx; test(); - IF ( EQ_16(st_fx->last_ppp_mode_dec_fx,1)||EQ_16(st_fx->last_nelp_mode_dec,1)) + IF ( EQ_16(st_fx->last_ppp_mode_dec,1)||EQ_16(st_fx->last_nelp_mode_dec,1)) { /* SC_VBR - reset the decoder, to avoid memory not updated issue for this unrealistic case */ CNG_reset_dec_fx( st_fx, pitch_buf_fx, voice_factors_fx ); @@ -136,7 +136,7 @@ void decod_unvoiced_ivas_fx( Word16 code2_fx[L_SUBFR]; test(); - IF(EQ_16(st_fx->last_ppp_mode_dec_fx, 1) || EQ_16(st_fx->last_nelp_mode_dec, 1)) + IF(EQ_16(st_fx->last_ppp_mode_dec, 1) || EQ_16(st_fx->last_nelp_mode_dec, 1)) { /* SC_VBR - reset the decoder, to avoid memory not updated issue for this unrealistic case */ CNG_reset_dec_fx(st_fx, pitch_buf_fx, voice_factors_fx); diff --git a/lib_dec/decision_matrix_dec_fx.c b/lib_dec/decision_matrix_dec_fx.c index 51a7712f2..44b34f3fd 100644 --- a/lib_dec/decision_matrix_dec_fx.c +++ b/lib_dec/decision_matrix_dec_fx.c @@ -40,16 +40,16 @@ void decision_matrix_dec_fx( move16(); st->extl_brate = 0; move16(); - st->ppp_mode_dec_fx = 0; + st->ppp_mode_dec = 0; move16(); - st->nelp_mode_dec_fx = 0; + st->nelp_mode_dec = 0; move16(); st->igf = 0; move16(); if( GT_32(st->total_brate,ACELP_8k00)) { - st->vbr_hw_BWE_disable_dec_fx = 0; + st->vbr_hw_BWE_disable_dec = 0; move16(); } @@ -141,7 +141,7 @@ void decision_matrix_dec_fx( st->last_extl = st->extl; } - st->vbr_hw_BWE_disable_dec_fx = 1; + st->vbr_hw_BWE_disable_dec = 1; move16(); get_next_indice( st, 1 ); @@ -150,7 +150,7 @@ void decision_matrix_dec_fx( /* 0 - PPP_NB, 1 - PPP_WB, 2 - NELP_NB, 3 - NELP_WB */ IF( ppp_nelp_mode == 0 ) { - st->ppp_mode_dec_fx = 1; + st->ppp_mode_dec = 1; move16(); st->coder_type = VOICED; move16(); @@ -159,7 +159,7 @@ void decision_matrix_dec_fx( } ELSE IF( EQ_16(ppp_nelp_mode,1)) { - st->ppp_mode_dec_fx = 1; + st->ppp_mode_dec = 1; move16(); st->coder_type = VOICED; move16(); @@ -168,7 +168,7 @@ void decision_matrix_dec_fx( } ELSE IF( EQ_16(ppp_nelp_mode,2)) { - st->nelp_mode_dec_fx = 1; + st->nelp_mode_dec = 1; move16(); st->coder_type = UNVOICED; move16(); @@ -177,7 +177,7 @@ void decision_matrix_dec_fx( } ELSE IF( EQ_16(ppp_nelp_mode,3)) { - st->nelp_mode_dec_fx = 1; + st->nelp_mode_dec = 1; move16(); st->coder_type = UNVOICED; move16(); @@ -414,7 +414,7 @@ void decision_matrix_dec_fx( test(); IF( EQ_16(st->core,ACELP_CORE)&&EQ_16(st->bwidth,WB)&<_32(st->total_brate,ACELP_9k60)) { - if( st->vbr_hw_BWE_disable_dec_fx == 0 ) + if( st->vbr_hw_BWE_disable_dec == 0 ) { st->extl = WB_BWE; move16(); diff --git a/lib_dec/dlpc_stoch_fx.c b/lib_dec/dlpc_stoch_fx.c index be07d2a5a..7ffdfc750 100644 --- a/lib_dec/dlpc_stoch_fx.c +++ b/lib_dec/dlpc_stoch_fx.c @@ -99,7 +99,7 @@ void lpc_unquantize( IF (st->lpcQuantization && st->acelp_cfg.midLpc&& st->core==ACELP_CORE && st->rate_switching_reset==0) { midlsf_dec ( &lsf[0], &lsf[m], param_lpc[nb_indices], lsfmid - ,coder_type ,&(st->mid_lsf_int_fx), st->prev_bfi, st->safety_net_fx); + ,coder_type ,&(st->mid_lsf_int), st->prev_bfi, st->safety_net); reorder_lsf_fx( lsfmid, LSF_GAP_MID_FX, M, st->sr_core ); lsf2lsp_fx(lsfmid, lspmid, M, st->sr_core); } diff --git a/lib_dec/evs_dec_fx.c b/lib_dec/evs_dec_fx.c index 117c0eaba..1eb8eb6c2 100644 --- a/lib_dec/evs_dec_fx.c +++ b/lib_dec/evs_dec_fx.c @@ -413,8 +413,8 @@ ivas_error evs_dec_fx( test(); IF ( EQ_16(st_fx->extl,SWB_TBE)||EQ_16(st_fx->extl,FB_TBE) || (NE_16(st_fx->coder_type,AUDIO) && NE_16(st_fx->coder_type,INACTIVE) && GT_32(st_fx->core_brate,SID_2k40) && EQ_16(st_fx->core,ACELP_CORE) - && GE_32(st_fx->output_Fs,32000) && GT_16(st_fx->bwidth,NB) && st_fx->bws_cnt > 0 && !st_fx->ppp_mode_dec_fx - && !( EQ_16( st_fx->nelp_mode_dec_fx, 1) && EQ_16( st_fx->bfi, 1) ) ) ) + && GE_32(st_fx->output_Fs,32000) && GT_16(st_fx->bwidth,NB) && st_fx->bws_cnt > 0 && !st_fx->ppp_mode_dec + && !( EQ_16( st_fx->nelp_mode_dec, 1) && EQ_16( st_fx->bfi, 1) ) ) ) { swb_tbe_dec_fx( st_fx, st_fx->coder_type, bwe_exc_extended_fx, st_fx->Q_exc, voice_factors_fx, old_syn_12k8_16k_fx, fb_exc_fx, &Q_fb_exc, hb_synth_fx, &hb_synth_fx_exp, pitch_buf_fx ); @@ -426,8 +426,8 @@ ivas_error evs_dec_fx( } } ELSE IF( EQ_16(st_fx->extl,SWB_BWE)||EQ_16(st_fx->extl,FB_BWE)|| - (GE_32(st_fx->output_Fs,32000) && EQ_16(st_fx->core,ACELP_CORE) && GT_16(st_fx->bwidth,NB) && st_fx->bws_cnt > 0 && !st_fx->ppp_mode_dec_fx - && !( EQ_16( st_fx->nelp_mode_dec_fx, 1) && EQ_16( st_fx->bfi, 1) ) ) ) + (GE_32(st_fx->output_Fs,32000) && EQ_16(st_fx->core,ACELP_CORE) && GT_16(st_fx->bwidth,NB) && st_fx->bws_cnt > 0 && !st_fx->ppp_mode_dec + && !( EQ_16( st_fx->nelp_mode_dec, 1) && EQ_16( st_fx->bfi, 1) ) ) ) { /* SWB BWE decoder */ hb_synth_fx_exp = swb_bwe_dec_fx( @@ -612,7 +612,7 @@ ivas_error evs_dec_fx( } set16_fx( st_fx->hb_prev_synth_buffer_fx, 0, tmps ); } - ELSE IF ( LT_16(tmps,st_fx->old_bwe_delay_fx)) + ELSE IF ( LT_16(tmps,st_fx->old_bwe_delay)) { /* the previous frame was TBE on top of ACELP@16kHz and the current frame is TBE on top of ACELP@12.8kHz */ /*incr = (short) ( L_FRAME / (tmps + 0.5f) );*/ @@ -622,19 +622,19 @@ ivas_error evs_dec_fx( FOR (i=0; ihb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16]), - st_fx->hb_prev_synth_buffer_fx[st_fx->old_bwe_delay_fx - 1 - i], sin_table256_fx[tmp16])); + st_fx->hb_prev_synth_buffer_fx[st_fx->old_bwe_delay - 1 - i], sin_table256_fx[tmp16])); tmp16 = add(tmp16, incr); } Copy(tmp_buffer_fx, st_fx->hb_prev_synth_buffer_fx, tmps); } - ELSE IF (GT_16(tmps,st_fx->old_bwe_delay_fx)) + ELSE IF (GT_16(tmps,st_fx->old_bwe_delay)) { /* the previous frame was TBE on top of ACELP@12.8kHz and the current frame is TBE on top of ACELP@16kHz */ /*incr = (short)( L_FRAME / (st->old_bwe_delay + 0.5f) );*/ - incr = idiv1616(L_FRAME*2, add(shl(st_fx->old_bwe_delay_fx,1),1)); + incr = idiv1616(L_FRAME*2, add(shl(st_fx->old_bwe_delay,1),1)); tmp16 = 0; move16(); - FOR (i=0; iold_bwe_delay_fx; i++) + FOR (i=0; iold_bwe_delay; i++) { tmp_buffer_fx[i] = mult_r(st_fx->hb_prev_synth_buffer_fx[i], sin_table256_fx[255 - tmp16]); move16(); @@ -647,10 +647,10 @@ ivas_error evs_dec_fx( move16(); } tmp16 = 0; - FOR (i=0; iold_bwe_delay_fx; i++) + FOR (i=0; iold_bwe_delay; i++) { /*tmp_buffer[tmps - 1 - i] += st->hb_prev_synth_buffer[st->old_bwe_delay - 1 - i] * sin_table256[i * incr];*/ - tmp_buffer_fx[tmps - 1 - i] = round_fx(L_mac(L_mult(tmp_buffer_fx[tmps - 1 - i], 32767), st_fx->hb_prev_synth_buffer_fx[st_fx->old_bwe_delay_fx - 1 - i], sin_table256_fx[tmp16/*i * incr*/])); + tmp_buffer_fx[tmps - 1 - i] = round_fx(L_mac(L_mult(tmp_buffer_fx[tmps - 1 - i], 32767), st_fx->hb_prev_synth_buffer_fx[st_fx->old_bwe_delay - 1 - i], sin_table256_fx[tmp16/*i * incr*/])); tmp16 = add(tmp16, incr); } @@ -667,7 +667,7 @@ ivas_error evs_dec_fx( Copy( tmp_buffer_fx, hb_synth_fx + tmps, output_frame - tmps ); Copy( tmp_buffer_fx + output_frame - tmps, st_fx->hb_prev_synth_buffer_fx, tmps ); - st_fx->old_bwe_delay_fx = tmps; + st_fx->old_bwe_delay = tmps; move16(); test(); @@ -676,7 +676,7 @@ ivas_error evs_dec_fx( test(); test(); test(); - IF( ( st_fx->ppp_mode_dec_fx || (EQ_16(st_fx->nelp_mode_dec_fx,1)&&EQ_16(st_fx->bfi,1)))&&EQ_16(st_fx->L_frame,st_fx->last_L_frame)&&(st_fx->bws_cnt>1||st_fx->last_extl!=-1)) + IF( ( st_fx->ppp_mode_dec || (EQ_16(st_fx->nelp_mode_dec,1)&&EQ_16(st_fx->bfi,1)))&&EQ_16(st_fx->L_frame,st_fx->last_L_frame)&&(st_fx->bws_cnt>1||st_fx->last_extl!=-1)) { Copy(hBWE_TD->old_hb_synth_fx, hb_synth_fx, output_frame ); diff --git a/lib_dec/gs_dec_fx.c b/lib_dec/gs_dec_fx.c index db2cd59da..2b352dd1a 100644 --- a/lib_dec/gs_dec_fx.c +++ b/lib_dec/gs_dec_fx.c @@ -81,32 +81,32 @@ void decod_audio_fx( (st_fx->element_mode > EVS_MONO && st_fx->total_brate > MIN_BRATE_GSC_NOISY_FLAG && st_fx->bwidth >= SWB && !st_fx->flag_ACELP16k)))) #endif { - st_fx->GSC_noisy_speech_fx = (Word16) get_next_indice( st_fx, 1 ); + st_fx->GSC_noisy_speech = (Word16) get_next_indice( st_fx, 1 ); } /* safety check in case of bit errors */ test(); - IF(st_fx->GSC_noisy_speech_fx && LT_16(st_fx->bwidth, SWB) && st_fx->GSC_IVAS_mode == 0) + IF(st_fx->GSC_noisy_speech && LT_16(st_fx->bwidth, SWB) && st_fx->GSC_IVAS_mode == 0) { st_fx->BER_detect = 1; move16(); - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); } /* set bit-allocation */ #ifdef ADD_LRTD - config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); + config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); #else - config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); + config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); #endif /*---------------------------------------------------------------* * Decode energy dynamics *---------------------------------------------------------------*/ #if defined ADD_LRTD test(); test(); - IF (st_fx->GSC_IVAS_mode >= 1 || (EQ_16(st_fx->GSC_noisy_speech_fx, 1) && st_fx->GSC_IVAS_mode == 0)) + IF (st_fx->GSC_IVAS_mode >= 1 || (EQ_16(st_fx->GSC_noisy_speech, 1) && st_fx->GSC_IVAS_mode == 0)) #else - IF( EQ_16(st_fx->GSC_noisy_speech_fx,1)) + IF( EQ_16(st_fx->GSC_noisy_speech,1)) #endif { nb_subfr = NB_SUBFR; @@ -275,7 +275,7 @@ void decod_audio_fx( ((st_fx->core_brate >= MIN_RATE_FCB || st_fx->GSC_noisy_speech) && ((nb_subfr == NB_SUBFR && st_fx->L_frame == L_FRAME) || (nb_subfr == NB_SUBFR16k && st_fx->L_frame == L_FRAME16k)))) #else - IF( EQ_16(st_fx->GSC_noisy_speech_fx,1)&&EQ_16(nb_subfr,NB_SUBFR)) + IF( EQ_16(st_fx->GSC_noisy_speech,1)&&EQ_16(nb_subfr,NB_SUBFR)) #endif { Word16 indice; @@ -578,32 +578,32 @@ void decod_audio_ivas_fx( (st_fx->element_mode > EVS_MONO && st_fx->total_brate > MIN_BRATE_GSC_NOISY_FLAG && st_fx->bwidth >= SWB && !st_fx->flag_ACELP16k)))) #endif { - st_fx->GSC_noisy_speech_fx = (Word16)get_next_indice(st_fx, 1); + st_fx->GSC_noisy_speech = (Word16)get_next_indice(st_fx, 1); } /* safety check in case of bit errors */ test(); - IF(st_fx->GSC_noisy_speech_fx && LT_16(st_fx->bwidth, SWB) && st_fx->GSC_IVAS_mode == 0) + IF(st_fx->GSC_noisy_speech && LT_16(st_fx->bwidth, SWB) && st_fx->GSC_IVAS_mode == 0) { st_fx->BER_detect = 1; move16(); - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); } /* set bit-allocation */ #if 1//def ADD_LRTD - config_acelp1_IVAS(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); + config_acelp1_IVAS(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, tdm_lp_reuse_flag, tdm_low_rate_mode, st_fx->idchan, st_fx->active_cnt, tdm_Pitch_reuse_flag, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); #else - config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech_fx, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); + config_acelp1(DEC, st_fx->total_brate, st_fx->core_brate, st_fx->core, st_fx->extl_orig, st_fx->extl_brate_orig, st_fx->L_frame, st_fx->GSC_noisy_speech, &(st_fx->acelp_cfg), st_fx->next_bit_pos, st_fx->coder_type, -1, 1, &nbits, NULL, st_fx->element_mode, &nbits /*dummy*/, 0, 0, st_fx->idchan, st_fx->active_cnt, 0, st_fx->tdm_LRTD_flag, st_fx->GSC_IVAS_mode); #endif /*---------------------------------------------------------------* * Decode energy dynamics *---------------------------------------------------------------*/ #if 1// defined ADD_LRTD test(); test(); - IF(st_fx->GSC_IVAS_mode >= 1 || (EQ_16(st_fx->GSC_noisy_speech_fx, 1) && st_fx->GSC_IVAS_mode == 0)) + IF(st_fx->GSC_IVAS_mode >= 1 || (EQ_16(st_fx->GSC_noisy_speech, 1) && st_fx->GSC_IVAS_mode == 0)) #else - IF(EQ_16(st_fx->GSC_noisy_speech_fx, 1)) + IF(EQ_16(st_fx->GSC_noisy_speech, 1)) #endif { nb_subfr = NB_SUBFR; @@ -625,7 +625,7 @@ void decod_audio_ivas_fx( { hGSCDec->noise_lev_fx = NOISE_LEVEL_SP0; } - else if (st_fx->GSC_noisy_speech_fx == 0) /* speech like but not noisy */ + else if (st_fx->GSC_noisy_speech == 0) /* speech like but not noisy */ { hGSCDec->noise_lev_fx = NOISE_LEVEL_SP3; } @@ -769,10 +769,10 @@ void decod_audio_ivas_fx( test(); #if 1//def ADD_LRTD if (!(st_fx->GSC_IVAS_mode > 0 && st_fx->L_frame / nb_subfr == 2 * L_SUBFR && st_fx->GSC_IVAS_mode < 3) && - ((st_fx->core_brate >= MIN_RATE_FCB || st_fx->GSC_noisy_speech_fx) && + ((st_fx->core_brate >= MIN_RATE_FCB || st_fx->GSC_noisy_speech) && ((nb_subfr == NB_SUBFR && st_fx->L_frame == L_FRAME) || (nb_subfr == NB_SUBFR16k && st_fx->L_frame == L_FRAME16k)))) #else - IF(EQ_16(st_fx->GSC_noisy_speech_fx, 1) && EQ_16(nb_subfr, NB_SUBFR)) + IF(EQ_16(st_fx->GSC_noisy_speech, 1) && EQ_16(nb_subfr, NB_SUBFR)) #endif { Word16 indice; @@ -1163,7 +1163,7 @@ void gsc_dec_fx( move16(); #endif test(); - IF( EQ_16(st_fx->last_good,INACTIVE_CLAS)||EQ_16(st_fx->Last_GSC_noisy_speech_flag_fx,1)) + IF( EQ_16(st_fx->last_good,INACTIVE_CLAS)||EQ_16(st_fx->Last_GSC_noisy_speech_flag,1)) { FOR( i=0; iL_frame; i++ ) { @@ -1188,7 +1188,7 @@ void gsc_dec_fx( *--------------------------------------------------------------------------------------*/ bands_and_bit_alloc_fx(hGSCDec->cor_strong_limit_fx, hGSCDec->noise_lev_fx, st_fx->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ, - max_ener_band, bits_per_bands, &nb_subbands, NULL, NULL, &pvq_len, coder_type, st_fx->bwidth, st_fx->GSC_noisy_speech_fx, + max_ener_band, bits_per_bands, &nb_subbands, NULL, NULL, &pvq_len, coder_type, st_fx->bwidth, st_fx->GSC_noisy_speech, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode ); #ifdef ADD_LRTD @@ -1303,7 +1303,7 @@ void gsc_dec_fx( highband_exc_dct_in_fx( st_fx->core_brate, mfreq_bindiv_loc, *last_bin, Diff_len, hGSCDec->noise_lev_fx, pit_band_idx, exc_diffQ, &hGSCDec->seed_tcx_fx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new, hGSCDec->last_exc_dct_in_fx, &hGSCDec->last_ener_fx, hGSCDec->last_bitallocation_band_fx, bitallocation_exc, st_fx->bfi, coder_type, - st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech_fx, hGSCDec->lt_ener_per_band_fx + st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech, hGSCDec->lt_ener_per_band_fx , st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode ); @@ -1477,7 +1477,7 @@ void gsc_dec_ivas_fx( move16(); #endif test(); - IF(EQ_16(st_fx->last_good, INACTIVE_CLAS) || EQ_16(st_fx->Last_GSC_noisy_speech_flag_fx, 1)) + IF(EQ_16(st_fx->last_good, INACTIVE_CLAS) || EQ_16(st_fx->Last_GSC_noisy_speech_flag, 1)) { FOR(i = 0; i < st_fx->L_frame; i++) { @@ -1502,7 +1502,7 @@ void gsc_dec_ivas_fx( *--------------------------------------------------------------------------------------*/ bands_and_bit_alloc_ivas_fx(hGSCDec->cor_strong_limit_fx, hGSCDec->noise_lev_fx, st_fx->core_brate, Diff_len, bit, &bit, Ener_per_bd_iQ, - max_ener_band, bits_per_bands, &nb_subbands, NULL, NULL, &pvq_len, coder_type, st_fx->bwidth, st_fx->GSC_noisy_speech_fx, + max_ener_band, bits_per_bands, &nb_subbands, NULL, NULL, &pvq_len, coder_type, st_fx->bwidth, st_fx->GSC_noisy_speech, st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode); #if 1//def ADD_LRTD @@ -1523,7 +1523,7 @@ void gsc_dec_ivas_fx( max_eq = 0; max_eq_val = 32767; - IF(((st_fx->core_brate < ACELP_7k20 && st_fx->GSC_noisy_speech_fx == 1) || st_fx->core_brate < 6000) && coder_type <= UNVOICED) + IF(((st_fx->core_brate < ACELP_7k20 && st_fx->GSC_noisy_speech == 1) || st_fx->core_brate < 6000) && coder_type <= UNVOICED) { j = maximum_fx(concat_out, nb_subbands * 16, &max_eq); //max_eq = max_eq_val / (abs_s(concat_out[j]) + 328 /*0.01f*/ ); @@ -1602,7 +1602,7 @@ void gsc_dec_ivas_fx( *--------------------------------------------------------------------------------------*/ #if 1//def ADD_LRTD test(); test(); test(); test(); test(); test(); - IF(GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->GSC_noisy_speech_fx, 1)) + IF(GE_16(st_fx->GSC_IVAS_mode, 1) && EQ_16(st_fx->GSC_noisy_speech, 1)) { FOR(i = 64; i < st_fx->L_frame; i++) { @@ -1611,7 +1611,7 @@ void gsc_dec_ivas_fx( exc_diffQ[i] = mult_r(exc_diffQ[i], max_eq); } } - ELSE IF(((LT_32(st_fx->core_brate, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech_fx, 1)) || LT_32(st_fx->core_brate, 6000)) && LE_16(st_fx->coder_type, UNVOICED)) + ELSE IF(((LT_32(st_fx->core_brate, ACELP_7k20) && EQ_16(st_fx->GSC_noisy_speech, 1)) || LT_32(st_fx->core_brate, 6000)) && LE_16(st_fx->coder_type, UNVOICED)) { FOR(i = 0; i < L_FRAME; i++) { @@ -1634,7 +1634,7 @@ void gsc_dec_ivas_fx( highband_exc_dct_in_ivas_fx(st_fx->core_brate, mfreq_bindiv_loc, *last_bin, Diff_len, hGSCDec->noise_lev_fx, pit_band_idx, exc_diffQ, &hGSCDec->seed_tcx_fx, Ener_per_bd_iQ, nb_subfr, exc_dct_in, st_fx->last_coder_type, bitallocation_band, lsf_new, hGSCDec->last_exc_dct_in_fx, &hGSCDec->last_ener_fx, hGSCDec->last_bitallocation_band_fx, bitallocation_exc, st_fx->bfi, coder_type, - st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech_fx, hGSCDec->lt_ener_per_band_fx + st_fx->bwidth, exc_wo_nf, Qexc_diffQ, Q_exc, st_fx->GSC_noisy_speech, hGSCDec->lt_ener_per_band_fx , st_fx->L_frame, st_fx->element_mode, st_fx->GSC_IVAS_mode ); diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index 2bd750daa..1f548d9dd 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -118,7 +118,7 @@ ivas_error init_decoder_fx( /* AVQ pre-quantizer memory */ st_fx->mem_preemp_preQ_fx = 0; move16(); - st_fx->last_nq_preQ_fx = 0; + st_fx->last_nq_preQ = 0; move16(); st_fx->use_acelp_preq = 0; move16(); @@ -194,11 +194,11 @@ ivas_error init_decoder_fx( Copy( GEWB_Ave_fx, st_fx->lsf_old_fx, M ); lsf2lsp_fx( st_fx->lsf_old_fx, st_fx->lsp_old_fx, M, INT_FS_FX ); - st_fx->mid_lsf_int_fx = 0; + st_fx->mid_lsf_int = 0; move16(); - st_fx->safety_net_fx = 0; + st_fx->safety_net = 0; move16(); - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; move16(); st_fx->last_voice_factor_fx = 0; move16(); @@ -307,15 +307,15 @@ ivas_error init_decoder_fx( /* Stationary noise UV modification */ - st_fx->unv_cnt_fx = 0; + st_fx->unv_cnt = 0; move16(); st_fx->ge_sm_fx = L_deposit_l(640); /*Q(GE_SHIFT)*/ - st_fx->uv_count_fx = 0; + st_fx->uv_count = 0; move16(); - st_fx->act_count_fx = 3; + st_fx->act_count = 3; move16(); Copy( st_fx->lsp_old_fx, st_fx->lspold_s_fx, M ); - st_fx->noimix_seed_fx = RANDOM_INITSEED; + st_fx->noimix_seed = RANDOM_INITSEED; move16(); st_fx->min_alpha_fx = 32767; move16(); /*1; Q15*/ @@ -506,7 +506,7 @@ ivas_error init_decoder_fx( set16_fx(st_fx->prev_synth_buffer_fx, 0, NS2SA_fx2(48000, DELAY_BWE_TOTAL_NS - DELAY_CLDFB_NS)); set16_fx(st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2(48000, DELAY_BWE_TOTAL_NS)); - st_fx->old_bwe_delay_fx = -1; /*Q0*/ move16(); + st_fx->old_bwe_delay = -1; /*Q0*/ move16(); /*-----------------------------------------------------------------* * TBE parameters @@ -543,7 +543,7 @@ ivas_error init_decoder_fx( st_fx->enerLL_fx = L_deposit_l(0); st_fx->prev_enerLL_fx = 0; move16(); - st_fx->prev_fractive_fx = 0; + st_fx->prev_fractive = 0; move16(); st_fx->prev_bws_cnt = 0; move16(); @@ -714,23 +714,23 @@ ivas_error init_decoder_fx( st_fx->hSC_VBR = NULL; } - st_fx->last_ppp_mode_dec_fx = 0; + st_fx->last_ppp_mode_dec = 0; move16(); - st_fx->old_ppp_mode_fx = 0; + st_fx->old_ppp_mode = 0; move16(); - st_fx->ppp_mode_dec_fx = 0; + st_fx->ppp_mode_dec = 0; move16(); st_fx->last_nelp_mode_dec = 0; move16(); - st_fx->nelp_mode_dec_fx = 0; + st_fx->nelp_mode_dec = 0; move16(); st_fx->prev_gain_pit_dec_fx = 0; move16(); st_fx->prev_tilt_code_dec_fx = 0; move16(); - st_fx->vbr_hw_BWE_disable_dec_fx = 0; + st_fx->vbr_hw_BWE_disable_dec = 0; move16(); - st_fx->last_vbr_hw_BWE_disable_dec_fx = 0; + st_fx->last_vbr_hw_BWE_disable_dec = 0; move16(); @@ -990,7 +990,7 @@ ivas_error init_decoder_ivas_fx( /* AVQ pre-quantizer memory */ st_fx->mem_preemp_preQ_fx = 0; move16(); - st_fx->last_nq_preQ_fx = 0; + st_fx->last_nq_preQ = 0; move16(); st_fx->use_acelp_preq = 0; move16(); @@ -1015,8 +1015,8 @@ ivas_error init_decoder_ivas_fx( Copy(GEWB_Ave_fx, st_fx->lsf_old_fx, M); lsf2lsp_fx(st_fx->lsf_old_fx, st_fx->lsp_old_fx, M, INT_FS_12k8); - st_fx->mid_lsf_int_fx = 0; - st_fx->safety_net_fx = 0; + st_fx->mid_lsf_int = 0; + st_fx->safety_net = 0; #ifdef IVAS_FLOAT_FIXED_TO_BE_REMOVED // To be removed when fixed version is available. /* FEC */ @@ -1116,15 +1116,15 @@ ivas_error init_decoder_ivas_fx( st_fx->old_bfi_cnt = 0; #endif - st_fx->unv_cnt_fx = 0; + st_fx->unv_cnt = 0; move16(); st_fx->ge_sm_fx = L_deposit_l(640); /*Q(GE_SHIFT)*/ - st_fx->uv_count_fx = 0; + st_fx->uv_count = 0; move16(); - st_fx->act_count_fx = 3; + st_fx->act_count = 3; move16(); Copy(st_fx->lsp_old_fx, st_fx->lspold_s_fx, M); - st_fx->noimix_seed_fx = RANDOM_INITSEED; + st_fx->noimix_seed = RANDOM_INITSEED; move16(); st_fx->min_alpha_fx = 32767; move16(); /*1; Q15*/ @@ -1156,9 +1156,9 @@ ivas_error init_decoder_ivas_fx( st_fx->GSC_IVAS_mode = 0; st_fx->Last_GSC_noisy_speech_flag = 0; #endif - st_fx->GSC_noisy_speech_fx = 0; + st_fx->GSC_noisy_speech = 0; st_fx->GSC_IVAS_mode = 0; - st_fx->Last_GSC_noisy_speech_flag_fx = 0; + st_fx->Last_GSC_noisy_speech_flag = 0; IF((idchan == 0 && NE_16(st_fx->element_mode, IVAS_CPE_MDCT)) || EQ_16(st_fx->element_mode, IVAS_CPE_TD)) { @@ -1429,7 +1429,7 @@ ivas_error init_decoder_ivas_fx( st_fx->old_bwe_delay = -1; set_f(st_fx->hb_prev_synth_buffer, 0, NS2SA(48000, DELAY_BWE_TOTAL_NS)); #endif - st_fx->old_bwe_delay_fx = -1; /*Q0*/ move16(); + st_fx->old_bwe_delay = -1; /*Q0*/ move16(); set16_fx(st_fx->hb_prev_synth_buffer_fx, 0, NS2SA_fx2(48000, DELAY_BWE_TOTAL_NS)); /*-----------------------------------------------------------------* @@ -1481,7 +1481,7 @@ ivas_error init_decoder_ivas_fx( st_fx->enerLL_fx = L_deposit_l(0); st_fx->prev_enerLL_fx = 0; move16(); - st_fx->prev_fractive_fx = 0; + st_fx->prev_fractive = 0; move16(); st_fx->prev_bws_cnt = 0; move16(); @@ -1728,23 +1728,23 @@ ivas_error init_decoder_ivas_fx( st_fx->vbr_hw_BWE_disable_dec = 0; st_fx->last_vbr_hw_BWE_disable_dec = 0; #endif - st_fx->last_ppp_mode_dec_fx = 0; + st_fx->last_ppp_mode_dec = 0; move16(); - st_fx->old_ppp_mode_fx = 0; + st_fx->old_ppp_mode = 0; move16(); - st_fx->ppp_mode_dec_fx = 0; + st_fx->ppp_mode_dec = 0; move16(); st_fx->last_nelp_mode_dec = 0; move16(); - st_fx->nelp_mode_dec_fx = 0; + st_fx->nelp_mode_dec = 0; move16(); st_fx->prev_gain_pit_dec_fx = 0; move16(); st_fx->prev_tilt_code_dec_fx = 0; move16(); - st_fx->vbr_hw_BWE_disable_dec_fx = 0; + st_fx->vbr_hw_BWE_disable_dec = 0; move16(); - st_fx->last_vbr_hw_BWE_disable_dec_fx = 0; + st_fx->last_vbr_hw_BWE_disable_dec = 0; move16(); /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index b7cfa694a..95cb9a086 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -1433,7 +1433,7 @@ ivas_error ivas_core_dec( st->coder_type = st->coder_type; st->prev_coder_type = st->prev_coder_type; st->prev_bws_cnt = st->prev_bws_cnt; - st->old_ppp_mode_fx = st->old_ppp_mode; + st->old_ppp_mode = st->old_ppp_mode; /*------------------fix-to-fix-end-----------------------*/ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 950656ab9..48a92c535 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -61,7 +61,7 @@ static void stereo_mode_combined_format_dec( const Decoder_Struct *st_ivas, CPE_ * * Channel Pair Element (CPE) decoding routine *--------------------------------------------------------------------------*/ - +#ifndef IVAS_FLOAT_FIXED ivas_error ivas_cpe_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t cpe_id, /* i : CPE # identifier */ @@ -590,6 +590,7 @@ ivas_error ivas_cpe_dec( return error; } +#endif #ifndef IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- * create_cpe_dec() diff --git a/lib_dec/ivas_cpe_dec_fx.c b/lib_dec/ivas_cpe_dec_fx.c index 14ee5abd0..2bae89389 100644 --- a/lib_dec/ivas_cpe_dec_fx.c +++ b/lib_dec/ivas_cpe_dec_fx.c @@ -334,9 +334,59 @@ ivas_error ivas_cpe_dec_fx( /*----------------------------------------------------------------* * Resets/updates in case of stereo switching *----------------------------------------------------------------*/ + Word16 q_temp = 11;//any q works + FOR(n = 0; n < hCPE->nchan_out; n++) + { + if (hCPE->output_mem[n] != NULL) + { + floatToFixed_arrL(&hCPE->output_mem[n][0], &hCPE->output_mem_fx[n][0], q_temp, NS2SA_fx2(st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS));//any q works + } + if (hCPE->input_mem[n] != NULL) + { + floatToFixed_arrL(&hCPE->input_mem[n][0], &hCPE->input_mem_fx[n][0], q_temp, NS2SA(hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS)); + } + if (hCPE->input_mem_LB[n] != NULL) + { + floatToFixed_arrL(&hCPE->input_mem_LB[n][0], &hCPE->input_mem_LB_fx[n][0], q_temp, STEREO_DFT32MS_OVL_16k); + } + + if (hCPE->hCoreCoder[n] != NULL) + { + floatToFixed_arrL(&hCPE->hCoreCoder[n]->prev_synth_buffer[0], &hCPE->hCoreCoder[n]->prev_synth_buffer32_fx[0], q_temp, NS2SA(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); + floatToFixed_arr(&hCPE->hCoreCoder[n]->prev_synth_buffer[0], &hCPE->hCoreCoder[n]->prev_synth_buffer_fx[0], 0, NS2SA(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); + } + if (hCPE->hStereoDft != NULL ) + { + floatToFixed_arrL(&hCPE->hStereoDft->side_gain[0], &hCPE->hStereoDft->side_gain_fx[0], 31, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX); + } + } stereo_switching_dec( hCPE, ivas_total_brate ); + FOR(n = 0; n < hCPE->nchan_out; n++) + { + if (hCPE->output_mem[n] != NULL) + { + fixedToFloat_arrL(&hCPE->output_mem_fx[n][0], &hCPE->output_mem[n][0], q_temp, NS2SA_fx2(st_ivas->hDecoderConfig->output_Fs, STEREO_DFT32MS_OVL_NS));//any q works + } + if (hCPE->input_mem[n] != NULL) + { + fixedToFloat_arrL(&hCPE->input_mem_fx[n][0], &hCPE->input_mem[n][0], q_temp, NS2SA(hCPE->hCoreCoder[0]->output_Fs, STEREO_DFT32MS_OVL_NS)); + } + if (hCPE->input_mem_LB[n] != NULL) + { + fixedToFloat_arrL(&hCPE->input_mem_LB_fx[n][0], &hCPE->input_mem_LB[n][0], q_temp, STEREO_DFT32MS_OVL_16k); + } + if (hCPE->hCoreCoder[n] != NULL) + { + fixedToFloat_arrL(&hCPE->hCoreCoder[n]->prev_synth_buffer32_fx[0], &hCPE->hCoreCoder[n]->prev_synth_buffer[0], q_temp, NS2SA(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); + //fixedToFloat_arrL(&hCPE->hCoreCoder[n]->prev_synth_buffer_fx[0], &hCPE->hCoreCoder[n]->prev_synth_buffer[0], 0, NS2SA(48000, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS)); + } + if (hCPE->hStereoDft) + { + fixedToFloat_arrL(&hCPE->hStereoDft->side_gain_fx[0], &hCPE->hStereoDft->side_gain[0], 31, STEREO_DFT_DEC_DFT_NB * STEREO_DFT_BAND_MAX); + } + } /*----------------------------------------------------------------* * Configuration of stereo decoder *----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c index 880fedc13..82a19c7b1 100644 --- a/lib_dec/ivas_omasa_dec.c +++ b/lib_dec/ivas_omasa_dec.c @@ -1390,7 +1390,17 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm( { tc_local[n] = st_ivas->hTcBuffer->tc[n + 2]; v_multc( tc_local[n], gain, tc_local[n], tcBufferSize ); +#ifdef IVAS_FLOAT_FIXED + floatToFixed_arr32( st_ivas->hTcBuffer->tc[n + 2], st_ivas->hTcBuffer->tc_fx[n + 2], 11, st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size ); + floatToFixed_arr32(st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_fx[n], 11, st_ivas->hMasaIsmData->delayBuffer_size); + Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS]; + tc_local_fx[n] = st_ivas->hTcBuffer->tc_fx[n + 2]; + delay_signal_fx( tc_local_fx[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer_size ); + fixedToFloat_arrL( st_ivas->hTcBuffer->tc_fx[n + 2], st_ivas->hTcBuffer->tc[n + 2], 11, st_ivas->hSpatParamRendCom->num_slots * st_ivas->hSpatParamRendCom->slot_size ); + fixedToFloat_arrL( st_ivas->hMasaIsmData->delayBuffer_fx[n], st_ivas->hMasaIsmData->delayBuffer[n], 11, st_ivas->hMasaIsmData->delayBuffer_size ); +#else delay_signal_float( tc_local[n], tcBufferSize, st_ivas->hMasaIsmData->delayBuffer[n], st_ivas->hMasaIsmData->delayBuffer_size ); +#endif // IVAS_FLOAT_FIXED } } diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 6993ad0ba..37d7c0785 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -488,13 +488,14 @@ typedef struct stereo_tca_dec_data_structure int16_t interp_dec_prevNCShift; /* NC Shift in previous frame */ int16_t interp_dec_switch_to_zero_diff; /* switch flag for interpolation */ - float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ + #ifdef IVAS_FLOAT_FIXED Word32 memChanL_fx[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over for Fixed */ Word32 memChanR_fx[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over for Fixed */ -#endif +#else + float memChanL[L_DEC_MEM_LEN_ICA]; /* left channel input to correct at the cross-over */ float memChanR[L_DEC_MEM_LEN_ICA]; /* right channel input to correct at the cross-over */ - +#endif } STEREO_TCA_DEC_DATA, *STEREO_TCA_DEC_HANDLE; diff --git a/lib_dec/ivas_stereo_ica_dec.c b/lib_dec/ivas_stereo_ica_dec.c index effd55a39..ee8e8b475 100644 --- a/lib_dec/ivas_stereo_ica_dec.c +++ b/lib_dec/ivas_stereo_ica_dec.c @@ -54,203 +54,7 @@ * upnmix, convert L/R to M/S. * ---------------------------------------------------------------*/ -void stereo_tca_dec( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - float *synth[CPE_CHANNELS], /* i/o: output synth */ - const int16_t output_frame /* i : length of a frame per channel */ -) -{ - /* Buffers, input Left and right channels @ input_Fs*/ - float bufChanL[L_DEC_MEM_LEN_ICA + L_FRAME48k]; - float bufChanR[L_DEC_MEM_LEN_ICA + L_FRAME48k]; - float *ptrChanL, *ptrChanR; - float *target; - int16_t target_idx, prevNCShift, currentNCShift, l_shift_adapt; - int16_t dsFactor, tempMax; - float *ref; - int16_t bothChannelShift; - int32_t output_Fs; - STEREO_TCA_DEC_HANDLE hStereoTCA; - - hStereoTCA = hCPE->hStereoTCA; - - output_Fs = hCPE->hCoreCoder[0]->output_Fs; - - if ( hCPE->nchan_out == 1 ) - { - if ( hCPE->hStereoDftDmx ) - { - if ( hCPE->element_mode == IVAS_CPE_DFT ) - { - hCPE->hStereoDftDmx->targetGain = 1.0f; - } - - /* save the target gain for next frame */ - hCPE->hStereoDftDmx->prevTargetGain = hCPE->hStereoDftDmx->targetGain; - } - - return; - } - else if ( hCPE->element_mode == IVAS_CPE_MDCT && !hCPE->hStereoMdct->use_itd ) - { - return; - } - - /* populate L/R memories into current buffers */ - mvr2r( hStereoTCA->memChanL, bufChanL, L_DEC_MEM_LEN_ICA ); - mvr2r( hStereoTCA->memChanR, bufChanR, L_DEC_MEM_LEN_ICA ); - - /* pointers to the current frame */ - ptrChanL = bufChanL + L_DEC_MEM_LEN_ICA; - ptrChanR = bufChanR + L_DEC_MEM_LEN_ICA; - - /* copy interleaved stereo data to two channels, e.g., L, R */ - mvr2r( synth[0], ptrChanL, output_frame ); - mvr2r( synth[1], ptrChanR, output_frame ); - - /* back up the L/R target synth for next frame */ - mvr2r( bufChanL + output_frame, hStereoTCA->memChanL, L_DEC_MEM_LEN_ICA ); - mvr2r( bufChanR + output_frame, hStereoTCA->memChanR, L_DEC_MEM_LEN_ICA ); - - /* TCA parameter de-quantize */ - dsFactor = (int16_t) ( output_Fs / 8000 ); - tempMax = NS2SA( output_Fs, L_NCSHIFT_NS ); - hStereoTCA->corrLagStats = min( hStereoTCA->indx_ica_NCShift * dsFactor, tempMax ); - - bothChannelShift = 0; - if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_MDCT ) - { - hStereoTCA->corrLagStats = 0; - hStereoTCA->refChanIndx = L_CH_INDX; - hStereoTCA->targetGain = 1.0f; - - if ( hCPE->element_mode == IVAS_CPE_DFT ) - { - hStereoTCA->corrLagStats = (int16_t) fabsf( hCPE->hStereoDft->itd[1] ); - hStereoTCA->refChanIndx = ( hCPE->hStereoDft->itd[1] >= 0 ) ? ( L_CH_INDX ) : ( R_CH_INDX ); - } - else if ( hCPE->element_mode == IVAS_CPE_MDCT ) - { - float itd; - - itd = hCPE->hStereoMdct->itd; - hStereoTCA->corrLagStats = (int16_t) fabsf( itd ); - hStereoTCA->refChanIndx = ( itd >= 0 ) ? ( L_CH_INDX ) : ( R_CH_INDX ); - } - - if ( hStereoTCA->refChanIndx != hStereoTCA->prevRefChanIndx && hStereoTCA->corrLagStats != 0 ) - { - bothChannelShift = 1; - } - } - - prevNCShift = (int16_t) abs( hStereoTCA->prevCorrLagStats ); - currentNCShift = (int16_t) abs( hStereoTCA->corrLagStats ); - - if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_TD ) - { - if ( hStereoTCA->corrLagStats == hStereoTCA->prevCorrLagStats && hStereoTCA->interp_dec_switch_to_zero_diff == 0 ) - { - hStereoTCA->interp_dec_switch_to_zero_diff = 1; - } - else - { - hStereoTCA->interp_dec_switch_to_zero_diff = 0; - } - - if ( currentNCShift != 0 ) - { - currentNCShift = TRUNC( 0.6 * prevNCShift + 0.4 * currentNCShift ); - } - - prevNCShift = hStereoTCA->interp_dec_prevNCShift; - hStereoTCA->interp_dec_prevNCShift = currentNCShift; - } - else - { - hStereoTCA->interp_dec_prevNCShift = currentNCShift; - hStereoTCA->interp_dec_switch_to_zero_diff = 0; - } - ref = ptrChanL; - target = ptrChanR; - target_idx = R_CH_INDX; - /* identify target signal to adjust for shift variations */ - if ( ( prevNCShift == 0 && hStereoTCA->refChanIndx == R_CH_INDX ) || ( hStereoTCA->prevRefChanIndx == R_CH_INDX ) ) - { - ref = ptrChanR; - target = ptrChanL; - target_idx = L_CH_INDX; - } - - if ( bothChannelShift == 1 ) - { - ref = ptrChanL; - target = ptrChanR; - target_idx = R_CH_INDX; - if ( hStereoTCA->refChanIndx == R_CH_INDX ) - { - ref = ptrChanR; - target = ptrChanL; - target_idx = L_CH_INDX; - } - } - - /* target signal adjustment for temporal shift variations */ - if ( hStereoTCA->prevCorrLagStats != hStereoTCA->corrLagStats || bothChannelShift || ( hStereoTCA->interp_dec_switch_to_zero_diff == 1 && hCPE->element_mode == IVAS_CPE_TD ) ) - { - l_shift_adapt = L_SHIFT_ADAPT_16k; - if ( output_Fs > 16000 ) - { - l_shift_adapt = L_SHIFT_ADAPT_MAX; - } - - if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_DFT ) - { - l_shift_adapt = l_shift_adapt >> 1; - } - - if ( abs( currentNCShift - prevNCShift ) <= N_MAX_SHIFT_CHANGE && bothChannelShift == 0 ) - { - adjustTargetSignal( target - currentNCShift, currentNCShift, prevNCShift, l_shift_adapt, 0 ); - } - else - { - if ( bothChannelShift == 1 ) - { - adjustTargetSignal( ref, 0, prevNCShift, l_shift_adapt, 1 ); - adjustTargetSignal( target - currentNCShift, currentNCShift, 0, l_shift_adapt, 1 ); - } - else - { - adjustTargetSignal( target - currentNCShift, currentNCShift, prevNCShift, l_shift_adapt, 1 ); - } - } - } - - /* temporal channel adjustment */ - mvr2r( target - currentNCShift, synth[target_idx], output_frame ); - - mvr2r( ref, synth[!target_idx], output_frame ); - - /* Scale the Right channel with the gain */ - stereo_tca_scale_R_channel( hCPE, synth[1], output_frame ); - - /*-----------------------------------------------------------------* - * updates and memory backups - *-----------------------------------------------------------------*/ - - /* save the reference channel index for next frame */ - hStereoTCA->prevRefChanIndx = hStereoTCA->refChanIndx; - - /* save the corr lag stats for next frame */ - hStereoTCA->prevCorrLagStats = hStereoTCA->corrLagStats; - - /* save the target gain for next frame */ - hStereoTCA->prevTargetGain = hStereoTCA->targetGain; - - return; -} #ifdef IVAS_FLOAT_FIXED @@ -457,7 +261,205 @@ void stereo_tca_dec_fx( hStereoTCA->prevTargetGain_fx = hStereoTCA->targetGain_fx; return; } +#else + +void stereo_tca_dec( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + float *synth[CPE_CHANNELS], /* i/o: output synth */ + const int16_t output_frame /* i : length of a frame per channel */ +) +{ + /* Buffers, input Left and right channels @ input_Fs*/ + float bufChanL[L_DEC_MEM_LEN_ICA + L_FRAME48k]; + float bufChanR[L_DEC_MEM_LEN_ICA + L_FRAME48k]; + float *ptrChanL, *ptrChanR; + float *target; + int16_t target_idx, prevNCShift, currentNCShift, l_shift_adapt; + int16_t dsFactor, tempMax; + float *ref; + int16_t bothChannelShift; + int32_t output_Fs; + STEREO_TCA_DEC_HANDLE hStereoTCA; + + hStereoTCA = hCPE->hStereoTCA; + + output_Fs = hCPE->hCoreCoder[0]->output_Fs; + + if (hCPE->nchan_out == 1) + { + if (hCPE->hStereoDftDmx) + { + if (hCPE->element_mode == IVAS_CPE_DFT) + { + hCPE->hStereoDftDmx->targetGain = 1.0f; + } + + /* save the target gain for next frame */ + hCPE->hStereoDftDmx->prevTargetGain = hCPE->hStereoDftDmx->targetGain; + } + return; + } + else if (hCPE->element_mode == IVAS_CPE_MDCT && !hCPE->hStereoMdct->use_itd) + { + return; + } + + /* populate L/R memories into current buffers */ + mvr2r(hStereoTCA->memChanL, bufChanL, L_DEC_MEM_LEN_ICA); + mvr2r(hStereoTCA->memChanR, bufChanR, L_DEC_MEM_LEN_ICA); + + /* pointers to the current frame */ + ptrChanL = bufChanL + L_DEC_MEM_LEN_ICA; + ptrChanR = bufChanR + L_DEC_MEM_LEN_ICA; + + /* copy interleaved stereo data to two channels, e.g., L, R */ + mvr2r(synth[0], ptrChanL, output_frame); + mvr2r(synth[1], ptrChanR, output_frame); + + /* back up the L/R target synth for next frame */ + mvr2r(bufChanL + output_frame, hStereoTCA->memChanL, L_DEC_MEM_LEN_ICA); + mvr2r(bufChanR + output_frame, hStereoTCA->memChanR, L_DEC_MEM_LEN_ICA); + + /* TCA parameter de-quantize */ + dsFactor = (int16_t)(output_Fs / 8000); + tempMax = NS2SA(output_Fs, L_NCSHIFT_NS); + hStereoTCA->corrLagStats = min(hStereoTCA->indx_ica_NCShift * dsFactor, tempMax); + + bothChannelShift = 0; + if (hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_MDCT) + { + hStereoTCA->corrLagStats = 0; + hStereoTCA->refChanIndx = L_CH_INDX; + hStereoTCA->targetGain = 1.0f; + + if (hCPE->element_mode == IVAS_CPE_DFT) + { + hStereoTCA->corrLagStats = (int16_t)fabsf(hCPE->hStereoDft->itd[1]); + hStereoTCA->refChanIndx = (hCPE->hStereoDft->itd[1] >= 0) ? (L_CH_INDX) : (R_CH_INDX); + } + else if (hCPE->element_mode == IVAS_CPE_MDCT) + { + float itd; + + itd = hCPE->hStereoMdct->itd; + hStereoTCA->corrLagStats = (int16_t)fabsf(itd); + hStereoTCA->refChanIndx = (itd >= 0) ? (L_CH_INDX) : (R_CH_INDX); + } + + if (hStereoTCA->refChanIndx != hStereoTCA->prevRefChanIndx && hStereoTCA->corrLagStats != 0) + { + bothChannelShift = 1; + } + } + + prevNCShift = (int16_t)abs(hStereoTCA->prevCorrLagStats); + currentNCShift = (int16_t)abs(hStereoTCA->corrLagStats); + + if (hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_TD) + { + if (hStereoTCA->corrLagStats == hStereoTCA->prevCorrLagStats && hStereoTCA->interp_dec_switch_to_zero_diff == 0) + { + hStereoTCA->interp_dec_switch_to_zero_diff = 1; + } + else + { + hStereoTCA->interp_dec_switch_to_zero_diff = 0; + } + + if (currentNCShift != 0) + { + currentNCShift = TRUNC(0.6 * prevNCShift + 0.4 * currentNCShift); + } + + prevNCShift = hStereoTCA->interp_dec_prevNCShift; + hStereoTCA->interp_dec_prevNCShift = currentNCShift; + } + else + { + hStereoTCA->interp_dec_prevNCShift = currentNCShift; + hStereoTCA->interp_dec_switch_to_zero_diff = 0; + } + + ref = ptrChanL; + target = ptrChanR; + target_idx = R_CH_INDX; + /* identify target signal to adjust for shift variations */ + if ((prevNCShift == 0 && hStereoTCA->refChanIndx == R_CH_INDX) || (hStereoTCA->prevRefChanIndx == R_CH_INDX)) + { + ref = ptrChanR; + target = ptrChanL; + target_idx = L_CH_INDX; + } + + if (bothChannelShift == 1) + { + ref = ptrChanL; + target = ptrChanR; + target_idx = R_CH_INDX; + if (hStereoTCA->refChanIndx == R_CH_INDX) + { + ref = ptrChanR; + target = ptrChanL; + target_idx = L_CH_INDX; + } + } + + /* target signal adjustment for temporal shift variations */ + if (hStereoTCA->prevCorrLagStats != hStereoTCA->corrLagStats || bothChannelShift || (hStereoTCA->interp_dec_switch_to_zero_diff == 1 && hCPE->element_mode == IVAS_CPE_TD)) + { + l_shift_adapt = L_SHIFT_ADAPT_16k; + if (output_Fs > 16000) + { + l_shift_adapt = L_SHIFT_ADAPT_MAX; + } + + if (hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_DFT) + { + l_shift_adapt = l_shift_adapt >> 1; + } + + if (abs(currentNCShift - prevNCShift) <= N_MAX_SHIFT_CHANGE && bothChannelShift == 0) + { + adjustTargetSignal(target - currentNCShift, currentNCShift, prevNCShift, l_shift_adapt, 0); + } + else + { + if (bothChannelShift == 1) + { + adjustTargetSignal(ref, 0, prevNCShift, l_shift_adapt, 1); + adjustTargetSignal(target - currentNCShift, currentNCShift, 0, l_shift_adapt, 1); + } + else + { + adjustTargetSignal(target - currentNCShift, currentNCShift, prevNCShift, l_shift_adapt, 1); + } + } + } + + /* temporal channel adjustment */ + mvr2r(target - currentNCShift, synth[target_idx], output_frame); + + mvr2r(ref, synth[!target_idx], output_frame); + + /* Scale the Right channel with the gain */ + stereo_tca_scale_R_channel(hCPE, synth[1], output_frame); + + /*-----------------------------------------------------------------* + * updates and memory backups + *-----------------------------------------------------------------*/ + + /* save the reference channel index for next frame */ + hStereoTCA->prevRefChanIndx = hStereoTCA->refChanIndx; + + /* save the corr lag stats for next frame */ + hStereoTCA->prevCorrLagStats = hStereoTCA->corrLagStats; + + /* save the target gain for next frame */ + hStereoTCA->prevTargetGain = hStereoTCA->targetGain; + + return; +} #endif /*-------------------------------------------------------------------* * stereo_tca_scale_R_channel() @@ -723,28 +725,7 @@ void stereo_tca_scale_R_channel_fx( * Stereo temporal channel adjustment (TCA) decoder initialization *-------------------------------------------------------------------*/ -void stereo_tca_init_dec( - STEREO_TCA_DEC_HANDLE hStereoTCA /* i/o: Stereo TCA handle */ -) -{ - hStereoTCA->refChanIndx = L_CH_INDX; - hStereoTCA->prevRefChanIndx = L_CH_INDX; - hStereoTCA->indx_ica_NCShift = 0; - hStereoTCA->indx_ica_gD = 0; - hStereoTCA->targetGain = 1.0f; - hStereoTCA->prevTargetGain = 1.0f; - - hStereoTCA->corrLagStats = 0; - hStereoTCA->prevCorrLagStats = 0; - - hStereoTCA->interp_dec_prevNCShift = 0; - hStereoTCA->interp_dec_switch_to_zero_diff = 0; - set_f( hStereoTCA->memChanL, 0.0f, L_DEC_MEM_LEN_ICA ); - set_f( hStereoTCA->memChanR, 0.0f, L_DEC_MEM_LEN_ICA ); - - return; -} #ifdef IVAS_FLOAT_FIXED void stereo_tca_init_dec_fx( @@ -766,10 +747,6 @@ void stereo_tca_init_dec_fx( hStereoTCA->interp_dec_prevNCShift = 0; hStereoTCA->interp_dec_switch_to_zero_diff = 0; -#if 1 - set_f( hStereoTCA->memChanL, 0.0f, L_DEC_MEM_LEN_ICA ); /*TODO: Remove float init*/ - set_f(hStereoTCA->memChanR, 0.0f, L_DEC_MEM_LEN_ICA); /* TODO: Remove float init*/ -#endif set32_fx( hStereoTCA->memChanL_fx, 0, L_DEC_MEM_LEN_ICA ); set32_fx( hStereoTCA->memChanR_fx, 0, L_DEC_MEM_LEN_ICA ); @@ -777,4 +754,29 @@ void stereo_tca_init_dec_fx( return; } + +#else + +void stereo_tca_init_dec( + STEREO_TCA_DEC_HANDLE hStereoTCA /* i/o: Stereo TCA handle */ +) +{ + hStereoTCA->refChanIndx = L_CH_INDX; + hStereoTCA->prevRefChanIndx = L_CH_INDX; + hStereoTCA->indx_ica_NCShift = 0; + hStereoTCA->indx_ica_gD = 0; + hStereoTCA->targetGain = 1.0f; + hStereoTCA->prevTargetGain = 1.0f; + + hStereoTCA->corrLagStats = 0; + hStereoTCA->prevCorrLagStats = 0; + + hStereoTCA->interp_dec_prevNCShift = 0; + hStereoTCA->interp_dec_switch_to_zero_diff = 0; + + set_f(hStereoTCA->memChanL, 0.0f, L_DEC_MEM_LEN_ICA); + set_f(hStereoTCA->memChanR, 0.0f, L_DEC_MEM_LEN_ICA); + + return; +} #endif diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 9c4b1a734..e89840855 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -3912,156 +3912,248 @@ void synchro_synthesis_fixed_clean( * * Handling of memories in case of CPE modes switching *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static Word16 saturate( Word32 L_var1 ) +{ + Word16 var_out; + + if ( L_var1 > 0X00007fffL ) + { + assert( 0 ); + var_out = MAX_16; + } + else if ( L_var1 < (Word32) 0xffff8000L ) + { + assert( 0 ); + var_out = MIN_16; + } + else + { + var_out = extract_l( L_var1 ); +#ifdef WMOPS + multiCounter[currCounter].extract_l--; +#endif + } + + BASOP_CHECK(); + + return ( var_out ); +} +Word32 side_gain_table[32 + 1] = { -ONE_IN_Q31, -2040109440, -1932735232, -1825361152, -1717986944, + -1610612736, -1503238528, -1395864320, -1288490240, -1181115904, -1073741824, + -966367616, -858993408, -751619200, -644245120, -536870912, -429496704, + -322122496, -214748288, -107374208, 0, 107374336, 214748416, + 322122496, 429496832, 536870912, 644245248, 751619328, 858993408, + 966367744, 1073741824, 1181116160, 1288490240 }; void stereo_switching_dec( - CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const Word32 ivas_total_brate /* i : IVAS total bitrate */ ) { - int16_t i, n; - int16_t dft32ms_ovl; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED + IF( hCPE->hStereoTCA != NULL ) + { + hCPE->hStereoTCA->prevTargetGain_fx = hCPE->hStereoTCA->prevTargetGain * ONE_IN_Q29; + } +#endif + Word16 i, n; + Word16 dft32ms_ovl; Decoder_State **sts; - float tmpF; - int16_t delay_comp_TD; + Word32 tmpF_fx; + Word16 delay_comp_TD; sts = hCPE->hCoreCoder; delay_comp_TD = NS2SA( sts[0]->output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ); /* prevent CPE mode switching in the first received frame */ - if ( sts[0]->ini_frame == 0 ) + IF( sts[0]->ini_frame == 0 ) { hCPE->last_element_mode = hCPE->element_mode; hCPE->stereo_switching_counter = 10; hCPE->NbFrameMod = 7; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED hCPE->lt_es_em = 0.0f; +#endif + hCPE->lt_es_em_fx = 0; } - if ( hCPE->element_mode == hCPE->last_element_mode ) + IF( hCPE->element_mode == hCPE->last_element_mode ) { hCPE->stereo_switching_counter++; hCPE->stereo_switching_counter = min( 10, hCPE->stereo_switching_counter ); } - else + ELSE { hCPE->stereo_switching_counter = 0; } - if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->element_brate >= IVAS_32k && hCPE->last_element_brate <= IVAS_24k4 ) + IF( hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->element_brate >= IVAS_32k && hCPE->last_element_brate <= IVAS_24k4 ) { - dft32ms_ovl = (int16_t) ( ( STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs ) / 48000 ); - set_zero( hCPE->output_mem[0], dft32ms_ovl ); + dft32ms_ovl = (Word16) ( ( STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs ) / 48000 ); + set32_fx( hCPE->output_mem_fx[0], 0, dft32ms_ovl ); } - - if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->last_element_mode != IVAS_CPE_DFT && hCPE->hCoreCoder[0]->ini_frame > 0 ) + IF( hCPE->element_mode == IVAS_CPE_DFT && hCPE->last_element_mode != IVAS_CPE_DFT && hCPE->hCoreCoder[0]->ini_frame > 0 ) { /* windowing the OLA memory */ - dft32ms_ovl = (int16_t) ( ( STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs ) / 48000 ); - for ( n = 0; n < CPE_CHANNELS; n++ ) + dft32ms_ovl = (Word16) ( ( STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs ) / 48000 ); + FOR( n = 0; n < CPE_CHANNELS; n++ ) { - if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) + IF( hCPE->last_element_mode == IVAS_CPE_MDCT ) { /* copy memories from previous MDCT Stereo frame to output_mem */ - mvr2r( hCPE->input_mem[n], hCPE->output_mem[n], dft32ms_ovl ); + Copy32( hCPE->input_mem_fx[n], hCPE->output_mem_fx[n], dft32ms_ovl ); } - if ( ivas_total_brate > IVAS_SID_5k2 || n == 0 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->nchan_out == 1 ) + IF( ivas_total_brate > IVAS_SID_5k2 || n == 0 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->nchan_out == 1 ) { - for ( i = 0; i < dft32ms_ovl; i++ ) + FOR( i = 0; i < dft32ms_ovl; i++ ) { - hCPE->output_mem[n][i] *= hCPE->hStereoDft->win32ms[STEREO_DFT32MS_STEP * ( dft32ms_ovl - 1 - i )]; + hCPE->output_mem_fx[n][i] = Mpy_32_32( hCPE->hStereoDft->win32ms_fx[STEREO_DFT32MS_STEP * ( dft32ms_ovl - 1 - i )], hCPE->output_mem_fx[n][i] ); } } - else + ELSE { - tmpF = 1.0f / hCPE->hStereoTCA->prevTargetGain; - for ( i = 0; i < dft32ms_ovl; i++ ) + IF( hCPE->hStereoDftDmx->prevTargetGain_fx == ONE_IN_Q29 ) { - hCPE->output_mem[n][i] *= tmpF * hCPE->hStereoDft->win32ms[STEREO_DFT32MS_STEP * ( dft32ms_ovl - 1 - i )]; + tmpF_fx = ONE_IN_Q27; } - for ( i = 0; i < delay_comp_TD; i++ ) + ELSE + { + Word16 temp_b = (Word16) L_shr( hCPE->hStereoDftDmx->prevTargetGain_fx, 16 ); + Word16 temp_b_q = 2; + tmpF_fx = Inv16( temp_b, &temp_b_q ); + tmpF_fx = L_shl( tmpF_fx, ( 31 - 4 ) - ( 15 - temp_b_q ) ); + } + FOR( i = 0; i < dft32ms_ovl; i++ ) + { + Word32 temp_result = Mpy_32_32( tmpF_fx, hCPE->hStereoDft->win32ms_fx[STEREO_DFT32MS_STEP * ( dft32ms_ovl - 1 - i )] ); + hCPE->output_mem_fx[n][i] = L_shl_sat( Mpy_32_32( hCPE->output_mem_fx[n][i], temp_result ), 4 ); + } + FOR( i = 0; i < delay_comp_TD; i++ ) { - hCPE->hCoreCoder[1]->prev_synth_buffer[i] *= tmpF; + Word64 temp_result = (Word64) hCPE->hCoreCoder[1]->prev_synth_buffer_fx[i] * tmpF_fx; + // 16bit buffer + hCPE->hCoreCoder[1]->prev_synth_buffer_fx[i] = saturate( W_shr( temp_result, 27 ) ); + // 32bit buffer + hCPE->hCoreCoder[1]->prev_synth_buffer32_fx[i] = W_sat_l( W_shr( temp_result, 27 ) ); } - for ( i = 0; i < L_DEC_MEM_LEN_ICA; i++ ) + FOR( i = 0; i < L_DEC_MEM_LEN_ICA; i++ ) { - hCPE->hStereoTCA->memChanR[i] *= tmpF; + hCPE->hStereoTCA->memChanR_fx[i] = L_shl_sat( Mpy_32_32( hCPE->hStereoTCA->memChanR_fx[i], tmpF_fx ), 4 ); } } } - if ( hCPE->last_element_mode == IVAS_CPE_MDCT ) + IF( hCPE->last_element_mode == IVAS_CPE_MDCT ) { - /* create passive downmix of MDCT Stereo memories for DFT input memory */ - v_add( hCPE->input_mem_LB[0], hCPE->input_mem_LB[1], hCPE->input_mem_LB[0], STEREO_DFT32MS_OVL_16k ); - v_multc( hCPE->input_mem_LB[0], 0.5f, hCPE->input_mem_LB[0], STEREO_DFT32MS_OVL_16k ); + /* create passive downmix of MDCT Stereo memories FOR DFT input memory */ + FOR( int ind = 0; ind < STEREO_DFT32MS_OVL_16k; ind++ ) + { + Word32 result_int = L_add_sat( hCPE->input_mem_LB_fx[0][ind], hCPE->input_mem_LB_fx[1][ind] ); + hCPE->input_mem_LB_fx[0][ind] = L_shr( result_int, 1 ); + } - v_add( hCPE->input_mem[0], hCPE->input_mem[1], hCPE->input_mem[0], dft32ms_ovl ); - v_multc( hCPE->input_mem[0], 0.5f, hCPE->input_mem[0], dft32ms_ovl ); + FOR( int ind = 0; ind < dft32ms_ovl; ind++ ) + { + Word32 result_int = L_add_sat( hCPE->input_mem_fx[0][ind], hCPE->input_mem_fx[1][ind] ); + hCPE->input_mem_fx[0][ind] = L_shr( result_int, 1 ); + } - if ( hCPE->nchan_out == 1 ) + IF( hCPE->nchan_out == 1 ) { - v_add( hCPE->output_mem[0], hCPE->output_mem[1], hCPE->output_mem[0], dft32ms_ovl ); - v_multc( hCPE->output_mem[0], INV_SQRT_2, hCPE->output_mem[0], dft32ms_ovl ); + FOR( int ind = 0; ind < dft32ms_ovl; ind++ ) + { + Word32 result_int = L_add_sat( hCPE->output_mem_fx[0][ind], hCPE->output_mem_fx[1][ind] ); + hCPE->output_mem_fx[0][ind] = Mpy_32_32( result_int, INV_SQRT_2_Q31 ); + } } } /* Update the side_gain[] parameters */ - if ( hCPE->last_element_mode != IVAS_CPE_MDCT ) + IF( hCPE->last_element_mode != IVAS_CPE_MDCT ) { - tmpF = 0; - if ( hCPE->hStereoTCA != NULL ) + tmpF_fx = 0; + IF( hCPE->hStereoTCA != NULL ) { - tmpF = usdequant( hCPE->hStereoTCA->indx_ica_gD, STEREO_TCA_GDMIN, STEREO_TCA_GDSTEP ); + tmpF_fx = side_gain_table[hCPE->hStereoTCA->indx_ica_gD]; } - - set_f( hCPE->hStereoDft->side_gain + STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX, tmpF, STEREO_DFT_BAND_MAX ); + set32_fx( hCPE->hStereoDft->side_gain_fx + STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX, tmpF_fx, STEREO_DFT_BAND_MAX ); } /* reset residual coding / ESF (secondary channel) */ +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED set_zero( hCPE->hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k ); - set_zero( hCPE->input_mem[1], NS2SA( sts[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); +#endif + set32_fx( hCPE->hStereoDft->res_cod_mem_fx, 0, STEREO_DFT_OVL_8k ); + + set32_fx( hCPE->input_mem_fx[1], 0, NS2SA( sts[0]->output_Fs, STEREO_DFT32MS_OVL_NS ) ); } - if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode != IVAS_CPE_TD && hCPE->hCoreCoder[0]->ini_frame > 0 ) + IF( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode != IVAS_CPE_TD && hCPE->hCoreCoder[0]->ini_frame > 0 ) { hCPE->hStereoTD->tdm_last_ratio_idx = LRTD_STEREO_MID_IS_PRIM; hCPE->hStereoTD->tdm_last_SM_flag = 0; hCPE->hStereoTD->tdm_prev_last_SM_flag = 0; /* First frame after DFT frame AND the content is uncorrelated or xtalk -> the primary channel is forced to left */ - if ( hCPE->hStereoTD->tdm_LRTD_flag == 1 ) + IF( hCPE->hStereoTD->tdm_LRTD_flag == 1 ) { hCPE->hStereoTD->tdm_last_ratio_idx = LRTD_STEREO_LEFT_IS_PRIM; } } /* no secondary channel in the previous frame -> memory resets */ - if ( hCPE->element_mode > IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_DFT ) + IF( hCPE->element_mode > IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_DFT ) { - if ( hCPE->last_element_brate <= IVAS_SID_5k2 && hCPE->nchan_out == 2 ) + IF( hCPE->last_element_brate <= IVAS_SID_5k2 && hCPE->nchan_out == 2 ) { /* reset CLDFB memories */ +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED cldfb_reset_memory_ivas( sts[0]->cldfbAna ); cldfb_reset_memory_ivas( sts[0]->cldfbBPF ); cldfb_reset_memory_ivas( sts[0]->cldfbSyn ); +#endif + + cldfb_reset_memory_fx( sts[0]->cldfbAna ); + cldfb_reset_memory_fx( sts[0]->cldfbBPF ); + cldfb_reset_memory_fx( sts[0]->cldfbSyn ); sts[0]->mem_deemph = 0; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED sts[0]->tilt_code = 0.0f; sts[0]->gc_threshold = 0.0f; +#endif + + sts[0]->tilt_code_fx = 0; + sts[0]->gc_threshold_fx = 0; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED set_f( sts[0]->mem_syn1, 0, M ); set_f( sts[0]->mem_syn2, 0, M ); set_f( sts[0]->mem_syn3, 0, M ); set_f( sts[0]->mem_syn_r_float, 0.0f, L_SYN_MEM ); +#endif + + set16_fx( sts[0]->mem_syn1_fx, 0, M ); + set16_fx( sts[0]->mem_syn2_fx, 0, M ); + set16_fx( sts[0]->mem_syn3_fx, 0, M ); + set16_fx( sts[0]->mem_syn_r, 0, L_SYN_MEM ); sts[1]->last_L_frame = sts[0]->last_L_frame; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED /* reset PCh memories */ set_f( sts[0]->old_exc, 0, L_EXC_MEM_DEC ); set_f( sts[0]->lsf_old, 0, M ); set_f( sts[0]->lsp_old, 0, M ); +#endif + + set16_fx( sts[0]->old_exc_fx, 0, L_EXC_MEM_DEC ); + set16_fx( sts[0]->lsf_old_fx, 0, M ); + set16_fx( sts[0]->lsp_old_fx, 0, M ); } sts[1]->last_extl = -1; @@ -4070,45 +4162,87 @@ void stereo_switching_dec( set_f( sts[1]->old_pitch_buf, (float) L_SUBFR, 2 * NB_SUBFR16k ); sts[1]->old_fpitchFB_float = 2 * (float) L_SUBFR; + // fix need to do correctly + set32_fx( sts[1]->old_pitch_buf_fx, L_deposit_h( L_SUBFR ), 2 * NB_SUBFR16k ); + sts[1]->old_fpitchFB = 2 * L_SUBFR; + /* reset CLDFB memories */ +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED cldfb_reset_memory_ivas( sts[1]->cldfbAna ); cldfb_reset_memory_ivas( sts[1]->cldfbBPF ); cldfb_reset_memory_ivas( sts[1]->cldfbSyn ); +#endif - sts[1]->mem_deemph = 0; + cldfb_reset_memory_fx( sts[1]->cldfbAna ); + cldfb_reset_memory_fx( sts[1]->cldfbBPF ); + cldfb_reset_memory_fx( sts[1]->cldfbSyn ); + sts[1]->mem_deemph = 0; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED sts[1]->tilt_code = 0.0f; sts[1]->gc_threshold = 0.0f; +#endif + sts[1]->tilt_code_fx = 0; + sts[1]->gc_threshold_fx = 0; + +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED set_f( sts[1]->mem_syn1, 0, M ); set_f( sts[1]->mem_syn2, 0, M ); set_f( sts[1]->mem_syn3, 0, M ); set_f( sts[1]->mem_syn_r_float, 0.0f, L_SYN_MEM ); +#endif + + set16_fx( sts[1]->mem_syn1_fx, 0, M ); + set16_fx( sts[1]->mem_syn2_fx, 0, M ); + set16_fx( sts[1]->mem_syn3_fx, 0, M ); + set16_fx( sts[1]->mem_syn_r, 0, L_SYN_MEM ); sts[1]->last_L_frame = sts[0]->last_L_frame; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED /* populate PCh memories into the SCh */ mvr2r( sts[0]->old_exc, sts[1]->old_exc, L_EXC_MEM_DEC ); mvr2r( sts[0]->lsf_old, sts[1]->lsf_old, M ); mvr2r( sts[0]->lsp_old, sts[1]->lsp_old, M ); - if ( hCPE->element_mode == IVAS_CPE_MDCT ) +#endif + + Copy( sts[0]->old_exc_fx, sts[1]->old_exc_fx, L_EXC_MEM_DEC ); + Copy( sts[0]->lsf_old_fx, sts[1]->lsf_old_fx, M ); + Copy( sts[0]->lsp_old_fx, sts[1]->lsp_old_fx, M ); + IF( hCPE->element_mode == IVAS_CPE_MDCT ) { sts[1]->last_core = sts[0]->last_core; sts[1]->last_coder_type = sts[0]->last_coder_type; +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED mvr2r( sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k ); mvr2r( sts[0]->delay_buf_out, sts[1]->delay_buf_out, HQ_DELTA_MAX * HQ_DELAY_COMP ); mvr2r( sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256 ); +#endif + + // 32bit buffer + Copy32( sts[0]->hHQ_core->oldOut_fx, sts[1]->hHQ_core->oldOut_fx, L_FRAME48k ); + Copy32( sts[0]->delay_buf_out32_fx, sts[1]->delay_buf_out32_fx, HQ_DELTA_MAX * HQ_DELAY_COMP ); + Copy32( sts[0]->hTcxDec->old_syn_Overl_32, sts[1]->hTcxDec->old_syn_Overl_32, 256 ); + // 16 bit buffer + Copy( sts[0]->hHQ_core->old_out_fx, sts[1]->hHQ_core->old_out_fx, L_FRAME48k ); + Copy( sts[0]->delay_buf_out_fx, sts[1]->delay_buf_out_fx, HQ_DELTA_MAX * HQ_DELAY_COMP ); + Copy( sts[0]->hTcxDec->old_syn_Overl, sts[1]->hTcxDec->old_syn_Overl, 256 ); } } - else if ( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_MDCT ) + ELSE IF( hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_MDCT ) { +#ifndef IVAS_FLOAT_CONV_TO_BE_REMOVED set_f( sts[0]->old_exc, 0.0f, L_EXC_MEM_DEC ); set_f( sts[1]->old_exc, 0.0f, L_EXC_MEM_DEC ); +#endif + set16_fx( sts[0]->old_exc_fx, 0, L_EXC_MEM_DEC ); + set16_fx( sts[1]->old_exc_fx, 0, L_EXC_MEM_DEC ); } /* TD/DFT -> MDCT stereo switching (there is no TCX in the TD stereo secondary channel, or DFT stereo) */ - if ( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode != IVAS_CPE_MDCT ) + IF( hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode != IVAS_CPE_MDCT ) { sts[1]->hTcxCfg->last_aldo = sts[0]->hTcxCfg->last_aldo; sts[1]->hTcxCfg->tcx_curr_overlap_mode = sts[0]->hTcxCfg->tcx_curr_overlap_mode; @@ -4122,8 +4256,217 @@ void stereo_switching_dec( return; } +#else +void stereo_switching_dec( + CPE_DEC_HANDLE hCPE, /* i/o: CPE decoder structure */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ +) +{ + int16_t i, n; + int16_t dft32ms_ovl; + Decoder_State **sts; + float tmpF; + int16_t delay_comp_TD; + + sts = hCPE->hCoreCoder; + delay_comp_TD = NS2SA(sts[0]->output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS); + /* prevent CPE mode switching in the first received frame */ + if (sts[0]->ini_frame == 0) + { + hCPE->last_element_mode = hCPE->element_mode; + hCPE->stereo_switching_counter = 10; + hCPE->NbFrameMod = 7; + hCPE->lt_es_em = 0.0f; + } + + if (hCPE->element_mode == hCPE->last_element_mode) + { + hCPE->stereo_switching_counter++; + hCPE->stereo_switching_counter = min(10, hCPE->stereo_switching_counter); + } + else + { + hCPE->stereo_switching_counter = 0; + } + + if (hCPE->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->element_brate >= IVAS_32k && hCPE->last_element_brate <= IVAS_24k4) + { + dft32ms_ovl = (int16_t)((STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs) / 48000); + set_zero(hCPE->output_mem[0], dft32ms_ovl); + } + + if (hCPE->element_mode == IVAS_CPE_DFT && hCPE->last_element_mode != IVAS_CPE_DFT && hCPE->hCoreCoder[0]->ini_frame > 0) + { + /* windowing the OLA memory */ + dft32ms_ovl = (int16_t)((STEREO_DFT32MS_OVL_MAX * sts[0]->output_Fs) / 48000); + for (n = 0; n < CPE_CHANNELS; n++) + { + if (hCPE->last_element_mode == IVAS_CPE_MDCT) + { + /* copy memories from previous MDCT Stereo frame to output_mem */ + mvr2r(hCPE->input_mem[n], hCPE->output_mem[n], dft32ms_ovl); + } + + if (ivas_total_brate > IVAS_SID_5k2 || n == 0 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->nchan_out == 1) + { + for (i = 0; i < dft32ms_ovl; i++) + { + hCPE->output_mem[n][i] *= hCPE->hStereoDft->win32ms[STEREO_DFT32MS_STEP * (dft32ms_ovl - 1 - i)]; + } + } + else + { + tmpF = 1.0f / hCPE->hStereoTCA->prevTargetGain; + for (i = 0; i < dft32ms_ovl; i++) + { + hCPE->output_mem[n][i] *= tmpF * hCPE->hStereoDft->win32ms[STEREO_DFT32MS_STEP * (dft32ms_ovl - 1 - i)]; + } + for (i = 0; i < delay_comp_TD; i++) + { + hCPE->hCoreCoder[1]->prev_synth_buffer[i] *= tmpF; + } + for (i = 0; i < L_DEC_MEM_LEN_ICA; i++) + { + hCPE->hStereoTCA->memChanR[i] *= tmpF; + } + } + } + + if (hCPE->last_element_mode == IVAS_CPE_MDCT) + { + /* create passive downmix of MDCT Stereo memories for DFT input memory */ + v_add(hCPE->input_mem_LB[0], hCPE->input_mem_LB[1], hCPE->input_mem_LB[0], STEREO_DFT32MS_OVL_16k); + v_multc(hCPE->input_mem_LB[0], 0.5f, hCPE->input_mem_LB[0], STEREO_DFT32MS_OVL_16k); + + v_add(hCPE->input_mem[0], hCPE->input_mem[1], hCPE->input_mem[0], dft32ms_ovl); + v_multc(hCPE->input_mem[0], 0.5f, hCPE->input_mem[0], dft32ms_ovl); + + if (hCPE->nchan_out == 1) + { + v_add(hCPE->output_mem[0], hCPE->output_mem[1], hCPE->output_mem[0], dft32ms_ovl); + v_multc(hCPE->output_mem[0], INV_SQRT_2, hCPE->output_mem[0], dft32ms_ovl); + } + } + + /* Update the side_gain[] parameters */ + if (hCPE->last_element_mode != IVAS_CPE_MDCT) + { + tmpF = 0; + if (hCPE->hStereoTCA != NULL) + { + tmpF = usdequant(hCPE->hStereoTCA->indx_ica_gD, STEREO_TCA_GDMIN, STEREO_TCA_GDSTEP); + } + + set_f(hCPE->hStereoDft->side_gain + STEREO_DFT_NBDIV * STEREO_DFT_BAND_MAX, tmpF, STEREO_DFT_BAND_MAX); + } + + /* reset residual coding / ESF (secondary channel) */ + set_zero(hCPE->hStereoDft->res_cod_mem, STEREO_DFT_OVL_8k); + set_zero(hCPE->input_mem[1], NS2SA(sts[0]->output_Fs, STEREO_DFT32MS_OVL_NS)); + } + + if (hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode != IVAS_CPE_TD && hCPE->hCoreCoder[0]->ini_frame > 0) + { + hCPE->hStereoTD->tdm_last_ratio_idx = LRTD_STEREO_MID_IS_PRIM; + hCPE->hStereoTD->tdm_last_SM_flag = 0; + hCPE->hStereoTD->tdm_prev_last_SM_flag = 0; + + /* First frame after DFT frame AND the content is uncorrelated or xtalk -> the primary channel is forced to left */ + if (hCPE->hStereoTD->tdm_LRTD_flag == 1) + { + hCPE->hStereoTD->tdm_last_ratio_idx = LRTD_STEREO_LEFT_IS_PRIM; + } + } + + /* no secondary channel in the previous frame -> memory resets */ + if (hCPE->element_mode > IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_DFT) + { + if (hCPE->last_element_brate <= IVAS_SID_5k2 && hCPE->nchan_out == 2) + { + /* reset CLDFB memories */ + cldfb_reset_memory_ivas(sts[0]->cldfbAna); + cldfb_reset_memory_ivas(sts[0]->cldfbBPF); + cldfb_reset_memory_ivas(sts[0]->cldfbSyn); + + sts[0]->mem_deemph = 0; + + sts[0]->tilt_code = 0.0f; + sts[0]->gc_threshold = 0.0f; + + set_f(sts[0]->mem_syn1, 0, M); + set_f(sts[0]->mem_syn2, 0, M); + set_f(sts[0]->mem_syn3, 0, M); + set_f(sts[0]->mem_syn_r_float, 0.0f, L_SYN_MEM); + + sts[1]->last_L_frame = sts[0]->last_L_frame; + + /* reset PCh memories */ + set_f(sts[0]->old_exc, 0, L_EXC_MEM_DEC); + set_f(sts[0]->lsf_old, 0, M); + set_f(sts[0]->lsp_old, 0, M); + } + sts[1]->last_extl = -1; + + sts[1]->prev_bfi = sts[0]->prev_bfi; + + set_f(sts[1]->old_pitch_buf, (float)L_SUBFR, 2 * NB_SUBFR16k); + sts[1]->old_fpitchFB_float = 2 * (float)L_SUBFR; + + /* reset CLDFB memories */ + cldfb_reset_memory_ivas(sts[1]->cldfbAna); + cldfb_reset_memory_ivas(sts[1]->cldfbBPF); + cldfb_reset_memory_ivas(sts[1]->cldfbSyn); + + sts[1]->mem_deemph = 0; + + sts[1]->tilt_code = 0.0f; + sts[1]->gc_threshold = 0.0f; + + set_f(sts[1]->mem_syn1, 0, M); + set_f(sts[1]->mem_syn2, 0, M); + set_f(sts[1]->mem_syn3, 0, M); + set_f(sts[1]->mem_syn_r_float, 0.0f, L_SYN_MEM); + + sts[1]->last_L_frame = sts[0]->last_L_frame; + + /* populate PCh memories into the SCh */ + mvr2r(sts[0]->old_exc, sts[1]->old_exc, L_EXC_MEM_DEC); + mvr2r(sts[0]->lsf_old, sts[1]->lsf_old, M); + mvr2r(sts[0]->lsp_old, sts[1]->lsp_old, M); + if (hCPE->element_mode == IVAS_CPE_MDCT) + { + sts[1]->last_core = sts[0]->last_core; + sts[1]->last_coder_type = sts[0]->last_coder_type; + + mvr2r(sts[0]->hHQ_core->old_out, sts[1]->hHQ_core->old_out, L_FRAME48k); + mvr2r(sts[0]->delay_buf_out, sts[1]->delay_buf_out, HQ_DELTA_MAX * HQ_DELAY_COMP); + mvr2r(sts[0]->hTcxDec->old_syn_Overl_float, sts[1]->hTcxDec->old_syn_Overl_float, 256); + } + } + else if (hCPE->element_mode == IVAS_CPE_TD && hCPE->last_element_mode == IVAS_CPE_MDCT) + { + set_f(sts[0]->old_exc, 0.0f, L_EXC_MEM_DEC); + set_f(sts[1]->old_exc, 0.0f, L_EXC_MEM_DEC); + } + + /* TD/DFT -> MDCT stereo switching (there is no TCX in the TD stereo secondary channel, or DFT stereo) */ + if (hCPE->element_mode == IVAS_CPE_MDCT && hCPE->last_element_mode != IVAS_CPE_MDCT) + { + sts[1]->hTcxCfg->last_aldo = sts[0]->hTcxCfg->last_aldo; + sts[1]->hTcxCfg->tcx_curr_overlap_mode = sts[0]->hTcxCfg->tcx_curr_overlap_mode; + sts[1]->fscale = sts[0]->fscale; + sts[1]->hTcxCfg->tcx_mdct_window_length = sts[0]->hTcxCfg->tcx_mdct_window_length; + sts[1]->pit_res_max = sts[0]->pit_res_max; + sts[1]->pit_res_max_past = sts[0]->pit_res_max_past; + sts[1]->hTcxDec->L_frameTCX = sts[0]->hTcxDec->L_frameTCX; + sts[1]->hTcxDec->conceal_eof_gain_float = sts[0]->hTcxDec->conceal_eof_gain_float; + } + + return; +} +#endif /*-------------------------------------------------------------------* * Function stereo_td2dft_update() * diff --git a/lib_dec/ivas_td_low_rate_dec.c b/lib_dec/ivas_td_low_rate_dec.c index 662bce160..4505e7fcf 100644 --- a/lib_dec/ivas_td_low_rate_dec.c +++ b/lib_dec/ivas_td_low_rate_dec.c @@ -183,13 +183,13 @@ void tdm_low_rate_dec( floatToFixed_arr(st->hGSCDec->last_exc_dct_in, st->hGSCDec->last_exc_dct_in_fx, st->Q_exc, L_FRAME); //st->hGSCDec->last_ener_fx = float_to_fix16(st->hGSCDec->last_ener, 0); Copy(st->hGSCDec->last_bitallocation_band, st->hGSCDec->last_bitallocation_band_fx, 6); - st->GSC_noisy_speech_fx = st->GSC_noisy_speech; + st->GSC_noisy_speech = st->GSC_noisy_speech; st->lp_gainc_fx = float_to_fix16(st->lp_gainc, Q3); st->bfi_pitch_fx = float_to_fix16(st->bfi_pitch, 0); st->tilt_code_fx = float_to_fix16(st->tilt_code, Q15); floatToFixed_arr(st->tilt_code_dec, st->tilt_code_dec_fx, Q15, NB_SUBFR16k); st->last_good = st->last_good; - st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; st->last_coder_type = st->last_coder_type; /*hGSCDec end*/ @@ -233,7 +233,7 @@ void tdm_low_rate_dec( fixedToFloat_arr(st->hGSCDec->last_exc_dct_in_fx, st->hGSCDec->last_exc_dct_in, st->Q_exc, L_FRAME); st->hGSCDec->last_ener = fixedToFloat(st->hGSCDec->last_ener_fx, 0); Copy(st->hGSCDec->last_bitallocation_band_fx, st->hGSCDec->last_bitallocation_band, 6); - st->GSC_noisy_speech = st->GSC_noisy_speech_fx; + st->GSC_noisy_speech = st->GSC_noisy_speech; st->lp_gainc = fixedToFloat(st->lp_gainc_fx, Q3); st->bfi_pitch = fixedToFloat(st->bfi_pitch_fx, 0); st->tilt_code = fixedToFloat(st->tilt_code_fx, Q15); @@ -275,7 +275,7 @@ void tdm_low_rate_dec_fx( nb_subfr = 2; st->GSC_IVAS_mode = 0; - st->GSC_noisy_speech_fx = 1; + st->GSC_noisy_speech = 1; hGSCDec->noise_lev_fx = 14; pit_band_idx = 10 + BAND1k2; @@ -534,7 +534,7 @@ void decod_gen_2sbfr( floatToFixed_arr( st->hGSCDec->last_exc_dct_in, st->hGSCDec->last_exc_dct_in_fx, st->Q_exc, L_FRAME ); // st->hGSCDec->last_ener_fx = float_to_fix16(st->hGSCDec->last_ener, 0); Copy( st->hGSCDec->last_bitallocation_band, st->hGSCDec->last_bitallocation_band_fx, 6 ); - st->GSC_noisy_speech_fx = st->GSC_noisy_speech; + st->GSC_noisy_speech = st->GSC_noisy_speech; st->lp_gainc_fx = float_to_fix16( st->lp_gainc, Q3 ); st->bfi_pitch_fx = float_to_fix16( st->bfi_pitch, 0 ); st->tilt_code_fx = float_to_fix16( st->tilt_code, Q15 ); @@ -543,7 +543,7 @@ void decod_gen_2sbfr( st->dm_fx.prev_gain_code = floatToFixed(st->dispMem[1], Q16); floatToFixed_arr(&(st->dispMem[2]), st->dm_fx.prev_gain_pit, Q14, 6); st->last_good = st->last_good; - st->Last_GSC_noisy_speech_flag_fx = st->Last_GSC_noisy_speech_flag; + st->Last_GSC_noisy_speech_flag = st->Last_GSC_noisy_speech_flag; st->last_coder_type = st->last_coder_type; /*hGSCDec end*/ @@ -594,7 +594,7 @@ void decod_gen_2sbfr( fixedToFloat_arr( st->hGSCDec->last_exc_dct_in_fx, st->hGSCDec->last_exc_dct_in, st->Q_exc, L_FRAME ); st->hGSCDec->last_ener = fixedToFloat( st->hGSCDec->last_ener_fx, 0 ); Copy( st->hGSCDec->last_bitallocation_band_fx, st->hGSCDec->last_bitallocation_band, 6 ); - st->GSC_noisy_speech = st->GSC_noisy_speech_fx; + st->GSC_noisy_speech = st->GSC_noisy_speech; st->lp_gainc = fixedToFloat( st->lp_gainc_fx, Q3 ); st->bfi_pitch = fixedToFloat( st->bfi_pitch_fx, 0 ); st->tilt_code = fixedToFloat( st->tilt_code_fx, Q15 ); diff --git a/lib_dec/lsf_dec_fx.c b/lib_dec/lsf_dec_fx.c index 23ed76bd7..fff93a55e 100644 --- a/lib_dec/lsf_dec_fx.c +++ b/lib_dec/lsf_dec_fx.c @@ -150,12 +150,12 @@ void lsf_dec_fx( ELSE { test(); - IF ( st_fx->nelp_mode_dec_fx == 0 && st_fx->ppp_mode_dec_fx == 0 ) + IF ( st_fx->nelp_mode_dec == 0 && st_fx->ppp_mode_dec == 0 ) { nBits = st_fx->acelp_cfg.lsf_bits; move16(); } - ELSE IF ( EQ_16(st_fx->nelp_mode_dec_fx,1)) + ELSE IF ( EQ_16(st_fx->nelp_mode_dec,1)) { IF ( EQ_16(coder_type,UNVOICED)) { @@ -168,7 +168,7 @@ void lsf_dec_fx( } } } - ELSE IF ( EQ_16(st_fx->ppp_mode_dec_fx,1)) + ELSE IF ( EQ_16(st_fx->ppp_mode_dec,1)) { nBits = 26; move16(); @@ -263,7 +263,7 @@ void lsf_dec_fx( IF( LT_16(enr_new, mult_r(9830/*0.3 Q15*/,enr_old))) { /* OLD CODE : if( st->safety_net == 1), replaced with a decision similar to MODE2 */ - st_fx->relax_prev_lsf_interp_fx = -1; + st_fx->relax_prev_lsf_interp = -1; move16(); test(); test(); @@ -271,7 +271,7 @@ void lsf_dec_fx( test(); if ( EQ_16(st_fx->clas_dec, UNVOICED_CLAS)||EQ_16(st_fx->clas_dec,SIN_ONSET)||EQ_16(st_fx->clas_dec,INACTIVE_CLAS)||EQ_16(coder_type,GENERIC)||EQ_16(coder_type,TRANSITION)) { - st_fx->relax_prev_lsf_interp_fx = 1; + st_fx->relax_prev_lsf_interp = 1; move16(); } } @@ -304,7 +304,7 @@ void lsf_dec_fx( #endif { /* LSP interpolation and conversion of LSPs to A(z) */ - int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, st_fx->relax_prev_lsf_interp_fx); + int_lsp4_fx(st_fx->L_frame, st_fx->lsp_old_fx, lsp_mid, lsp_new, Aq, M, st_fx->relax_prev_lsf_interp); } /*------------------------------------------------------------------* * Check LSF stability (distance between old LSFs and current LSFs) @@ -490,7 +490,7 @@ void lsf_end_dec_fx( } } - st->safety_net_fx = safety_net; + st->safety_net = safety_net; move16(); /*--------------------------------------------------------------------------* @@ -824,13 +824,13 @@ void lsf_mid_dec_fx( lsp2lsf_fx( lsp_new, qlsf1, M, st_fx->sr_core); /* Codebook selection */ - IF ( EQ_16(st_fx->ppp_mode_dec_fx,1)) + IF ( EQ_16(st_fx->ppp_mode_dec,1)) { nb_bits = 1; move16(); ratio = &tbl_mid_voi_wb_1b_fx[0]; } - ELSE IF ( EQ_16(st_fx->nelp_mode_dec_fx,1)) + ELSE IF ( EQ_16(st_fx->nelp_mode_dec,1)) { nb_bits = 4; move16(); @@ -916,7 +916,7 @@ void lsf_mid_dec_fx( } /* check for incorrect LSF ordering */ - IF ( EQ_16(st_fx->mid_lsf_int_fx, 1)) + IF ( EQ_16(st_fx->mid_lsf_int, 1)) { FOR (j=1; jprev_bfi || ( EQ_16(st_fx->mid_lsf_int_fx, 1) && bad_spacing)) + IF ( st_fx->prev_bfi || ( EQ_16(st_fx->mid_lsf_int, 1) && bad_spacing)) { FOR (j=0; jprev_bfi ) { /* continue redoing mid-LSF interpolation with 0.4 in order not to propagate the error */ - st_fx->mid_lsf_int_fx = 1; + st_fx->mid_lsf_int = 1; move16(); } - if (st_fx->safety_net_fx ) + if (st_fx->safety_net ) { /* safety-net encountered -> stop redoing mid-LSF interpolation with 0.4 */ - st_fx->mid_lsf_int_fx = 0; + st_fx->mid_lsf_int = 0; move16(); } diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index eef159094..b6e8442fb 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1911,10 +1911,10 @@ typedef struct Decoder_State Word16 agc_mem_fx[2]; /* memory of AGC for saturation control Q0*/ int16_t mid_lsf_int; - Word16 mid_lsf_int_fx; + //Word16 mid_lsf_int; int16_t safety_net; - Word16 safety_net_fx; + //Word16 safety_net; float stab_fac_smooth_lt; float log_energy_old; @@ -1935,12 +1935,12 @@ typedef struct Decoder_State int16_t GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ - Word16 GSC_noisy_speech_fx; /* AC mode (GSC) - flag to indicate GSC osn SWB noisy speech */ + //Word16 GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC osn SWB noisy speech */ int16_t GSC_IVAS_mode; /* AC mode (GSC) - GSC IVAS mode */ int16_t Last_GSC_noisy_speech_flag; /* AC mode (GSC) - mem of the past flag to indicate GSC osn SWB noisy speech */ - Word16 Last_GSC_noisy_speech_flag_fx; /* AC mode (GSC) - mem of the past flag to indicate GSC osn SWB noisy speech */ + //Word16 Last_GSC_noisy_speech_flag; /* AC mode (GSC) - mem of the past flag to indicate GSC osn SWB noisy speech */ GSC_DEC_HANDLE hGSCDec; @@ -1954,13 +1954,13 @@ typedef struct Decoder_State ZERO_BWE_DEC_HANDLE hBWE_zero; /* HF (6-7kHz) BWE */ int16_t unv_cnt; /* Stationary noise UV modification - unvoiced frame counter */ - Word16 unv_cnt_fx; /* Stationary noise UV modification - unvoiced frame counter Q0*/ + //Word16 unv_cnt; /* Stationary noise UV modification - unvoiced frame counter Q0*/ int16_t uv_count; /* Stationary noise UV modification - unvoiced counter */ - Word16 uv_count_fx; /* Stationary noise UV modification - unvoiced counter Q0*/ + //Word16 uv_count; /* Stationary noise UV modification - unvoiced counter Q0*/ int16_t act_count; /* Stationary noise UV modification - activation counter */ - Word16 act_count_fx; /* Stationary noise UV modification - activation counter Q0*/ + //Word16 act_count; /* Stationary noise UV modification - activation counter Q0*/ float ge_sm; /* Stationary noise UV modification - smoothed excitation gain */ Word32 ge_sm_fx; /* Stationary noise UV modification - smoothed excitation gain Q(GE_SHIFT)*/ @@ -1969,7 +1969,7 @@ typedef struct Decoder_State Word16 lspold_s_fx[M]; /* Stationary noise UV modification - old LSP vector Q15*/ int16_t noimix_seed; /* Stationary noise UV modification - mixture seed */ - Word16 noimix_seed_fx; /* Stationary noise UV modification - mixture seed Q0*/ + //Word16 noimix_seed; /* Stationary noise UV modification - mixture seed Q0*/ float min_alpha; /* Stationary noise UV modification - minimum alpha */ Word16 min_alpha_fx; /* Stationary noise UV modification - minimum alpha Q15*/ @@ -2057,7 +2057,7 @@ typedef struct Decoder_State WI_DEC_HANDLE hWIDec; int16_t relax_prev_lsf_interp; - Word16 relax_prev_lsf_interp_fx; + //Word16 relax_prev_lsf_interp; float mem_syn_clas_estim[L_SYN_MEM_CLAS_ESTIM]; /* FEC - memory of the synthesis signal for frame class estimation */ Word16 mem_syn_clas_estim_fx[L_SYN_MEM_CLAS_ESTIM]; /* FEC - memory of the synthesis signal for frame class estimation */ @@ -2102,7 +2102,7 @@ typedef struct Decoder_State Word16 mem_preemp_preQ_fx; /* ACELP@16kHz - prequantizer preemhasis memory */ int16_t last_nq_preQ; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ - Word16 last_nq_preQ_fx; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ + //Word16 last_nq_preQ; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ int16_t last_code_preq; /* ACELP@16kHz - last coefficient of the pre-quantizer contribution */ @@ -2164,16 +2164,16 @@ typedef struct Decoder_State SC_VBR_DEC_HANDLE hSC_VBR; int16_t last_ppp_mode_dec; - Word16 last_ppp_mode_dec_fx; /*Q0*/ + //Word16 last_ppp_mode_dec; /*Q0*/ int16_t ppp_mode_dec; - Word16 ppp_mode_dec_fx; /*Q0*/ + //Word16 ppp_mode_dec; /*Q0*/ int16_t last_nelp_mode_dec; // Word16 last_nelp_mode_dec; int16_t nelp_mode_dec; - Word16 nelp_mode_dec_fx; /* Q0 */ + //Word16 nelp_mode_dec; /* Q0 */ float prev_gain_pit_dec; Word16 prev_gain_pit_dec_fx; /*Q14*/ @@ -2182,10 +2182,10 @@ typedef struct Decoder_State Word16 prev_tilt_code_dec_fx; /*Q15*/ int16_t vbr_hw_BWE_disable_dec; - Word16 vbr_hw_BWE_disable_dec_fx; + //Word16 vbr_hw_BWE_disable_dec; int16_t last_vbr_hw_BWE_disable_dec; - Word16 last_vbr_hw_BWE_disable_dec_fx; + //Word16 last_vbr_hw_BWE_disable_dec; /*----------------------------------------------------------------------------------* * channel-aware mode @@ -2227,7 +2227,7 @@ typedef struct Decoder_State //Word16 last_core_fx; /*Q0*/ int16_t last_core_from_bs; /* last frame core as coded in TCX bitstream */ - Word16 last_core_bs_fx; + //Word16 last_core_bs_fx; int16_t last_L_frame_ori; //Word16 last_L_frame_ori_fx; @@ -2265,7 +2265,7 @@ typedef struct Decoder_State TD_BWE_DEC_HANDLE hBWE_TD; int16_t old_bwe_delay; - Word16 old_bwe_delay_fx; /*Q0*/ + //Word16 old_bwe_delay; /*Q0*/ float hb_prev_synth_buffer[NS2SA( 48000, DELAY_BWE_TOTAL_NS )]; Word16 hb_prev_synth_buffer_fx[NS2SA(48000, DELAY_BWE_TOTAL_NS)]; @@ -2293,7 +2293,7 @@ typedef struct Decoder_State Word32 prev_enerLL_fx; int16_t prev_fractive; - Word16 prev_fractive_fx; + //Word16 prev_fractive; int16_t prev_bws_cnt; // Word16 prev_bws_cnt; @@ -2612,7 +2612,7 @@ typedef struct Decoder_State uint8_t m_old_frame_type; /*ZERO_FRAME/SID_FRAME/ACTIVE_FRAME*/ int16_t old_ppp_mode; - Word16 old_ppp_mode_fx; + //Word16 old_ppp_mode; int16_t con_tcx; int16_t last_con_tcx; diff --git a/lib_dec/stat_noise_uv_dec_fx.c b/lib_dec/stat_noise_uv_dec_fx.c index 0a576f1f5..a090fdfc7 100644 --- a/lib_dec/stat_noise_uv_dec_fx.c +++ b/lib_dec/stat_noise_uv_dec_fx.c @@ -45,7 +45,7 @@ void stat_noise_uv_dec_fx( *-----------------------------------------------------------------*/ IF (EQ_16(coder_type,INACTIVE)) { - IF (GT_16(st_fx->unv_cnt_fx,20)) + IF (GT_16(st_fx->unv_cnt,20)) { /*ftmp = st->lp_gainc * st->lp_gainc;*/ L_tmp = L_mult0(st_fx->lp_gainc_fx, st_fx->lp_gainc_fx); /*Q3 * Q3 ->Q6*/ @@ -64,20 +64,20 @@ void stat_noise_uv_dec_fx( } ELSE { - st_fx->unv_cnt_fx = add(st_fx->unv_cnt_fx,1); + st_fx->unv_cnt = add(st_fx->unv_cnt,1); } } ELSE { - st_fx->unv_cnt_fx = 0; + st_fx->unv_cnt = 0; move16(); } IF (!st_fx->Opt_AMR_WB) { stat_noise_uv_mod_fx( coder_type, noisiness, st_fx->lsp_old_fx, lsp_new, lsp_mid, Aq - ,exc2, st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count_fx, &st_fx->act_count_fx, - st_fx->lspold_s_fx, &st_fx->noimix_seed_fx, &st_fx->min_alpha_fx, + ,exc2, st_fx->Q_exc, 0, &st_fx->ge_sm_fx, &st_fx->uv_count, &st_fx->act_count, + st_fx->lspold_s_fx, &st_fx->noimix_seed, &st_fx->min_alpha_fx, &st_fx->exc_pe_fx, st_fx->core_brate, st_fx->bwidth, &st_fx->Q_stat_noise, &st_fx->Q_stat_noise_ge ); } diff --git a/lib_dec/swb_tbe_dec.c b/lib_dec/swb_tbe_dec.c index ac5a2f701..d3993caf1 100644 --- a/lib_dec/swb_tbe_dec.c +++ b/lib_dec/swb_tbe_dec.c @@ -1167,10 +1167,10 @@ void ivas_swb_tbe_dec_fx( test(); test(); test(); - IF((st->prev_fractive_fx == 0 && + IF((st->prev_fractive == 0 && (LT_32(st->prev_enerLH_fx, L_shl(st->enerLH_fx, 1)) && GT_32(st->prev_enerLH_fx, L_shr(st->enerLH_fx, 1)) && LT_32(st->prev_enerLL_fx, L_shl(st->enerLL_fx, 1)) && GT_32(st->prev_enerLL_fx, L_shr(st->enerLL_fx, 1)))) - || (EQ_16(st->prev_fractive_fx, 1) && + || (EQ_16(st->prev_fractive, 1) && GT_32(L_shr(st->prev_enerLH_fx, 2), Mult_32_16(st->enerLH_fx, 24576))) /* 24576 in Q13*/ || (GT_32(L_shr(st->enerLL_fx, 1), Mult_32_16(st->enerLH_fx, 24576)) && /*24576 = 1.5 in Q14*/ LT_16(st->tilt_wb_fx, 20480))/* 20480 = 10 in Q11*/ @@ -2464,7 +2464,7 @@ void ivas_swb_tbe_dec_fx( { IF(GT_16(st->tilt_wb_fx, 8192)) { - IF(st->prev_fractive_fx == 0) + IF(st->prev_fractive == 0) { st->tilt_wb_fx = 8192; } @@ -2585,14 +2585,14 @@ void ivas_swb_tbe_dec_fx( test(); test(); IF((LT_32(L_shr(st->prev_enerLH_fx, 1), st->enerLH_fx) && GT_32(st->prev_enerLH_fx,L_shr(st->enerLH_fx,1))) - && (LT_32(L_shr(st->prev_enerLL_fx, 1), st->enerLL_fx) && GT_32(st->prev_enerLL_fx, L_shr(st->enerLL_fx, 1))) && (is_fractive ^ st->prev_fractive_fx) == 0) + && (LT_32(L_shr(st->prev_enerLL_fx, 1), st->enerLL_fx) && GT_32(st->prev_enerLL_fx, L_shr(st->enerLL_fx, 1))) && (is_fractive ^ st->prev_fractive) == 0) { GainFrame_fx = L_add(L_shr(GainFrame_fx, 1), L_shr(GainFrame_prevfrm_fx, 1)); } ELSE { test(); - IF(is_fractive == 0 && EQ_16(st->prev_fractive_fx, 1)) + IF(is_fractive == 0 && EQ_16(st->prev_fractive, 1)) { L_tmp1 = L_shl(Mult_32_16(GainFrame_fx, 3277), 13); /* 31 */ L_tmp = L_sub(2147483647, L_tmp1); /* 31 */ diff --git a/lib_dec/swb_tbe_dec_fx.c b/lib_dec/swb_tbe_dec_fx.c index 249130b70..17dc79be0 100644 --- a/lib_dec/swb_tbe_dec_fx.c +++ b/lib_dec/swb_tbe_dec_fx.c @@ -1869,10 +1869,10 @@ void swb_tbe_dec_fx( test(); test(); test(); - IF( (st_fx->prev_fractive_fx == 0 && + IF( (st_fx->prev_fractive == 0 && (LT_32( st_fx->prev_enerLH_fx, L_shl( st_fx->enerLH_fx, 1 ) ) && GT_32( st_fx->prev_enerLH_fx, L_shr( st_fx->enerLH_fx, 1 ) ) && LT_32( st_fx->prev_enerLL_fx, L_shl( st_fx->enerLL_fx, 1 ) ) && GT_32( st_fx->prev_enerLL_fx, L_shr( st_fx->enerLL_fx, 1 ) ) )) - || (EQ_16(st_fx->prev_fractive_fx,1) && + || (EQ_16(st_fx->prev_fractive,1) && GT_32(L_shr(st_fx->prev_enerLH_fx,2), Mult_32_16(st_fx->enerLH_fx,24576)) ) /* 24576 in Q13*/ || (GT_32(L_shr(st_fx->enerLL_fx,1), Mult_32_16(st_fx->enerLH_fx, 24576)) && /*24576 = 1.5 in Q14*/ LT_16(st_fx->tilt_wb_fx, 20480) )/* 20480 = 10 in Q11*/ @@ -1917,7 +1917,7 @@ void swb_tbe_dec_fx( !(L_sub(L_shr(st_fx->prev_enerLH_fx, 1), st_fx->enerLH_fx) < 0 &&L_sub(st_fx->prev_enerLH_fx, L_shr(st_fx->enerLH_fx,1)>0))) || sub(st_fx->last_core, ACELP_CORE) != 0 || (sub(st_fx->last_core, ACELP_CORE) == 0 && L_sub(L_abs(L_sub(st_fx->last_core_brate, st_fx->core_brate)), 3600) > 0) - || sub((is_fractive ^ st_fx->prev_fractive_fx), 1) == 0 ) + || sub((is_fractive ^ st_fx->prev_fractive), 1) == 0 ) { set16_fx( GainShape, 11587, NUM_SHB_SUBFR ); } @@ -2606,7 +2606,7 @@ void swb_tbe_dec_fx( /*bandwidth switching should be updated*/ if( GT_16( st_fx->tilt_swb_fx, 16384 )) { - st_fx->prev_fractive_fx = 1; + st_fx->prev_fractive = 1; move16(); } @@ -2623,7 +2623,7 @@ void swb_tbe_dec_fx( move16(); } test(); - if( st_fx->prev_fractive_fx == 1 && GT_16( st_fx->tilt_wb_fx, 1024 )) + if( st_fx->prev_fractive == 1 && GT_16( st_fx->tilt_wb_fx, 1024 )) { st_fx->tilt_wb_fx = 1024; move16(); @@ -2633,7 +2633,7 @@ void swb_tbe_dec_fx( { IF(GT_16(st_fx->tilt_wb_fx, 8192)) { - IF(st_fx->prev_fractive_fx == 0) + IF(st_fx->prev_fractive == 0) { st_fx->tilt_wb_fx = 8192; } @@ -2692,7 +2692,7 @@ void swb_tbe_dec_fx( } test(); - IF( EQ_16((is_fractive & st_fx->prev_fractive_fx), 1)&>_32(GainFrame,GainFrame_prevfrm_fx)) + IF( EQ_16((is_fractive & st_fx->prev_fractive), 1)&>_32(GainFrame,GainFrame_prevfrm_fx)) { GainFrame = L_add(Mult_32_16(GainFrame_prevfrm_fx, 26214), Mult_32_16(GainFrame, 6554));/* 18 +15 -15 = 18*/ } @@ -2703,14 +2703,14 @@ void swb_tbe_dec_fx( test(); test(); IF((LT_32(L_shr(st_fx->prev_enerLH_fx, 1), st_fx->enerLH_fx)&& GT_32(st_fx->prev_enerLH_fx,L_shr(st_fx->enerLH_fx,1))) - && (LT_32(L_shr(st_fx->prev_enerLL_fx, 1), st_fx->enerLL_fx) && GT_32(st_fx->prev_enerLL_fx, L_shr(st_fx->enerLL_fx, 1)) ) && (is_fractive ^ st_fx->prev_fractive_fx) == 0) + && (LT_32(L_shr(st_fx->prev_enerLL_fx, 1), st_fx->enerLL_fx) && GT_32(st_fx->prev_enerLL_fx, L_shr(st_fx->enerLL_fx, 1)) ) && (is_fractive ^ st_fx->prev_fractive) == 0) { GainFrame = L_add(L_shr(GainFrame, 1), L_shr(GainFrame_prevfrm_fx, 1)); } ELSE { test(); - IF(is_fractive == 0 && EQ_16(st_fx->prev_fractive_fx, 1)) + IF(is_fractive == 0 && EQ_16(st_fx->prev_fractive, 1)) { L_tmp1 = L_shl(Mult_32_16(GainFrame, 3277), 13); /* 31 */ L_tmp = L_sub(2147483647, L_tmp1); /* 31 */ @@ -2821,7 +2821,7 @@ void swb_tbe_dec_fx( } } } - st_fx->prev_fractive_fx = is_fractive; + st_fx->prev_fractive = is_fractive; move16(); /* Adjust the subframe and frame gain of the synthesized shb signal */ diff --git a/lib_dec/updt_dec_fx.c b/lib_dec/updt_dec_fx.c index a386b83d6..9b0e16de0 100644 --- a/lib_dec/updt_dec_fx.c +++ b/lib_dec/updt_dec_fx.c @@ -59,7 +59,7 @@ void updt_dec_fx( test(); IF (st_fx->hGSCDec != NULL ) { - IF ((NE_16(st_fx->coder_type, AUDIO) || st_fx->Last_GSC_noisy_speech_flag_fx != 0) && st_fx->hGSCDec->Last_GSC_pit_band_idx_fx > 0) + IF ((NE_16(st_fx->coder_type, AUDIO) || st_fx->Last_GSC_noisy_speech_flag != 0) && st_fx->hGSCDec->Last_GSC_pit_band_idx_fx > 0) { st_fx->hGSCDec->Last_GSC_pit_band_idx_fx = 0; move16(); /*The temporal contribution of the GSC is meaningless after 1 frame lost for inactive & unvoiced content */ @@ -116,7 +116,7 @@ void updt_dec_fx( } /* update last GSC SWB speech flag for FEC */ - st_fx->Last_GSC_noisy_speech_flag_fx = st_fx->GSC_noisy_speech_fx; + st_fx->Last_GSC_noisy_speech_flag = st_fx->GSC_noisy_speech; move16(); /* update counter for FEC pitch estimate */ @@ -179,13 +179,13 @@ void updt_dec_fx( } /* SC-VBR */ - st_fx->old_ppp_mode_fx = st_fx->last_ppp_mode_dec_fx; + st_fx->old_ppp_mode = st_fx->last_ppp_mode_dec; move16(); - st_fx->last_ppp_mode_dec_fx = st_fx->ppp_mode_dec_fx; + st_fx->last_ppp_mode_dec = st_fx->ppp_mode_dec; move16(); - st_fx->last_nelp_mode_dec = st_fx->nelp_mode_dec_fx; + st_fx->last_nelp_mode_dec = st_fx->nelp_mode_dec; move16(); - st_fx->last_vbr_hw_BWE_disable_dec_fx = st_fx->vbr_hw_BWE_disable_dec_fx; + st_fx->last_vbr_hw_BWE_disable_dec = st_fx->vbr_hw_BWE_disable_dec; move16(); /*core switching updates*/ @@ -351,13 +351,13 @@ void updt_IO_switch_dec_fx( st_fx->psf_lp_noise_fx = round_fx(L_shl(st_fx->lp_noise,1)); /* reset VBR signalling */ - st_fx->last_ppp_mode_dec_fx = 0; + st_fx->last_ppp_mode_dec = 0; move16(); st_fx->last_nelp_mode_dec = 0; move16(); - st_fx->ppp_mode_dec_fx = 0; + st_fx->ppp_mode_dec = 0; move16(); - st_fx->nelp_mode_dec_fx = 0; + st_fx->nelp_mode_dec = 0; move16(); } diff --git a/lib_dec/voiced_dec_fx.c b/lib_dec/voiced_dec_fx.c index cb99fa9a3..e4ebaf4e2 100644 --- a/lib_dec/voiced_dec_fx.c +++ b/lib_dec/voiced_dec_fx.c @@ -211,7 +211,7 @@ ivas_error ppp_voiced_decoder_fx( } /* Restoring PPP memories when the last frame is non-PPP or full-rate PPP */ - IF (NE_16(st_fx->last_ppp_mode_dec_fx,1)) + IF (NE_16(st_fx->last_ppp_mode_dec,1)) { GetSinCosTab_fx(pl, S_fx, C_fx); diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index e2514d5db..76dc25558 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -2470,7 +2470,7 @@ typedef struct enc_core_structure // GSC_ENC_HANDLE hGSCEnc; // // -// Word16 GSC_noisy_speech_fx; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ +// Word16 GSC_noisy_speech; /* AC mode (GSC) - flag to indicate GSC on SWB noisy speech */ // // SP_MUS_CLAS_HANDLE hSpMusClas; // @@ -2515,11 +2515,11 @@ typedef struct enc_core_structure // // Word16 lp_noise_fx; /* CNG and DTX - LP filtered total noise estimation */ // -// Word16 uv_count_fx; /*Q0*/ /* Stationary noise UV modification - unvoiced counter */ -// Word16 act_count_fx; /*Q0*/ /* Stationary noise UV modification - activation counter */ +// Word16 uv_count; /*Q0*/ /* Stationary noise UV modification - unvoiced counter */ +// Word16 act_count; /*Q0*/ /* Stationary noise UV modification - activation counter */ // Word32 ge_sm_fx; /* Stationary noise UV modification - smoothed excitation gain */ // Word16 lspold_s_fx[M]; /*Q15*/ /* Stationary noise UV modification - old LSP vector */ -// Word16 noimix_seed_fx; /*Q0*/ /* Stationary noise UV modification - mixture seed */ +// Word16 noimix_seed; /*Q0*/ /* Stationary noise UV modification - mixture seed */ // Word16 min_alpha_fx; /*Q15*/ /* Stationary noise UV modification - minimum alpha */ // Word16 exc_pe_fx; /* Stationary noise UV modification - memory of the preemphasis filter */ // @@ -2527,7 +2527,7 @@ typedef struct enc_core_structure // Word16 mem_preemph16k_fx; /* ACELP@16kHz - preemphasis filter memory @16kHz */ // Word16 mem_deemp_preQ_fx; /* ACELP@16kHz - prequantizer deemhasis memory */ // Word16 mem_preemp_preQ_fx; /* ACELP@16kHz - prequantizer preemhasis memory */ -// Word16 last_nq_preQ_fx; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ +// Word16 last_nq_preQ; /* ACELP@16kHz - AVQ subquantizer number of the last sub-band of the last subframe */ // Word16 use_acelp_preq; /* ACELP@16kHz - flag of prequantizer usage */ // // Word16 bpf_off_fx; -- GitLab