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

checkout d* e* f* g* from lib_com from #fb1b9104

parent 11f0d8cb
Loading
Loading
Loading
Loading
Loading
+43 −8
Original line number Diff line number Diff line
@@ -39,7 +39,12 @@
#include "prot_fx.h"
#include "wmc_auto.h"

#ifndef ISSUE_1836_FILEACTIVE_deemph_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
void deemph_fx_32(
    Word32 *signal,  /* i/o: signal            Qx*/
    const Word16 mu, /* i  : deemphasis factor Q15*/
@@ -93,22 +98,34 @@ void deemph_fx(
{
    Word16 i;
    Word32 L_tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow;
    Overflow = 0;
    move32();
#endif

    L_tmp = L_deposit_h( signal[0] );              /*Qx+16*/
    L_tmp = L_mac_o( L_tmp, *mem, mu, &Overflow ); /*Qx+16*/
    signal[0] = round_fx_o( L_tmp, &Overflow );    /*Qx*/
#else
    L_tmp = L_deposit_h( signal[0] );                                                                               /*Qx+16*/
    L_tmp = L_mac_sat( L_tmp, *mem, mu );                                                                           /*Qx+16*/
    signal[0] = round_fx_sat( L_tmp );                                                                              /*Qx*/
#endif


    move16();

    FOR( i = 1; i < L; i++ )
    {
        L_tmp = L_deposit_h( signal[i] ); /*Qx+16*/
#ifdef ISSUE_1836_replace_overflow_libcom
        L_tmp = L_mac_sat( L_tmp, signal[i - 1], mu ); /*Qx+16*/
        signal[i] = round_fx_sat( L_tmp );             /*Qx*/
#else
        L_tmp = L_mac_o( L_tmp, signal[i - 1], mu, &Overflow );                                                     /*Qx+16*/
        signal[i] = round_fx_o( L_tmp, &Overflow );                                                                 /*Qx*/
#endif
        move16();
    }

@@ -131,10 +148,12 @@ void Deemph2(
{
    Word16 i;
    Word32 L_tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow;
    Overflow = 0;
    move32();
#endif
#endif
    /* saturation can occur in L_mac() */

@@ -145,7 +164,11 @@ void Deemph2(
    FOR( i = 1; i < L; i++ )
    {
        L_tmp = L_mult( x[i], 16384 /*0.5f in Q15*/ ); /*Qx+16*/
#ifdef ISSUE_1836_replace_overflow_libcom
        x[i] = mac_r_sat( L_tmp, x[i - 1], mu ); /*Qx-1*/
#else
        x[i] = mac_ro( L_tmp, x[i - 1], mu, &Overflow );                                                            /*Qx-1*/
#endif
        move16();
    }

@@ -175,10 +198,12 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
{
    Word16 i;
    Word32 L_tmp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow;
    Overflow = 0;
    move32();
#endif
#endif

    /* signal[0] = signal[0] + mu * (*mem); */
@@ -188,8 +213,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
        shift = shr( -32768, shift ); /*Q15 - shift*/
        FOR( i = 0; i < L; i++ )
        {
#ifdef ISSUE_1836_replace_overflow_libcom
            L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), x[i], shift ); /*Qx-shift+16*/
            x[i] = round_fx_sat( L_tmp );                               /*Qx-shift*/
#else
            L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), x[i], shift, &Overflow );                                    /*Qx-shift+16*/
            x[i] = round_fx_o( L_tmp, &Overflow );                                                                  /*Qx-shift*/
#endif
            move16();
        }
    }
@@ -197,8 +227,13 @@ void E_UTIL_deemph2( Word16 shift, Word16 *x, const Word16 mu, const Word16 L, W
    {
        FOR( i = 0; i < L; i++ )
        {
#ifdef ISSUE_1836_replace_overflow_libcom
            L_tmp = L_msu_sat( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/ ); /*Qx-shift+16*/
            x[i] = round_fx_sat( L_tmp );                                                                  /*Qx-shift*/
#else
            L_tmp = L_msu_o( Mpy_32_16_1( L_tmp, mu ), shr_sat( x[i], shift ), -32768 /*1.0f in Q15*/, &Overflow ); /*Qx-shift+16*/
            x[i] = round_fx_o( L_tmp, &Overflow );                                                                  /*Qx-shift*/
#endif
            move16();
        }
    }
+42 −8
Original line number Diff line number Diff line
@@ -13,6 +13,11 @@

#include "math_32.h"

#ifndef ISSUE_1836_FILEACTIVE_edct_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif

static Word16 get_edxt_factor( Word16 length ) /* Returns value of sqrtf(2.f/length) in Q15 */
{
@@ -396,10 +401,12 @@ void edct_16fx(
    const Word16 *px, *pt;
    Word16 *py;
    (void) element_mode;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow;
    Overflow = 0;
    move32();
#endif
#endif
    /*COMPLETE: some eDCT sub function are missing */

@@ -456,12 +463,21 @@ void edct_16fx(
        i2 = shl( i, 1 );

        L_tmp = L_mult( x[i2], edct_table[i] ); /*Q(Qx+16) */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( L_tmp, *px, *pt );                /*Q(Qx+16) */
        re2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */
        move16();
        L_tmp = L_mult( *px, edct_table[i] );               /*Q(Qx+16) */
        Lacc = L_msu_sat( L_tmp, x[i2], *pt );              /*Q(Qx+16) */
        im2[i] = round_fx_sat( L_shl_sat( Lacc, Q_edct ) ); /* Q(Qx+Q_edct) */
#else
        Lacc = L_mac_o( L_tmp, *px, *pt, &Overflow );                         /*Q(Qx+16) */
        re2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */
        move16();
        L_tmp = L_mult( *px, edct_table[i] );                                 /*Q(Qx+16) */
        Lacc = L_msu_o( L_tmp, x[i2], *pt, &Overflow );                       /*Q(Qx+16) */
        im2[i] = round_fx_o( L_shl_o( Lacc, Q_edct, &Overflow ), &Overflow ); /* Q(Qx+Q_edct) */
#endif
        move16();
        px -= 2;
        pt--;
@@ -487,11 +503,19 @@ void edct_16fx(
    FOR( i = 0; i < shr( length, 1 ); i++ )
    {
        tmp = mult_r( im2[i], fact ); /*Q(Qx+Q_edct) */
#ifdef ISSUE_1836_replace_overflow_libcom
        re[i] = sub_sat( re2[i], tmp ); /*Q(Qx+Q_edct) */
#else
        re[i] = sub_o( re2[i], tmp, &Overflow );                              /*Q(Qx+Q_edct) */
#endif
        move16();

        tmp = mult_r( re2[i], fact ); /*Q(Qx+Q_edct) */
#ifdef ISSUE_1836_replace_overflow_libcom
        im[i] = add_sat( im2[i], tmp ); /*Q(Qx+Q_edct) */
#else
        im[i] = add_o( im2[i], tmp, &Overflow );                              /*Q(Qx+Q_edct) */
#endif
        move16();
    }

@@ -503,6 +527,15 @@ void edct_16fx(
        i2 = shl( i, 1 );

        L_tmp = L_mult( re[i], edct_table[i] ); /*Q(Qx+Q_edct+16) */
#ifdef ISSUE_1836_replace_overflow_libcom
        Lacc = L_mac_sat( L_tmp, im[i], *pt );             /*Q(Qx+Q_edct+16) */
        y[i2] = round_fx_sat( L_shr_sat( Lacc, Q_edct ) ); /* Q(Qx) */
        move16();

        L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */
        Lacc = L_msu( L_tmp, im[i], edct_table[i] );                               /*Q(Qx+Q_edct+16) */
        *py = round_fx_sat( L_shr_sat( Lacc, Q_edct ) );                           /* Q(Qx) */
#else
        Lacc = L_mac_o( L_tmp, im[i], *pt, &Overflow );                       /*Q(Qx+Q_edct+16) */
        y[i2] = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow );  /* Q(Qx) */
        move16();
@@ -510,6 +543,7 @@ void edct_16fx(
        L_tmp = L_mult( re[i], edct_table[sub( shr( length, 1 ), add( 1, i ) )] ); /*Q(Qx+Q_edct+16) */
        Lacc = L_msu( L_tmp, im[i], edct_table[i] );                               /*Q(Qx+Q_edct+16) */
        *py = round_fx_o( L_shr_o( Lacc, Q_edct, &Overflow ), &Overflow );         /* Q(Qx) */
#endif
        move16();

        py -= 2;
+12 −0
Original line number Diff line number Diff line
@@ -43,6 +43,12 @@
#include "rom_com.h"
#include "wmc_auto.h"
#include "stl.h"

#ifndef ISSUE_1836_FILEACTIVE_env_stab_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif
#endif
/*--------------------------------------------------------------------------*
 * Local constants
 *--------------------------------------------------------------------------*/
@@ -187,9 +193,11 @@ Word16 env_stab_smo_fx( /* Q0 */
    Word16 maxval, pp[NUM_ENV_STAB_PLC_STATES], pa[NUM_ENV_STAB_PLC_STATES];
    Word16 i;
    Word16 tmp, sum, exp;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif
    /* get previous state */
    prev_state = maximum_fx( env_stab_state_p, NUM_ENV_STAB_PLC_STATES, &maxval );
@@ -226,7 +234,11 @@ Word16 env_stab_smo_fx( /* Q0 */
    /*tmp = shl(tmp, add(exp, 1));*/       /* Q15 */
    FOR( i = 0; i < NUM_ENV_STAB_PLC_STATES; i++ )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        env_stab_state_p[i] = round_fx_sat( L_shl_sat( L_mult_sat( env_stab_state_p[i], tmp ), add( exp, 1 ) ) ); /* Q15 */
#else
        env_stab_state_p[i] = round_fx_o( L_shl_o( L_mult_o( env_stab_state_p[i], tmp, &Overflow ), add( exp, 1 ), &Overflow ), &Overflow ); /* Q15 */
#endif
        move16();
    }

+41 −1
Original line number Diff line number Diff line
@@ -21,6 +21,12 @@
#define CNG_HS           4         /* 4 bit headroom for dot product */
#define CNG_S            6         /* 1 sign bit, 6 bit integer part, 9 bit frational part for input and output data */

#ifndef ISSUE_1836_FILEACTIVE_fd_cng_com_fx_c
#ifdef ISSUE_1836_replace_overflow_libcom
#undef ISSUE_1836_replace_overflow_libcom
#endif

#endif
/*-------------------------------------------------------------------
 * Local function prototypes
 *-------------------------------------------------------------------*/
@@ -647,11 +653,12 @@ void minimum_statistics(
    Word16 msAlphaCorAlpha2;
    Word16 msPeriodogSum16;
    Word16 msNoiseFloor16;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif

#endif

    len2 = i_mult( MSNUMSUBFR, len );

@@ -750,7 +757,11 @@ void minimum_statistics(
                    /* use absolute value to avoid -1.0 x -1.0 multiplications */
                    s2 = norm_l( scalar2 );
                }
#ifdef ISSUE_1836_replace_overflow_libcom
                scalar216 = round_fx_sat( L_shl( scalar2, s2 ) );
#else
                scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow );
#endif
                scalar2 = L_mult( scalar216, scalar216 );

                /* find common exponent */
@@ -900,7 +911,11 @@ void minimum_statistics(
                s2 = s_min( s2, WORD32_BITS - 1 );

                /* beta: scaled by s2 */
#ifdef ISSUE_1836_replace_overflow_libcom
                tmp16 = round_fx_sat( L_shl( tmp, s1 ) );
#else
                tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow );
#endif
                beta = mult_r( tmp16, tmp16 );

                /* scalar3: scaled by s3 */
@@ -988,8 +1003,13 @@ void minimum_statistics(
                    move32();
                    /* exponent msCurrentMinSubWindow[j]: CNG_S */
                    BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef ISSUE_1836_replace_overflow_libcom
                    msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 );
                    move32();
#else
                    msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow );
                    move32();
#endif
                    BASOP_SATURATE_WARNING_ON_EVS;
                }
            }
@@ -1246,10 +1266,12 @@ void minimum_statistics_fx(
    Word16 msAlphaCorAlpha2;
    Word16 msPeriodogSum16;
    Word16 msNoiseFloor16;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif


    len2 = i_mult( MSNUMSUBFR, len );
@@ -1349,7 +1371,11 @@ void minimum_statistics_fx(
                    /* use absolute value to avoid -1.0 x -1.0 multiplications */
                    s2 = norm_l( scalar2 );
                }
#ifdef ISSUE_1836_replace_overflow_libcom
                scalar216 = round_fx_sat( L_shl( scalar2, s2 ) );
#else
                scalar216 = round_fx_o( L_shl_o( scalar2, s2, &Overflow ), &Overflow );
#endif
                scalar2 = L_mult( scalar216, scalar216 );

                /* find common exponent */
@@ -1506,7 +1532,11 @@ void minimum_statistics_fx(
                s2 = s_min( s2, WORD32_BITS - 1 );

                /* beta: scaled by s2 */
#ifdef ISSUE_1836_replace_overflow_libcom
                tmp16 = round_fx_sat( L_shl( tmp, s1 ) );
#else
                tmp16 = round_fx_o( L_shl_o( tmp, s1, &Overflow ), &Overflow );
#endif
                beta = mult_r( tmp16, tmp16 );

                /* scalar3: scaled by s3 */
@@ -1594,7 +1624,11 @@ void minimum_statistics_fx(
                    move32();
                    /* exponent msCurrentMinSubWindow[j]: CNG_S */
                    BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef ISSUE_1836_replace_overflow_libcom
                    msCurrentMinSubWindow[j] = L_shl_sat( Mpy_32_32( scalar, msBminSubWin[j] ), 5 );
#else
                    msCurrentMinSubWindow[j] = L_shl_o( Mpy_32_32( scalar, msBminSubWin[j] ), 5, &Overflow );
#endif
                    move32();
                    BASOP_SATURATE_WARNING_ON_EVS;
                }
@@ -2279,10 +2313,12 @@ static void getmidbands(
)
{
    Word16 j, max_psize, shift;
#ifndef ISSUE_1836_replace_overflow_libcom
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif


    max_psize = psize[0];
@@ -2316,7 +2352,11 @@ static void getmidbands(
    move16();
    FOR( j = 0; j < npart; j++ )
    {
#ifdef ISSUE_1836_replace_overflow_libcom
        psize_norm[j] = shl_sat( psize[j], shift ); // Q(15 - psize_norm_exp)
#else
        psize_norm[j] = shl_o( psize[j], shift, &Overflow ); // Q(15 - psize_norm_exp)
#endif
        move16();
    }
    /* minimum_statistics needs fixed exponent of 6 */
+435 −1

File changed.

Preview size limit exceeded, changes collapsed.

Loading