From d0f1ba455a5266495f2ce0da5cc276e89c87d25b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 13 Jan 2025 14:40:27 +0530 Subject: [PATCH 1/2] Fix for 3GPP issue 1156: Encoder crash for Stereo at 32kbps in SWB_BWE_encoding_ivas_fx() Link #1156 --- lib_com/options.h | 1 + lib_enc/swb_bwe_enc_fx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index d2f32a1ce..5840a67dd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -115,4 +115,5 @@ #define FIX_ISSUE_1154 /* Ittiam: Fix for Issue 1154: Encoder crash for ParamMC 7.1 at 96kbps in ivas_param_mc_param_est_enc_fx() */ #define FIX_ISSUE_1157 /* Ittiam: Fix for Issue 1157: Encoder crash for Stereo at 48/64kbps DTX on/off in kernel_switch_trafo_fx() */ #define FIX_ISSUE_1152 /* Ittiam: Fix for issue 1152: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from find_tilt_fx function*/ +#define FIX_ISSUE_1156 /* Ittiam: Fix for Issue 1156: Encoder crash for Stereo at 32kbps in SWB_BWE_encoding_ivas_fx() */ #endif diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index ef16b333c..11efe0a59 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -3349,7 +3349,15 @@ static Word16 SWB_BWE_encoding_ivas_fx( expn = sub( sub( 30, expn ), sub( shl( Q_insig_lp, 1 ), 7 ) ); expd = norm_l( WB_tenv_syn_fx ); +#ifdef FIX_ISSUE_1156 +#ifdef BASOP_NOGLOB + den = round_fx_o( L_shl( WB_tenv_syn_fx, expd ), &Overflow ); +#else + den = round_fx( L_shl( WB_tenv_syn_fx, expd ) ); +#endif +#else den = round_fx( L_shl( WB_tenv_syn_fx, expd ) ); +#endif expd = sub( sub( 30, expd ), sub( shl( st_fx->Q_syn2, 1 ), 7 ) ); scale = shr( sub( den, num ), 15 ); -- GitLab From 0c8d3f17fa3d95286b63451644ad79178505d6f2 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 13 Jan 2025 15:02:19 +0530 Subject: [PATCH 2/2] Clang formatting changes --- lib_enc/swb_bwe_enc_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/swb_bwe_enc_fx.c b/lib_enc/swb_bwe_enc_fx.c index 11efe0a59..355246ec8 100644 --- a/lib_enc/swb_bwe_enc_fx.c +++ b/lib_enc/swb_bwe_enc_fx.c @@ -3309,7 +3309,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( #ifdef BASOP_NOGLOB L_SWB_tenv = L_add_sat( L_SWB_tenv, L_mult0( insig_hp_fx[i + tmp], insig_hp_fx[i + tmp] ) ); /*2*Q_shb */ #else - L_SWB_tenv = L_add( L_SWB_tenv, L_mult0( insig_hp_fx[i + tmp], insig_hp_fx[i + tmp] ) ); /*2*Q_shb */ + L_SWB_tenv = L_add( L_SWB_tenv, L_mult0( insig_hp_fx[i + tmp], insig_hp_fx[i + tmp] ) ); /*2*Q_shb */ #endif } @@ -3336,7 +3336,7 @@ static Word16 SWB_BWE_encoding_ivas_fx( #ifdef BASOP_NOGLOB SWB_tenv_fx[n_band] = round_fx_sat( L_shl_sat( L_tmp, sub( exp, 12 ) ) ); /*Q3 */ #else - SWB_tenv_fx[n_band] = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /*Q3 */ + SWB_tenv_fx[n_band] = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /*Q3 */ #endif move16(); } -- GitLab