From d6f7d097fc14a6b7f2a1a7c7194daee6f5648e23 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 30 Aug 2024 10:21:25 +0530 Subject: [PATCH 1/2] Fix for crash observed for SBA format with LTV streams --- lib_dec/tonalMDCTconcealment.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 41185a126..f27836c0e 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -1457,7 +1457,7 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx( const Word16 L_frame, const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode ) { - Word16 inc, start_idx, stop_idx; + Word16 inc, start_idx, stop_idx, i; Word32 *noiseLevelPtr, *scfs_bg, *scfs_for_shaping; Word16 noiseLevelPtr_exp; HANDLE_FD_CNG_COM hFdCngCom; @@ -1533,8 +1533,23 @@ void TonalMdctConceal_whiten_noise_shape_ivas_fx( q_wns = sub( sub( 31, noiseLevelPtr_exp ), 3 ); sns_shape_spectrum_fx( whitenend_noise_shape, &q_wns, psychParams, scfs_for_shaping, Q16, L_frame, NULL ); - Copy32( whitenend_noise_shape + start_idx, hFdCngCom->cngNoiseLevel, sub( stop_idx, start_idx ) ); - hFdCngCom->cngNoiseLevelExp = sub( Q30, q_wns ); + IF( GT_16( add( q_wns, 1 ), sub( 31, hFdCngCom->cngNoiseLevelExp ) ) ) + { + FOR( i = 0; i < sub( stop_idx, start_idx ); i++ ) + { + hFdCngCom->cngNoiseLevel[i] = L_shr( whitenend_noise_shape[start_idx + i], sub( add( q_wns, hFdCngCom->cngNoiseLevelExp ), 30 ) ); + move32(); + } + } + ELSE + { + Copy32( whitenend_noise_shape + start_idx, hFdCngCom->cngNoiseLevel, sub( stop_idx, start_idx ) ); + + scale_sig32( hFdCngCom->cngNoiseLevel + sub( stop_idx, start_idx ), sub( FFTCLDFBLEN, sub( stop_idx, start_idx ) ), sub( add( q_wns, hFdCngCom->cngNoiseLevelExp ), 30 ) ); + + hFdCngCom->cngNoiseLevelExp = sub( Q30, q_wns ); // Exponent = 31 - (q_wns + 1) + move16(); + } } ELSE { -- GitLab From 4713fad1a60fb4ce0d1bc9e09049775209b95648 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 30 Aug 2024 16:31:22 +0530 Subject: [PATCH 2/2] Disable new hp20 changes and LTV crash fix --- lib_com/options.h | 2 +- lib_dec/tonalMDCTconcealment_fx.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index aa53a1e54..6601c0d5e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,7 +111,7 @@ #define FIX_818_COMPLEXITY_IMPROV /* Fix for issue 818 */ #define FIX_805_VERIFICATION /* Fix for issue 805 */ #define FIX_827_HIGH_MLD /* Fix for issue 827 */ -#define HP20_FIX32_RECODING /* Improved hp20 filtering code */ +//#define HP20_FIX32_RECODING /* Improved hp20 filtering code */ #endif #define ISM_DISABLE #define FIX_TMP_714 diff --git a/lib_dec/tonalMDCTconcealment_fx.c b/lib_dec/tonalMDCTconcealment_fx.c index 7203bf992..1b96b3b8f 100644 --- a/lib_dec/tonalMDCTconcealment_fx.c +++ b/lib_dec/tonalMDCTconcealment_fx.c @@ -1505,7 +1505,11 @@ void TonalMDCTConceal_InsertNoise_ivas_fx( num = L_shr( num, 1 ); exp = add( exp, 1 ); } +#ifdef BASOP_NOGLOB + tmp = div_l( num, round_fx_sat( den ) ); +#else tmp = div_l( num, round_fx( den ) ); +#endif tmp = Sqrt16( tmp, &exp ); g = mult_r( g, tmp ); // exponent of g = exp -- GitLab