From 221a6da1724eccc1abc72abe5b2d196c07e40406 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 18 Nov 2024 13:32:13 +0530 Subject: [PATCH] Fix for 3GPP issue 1028: OSBA 192 kbps: Concealment introduces clicks link #1028 --- lib_dec/er_dec_tcx_fx.c | 4 ++-- lib_dec/ivas_mdct_core_dec.c | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lib_dec/er_dec_tcx_fx.c b/lib_dec/er_dec_tcx_fx.c index 897d6f2e7..53cd15c4f 100644 --- a/lib_dec/er_dec_tcx_fx.c +++ b/lib_dec/er_dec_tcx_fx.c @@ -2151,7 +2151,7 @@ void con_tcx_ivas_fx( move16(); /* update memory for low band */ - st->Q_syn = 0; + st->Q_syn = Q_syn; move16(); Scale_sig( hTcxDec->old_syn_Overl, shr( st->L_frame, 1 ), sub( -1, Q_syn ) ); /*Q_syn*/ lerp( hTcxDec->syn_OverlFB, hTcxDec->syn_Overl, shr( st->L_frame, 1 ), shr( L_frame, 1 ) ); @@ -2159,7 +2159,7 @@ void con_tcx_ivas_fx( hTcxDec->Q_syn_Overl_TDAC = hTcxDec->Q_syn_Overl_TDACFB; move16(); lerp( st->hHQ_core->old_out_fx, st->hHQ_core->old_out_LB_fx, st->L_frame, L_frame ); - + st->hHQ_core->Q_old_wtda_LB = Q_syn; st->old_enr_LP = Enr_1_Az_fx( A_local, L_SUBFR ); /*Q3*/ move16(); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index e86d211f9..bc011058c 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -2162,9 +2162,9 @@ void ivas_mdct_core_reconstruct_fx( { assert( EQ_16( st->bfi, 1 ) ); - Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), negate( q_syn ) ); // Q0 - Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), negate( q_syn ) ); // Q0 - q_syn = 0; + Scale_sig( synth_buf_fx, add( add( st->hTcxDec->old_synth_len, L_FRAME_PLUS ), M ), sub( -2, q_syn ) ); // Q0 + Scale_sig( synth_bufFB_fx, add( add( st->hTcxDec->old_synth_lenFB, L_FRAME_PLUS ), M ), sub( -2, q_syn ) ); // Q0 + q_syn = -2; move16(); /* PLC: [TCX: TD PLC] */ IF( MCT_flag != 0 ) @@ -2182,8 +2182,17 @@ void ivas_mdct_core_reconstruct_fx( con_tcx_ivas_fx( st, &synthFB_fx[0], hCPE->hStereoMdct->lastCoh_fx, &sts[0]->seed_acelp, 0, &st->hFdCngDec->hFdCngCom->A_cng[0] ); } } + st->hHQ_core->Q_old_wtda = add( st->hHQ_core->Q_old_wtda, q_syn ); + move16(); + st->hHQ_core->Q_old_wtda_LB = add( st->hHQ_core->Q_old_wtda_LB, q_syn ); + move16(); + st->hTcxDec->Q_syn_Overl_TDAC = add( st->hTcxDec->Q_syn_Overl_TDAC, q_syn ); + move16(); + st->hTcxDec->Q_syn_Overl_TDACFB = add( st->hTcxDec->Q_syn_Overl_TDACFB, q_syn ); + move16(); + st->Q_syn = q_syn; + move16(); - Scale_sig( synthFB_fx, st->hTcxDec->L_frameTCX, q_syn ); // q_syn IF( ( EQ_16( st->nbLostCmpt, 1 ) ) || ( st->hTcxDec->tcxConceal_recalc_exc != 0 ) ) { Scale_sig( synthFB_fx - add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), add( add( shr( st->hTcxDec->L_frameTCX, 1 ), st->hTcxDec->pit_max_TCX ), 2 * M ), sub( q_syn, sub( st->Q_exc, 1 ) ) ); // 2 * q_syn - (st->Q_exc - 1) @@ -2220,11 +2229,11 @@ void ivas_mdct_core_reconstruct_fx( /* Update FEC_scale_syn parameters */ IF( st->hTcxLtpDec->tcxltp_gain == 0 ) { - frame_ener_fx( st->L_frame, UNVOICED, synth_fx, shr( st->L_frame, 1 ), &st->enr_old_fx, st->L_frame, 0, 0, 0 ); + frame_ener_fx( st->L_frame, UNVOICED, synth_fx, shr( st->L_frame, 1 ), &st->enr_old_fx, st->L_frame, q_syn, 0, 0 ); } ELSE { - frame_ener_fx( st->L_frame, st->clas_dec, synth_fx, extract_l( L_shr( st->old_fpitch, 16 ) ), &st->enr_old_fx, st->L_frame, 0, 0, 0 ); + frame_ener_fx( st->L_frame, st->clas_dec, synth_fx, extract_l( L_shr( st->old_fpitch, 16 ) ), &st->enr_old_fx, st->L_frame, q_syn, 0, 0 ); } } @@ -2237,6 +2246,7 @@ void ivas_mdct_core_reconstruct_fx( move16(); move16(); Scale_sig( st->hTcxDec->old_synthFB_fx, st->hTcxDec->old_synth_lenFB, sub( st->Q_syn, q_syn ) ); // st->Q_syn + IF( st->hHQ_core != NULL ) { Copy( st->hHQ_core->old_out_fx + NS2SA( st->output_Fs, N_ZERO_MDCT_NS ), st->hTcxDec->old_synthFB_fx + st->hTcxDec->old_synth_lenFB, NS2SA( st->output_Fs, PH_ECU_LOOKAHEAD_NS ) ); -- GitLab