Commit c2d0583b authored by Fabian Bauer's avatar Fabian Bauer
Browse files

lib_com/hq2_noise_inject_fx.c

lib_com/ifft_rel_fx.c
lib_com/igf_base_fx.c
lib_com/interpol_fx.c
lib_com/low_rate_band_att_fx.c
lib_com/lpc_tools_fx.c
lib_com/lsf_tools_fx.c : completed overflow op replacement
parent b46c8a45
Loading
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -1119,10 +1119,8 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
    Word32 L_c;

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef ISSUE_1836_replace_overflow_libcom
    Flag Overflow = 0;
    move16();
#endif
    Flag Carry = 0;
    move16();
#endif
@@ -1144,18 +1142,11 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
        {
            Carry = 0;
            move16();
#ifdef ISSUE_1836_replace_overflow_libcom
            sfbEnergy[sfb] = L_add_c( sfbEnergy[sfb], pPowerSpectrum[line], &Carry ); //??sat
            move32();
            move16();
            L_c = L_macNs_c( L_c, 0, 0, &Carry ); //??sat
#else
            sfbEnergy[sfb] = L_add_co( sfbEnergy[sfb], pPowerSpectrum[line], &Carry, &Overflow );
            move32();
            Overflow = 0;
            move16();
            L_c = L_macNs_co( L_c, 0, 0, &Carry, &Overflow );
#endif
        }
        sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) );
        move32();
+28 −27
Original line number Diff line number Diff line
@@ -894,7 +894,8 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
    Word16 alp_h, alp_l, alp_exp; /* Prediction gain; hi lo and exponent         */
    Word32 t0, t1, t2;            /* temporary variables                         */
    Word16 flag;
    Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */#
    Word16 Ah[TCXLTP_LTP_ORDER + 1], Al[TCXLTP_LTP_ORDER + 1]; /* LPC coef. in double prec. */
#
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
        Flag Overflow = 0;
+93 −12
Original line number Diff line number Diff line
@@ -69,8 +69,10 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift

    Word16 cheb;
    Word32 t0, b1, b2;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    cheb = norm_s( x );
@@ -108,15 +110,25 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
        b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i]    */
        /* i = 5 */
        t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1                  */
#ifdef ISSUE_1836_replace_overflow_libcom
        if ( !cheb )
            t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1                */ //??sat
#else
        if ( !cheb )
            t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1                */
#endif
        t0 = L_sub( t0, b1 );                 /* t0 = 2*x*b1 - b2           */
        b1 = L_add( t0, *f++ );               /* b0 = 2*x*b1 - b2 + f[i]    */

        /* i = 6 */
        t0 = Mpy_32_16_1( b1, x ); /* t0 = x*b1                  */
#ifdef ISSUE_1836_replace_overflow_libcom
        if ( !cheb )
            t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1                */ //??sat
#else
        if ( !cheb )
            t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1                */
#endif
        t0 = L_sub( t0, b2 );                 /* t0 = 2*x*b1 - b2           */
    }
    /* IF (sub(n,8) == 0) */
@@ -125,8 +137,13 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift
        b2 = L_add( t0, *f++ ); /* b0 = 2*x*b1 - b2 + f[i]    */
        /* i = 7 */
        t0 = Mpy_32_16_1( b2, x ); /* t0 = x*b1                  */
#ifdef ISSUE_1836_replace_overflow_libcom
        if ( !cheb )
            t0 = L_shl_sat( t0, 1 ); /* t0 = 2*x*b1                */ //??sat
#else
        if ( !cheb )
            t0 = L_shl_o( t0, 1, &Overflow ); /* t0 = 2*x*b1                */
#endif
        t0 = L_sub( t0, b1 );                 /* t0 = 2*x*b1 - b2           */
                                              /*b1 = L_add(b2,0);*/
    }
