diff --git a/lib_com/options.h b/lib_com/options.h index 7079776b07e3ec67dd79e380918256e57f9004aa..d19e9d6b867b416fc42b0ea709ada712c2768bcf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,9 @@ #define FIX_854_HILBERT_SCALING /* VA: reduce lost of precision due to unnecessary scaling, reduce a lot the 2 kHz tone */ #define FIX_856_EXTRACT_L /* VA: Fix undesirable wrap-around */ #define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: issue 835: wide range of buffer values for cx in ParamMC */ + +#define FIX_860_FER_CRASH /* VA: fix crash issues caused by saturation within shl */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_stereo_dft_dec_fx.c b/lib_dec/ivas_stereo_dft_dec_fx.c index c4988417f0adc0fc4b906da2b7a58fbbedc7f346..a03d520f9c5d5e4de1b8eb75ff71c0993f2d6a9a 100644 --- a/lib_dec/ivas_stereo_dft_dec_fx.c +++ b/lib_dec/ivas_stereo_dft_dec_fx.c @@ -3676,7 +3676,11 @@ void stereo_dft_dec_read_BS_fx( { hStereoDft->side_gain_index_previous[b] = ind1[b]; move16(); +#ifdef FIX_860_FER_CRASH + hStereoDft->res_gains_ind_fx[0][b + STEREO_DFT_BAND_MAX] = L_shl_sat( ind1[b], 26 ); +#else hStereoDft->res_gains_ind_fx[0][b + STEREO_DFT_BAND_MAX] = L_shl( ind1[b], 26 ); +#endif move32(); } @@ -3866,7 +3870,11 @@ void stereo_dft_dec_read_BS_fx( stereo_dft_dequantize_res_gains_fx( ind1 + b, &I, hStereoDft->side_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), hStereoDft->res_pred_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), 1 ); hStereoDft->res_pred_index_previous[b] = I; move16(); +#ifdef FIX_860_FER_CRASH + hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl_sat( I, 26 ); +#else hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl( I, 26 ); +#endif move32(); } @@ -3891,7 +3899,11 @@ void stereo_dft_dec_read_BS_fx( stereo_dft_dequantize_res_gains_fx( ind1 + b, &I, hStereoDft->side_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), hStereoDft->res_pred_gain_fx + add( i_mult( add( k, k_offset ), STEREO_DFT_BAND_MAX ), b ), 1 ); hStereoDft->res_pred_index_previous[b] = I; move16(); +#ifdef FIX_860_FER_CRASH + hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl_sat( I, 26 ); +#else hStereoDft->res_gains_ind_fx[1][b + STEREO_DFT_BAND_MAX] = L_shl( I, 26 ); +#endif move32(); } } diff --git a/lib_dec/ivas_stereo_icbwe_dec.c b/lib_dec/ivas_stereo_icbwe_dec.c index 5476af31c91a412db9d4a9b8ba164787383c867b..76ebdf3109751f6419e2bbd2cb4e53d6c050d167 100644 --- a/lib_dec/ivas_stereo_icbwe_dec.c +++ b/lib_dec/ivas_stereo_icbwe_dec.c @@ -1209,7 +1209,11 @@ void stereo_icBWE_dec_fx( tmp = shl( tmp, 2 ); icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, ratio_L_fx, &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#ifdef FIX_860_FER_CRASH + icbweM2Ref_fx = shl_sat( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#else + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#endif } ELSE { @@ -1238,7 +1242,11 @@ void stereo_icBWE_dec_fx( tmp = shl( tmp, 2 ); icbweM2Ref_fx = Sqrt16( sub( 16384, tmp ), &temp1_fx ); icbweM2Ref_fx = BASOP_Util_Divide1616_Scale( icbweM2Ref_fx, sub( 32767, ratio_L_fx ), &temp2_fx ); - icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#ifdef FIX_860_FER_CRASH + icbweM2Ref_fx = shl_sat( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#else + icbweM2Ref_fx = shl( icbweM2Ref_fx, add( temp2_fx, sub( temp1_fx, 1 ) ) ); // Q14 +#endif } ELSE {