From 7416680588af1be551f094b3f0b2abbcfbf7476b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 18 Oct 2024 10:38:16 +0530 Subject: [PATCH] Fix for 3gpp issue 896: Decoder crashed when decoding SBA bitstreams with deterministic loss pattern [x] Changed Q of subFrameTotalEne_fx inside ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices_fx --- lib_rend/ivas_dirac_dec_binaural_functions.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index 21c49189e..08ed2c26e 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -2400,7 +2400,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric instEne_fx = Mpy_32_32( inRe_fx[ch][slot][bin], inRe_fx[ch][slot][bin] ); // 2q - 31 instEne_fx = L_add( instEne_fx, Mpy_32_32( inIm_fx[ch][slot][bin], inIm_fx[ch][slot][bin] ) ); // 2q - 31 hDiracDecBin->ChEne_fx[ch][bin] = BASOP_Util_Add_Mant32Exp( hDiracDecBin->ChEne_fx[ch][bin], hDiracDecBin->ChEne_e[ch][bin], instEne_fx, sub( 66, shl( q, 1 ) ), &hDiracDecBin->ChEne_e[ch][bin] ); - subFrameTotalEne_fx[bin] = L_add( subFrameTotalEne_fx[bin], instEne_fx ); // 2q - 31 + subFrameTotalEne_fx[bin] = L_add( subFrameTotalEne_fx[bin], L_shr( instEne_fx, 1 ) ); // 2q - 32 move32(); move32(); } @@ -2408,7 +2408,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } q = sub( q, 2 ); - q_subFrameTotalEne = sub( shl( q, 1 ), 31 ); + q_subFrameTotalEne = sub( shl( q, 1 ), 32 ); /* Apply EQ at low bit rates */ IF( applyLowBitRateEQ != 0 ) @@ -2417,12 +2417,12 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric FOR( bin = LOW_BIT_RATE_BINAURAL_EQ_OFFSET; bin < lastEqBin; bin++ ) { - subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[bin] ); // 2q -31 + subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[bin] ); // 2q -32 move32(); } FOR( ; bin < nBins; bin++ ) { - subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[lastEqBin] ); // 2q -31 + subFrameTotalEne_fx[bin] = Mpy_32_32( subFrameTotalEne_fx[bin], lowBitRateEQ_fx[lastEqBin] ); // 2q -32 move32(); } } @@ -2434,9 +2434,6 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric Word32 tempRe, tempIm; Word32 subFrameSumEne_fx[CLDFB_NO_CHANNELS_MAX]; - scale_sig32( subFrameTotalEne_fx, nBins, -2 ); - q_subFrameTotalEne = sub( q_subFrameTotalEne, 1 ); - set32_fx( subFrameSumEne_fx, 0, CLDFB_NO_CHANNELS_MAX ); FOR( slot = 0; slot < hSpatParamRendCom->subframe_nbslots[subframe]; slot++ ) { @@ -2444,13 +2441,13 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric { tempRe = L_add( inRe_fx[0][slot][bin], inRe_fx[1][slot][bin] ); // q tempIm = L_add( inIm_fx[0][slot][bin], inIm_fx[1][slot][bin] ); // q - subFrameSumEne_fx[bin] = L_add( subFrameSumEne_fx[bin], L_add( L_shr( Mpy_32_32( tempRe, tempRe ), 1 ), L_shr( Mpy_32_32( tempIm, tempIm ), 1 ) ) ); // 2q -31 + subFrameSumEne_fx[bin] = L_add( subFrameSumEne_fx[bin], L_add( L_shr( Mpy_32_32( tempRe, tempRe ), 1 ), L_shr( Mpy_32_32( tempIm, tempIm ), 1 ) ) ); // 2q -32 move32(); } } FOR( bin = 0; bin < nBins; bin++ ) { - subFrameTotalEne_fx[bin] = L_max( subFrameTotalEne_fx[bin], subFrameSumEne_fx[bin] ); // 2q -31 + subFrameTotalEne_fx[bin] = L_max( subFrameTotalEne_fx[bin], subFrameSumEne_fx[bin] ); // 2q -32 move32(); } } @@ -2477,7 +2474,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric * HRTF data set and a BRIR-based data set. The HRTF data set is spectrally corrected to match * the early spectrum of the BRIR data, using the spectral correction data in * hBinaural->earlyPartEneCorrection[bin], based on the BRIR set. */ - meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( 2q - 31 ) + meanEnePerCh_fx = Mpy_32_32( hDiracDecBin->earlyPartEneCorrection_fx[bin], subFrameTotalEne_fx[bin] ); // Q( q_meanEnePerCh ) q_meanEnePerCh = sub( add( q_earlyPartEneCorrection, q_subFrameTotalEne ), 30 ); /* Determine direct part target covariance matrix (for 1 or 2 directions) */ FOR( dirIndex = 0; dirIndex < hSpatParamRendCom->numSimultaneousDirections; dirIndex++ ) -- GitLab