@@ -146,8 +163,13 @@ static Word16 chebyshev( Word16 x, Word32 *f, const Word16 n, const Word16 shift


    BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1836_replace_overflow_libcom
    t0 = L_shl_sat( t0, shift ); /* Qx to Q30 with saturation */  //??sat
    cheb = round_fx_sat( t0 );   /* Result in Q14             */  //??sat
#else
    t0 = L_shl_o( t0, shift, &Overflow ); /* Qx to Q30 with saturation */
    cheb = round_fx_o( t0, &Overflow );   /* Result in Q14              */
#endif
    cheb = s_max( -32767, cheb );         /* to avoid saturation        */
    BASOP_SATURATE_WARNING_ON_EVS
    return ( cheb );
@@ -162,8 +184,10 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is
    Word32 t0, t1;
    Word16 scale = 1024;
    move16();
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    /*-------------------------------------------------------------*
@@ -286,7 +310,11 @@ void E_LPC_a_isp_conversion( const Word16 a[], Word16 isp[], const Word16 old_is
             * xint = xlow - ylow*(xhigh-xlow)/(yhigh-ylow)
             *--------------------------------------------------------*/

#ifdef ISSUE_1836_replace_overflow_libcom
            y = sub_sat( yhigh, ylow );
#else
            y = sub_o( yhigh, ylow, &Overflow );
#endif
            IF( y != 0 )
            {
                x = sub( xhigh, xlow );
@@ -1222,9 +1250,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
    Word16 nc;
    Word32 t0;
    Word16 Ovf, Ovf2;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif


    /*-----------------------------------------------------*
@@ -1255,7 +1285,11 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
    {
        f1[nc - i] = L_add( f1[nc - i], f1[nc - i - 1] );
        move32();
#ifdef ISSUE_1836_replace_overflow_libcom
        f2[nc - i] = L_sub_sat( f2[nc - i], f2[nc - i - 1] ); //??sat
#else
        f2[nc - i] = L_sub_o( f2[nc - i], f2[nc - i - 1], &Overflow );
#endif
        move32();
    }

@@ -1265,11 +1299,19 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
     *-----------------------------------------------------*/

    t0 = L_deposit_l( 0 );
#ifdef ISSUE_1836_replace_overflow_libcom
    FOR( i = 1; i <= nc; i++ )
    {
        t0 = L_max( t0, L_abs( L_add_sat( f1[i], f2[i] ) ) );
        t0 = L_max( t0, L_abs( L_sub_sat( f1[i], f2[i] ) ) );
    }
#else
    FOR( i = 1; i <= nc; i++ )
    {
        t0 = L_max( t0, L_abs( L_add_o( f1[i], f2[i], &Overflow ) ) );
        t0 = L_max( t0, L_abs( L_sub_o( f1[i], f2[i], &Overflow ) ) );
    }
#endif
    k = s_min( norm_l( t0 ), 6 );
    a[0] = shl( 256, k );
    move16();
@@ -1283,6 +1325,16 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
    FOR( i = 1; i <= nc; i++ )
    {
        /* a[i] = 0.5*(f1[i] + f2[i]) */
#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_add_sat( f1[i], f2[i] );                             //??sat
        t0 = L_shl( t0, k );
        a[i] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */   //??sat

        /* a[j] = 0.5*(f1[i] - f2[i]) */
        t0 = L_sub_sat( f1[i], f2[i] );                             //??sat
        t0 = L_shl( t0, k );
        a[j] = round_fx_sat( t0 ); /* from Q23 to Qx and * 0.5 */   //??sat
#else
        t0 = L_add_o( f1[i], f2[i], &Overflow );
        t0 = L_shl( t0, k );
        a[i] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */
@@ -1291,6 +1343,7 @@ void E_LPC_f_lsp_a_conversion( const Word16 *lsp, Word16 *a, const Word16 m )
        t0 = L_sub_o( f1[i], f2[i], &Overflow );
        t0 = L_shl( t0, k );
        a[j] = round_fx_o( t0, &Overflow ); /* from Q23 to Qx and * 0.5 */
#endif
        j--;
    }

@@ -1734,8 +1787,10 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
    Word16 m, j, n;
    Word16 q, q_a, q_a2, One_Qx;
    Word32 One_Qx2;
#ifdef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif
    q = add( norm_s( a[-1] ), 1 );
    q_a = sub( 15, q );
@@ -1797,31 +1852,39 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
        {
            n = sub( sub( m, (Word16) 1 ), j );
            L_tmp1 = L_mult( denom_mant, f_fx[j] );     /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
#ifdef ISSUE_1836_replace_overflow_libcom
            L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[n] ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */ //??sat
            L_tmp2 = L_mult( denom_mant, f_fx[n] );     /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */
            L_tmp2 = L_mac_sat( L_tmp2, tmp, f_fx[j] ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */ //??sat
            L_tmp1 = L_shr_sat( L_tmp1, exp );          /* bringing to true Q28 */                                //??sat
            L_tmp2 = L_shr_sat( L_tmp2, exp );          /* bringing to true Q28 */                                //??sat
            f_fx[j] = round_fx_sat( L_tmp1 );           /* extracting in q_a */                                   //??sat
            f_fx[n] = round_fx_sat( L_tmp2 );           /* extracting in q_a */                                   //??sat
#else
            L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[n], &Overflow ); /* denom*f[j]+km*denom*f[n] in Q28 (floating with exp) */
            L_tmp2 = L_mult( denom_mant, f_fx[n] );              /* denom*f[n]. Q15*Q12 = Q28 (floating with exp) */
            L_tmp2 = L_mac_o( L_tmp2, tmp, f_fx[j], &Overflow ); /* denom*f[n]+km*denom*f[j] in Q28 (floating with exp) */
#ifdef ISSUE_1799_replace_L_shr_o
            L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
            L_tmp2 = L_shr_sat( L_tmp2, exp ); /* bringing to true Q28 */
#else
            L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
            L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow ); /* bringing to true Q28 */
#endif
            f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
            f_fx[n] = round_fx_o( L_tmp2, &Overflow ); /* extracting in q_a */
#endif
        }

        IF( m & 1 )
        {
            L_tmp1 = L_mult( denom_mant, f_fx[j] );              /* denom*f[j]. Q15*Q12 = Q28 (floating with exp) */
            L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
#ifdef ISSUE_1799_replace_L_shr_o
            L_tmp1 = L_shr_sat( L_tmp1, exp ); /* bringing to true Q28 */
#ifdef ISSUE_1836_replace_overflow_libcom
            L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j], &Overflow );  /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */   //??sat
            L_tmp1 = L_shr_sat( L_tmp1, exp );                      /* bringing to true Q28 */                                  //??sat
            f_fx[j] = round_fx_sat( L_tmp1, &Overflow );            /* extracting in q_a */                                     //??sat
            move16();
