Commit 3b69f310 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

checkout lib_com from main

parent fb1b9104
Loading
Loading
Loading
Loading
Loading
+1 −29
Original line number Diff line number Diff line
@@ -10,12 +10,6 @@
#include "basop_proto_func.h"
#include "cnst.h"

#ifndef ISSUE_1836_FILEACTIVE_arith_coder_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif

/* Fixed point implementation of exp(negate()) */
Word32 expfp(                    /* o: Q31 */
              const Word16 x,    /* i: mantissa  Q-e */
@@ -200,12 +194,10 @@ void tcx_arith_scale_envelope(
    Word16 statesi, bits;
    Word32 mean, a, s, L_tmp;
    Word16 mean_e, tmp, tmp2;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif


    lob_bits = 0;
@@ -231,11 +223,7 @@ void tcx_arith_scale_envelope(

        tmp = norm_l( env[k] );
        tmp2 = sub( 15, tmp );
#ifdef ISSUE_1836_replace_overflow_libcom
        tmp = Inv16( round_fx_sat( L_shl( env[k], tmp ) ), &tmp2 ); /* exp(tmp2) */
#else
        tmp = Inv16( round_fx_o( L_shl_o( env[k], tmp, &Overflow ), &Overflow ), &tmp2 ); /* exp(tmp2) */
#endif
        ienv[k] = L_shl( L_deposit_h( tmp ), sub( tmp2, 15 ) );                           /* Q16 */
        move32();
        mean = L_add( mean, ienv[k] ); /* Q16 */
@@ -268,11 +256,7 @@ void tcx_arith_scale_envelope(
    b_e = add( b_e, mean_e );

    /* scale = (-b + (float)sqrt(b*b - 4.0f*a*0.035f)) / (2.0f * a); */
#ifdef ISSUE_1836_replace_overflow_libcom
    tmp = round_fx_sat( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ) );
#else
    tmp = round_fx_o( BASOP_Util_Add_Mant32Exp( L_mult( b, b ), shl( b_e, 1 ), Mpy_32_16_1( a, -4588 /*-4.0f*0.035f Q15*/ ), a_e, &tmp2 ), &Overflow );
#endif

    IF( tmp <= 0 )
    {
@@ -287,11 +271,7 @@ void tcx_arith_scale_envelope(

    tmp2 = BASOP_Util_Add_MantExp( negate( b ), b_e, tmp, tmp2, &scale ); /* exp(scale) */
    scale = BASOP_Util_Divide1616_Scale( scale, round_fx( a ), &tmp );
#ifdef ISSUE_1836_replace_overflow_libcom
    scale = shl_sat( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ) ); /* Q15 */
#else
    scale = shl_o( scale, sub( sub( add( tmp, tmp2 ), a_e ), 1 ), &Overflow ); /* Q15 */
#endif

    /* iscale = 1.0f / scale; */
    iscale_e = 0;
@@ -340,11 +320,7 @@ void tcx_arith_scale_envelope(
                L_tmp = L_add( L_tmp, L_shl( Mpy_32_16_1( env[k], mult_r( 1147 /*0.035f Q15*/, iscale ) ), iscale_e ) ); /* Q16 */

                tmp = norm_l( L_tmp );
#ifdef ISSUE_1836_replace_overflow_libcom
                statesi = mult_r( statesi, round_fx_sat( L_shl( L_tmp, tmp ) ) );
#else
                statesi = mult_r( statesi, round_fx_o( L_shl_o( L_tmp, tmp, &Overflow ), &Overflow ) );
#endif
                bits = add( bits, sub( 15, tmp ) );

                tmp = norm_s( statesi );
@@ -431,11 +407,7 @@ void tcx_arith_scale_envelope(
    *s_env_e = sub( add( 15, iscale_e ), tmp );
    move16();
    BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef ISSUE_1836_replace_overflow_libcom
    a = L_shl_sat( 1265000, sub( 15, *s_env_e ) );
#else
    a = L_shl_o( 1265000, sub( 15, *s_env_e ), &Overflow );
#endif
    BASOP_SATURATE_WARNING_ON_EVS;

    FOR( k = 0; k < L_frame; k++ )
+0 −45
Original line number Diff line number Diff line
@@ -45,13 +45,6 @@
#include "basop_settings.h"
#include "cnst.h"

#ifndef ISSUE_1836_FILEACTIVE_basop_util_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif


extern const Word32 SqrtTable[32];     // Q31
extern const Word16 SqrtDiffTable[32]; /* Q15 */

@@ -274,11 +267,9 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a
    Word16 preShift, postShift;
    Word16 m;
    Word32 m32;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif


    assert( b_m != 0 );
@@ -312,11 +303,7 @@ void BASOP_Util_Divide_MantExp( Word16 a_m, /*!< Mantissa of dividend a

    /* normalize result */
    postShift = norm_l( m32 );
#ifdef ISSUE_1836_replace_overflow_libcom
    m = round_fx_sat( L_shl( m32, postShift ) );
#else
    m = round_fx_o( L_shl( m32, postShift ), &Overflow );
#endif

    /* exponent */
    *ptrResult_e = sub( add( add( a_e, sub( 1, b_e ) ), preShift ), postShift );
@@ -332,9 +319,7 @@ static Word16 Sqrt16_common( Word16 m,
                             Word16 e )
{
    Word16 index, frac;
#ifndef ISSUE_1836_replace_overflow_libcom
    Flag Overflow;
#endif


    assert( ( m >= 0x4000 ) || ( m == 0 ) );
@@ -349,13 +334,9 @@ static Word16 Sqrt16_common( Word16 m,
    /* interpolate */
    if ( m != 0 )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        m = mac_r_sat( SqrtTable[index], SqrtDiffTable[index], frac );
#else
        BASOP_SATURATE_WARNING_OFF_EVS;
        m = mac_ro( SqrtTable[index], SqrtDiffTable[index], frac, &Overflow );
        BASOP_SATURATE_WARNING_ON_EVS;
#endif
    }

    /* handle odd exponents */
@@ -371,19 +352,13 @@ static Word32 Sqrt32_common( Word32 m,
                             Word16 e )
{
    Word16 m16, index, frac;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    assert( ( m >= 0x40000000 ) || ( m == 0 ) );

#ifdef ISSUE_1836_replace_overflow_libcom
    m16 = round_fx_sat( m );
#else
    m16 = round_fx_o( m, &Overflow );
#endif

    /* get table index (upper 6 bits minus 32) */
    /* index = (m16 >> 9) - 32; */
@@ -439,23 +414,16 @@ static Word32 ISqrt32_common( Word32 m,
                              Word16 e )
{
    Word16 m16, index, frac;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif

    assert( m >= 0x40000000 );
#ifdef ISSUE_1836_replace_overflow_libcom
    m16 = round_fx_sat( m );
#else
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    m16 = round_fx_o( m, &Overflow );
#else
    m16 = round_fx( m );
#endif
#endif


    /* get table index (upper 6 bits minus 32) */
    /* index = (m16 >> 25) - 32; */
@@ -922,11 +890,9 @@ Word16 divide3232( Word32 L_num, Word32 L_denom )
{
    Word16 z;
    Word32 sign;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
#endif
#endif


    sign = L_and( L_xor( L_num, L_denom ), (Word32) 0x80000000 );
@@ -940,11 +906,7 @@ Word16 divide3232( Word32 L_num, Word32 L_denom )
    L_denom = L_shl( L_denom, z );

    /* round_fx instead of extract_h improves spectral distortion in E_UTIL_lev_dur (schur version). */
#ifdef ISSUE_1836_replace_overflow_libcom
    z = div_l( L_num, round_fx_sat( L_denom ) );
#else
    z = div_l( L_num, round_fx_o( L_denom, &Overflow ) );
#endif
    if ( 0 != sign )
    {
        z = negate( z );
@@ -2088,21 +2050,14 @@ Word32 norm_llQ31( /* o : normalized result Q31 */
    Word16 i;
    Word32 L_tmp;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef ISSUE_1836_replace_overflow_libcom
    Flag Overflow = 0;
#endif
    Flag Carry = 0;
#endif /* BASOP_NOGLOB */

    /* Move MSBit of L_sum into L_c */
    Carry = 0;
#ifdef ISSUE_1836_replace_overflow_libcom
    L_tmp = L_add_c( L_sum, L_sum, &Carry ); /* L_tmp = L_sum << 1         */
    L_c = L_add_c( L_c, L_c, &Carry );
#else
    L_tmp = L_add_co( L_sum, L_sum, &Carry, &Overflow ); /* L_tmp = L_sum << 1         */
    L_c = L_add_co( L_c, L_c, &Carry, &Overflow );
#endif
    L_add( 0, 0 );
    test();
    IF( ( L_c != (Word32) 0L ) && ( L_c != (Word32) 0xFFFFFFFFL ) )
+2 −20
Original line number Diff line number Diff line
@@ -8,12 +8,6 @@
#include "rom_com.h" /* Static table prototypes                */
#include "prot_fx.h" /* Function prototypes                    */

#ifndef ISSUE_1836_FILEACTIVE_bitalloc_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
void bitalloc_fx(
    Word16 *y,              /* i  : reordered norm of sub-vectors              Q0 */
    Word16 *idx,            /* i  : reordered sub-vector indices               Q0 */
@@ -29,11 +23,9 @@ void bitalloc_fx(
    Word16 diff, temp;
    Word16 fac;
    Word16 ii;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    Word16 SFM_thr = SFM_G1G2;
    move16();
@@ -62,11 +54,7 @@ void bitalloc_fx(
        move16();
        FOR( m = 1; m < im; m++ )
        {
#ifdef ISSUE_1836_replace_overflow_libcom
            v = sub_sat( temp, y[m] ); /* Q0 */
#else
            v = sub_o( temp, y[m], &Overflow ); /* Q0 */
#endif
            temp = s_max( temp, y[m] );
            if ( v < 0 )
            {
@@ -257,11 +245,9 @@ Word16 BitAllocF_fx(
    Word16 tmp, exp1, exp2;
    Word32 Rsubband_w32_fx[NB_SFM]; /* Q15  */
    Word16 B_w16_fx;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    set32_fx( Rsubband_w32_fx, 0, NB_SFM );
@@ -456,11 +442,7 @@ Word16 BitAllocF_fx(
            exp1 = sub( norm_l( L_tmp2 ), 1 );
            exp2 = norm_s( n );
            tmp = div_s( extract_h( L_shl( L_tmp2, exp1 ) ), shl( n, exp2 ) ); /*15 + 15 + exp1 - 16 - exp2*/
#ifdef ISSUE_1836_replace_overflow_libcom
            m_fx = shl_sat( tmp, sub( exp2, exp1 ) ); /*Q14*/
#else
            m_fx = shl_o( tmp, sub( exp2, exp1 ), &Overflow );                 /*Q14*/
#endif
            if ( L_tmp1 < 0 )
            {
                m_fx = negate( m_fx );
+0 −16
Original line number Diff line number Diff line
@@ -48,12 +48,6 @@
#define N40 ( 20 )
#define N60 ( 30 )

#ifndef ISSUE_1836_FILEACTIVE_cldfb_evs_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
static void
cldfb_init_proto_and_twiddles( HANDLE_CLDFB_FILTER_BANK hs );

@@ -1246,11 +1240,9 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
    Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX];
    // Word16 freqTable[2] = {20, 40};
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    FOR( k = 0; k < numberCols; k++ )
@@ -1337,11 +1329,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
        {
            FOR( j = 20; j < numberBandsM; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
                nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
            }
        }

@@ -1364,11 +1352,7 @@ void GetEnergyCldfb( Word32 *energyLookahead, /*!< o: Q(*sf_energyLookahead)
        {
            FOR( j = 20; j < numberBandsM; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
                nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
            }
        }

+0 −15
Original line number Diff line number Diff line
@@ -51,11 +51,6 @@
#define restrict
#endif

#ifndef ISSUE_1836_FILEACTIVE_cldfb_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif

/*-------------------------------------------------------------------*
 * Local prototypes
@@ -1506,11 +1501,9 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
    Word32 energyValues[CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX];
    Word16 energyValuesSumE[CLDFB_NO_CHANNELS_MAX];
    // Word16 freqTable[2] = {20, 40};
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    FOR( k = 0; k < numberCols; k++ )
@@ -1597,11 +1590,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
        {
            FOR( j = 20; j < numberBandsM; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
                nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
            }
        }

@@ -1624,11 +1613,7 @@ static void GetEnergyCldfb_ivas_fx( Word32 *energyLookahead, /*!< o: Q(*sf_e
        {
            FOR( j = 20; j < numberBandsM; j++ )
            {
#ifdef ISSUE_1836_replace_overflow_libcom
                nrg = L_add_sat( nrg, L_shr_sat( energyValues[k][j], s ) );
#else
                nrg = L_add_o( nrg, L_shr_o( energyValues[k][j], s, &Overflow ), &Overflow );
#endif
            }
        }

Loading