From 4a26af6383200d1114e60a68de51d462ce2f74e4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Wed, 31 Jan 2024 09:32:06 +0530 Subject: [PATCH] Update td_stereo_param_updt_fx to avoid a crash [x] Update td_stereo_param_updt_fx function to resolve a crash [x] getTCXparam fixed function call reverted to float as some dependency observed which leads to crash. --- lib_com/ivas_stereo_td_bit_alloc.c | 20 +++++++++++++++----- lib_dec/ivas_tcx_core_dec.c | 7 +------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib_com/ivas_stereo_td_bit_alloc.c b/lib_com/ivas_stereo_td_bit_alloc.c index e7db2b48b..2a9f5a8d0 100644 --- a/lib_com/ivas_stereo_td_bit_alloc.c +++ b/lib_com/ivas_stereo_td_bit_alloc.c @@ -521,14 +521,24 @@ void td_stereo_param_updt_fx( } /* This is only to keep the buffer up-to-date */ - Word16 mult_factor = float_to_fix16( 0.8f, 15 ); - + Word16 mult_factor = 26214/*0.8f in Q15*/; + Word16 min_tdm_Pri_pitch_buf_fx = 0; + Word16 Flag = 0; IF( flag_ACELP16k == 1 ) { - FOR( i = 0; i < NB_SUBFR; i++ ) + FOR(i = 0; i < NB_SUBFR; i++) + { + tdm_Pri_pitch_buf_fx[i] = mult(pitch_buf_PCh_fx[i], mult_factor); + min_tdm_Pri_pitch_buf_fx = s_min(tdm_Pri_pitch_buf_fx[i], min_tdm_Pri_pitch_buf_fx); + } + Flag = BASOP_Util_Cmp_Mant32Exp( L_deposit_l(min_tdm_Pri_pitch_buf_fx), 31 - Q_var, PIT_MIN, 31 ); + IF(Flag == -1) { - tdm_Pri_pitch_buf_fx[i] = mult( pitch_buf_PCh_fx[i], mult_factor ); - tdm_Pri_pitch_buf_fx[i] = max( tdm_Pri_pitch_buf_fx[i], float_to_fix16( PIT_MIN, Q_var ) ); + FOR(i = 0; i < NB_SUBFR; i++) + { + + tdm_Pri_pitch_buf_fx[i] = s_max(tdm_Pri_pitch_buf_fx[i], shr(PIT_MIN, Q_var)); + } } } ELSE diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index a7a8cb208..510656a16 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -895,12 +895,7 @@ static void dec_prm_tcx( if ( st->use_partial_copy == 0 ) { - getTCXparam( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 ); - // Q-factor for hTcxLtpDec->tcxltp_gain is 15 - // To be removed later - st->hTcxLtpDec->tcxltp_gain_float = fixedToFloat( st->hTcxLtpDec->tcxltp_gain, 15 ); - st->hTcxDec->tcxltp_last_gain_unmodified_float = st->hTcxLtpDec->tcxltp_gain_float; - // + getTCXparam_ivas( st, st, hm_cfg, param, bits_common, start_bit_pos, NULL, NULL, NULL, -1 ); } if ( !st->use_partial_copy ) -- GitLab