From 3ed639c2f63aad7da35b91a03a99341f1a63f879 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 11 Jul 2024 22:22:02 +0530 Subject: [PATCH] Fix for LTV crash for OMASA stream [x] Test case - ltv-OMASA 2Dir1TC 3ISM at 24.4 kbps, 48kHz in, 16kHz out, FOA out, FER at 10% --- lib_dec/fd_cng_dec_fx.c | 6 +++--- lib_dec/ivas_stereo_cng_dec.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/fd_cng_dec_fx.c b/lib_dec/fd_cng_dec_fx.c index f4cf173f5..c02850ada 100644 --- a/lib_dec/fd_cng_dec_fx.c +++ b/lib_dec/fd_cng_dec_fx.c @@ -2853,10 +2853,10 @@ void perform_noise_estimation_dec_ivas_fx( /* energy significantly decreases in one of the larger partitions during active frames -> downward update */ FOR( p = CNA_ACT_DN_LARGE_PARTITION; p < npart; p++ ) { - L_tmp = L_shr( hFdCngDec->msPeriodog_ST_fx[p], sub( sub( 31, hFdCngDec->msPeriodog_ST_exp ), 4 ) ); - IF( LT_32( hFdCngDec->msPeriodog_ST_fx[p], msNoiseEst[p] ) ) + L_tmp = L_shr( hFdCngDec->msPeriodog_ST_fx[p], sub( hFdCngDec->msNoiseEst_exp, hFdCngDec->msPeriodog_ST_exp ) ); + IF( LT_32( L_tmp, msNoiseEst[p] ) ) { - msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), Mpy_32_16_1( L_tmp, (Word16) L_sub( ONE_IN_Q15, CNA_ACT_DN_FACT_Q15 ) ) ); + msNoiseEst[p] = L_add( Mpy_32_16_1( msNoiseEst[p], CNA_ACT_DN_FACT_Q15 ), Mpy_32_16_1( L_tmp, ONE_IN_Q15 - CNA_ACT_DN_FACT_Q15 ) ); move32(); } } diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 5aef907a7..eef15da05 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -1377,7 +1377,7 @@ static void stereo_dft_generate_comfort_noise_fx( IF( ( st->hFdCngDec->smoothed_psd_fx[i] > 0 ) && GT_32( Mpy_32_16_1( ftmp, (Word16) 0x3333 ), L_shr_sat( st->hFdCngDec->smoothed_psd_fx[i], l_shift_val ) ) ) { /* prevent abrupt upward update steps */ - ftmp = L_add( L_shl( st->hFdCngDec->smoothed_psd_fx[i], 2 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 1 ) ); + ftmp = L_add( L_shl( st->hFdCngDec->smoothed_psd_fx[i], 1 ), L_shr( st->hFdCngDec->smoothed_psd_fx[i], 1 ) ); l_shift_val = 0; move16(); } -- GitLab