Commit 9806f3e3 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

checkout *k *l from lib_com from main

parent 791028ea
Loading
Loading
Loading
Loading
Loading
+6 −31
Original line number Diff line number Diff line
@@ -8,11 +8,6 @@
#include "prot_fx.h"
#include "ivas_prot_fx.h"

#ifndef ISSUE_1836_FILEACTIVE_low_rate_band_att_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif

/*--------------------------------------------------------------------------*
 * fine_gain_pred()
@@ -44,11 +39,9 @@ void ivas_fine_gain_pred_fx(
    Word16 tmp, exp, exp2;
    Word32 L_tmp;
    UWord16 lsb;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move16();
#endif
#endif

    FOR( band = 0; band < num_sfm; band++ )
@@ -88,11 +81,7 @@ void ivas_fine_gain_pred_fx(
                tmp1 = shr( tmp1, sub( sub( 15, tmp_exp ), Q11 ) );
                Mpy_32_16_ss( L_tmp, tmp1, &L_tmp, &lsb ); /*31-exp+11-15=27-exp */

#ifdef ISSUE_1836_replace_overflow_libcom
                gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat
#else
                gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */
#endif
                test();
                test();
                IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */
@@ -108,11 +97,7 @@ void ivas_fine_gain_pred_fx(

                    /*gp *= 1.0f - 0.05f / accuracy; */
                    tmp = div_s( 13107, accuracy );       /* 0.05 in Q18 */
#ifdef ISSUE_1836_replace_overflow_libcom
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat
#else
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#endif
                    tmp = sub( 32767, tmp );
                    tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
                    gp = mult_r( tmp, gp );    /*15+12+1-16=12 */
@@ -169,11 +154,9 @@ void fine_gain_pred_fx(
    Word16 tmp, exp, exp2;
    Word32 L_tmp;
    UWord16 lsb;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    FOR( band = 0; band < num_sfm; band++ )
@@ -206,11 +189,7 @@ void fine_gain_pred_fx(
                exp = sub( 31, add( exp, sub( 30, shl( shift, 1 ) ) ) );
                L_tmp = Isqrt_lc( L_tmp, &exp );                                          /*31 - exp */
                Mpy_32_16_ss( L_tmp, fine_gain_pred_sqrt_bw[bw_idx], &L_tmp, &lsb );      /*31-exp+11-15=27-exp */
#ifdef ISSUE_1836_replace_overflow_libcom
                gp = round_fx_sat( L_shl_sat( L_tmp, add( 1, exp ) ) ); /*27-exp+1+exp-16=12 */ //??sat //??sat
#else
                gp = round_fx_o( L_shl_o( L_tmp, add( 1, exp ), &Overflow ), &Overflow ); /*27-exp+1+exp-16=12 */
#endif
                test();
                test();
                IF( EQ_16( core, HQ_CORE ) && R != NULL && LE_16( R[i_sort[band]], 256 ) ) /* 256 is 32 in Q3 */
@@ -226,11 +205,7 @@ void fine_gain_pred_fx(

                    /*gp *= 1.0f - 0.05f / accuracy; */
                    tmp = div_s( 13107, accuracy );       /* 0.05 in Q18 */
#ifdef ISSUE_1836_replace_overflow_libcom
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */ //??sat
#else
                    tmp = shr_sat( tmp, sub( 34, exp ) ); /*15+18-exp+16-15=34-exp */
#endif
                    tmp = sub( 32767, tmp );
                    tmp = s_max( 27554, tmp ); /* Limit attenuation to norm quantizer error, 2^-0.25 in Q15 */
                    gp = mult_r( tmp, gp );    /*15+12+1-16=12 */
+6 −124
Original line number Diff line number Diff line
@@ -42,12 +42,6 @@
#include "rom_com.h"
#include "basop_util.h"

#ifndef ISSUE_1836_FILEACTIVE_lpc_tools_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif


/*-----------------------------------------------------------------*
 * Local constants
@@ -415,10 +409,8 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word
{
    Word16 approx /*, hi, lo, n_hi , n_lo*/;
    Word32 L_32;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    /* First approximation: 1 / L_denom = 1/denom_hi */
@@ -435,11 +427,7 @@ static Word32 Div_32_opt( Word32 L_num /*Q31*/, Word16 denom_hi /*Qx -16*/, Word

    L_32 = Mpy_32_32( L_num, L_32 );

#ifdef ISSUE_1836_replace_overflow_libcom
    L_32 = L_shl_sat( L_32, 2 ); //??sat
#else
    L_32 = L_shl_o( L_32, 2, &Overflow );
#endif

    return ( L_32 );
}
@@ -475,11 +463,9 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
    Word32 t0, t1, t2;            /* temporary variables                         */
    Word16 flag;
    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;
#endif
#endif


    BASOP_SATURATE_WARNING_OFF_EVS
@@ -540,21 +526,12 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
            t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
        }

#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */
#else
        t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
#endif
                                          /* No overflow possible            */

        /* Compose and add R[i] in Q3 */
#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_mac_sat( t0, Rl[i], 1 );      //??sat
        t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat
#else
        t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
        t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
#endif

        /* K = -t0 / Alpha */
        t1 = L_abs( t0 );
@@ -569,11 +546,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        {
            t2 = L_negate( t2 ); /* K =-t0/Alpha                    */
        }
#ifdef ISSUE_1836_replace_overflow_libcom
        t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha   */ //??sat
#else
        t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha   */
#endif
        test();
        if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
        {
@@ -612,11 +585,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
        L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27                   */

        /* Alpha = Alpha * (1-K**2) */
#ifdef ISSUE_1836_replace_overflow_libcom
        t1 = L_mult_sat( Kh, Kh ); /* K*K      in Q31 */ //??sat
#else
        t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K      in Q31 */
#endif
        t0 = L_mac( t1, mult( Kh, Kl ), 2 );
        t0 = L_abs( t0 );                       /* Some case <0 !! */
        t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K  in Q31 */
@@ -652,11 +621,7 @@ Word16 E_LPC_lev_dur_stab( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*QR
    FOR( i = 1; i <= order; i++ )
    {
        t0 = L_Comp( Ah[i], Al[i] );
#ifdef ISSUE_1836_replace_overflow_libcom
        A[i] = round_fx_sat( L_shl_sat( t0, k ) );
#else
        A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow );
#endif
        move16();
    }

@@ -692,11 +657,9 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
    Word32 t0, t1, t2;            /* temporary variables                         */
    Word16 flag;
    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;
#endif
#endif


    BASOP_SATURATE_WARNING_OFF_EVS
@@ -757,21 +720,12 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
            t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
        }

#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */
#else
        t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
#endif
                                          /* No overflow possible            */

        /* Compose and add R[i] in Q3 */
#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_mac_sat( t0, Rl[i], 1 );      //??sat
        t0 = L_msu_sat( t0, Rh[i], -32768 ); //??sat
#else
        t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
        t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
#endif

        /* K = -t0 / Alpha */
        t1 = L_abs( t0 );
@@ -786,11 +740,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
        {
            t2 = L_negate( t2 ); /* K =-t0/Alpha                    */
        }
#ifdef ISSUE_1836_replace_overflow_libcom
        t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha   */ //??sat
#else
        t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha   */
#endif
        test();
        if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
        {
@@ -829,11 +779,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
        L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27                   */

        /* Alpha = Alpha * (1-K**2) */
#ifdef ISSUE_1836_replace_overflow_libcom
        t1 = L_mult_sat( Kh, Kh ); /* K*K      in Q31 */ //??sat
#else
        t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K      in Q31 */
#endif
        t0 = L_mac( t1, mult( Kh, Kl ), 2 );
        t0 = L_abs( t0 );                       /* Some case <0 !! */
        t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K  in Q31 */
@@ -869,11 +815,7 @@ Word16 E_LPC_lev_dur_stab_ivas_fx( const Word16 Rh[], const Word16 Rl[], Word16
    FOR( i = 1; i <= order; i++ )
    {
        t0 = L_Comp( Ah[i], Al[i] );
#ifdef ISSUE_1836_replace_overflow_libcom
        A[i] = round_fx_sat( L_shl_sat( t0, k ) ); //??sat
#else
        A[i] = round_fx_o( L_shl_o( t0, k, &Overflow ), &Overflow );
#endif
        move16();
    }

@@ -909,13 +851,10 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
    Word32 t0, t1, t2;            /* temporary variables                         */
    Word16 flag;
    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;
    move32();
#endif
#endif


    BASOP_SATURATE_WARNING_OFF_EVS
@@ -976,21 +915,12 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
            t0 = Mac_32( t0, Rh[j], Rl[j], Ah[i - j], Al[i - j] );
        }

#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_shl( t0, 4 ); /* result in Q27 -> convert to Q31 */ //??sat
#else
        t0 = L_shl_o( t0, 4, &Overflow ); /* result in Q27 -> convert to Q31 */
#endif
                                          /* No overflow possible            */

        /* Compose and add R[i] in Q3 */
#ifdef ISSUE_1836_replace_overflow_libcom
        t0 = L_mac_sat( t0, Rl[i], 1 );
        t0 = L_msu_sat( t0, Rh[i], -32768 );
#else
        t0 = L_mac_o( t0, Rl[i], 1, &Overflow );
        t0 = L_msu_o( t0, Rh[i], -32768, &Overflow );
#endif

        /* K = -t0 / Alpha */
        t1 = L_abs( t0 );
@@ -1005,11 +935,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        {
            t2 = L_negate( t2 ); /* K =-t0/Alpha                    */
        }
#ifdef ISSUE_1836_replace_overflow_libcom
        t2 = L_shl_sat( t2, alp_exp ); /* denormalize; compare to Alpha   */ //??sat
#else
        t2 = L_shl_o( t2, alp_exp, &Overflow ); /* denormalize; compare to Alpha   */
#endif
        test();
        if ( ( mem != NULL ) && ( ( GT_16( abs_s( extract_h( t2 ) ), k_max ) ) ) )
        {
@@ -1048,11 +974,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
        L_Extract( t2, &Ah[i], &Al[i] ); /* An[i] in Q27                   */

        /* Alpha = Alpha * (1-K**2) */
#ifdef ISSUE_1836_replace_overflow_libcom
        t1 = L_mult_sat( Kh, Kh ); /* K*K      in Q31 */ //??sat
#else
        t1 = L_mult_o( Kh, Kh, &Overflow ); /* K*K      in Q31 */
#endif
        t0 = L_mac( t1, mult( Kh, Kl ), 2 );
        t0 = L_abs( t0 );                       /* Some case <0 !! */
        t0 = L_sub( (Word32) 0x7fffffffL, t0 ); /* 1 - K*K  in Q31 */
@@ -1088,11 +1010,7 @@ Word16 E_LPC_lev_dur_stab_fx( const Word16 Rh[] /*QR -16*/, const Word16 Rl[] /*
    FOR( i = 1; i <= order; i++ )
    {
        t0 = L_Comp( Ah[i], Al[i] );
#ifdef ISSUE_1836_replace_overflow_libcom
        A[i] = L_shl_sat( t0, k ); //??sat
#else
        A[i] = L_shl_o( t0, k, &Overflow );
#endif
        move16();
    }

@@ -1560,11 +1478,9 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
    Word16 lpc[19];
    move16();

#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    /* half length FFT */
@@ -1740,22 +1656,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
        Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) );
        Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) );
        BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1836_replace_overflow_libcom
        tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im ); //??sat
        move16();
        tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re ); //??sat
        move16();
        BASOP_SATURATE_WARNING_ON_EVS
        RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re );
        move16();
        ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im );
        move16();
        BASOP_SATURATE_WARNING_OFF_EVS
        tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat
        move16();
        tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat
        move16();