#else
            L_tmp1 = L_mac_o( L_tmp1, tmp, f_fx[j], &Overflow ); /* denom*f[j]+km*denom*f[j] in Q28 (floating with exp) */
            L_tmp1 = L_shr_o( L_tmp1, exp, &Overflow ); /* bringing to true Q28 */
#endif
            f_fx[j] = round_fx_o( L_tmp1, &Overflow ); /* extracting in q_a */
            move16();
#endif
        }
    }

@@ -2273,8 +2336,10 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
    Word16 i, m;
    Word32 L_tmp;
    Word16 tmp, e;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    /*-------------------------------------------------------------------*
@@ -2320,11 +2385,15 @@ Word16 lsf_stab_fx( /* o : LP filter stability Q15*/
    }

    e = sub( 30 - 21 - 1, e );
#ifdef ISSUE_1836_replace_overflow_libcom
    tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q14*/  //??sat //??sat
#else
    tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q14*/
#endif

    tmp = sub( 20480, tmp ); /* 1.25 - tmp in Q14          */
#ifdef ISSUE_1796_replace_shl_o
    tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */
#ifdef ISSUE_1836_replace_overflow_libcom
    tmp = shl_sat( tmp, 1 ); /* Q14 -> Q15 with saturation */     //??sat
#else
    tmp = shl_o( tmp, 1, &Overflow );                   /* Q14 -> Q15 with saturation */
#endif
@@ -2364,8 +2433,10 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability
    Word16 i, m;
    Word32 L_tmp;
    Word16 tmp, e;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    /*-------------------------------------------------------------------*
@@ -2417,7 +2488,11 @@ Word16 lsf_stab_ivas_fx( /* o : LP filter stability
    }

    e = sub( 30 - 21 - 1, e );
#ifdef ISSUE_1836_replace_overflow_libcom
    tmp = round_fx_sat( L_shl_sat( L_tmp, e ) ); /*Q12*/  //??sat //??sat
#else
    tmp = round_fx_o( L_shl_o( L_tmp, e, &Overflow ), &Overflow ); /*Q12*/
#endif

    // tmp = sub(20480, tmp);                /* 1.25 - tmp in Q14          */
    tmp = sub( 5120, tmp ); /* 1.25 - tmp in Q12          */
@@ -3776,8 +3851,10 @@ Word16 root_search_fx( Word16 low,
    Word32 v_high, vh;
    Word32 Ltemp, L_tmp1, L_tmp, Ltmp;
    Word16 exp1, tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    v_high = polynomial_eval_fx( high, coef, order ); /*  v_high has the value at high index */
@@ -3847,7 +3924,11 @@ Word16 root_search_fx( Word16 low,
            exp1 = sub( 30 - 25, exp1 );
            tmp = div_s( 16384, tmp );                        /* 15+exp1 */
            Ltmp = Mult_32_16( *v_low, tmp );                 /* 15+exp1+25-15 */
#ifdef ISSUE_1836_replace_overflow_libcom
            Ltemp = L_shl_sat( Ltmp, ( 6 - exp1 ) );          /* Q31 */     //??sat
#else
            Ltemp = L_shl_o( Ltmp, ( 6 - exp1 ), &Overflow ); /* Q31 */
#endif
            if ( LT_32( *v_low, vh ) )
            {
                Ltemp = L_negate( Ltemp );
+18 −18

File changed.

Contains only whitespace changes.

+25 −25

File changed.

Contains only whitespace changes.

+2 −2

File changed.

Contains only whitespace changes.

+4 −4

File changed.

Contains only whitespace changes.

Loading