From 2e47ef37fa2238967b21fbc8082c095c23ebcdc1 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 4 Nov 2024 20:30:54 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 979: OSBA 128kbps JBM - Saturations across whole signal [x] For this issue, MLD reduced from 88.xx to 12.xx. On debugging 12.xx artifacts, it was observed that it is due to different PLC mode in Float and Basop decoder. When tried giving same PLC mode in both all visible artifacts get resolved. --- lib_dec/ivas_mdct_core_dec.c | 7 ------- lib_dec/lib_dec_fx.c | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index caa01e7de..0550189ac 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -2163,11 +2163,6 @@ void ivas_mdct_core_reconstruct_fx( ELSE /*ACELP core for ACELP-PLC */ { 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; - move16(); - move16(); /* PLC: [TCX: TD PLC] */ IF( MCT_flag != 0 ) { @@ -2184,8 +2179,6 @@ 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] ); } } - - 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) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 9d1fb571c..1ec213673 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1105,9 +1105,22 @@ ivas_error IVAS_DEC_GetSamples( } ELSE { + Word32 max_val; + Word16 max_shift; + + maximum_32_fx( hIvasDec->apaExecBuffer_fx, APA_BUF_PER_CHANNEL * nTransportChannels, &max_val ); + IF( max_val ) + { + max_shift = sub( 31 - 3, norm_l( L_shr( max_val, 11 ) ) ); + } + ELSE + { + max_shift = Q11; + move16(); + } FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i ) { - tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], Q12 ) ); // Q(-1) + tmp_apaExecBuffer[i] = extract_l( L_shr( hIvasDec->apaExecBuffer_fx[i], max_shift ) ); // Q(-1) } IF( apa_exec_ivas_fx( hIvasDec->hTimeScaler, tmp_apaExecBuffer, (UWord16) imult3216( hIvasDec->nSamplesFrame, nTransportChannels ), (UWord16) hIvasDec->tsm_max_scaling, tmp_apaExecBuffer, &nTimeScalerOutSamples ) != 0 ) { @@ -1116,7 +1129,7 @@ ivas_error IVAS_DEC_GetSamples( FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i ) { - hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], Q12 ); // Q11 + hIvasDec->apaExecBuffer_fx[i] = L_shl( tmp_apaExecBuffer[i], max_shift ); // Q11 } } assert( LE_32( (Word32) nTimeScalerOutSamples, APA_BUF ) ); -- GitLab From a930638c710eba58d3485fcf2be4eb96785f87ce Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Tue, 5 Nov 2024 08:38:48 +0530 Subject: [PATCH 2/2] Fix for JBM MLD cases --- lib_dec/lib_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 1ec213673..90b3eb4d8 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -1111,11 +1111,11 @@ ivas_error IVAS_DEC_GetSamples( maximum_32_fx( hIvasDec->apaExecBuffer_fx, APA_BUF_PER_CHANNEL * nTransportChannels, &max_val ); IF( max_val ) { - max_shift = sub( 31 - 3, norm_l( L_shr( max_val, 11 ) ) ); + max_shift = s_max( Q12, sub( 31 - 3, norm_l( L_shr( max_val, 11 ) ) ) ); } ELSE { - max_shift = Q11; + max_shift = Q12; move16(); } FOR( Word32 i = 0; i < APA_BUF_PER_CHANNEL * nTransportChannels; ++i ) -- GitLab