#else
        tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.re, pwn17->v.re ), ptwiddle->v.im, pwn17->v.im, &Overflow );
        move16();
        tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.re, pwn17->v.im ), ptwiddle->v.im, pwn17->v.re, &Overflow );
@@ -1770,7 +1670,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
        move16();
        tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re, &Overflow );
        move16();
#endif
        BASOP_SATURATE_WARNING_ON_EVS
        RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im );
        move16();
@@ -1791,22 +1690,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
        Word16 ImAr = extract_h( L_sub( ImagFFT[i], ImagFFT[N / 2 - i] ) );
        Word16 ImBr = extract_h( L_add( ImagFFT[i], ImagFFT[N / 2 - i] ) );
        BASOP_SATURATE_WARNING_OFF_EVS
#ifdef ISSUE_1836_replace_overflow_libcom
        tmpw15.v.re = mac_r_sat( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im ); //??sat
        move16();
        tmpw15.v.im = msu_r_sat( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re ); //??sat
        move16();
        BASOP_SATURATE_WARNING_ON_EVS
        RealOut[i] = mac_r( L_msu( L_msu( L_mult( ReAr, pwn17->v.re ), ImAr, pwn17->v.im ), ReBr, pwn15->v.im ), ImBr, pwn15->v.re );
        move16();
        ImagOut[i] = mac_r( L_mac( L_mac( L_mult( ReAr, pwn17->v.im ), ImAr, pwn17->v.re ), ReBr, pwn15->v.re ), ImBr, pwn15->v.im );
        move16();
        BASOP_SATURATE_WARNING_OFF_EVS
        tmpw15.v.re = msu_r_sat( L_mult( ptwiddle->v.re, pwn17i->v.im ), ptwiddle->v.im, pwn17i->v.re ); //??sat
        move16();
        tmpw15.v.im = mac_r_sat( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re ); //??sat
        move16();
