diff --git a/lib_com/options.h b/lib_com/options.h index c0d07582cca1bb43820bf56e3abbd52c45bfad8e..2bd4c88b7a2e872f10785f9e926da1a5acebfd45 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -97,6 +97,7 @@ #define FIX_BASOP_2627_PARAM_MC_ILD_REMAP_EXP /* FhG: BASOP #2627: accumulate 10^(ILD/10) using a dynamic exponent */ #define FIX_BASOP_2635_EFAP_ADD_VERTEX_ELE_ROUND /* FhG: BASOP #2635: round |elevation| with anint_fx before the 90deg subtraction in add_vertex_fx */ #define FIX_BASOP_2639_INCORRECT_ARRAY_INDEX /* Dolby: BASOP #2639: incorrect array index in ivas_spar_unquant_dtx_indicies */ +#define FIX_BASOP_2640_MASA_STEREO_TYPE_ASSERT /* Nokia: BASOP issue 2640: Fix assert by saturating shift when exponent difference is very large. */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c index 27a95190f8013bf9531eeae20dde0c613436e842..cf995220e5b71442a25f8f9259bab8b3f2161c5d 100644 --- a/lib_rend/ivas_dirac_output_synthesis_dec_fx.c +++ b/lib_rend/ivas_dirac_output_synthesis_dec_fx.c @@ -2063,13 +2063,21 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls_fx( subtract_target_ratio = L_sub( BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ), BASOP_Util_Log2( masa_stereo_type_detect->target_power_y_smooth_fx ) ); // Q25 exp = sub( masa_stereo_type_detect->q_subtract_power_y_smooth, masa_stereo_type_detect->q_target_power_y_smooth ); +#ifdef FIX_BASOP_2640_MASA_STEREO_TYPE_ASSERT + L_tmp = Mpy_32_32( L_sub( subtract_target_ratio, L_shl_sat( exp, 25 ) ), LOG10_2_Q31 ); // Q25 +#else L_tmp = Mpy_32_32( L_sub( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ); // Q25 +#endif } ELSE { subtract_target_ratio = BASOP_Util_Log2( masa_stereo_type_detect->subtract_power_y_smooth_fx ); // Q25 exp = sub( 31, masa_stereo_type_detect->q_subtract_power_y_smooth ); +#ifdef FIX_BASOP_2640_MASA_STEREO_TYPE_ASSERT + L_tmp = L_sub( Mpy_32_32( L_add( subtract_target_ratio, L_shl_sat( exp, 25 ) ), LOG10_2_Q31 ), -503316480 /* L_shl( -15, 25 ) */ /*log(EPSILON)*/ ); // Q25 +#else L_tmp = L_sub( Mpy_32_32( L_add( subtract_target_ratio, L_shl( exp, 25 ) ), LOG10_2_Q31 ), -503316480 /* L_shl( -15, 25 ) */ /*log(EPSILON)*/ ); // Q25 +#endif } subtract_target_ratio_db = Mpy_32_32( 1342177280 /* 10.0f * in Q27*/, L_tmp ); // (Q27, (Q25, Q31)) -> (Q27, Q25) -> Q21