From 2595b115ecd050ecd9dd87bc83747c556e5175fd Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Fri, 10 Jan 2025 15:03:18 +0530 Subject: [PATCH] Fix for 3GPP issue 1153: Assertion error observed in stereo_dmx_evs_enc_fx from calc_poc_fx function Link #1153 --- lib_com/options.h | 1 + lib_enc/ivas_stereo_dmx_evs.c | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 225d8ac92..10deb6c3b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -111,4 +111,5 @@ #define FIX_ISSUE_1147 /*Ittiam: Fix for issue 1147: Added saturation in DetectTnsFilt_fx.*/ #define FIX_ISSUE_1150 /* Ittiam: Fix for Issue 1150: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from tcx_ltp_find_gain function*/ #define FIX_ISSUE_1151 /* Ittiam: Fix for Issue 1151: Assertion error observed in evs_enc_fx (with option stereo_dmx_evs) from sp_mus_classif_gmm_fx function*/ +#define FIX_ISSUE_1153 /* Ittiam: Fix for Issue 1153: Assertion error observed in stereo_dmx_evs_enc_fx from calc_poc_fx function*/ #endif diff --git a/lib_enc/ivas_stereo_dmx_evs.c b/lib_enc/ivas_stereo_dmx_evs.c index 801aae865..4ef16ce9f 100644 --- a/lib_enc/ivas_stereo_dmx_evs.c +++ b/lib_enc/ivas_stereo_dmx_evs.c @@ -1005,7 +1005,11 @@ static void calc_poc_fx( FOR( i = 0; i < hPHA->pha_len; i++ ) { // hPHA->p_curr_taps[n][i] *= hPHA->win[i]; +#ifdef FIX_ISSUE_1153 + hPHA->p_curr_taps_fx[n][i] = Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ); // Q30 +#else hPHA->p_curr_taps_fx[n][i] = L_shl( Mpy_32_16_1( hPHA->p_curr_taps_fx[n][i], hPHA->win_fx[i] ), 1 ); // Q31 +#endif move32(); } @@ -1013,9 +1017,22 @@ static void calc_poc_fx( move32(); energy_e = 0; move16(); +#ifdef FIX_ISSUE_1153 + Word16 shift = L_norm_arr( hPHA->p_curr_taps_fx[n], hPHA->pha_len ); + IF( shift ) + { + scale_sig32( hPHA->p_curr_taps_fx[n], hPHA->pha_len, 1 ); + shift = 1; + move16(); + } +#endif FOR( i = 0; i < hPHA->pha_len; i++ ) { +#ifdef FIX_ISSUE_1153 + energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), shl( sub( 1, shift ), 1 ), &energy_e ); +#else energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, Mpy_32_32_r( hPHA->p_curr_taps_fx[n][i], hPHA->p_curr_taps_fx[n][i] ), 0, &energy_e ); +#endif } // energy = (float) inv_sqrt( energy + EPSILON ); energy = BASOP_Util_Add_Mant32Exp( energy, energy_e, EPSILON_FX_M, EPSILON_FX_E, &energy_e ); -- GitLab