#else
        tmpw15.v.re = mac_ro( L_mult( ptwiddle->v.im, pwn17->v.re ), ptwiddle->v.re, pwn17->v.im, &Overflow );
        move16();
        tmpw15.v.im = msu_ro( L_mult( ptwiddle->v.im, pwn17->v.im ), ptwiddle->v.re, pwn17->v.re, &Overflow );
@@ -1821,7 +1704,6 @@ void E_LPC_a_lsf_isf_conversion( Word16 *lpcCoeffs /*Qx*/, Word16 *lsf /*15Q16*/
        move16();
        tmpw15.v.im = mac_ro( L_mult( ptwiddle->v.im, pwn17i->v.im ), ptwiddle->v.re, pwn17i->v.re, &Overflow );
        move16();
#endif
        BASOP_SATURATE_WARNING_ON_EVS
        RealOut[N / 2 - i] = msu_r( L_mac( L_mac( L_mult( ReAr, pwn17i->v.re ), ImAr, pwn17i->v.im ), ImBr, pwn15i->v.re ), ReBr, pwn15i->v.im );
        move16();
+16 −116
Original line number Diff line number Diff line
@@ -40,12 +40,6 @@
#include "ivas_error.h"
#include "ivas_prot_fx.h"

#ifndef ISSUE_1836_FILEACTIVE_lsf_tools_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
/*-------------------------------------------------------------------*
 * Local constants
 *-------------------------------------------------------------------*/
@@ -75,10 +69,8 @@ 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 );
@@ -116,25 +108,15 @@ 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) */
@@ -143,13 +125,8 @@ 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);*/
    }
