Commit a68ecade authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '860-decoder-crash-during-frame-erasure' into 'main'

fix possible saturations when shl reach max values, changes under FIX_860_FER_CRASH

Closes #860

See merge request !561
parents 21bbf39f 3dfdddb5
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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 */
+12 −0
Original line number Diff line number Diff line
@@ -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();
                    }
                }
+10 −2
Original line number Diff line number Diff line
@@ -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 );
#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 );
#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
                {