Commit 175367b3 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

replaced some more overflow ops

parent 9b62d90b
Loading
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -95,9 +95,11 @@ void FEC_exc_estim_fx(
    Word32 cond3;
    Word32 predPitchLag;
    GSC_DEC_HANDLE hGSCDec;
#ifndef ISSUE_1866_replace_overflow_libdec
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
#endif
    hGSCDec = st_fx->hGSCDec;

@@ -126,7 +128,7 @@ void FEC_exc_estim_fx(

        gainCNG = round_fx( L_shl( L_tmp, sub( exp, 12 ) ) ); /* In Q3 */
    }
#ifdef ISSUE_1796_replace_shl_o
#ifdef ISSUE_1866_replace_overflow_libdec
    tmp1 = shl_sat( st_fx->lp_gainc_fx, 1 );
#else
    tmp1 = shl_o( st_fx->lp_gainc_fx, 1, &Overflow );
@@ -191,8 +193,8 @@ void FEC_exc_estim_fx(
    {
        test();
        test();
#ifdef ISSUE_1796_replace_shl_o
        IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
#ifdef ISSUE_1866_replace_overflow_libdec
        IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&   //??sat
              GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past  */
            GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) )                                                                                /* or last update too far in the past */
#else
@@ -210,8 +212,8 @@ void FEC_exc_estim_fx(
    {
        test();
        test();
#ifdef ISSUE_1796_replace_shl_o
        IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&
#ifdef ISSUE_1866_replace_overflow_libdec
        IF( ( LT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), shl_sat( mult( 29491, st_fx->bfi_pitch_fx ), 1 ) ) &&      //??sat
              GT_16( round_fx( L_shl( st_fx->old_pitch_buf_fx[2 * NB_SUBFR16k - 1], 6 ) ), mult( 19661, st_fx->bfi_pitch_fx ) ) ) || /* last pitch coherent with the past  */
            GE_16( st_fx->upd_cnt, MAX_UPD_CNT ) )                                                                                   /* or last update too far in the past */
#else
@@ -313,7 +315,11 @@ void FEC_exc_estim_fx(
        IF( LE_16( st_fx->nbLostCmpt, 1 ) )
        {
            /* if stable, do not decrease the energy, pitch_gain = 0 */
#ifdef ISSUE_1866_replace_overflow_libdec
            alpha = mac_r_sat( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX ); /*st_fx->stab_fac_fx in Q15*/ //??sat
#else
            alpha = mac_ro( ( 1L << 16 ) * 2 * _ALPHA_U_FX, st_fx->stab_fac_fx, 32768 - 2 * _ALPHA_U_FX, &Overflow ); /*st_fx->stab_fac_fx in Q15*/
#endif
        }
        ELSE IF( EQ_16( st_fx->nbLostCmpt, 2 ) )
        {
@@ -362,7 +368,11 @@ void FEC_exc_estim_fx(
            L_tmp = L_deposit_h( tmp );
            L_tmp = Isqrt_lc( L_tmp, &exp );

#ifdef ISSUE_1866_replace_overflow_libdec
            gain = extract_h( L_shl_sat( L_tmp, exp ) ); //??sat
#else
            gain = extract_h( L_shl_o( L_tmp, exp, &Overflow ) );
#endif

            gain = s_min( gain, 32113 ); /*0.98 */
            gain = s_max( gain, 27853 ); /*0.85 */
@@ -768,7 +778,7 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
{
    Word16 tmp_pit, tmp_pit_e, tmp_frame, tmp_frame_e;
    Word32 tmp_pit2;
#ifndef ISSUE_1796_replace_shl_o
#ifndef ISSUE_1866_replace_overflow_libdec
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
@@ -782,8 +792,8 @@ static void pulseRes_preCalc( Word16 *cond1, Word16 *cond2, Word32 *cond3, Word1
    tmp_frame = sub( 32767 /*1.f Q15*/, tmp_frame ); /*Q15*/
    BASOP_SATURATE_WARNING_OFF_EVS
    /*To calc Q15 threshold, overflow may happen - do negation and compare with negated value to check also highest possible value*/
#ifdef ISSUE_1796_replace_shl_o
    tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e );
#ifdef ISSUE_1866_replace_overflow_libdec
    tmp_pit = shl_sat( negate( tmp_pit ), tmp_pit_e );  //??sat
#else
    tmp_pit = shl_o( negate( tmp_pit ), tmp_pit_e, &Overflow );
#endif
+3 −3
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ void minimumStatistics_fx(
    Word16 f, p, i;
    Word16 tmp, tmp2, tmp_e;
    Word32 tmp32;
#ifndef ISSUE_1796_replace_shl_o
#ifndef ISSUE_1866_replace_overflow_libdec
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
@@ -55,8 +55,8 @@ void minimumStatistics_fx(


    BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1796_replace_shl_o
    IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) )
#ifdef ISSUE_1866_replace_overflow_libdec
    IF( LT_16( shl_sat( currentFrameLevel, currentFrameLevel_e ), PLC_MIN_CNG_LEV ) )   //??sat
#else
    IF( LT_16( shl_o( currentFrameLevel, currentFrameLevel_e, &Overflow ), PLC_MIN_CNG_LEV ) )
#endif
+6 −0
Original line number Diff line number Diff line
@@ -62,9 +62,11 @@ ivas_error evs_dec_fx(

    push_wmops( "evs_dec_fx" );

#ifndef ISSUE_1866_replace_overflow_libdec
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
    #endif
    hBWE_TD = st_fx->hBWE_TD;
    hHQ_core = st_fx->hHQ_core;
@@ -450,7 +452,11 @@ ivas_error evs_dec_fx(
                /*hb_synth[i] *= (i*tmp);*/
                hb_synth_fx[i] = mult_r( hb_synth_fx[i], tmp16_2 ); /*hb_synth_fx_exp*/
                move16();
#ifdef ISSUE_1866_replace_overflow_libdec
                tmp16_2 = add_sat( tmp16_2, tmp16 ); //??sat
#else
                tmp16_2 = add_o( tmp16_2, tmp16, &Overflow );
#endif
            }
        }

+8 −0
Original line number Diff line number Diff line
@@ -938,7 +938,11 @@ Word16 ApplyFdCng_fx(
                }
                L_tmp_exp = 0;
                move16();
#ifdef ISSUE_1866_replace_overflow_libdec
                IF( GT_32(  L_tmp , 21474836 ) /*0.01f Q31*/ )
#else
                IF( GT_32( L_shl_o( L_tmp, L_tmp_exp, &Overflow ), 21474836 ) /*0.01f Q31*/ )
#endif
                {
                    test();
                    test();
@@ -1047,7 +1051,11 @@ Word16 ApplyFdCng_fx(
                L_tmp_exp = add( L_tmp_exp, -7 );                                                               /*->Q16, L_tmp_exp */
                L_tmp_exp = add( L_tmp_exp, 31 - 16 );                                                          /*->Q31, L_tmp_exp*/

#ifdef ISSUE_1866_replace_overflow_libdec
                st->cngTDLevel = round_fx_sat( Sqrt32( L_tmp, &L_tmp_exp ) ); /*Q15 - L_tmp_exp*/   //??sat
#else
                st->cngTDLevel = round_fx_o( Sqrt32( L_tmp, &L_tmp_exp ), &Overflow ); /*Q15 - L_tmp_exp*/
#endif
                move16();
                st->cngTDLevel_e = L_tmp_exp;
                move16();