@@ -169,13 +146,8 @@ 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 );
@@ -190,10 +162,8 @@ 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

    /*-------------------------------------------------------------*
@@ -316,11 +286,7 @@ 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 );
@@ -1256,11 +1222,9 @@ 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


    /*-----------------------------------------------------*
@@ -1291,11 +1255,7 @@ 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();
    }

@@ -1305,19 +1265,11 @@ 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();
@@ -1331,16 +1283,6 @@ 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 */
@@ -1349,7 +1291,6 @@ 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--;
    }

@@ -1793,10 +1734,8 @@ 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;
#ifndef 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 );
@@ -1858,15 +1797,6 @@ 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) */
@@ -1874,23 +1804,15 @@ void a2rc_fx( const Word16 *a, /* i: can be any Q */
            L_tmp2 = L_shr_o( L_tmp2, exp, &Overflow );          /* bringing to true Q28 */
            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) */
#ifdef ISSUE_1836_replace_overflow_libcom
            L_tmp1 = L_mac_sat( L_tmp1, tmp, f_fx[j] ); /* 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 ); /* 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 */
            f_fx[j] = round_fx_o( L_tmp1, &Overflow );           /* extracting in q_a */
            move16();
#endif
        }
    }

@@ -2342,10 +2264,8 @@ 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

    /*-------------------------------------------------------------------*
@@ -2391,18 +2311,10 @@ 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_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

    tmp = s_max( tmp, 0 );

@@ -2439,10 +2351,8 @@ 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

    /*-------------------------------------------------------------------*
@@ -2494,11 +2404,7 @@ 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          */
@@ -3857,10 +3763,8 @@ 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 */
@@ -3930,11 +3834,7 @@ 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 );
+0 −86

File changed.

Preview size limit exceeded, changes collapsed.