Commit 6bc2f63e authored by Manuel Jander's avatar Manuel Jander
Browse files

Fix LTV crashes. Switches...

Fix LTV crashes. Switches NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx and NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 (a second case).
parent e7bea40b
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@
#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT             /* FhG: Dynamic scale of shb_speech buffers */
#define NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION   /* FhG: Use different scale to avoid saturation of LPC coefficient in TD Stereo signal extrapolation. */
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* FhG: Avoid overflow of SWB_fenv_fx in SWB_BWE_encoding_fx because of very small energies. */
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */
#define HARM_HQ_CORE_KEEP_BE                            /* hack to keep all BE after HQ core functions harmonization; pending resolving issues #2450, #2451, #2452 */
#define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM            /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */
#define FIX_2480_HARM_TONALMDCT                         /* FhG: basop issue 2480: Harmonize TonalMDCTConceal_Detect_fx() and TonalMDCTConceal_Detect_ivas_fx() */
+13 −0
Original line number Diff line number Diff line
@@ -1362,8 +1362,12 @@ static void MSVQ_Interpol_Tran_fx(
        FOR( n_band = 0; n_band < DIM_TR2 - 1; n_band++ )
        {
            /*quant_tmp2[n_band] = env_temp12[n_band] - ((quant_tmp[n_band]+quant_tmp[n_band+1])/2.f); */
#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx
            tmp = add( shr( quant_tmp[n_band], 1 ), shr( quant_tmp[n_band + 1], 1 ) ); /*Q8 */
#else
            tmp = add( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */
            tmp = shr( tmp, 1 );
#endif
            quant_tmp2[n_band] = sub( env_temp12[n_band], tmp );
            move16(); /*Q8 */
        }
@@ -1382,8 +1386,12 @@ static void MSVQ_Interpol_Tran_fx(
        FOR( n_band = 0; n_band < DIM_TR2 - 1; n_band++ )
        {
            /*quant_select[n_band*2+1] = ((quant_tmp[n_band]+quant_tmp[n_band+1])/2.f) + quant_tmp2[n_band]; */
#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx
            tmp = add( shr( quant_tmp[n_band], 1 ), shr( quant_tmp[n_band + 1], 1 ) ); /*Q8 */
#else
            tmp = add( quant_tmp[n_band], quant_tmp[n_band + 1] ); /*Q8 */
            tmp = shr( tmp, 1 );
#endif
            quant_select[n_band * 2 + 1] = add( tmp, quant_tmp2[n_band] );
            move16();
        }
@@ -2311,7 +2319,12 @@ static Word16 SWB_BWE_encoding_fx(
                L_tmp = Mpy_32_16( exp, tmp, 24660 ); /* Q14 */ /*10log10(2) in Q13 */
                tmp = round_fx( L_shl( L_tmp, 10 ) );           /* Q8 */

#ifdef NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2
                /* For very small energies, log10 in Q8 smaller than -128.0, saturation can occur here. */
                SWB_fenv_fx[n_band] = sub_sat( tmp, Mean_env_tr_fx[n_band] );
#else
                SWB_fenv_fx[n_band] = sub( tmp, Mean_env_tr_fx[n_band] );
#endif
                move16(); /*Q8 */
            }
        }