From d380e91f41bac21f7b4a96e1b776fb8d53a75304 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 24 Apr 2025 12:35:36 +0530 Subject: [PATCH] Fix for 3GPP issue 1507: BASOP decoder asserts in ivas_hq_phase_ecu_fx with OMASA FER bitstream from BASOP encoder Link #1507 --- lib_dec/ivas_stereo_dft_plc_fx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_stereo_dft_plc_fx.c b/lib_dec/ivas_stereo_dft_plc_fx.c index 90d9c5823..3fed308b2 100644 --- a/lib_dec/ivas_stereo_dft_plc_fx.c +++ b/lib_dec/ivas_stereo_dft_plc_fx.c @@ -188,6 +188,8 @@ Word32 imax_pos_fx( Word32 posi, y1, y2, y3, y3_y1, y2i; Word32 ftmp_den1, ftmp_den2; Word16 q_div_2i, q_div_posi; + Word64 W_tmp; + Word16 shift1, shift2; /* Seek the extrema of the parabola P(x) defined by 3 consecutive points so that P([-1 0 1]) = [y1 y2 y3] */ y1 = y[0]; /* Qx */ move32(); @@ -195,9 +197,13 @@ Word32 imax_pos_fx( move32(); y3 = y[2]; /* Qx */ move32(); - y3_y1 = L_sub( y3, y1 ); /* Qx */ - ftmp_den1 = L_sub( L_add( y1, y3 ), L_shl( y2, 1 ) ); /* Qx */ - ftmp_den2 = L_shl( L_sub( L_sub( L_shl( y2, 1 ), y1 ), y3 ), 1 ); /* Qx */ + y3_y1 = L_sub( y3, y1 ); /* Qx */ + W_tmp = W_sub( W_add( y1, y3 ), W_shl( y2, 1 ) ); /* Qx */ + shift1 = W_norm( W_tmp ); + ftmp_den1 = W_extract_h( W_shl( W_tmp, shift1 ) ); /* Qx + shift1 - 32 */ + W_tmp = W_shl( W_sub( W_sub( W_shl( y2, 1 ), y1 ), y3 ), 1 ); /* Qx */ + shift2 = W_norm( W_tmp ); + ftmp_den2 = W_extract_h( W_shl( W_tmp, shift2 ) ); /* Qx + shift2 - 32 */ test(); IF( ( ftmp_den2 == 0 ) || ( ftmp_den1 == 0 ) ) @@ -206,6 +212,7 @@ Word32 imax_pos_fx( } y2i = Mpy_32_16_1( Mpy_32_16_1( y3_y1, BASOP_Util_Divide3232_Scale( y3_y1, ftmp_den1, &q_div_2i ) ), (Word16) ( 0xF000 ) ); /* q_div_2i */ + q_div_2i = sub( add( q_div_2i, shift1 ), 32 ); IF( q_div_2i < 0 ) { y2i = L_shl( y2i, q_div_2i ); @@ -219,6 +226,7 @@ Word32 imax_pos_fx( } /* their corresponding normalized locations */ posi = BASOP_Util_Divide3232_Scale( y3_y1, ( ftmp_den2 ), &q_div_posi ); /* q_div_posi */ + q_div_posi = sub( add( q_div_posi, shift2 ), 32 ); IF( ( q_div_posi != 0 ) ) { posi = L_shl( posi, q_div_posi ); -- GitLab