Commit 788d7b57 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 1796-replace-shl_o-by-overflow-free-alternatives
parents 729b1b67 3fb2a16c
Loading
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -606,7 +606,9 @@ Word64 dot_product_cholesky_fixed(
{
    Word16 i, j;
    Word64 suma, tmp_sum;
#ifndef OPT_MCT_ENC_V3_BE
    Word32 mul;
#endif
    Word32 tmp;
    const Word32 *pt_x, *pt_A;
    pt_A = A;
@@ -621,12 +623,20 @@ Word64 dot_product_cholesky_fixed(

        FOR( j = 0; j <= i; j++ )
        {
#ifdef OPT_MCT_ENC_V3_BE
            tmp_sum = W_add( tmp_sum, Mpy_32_32( *pt_x++, *pt_A++ ) );
#else
            mul = Mpy_32_32( *pt_x++, *pt_A++ );
            tmp_sum = W_add( tmp_sum, W_deposit32_l( mul ) );
#endif
        }

#ifdef OPT_MCT_ENC_V3_BE
        tmp = W_shl_sat_l( tmp_sum, -4 ); // to make sure that the tmp_sum will not overflow
#else
        tmp_sum = W_shr( tmp_sum, 4 ); // to make sure that the tmp_sum will not overflow
        tmp = W_extract_l( tmp_sum );
#endif
        suma = W_mac_32_32( suma, tmp, tmp );
    }

+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@


/* Note: each compile switch (FIX_1101_...) is independent from the other ones */
#define OPT_MCT_ENC_V3_BE
#define OPT_MCT_ENC_V3_NBE
#define OPT_MCT_ENC_V2_BE
#define OPT_BIN_REND_V2_NBE
+22 −0
Original line number Diff line number Diff line
@@ -727,6 +727,9 @@ static void ivas_find_enr(
    Word32 min_ener;
    Word16 shift = 0;
    move16();
#ifdef OPT_MCT_ENC_V3_BE
    Word16 tmp_shift;
#endif

    ptR = &data[1];         /* first real */
    ptI = &data[L_FFT - 1]; /* first imaginary */
@@ -756,13 +759,20 @@ static void ivas_find_enr(

    freq = BIN_FREQ_FX;
    move16();
#ifdef OPT_MCT_ENC_V3_BE
    tmp_shift = sub( -Q16, shift ); // 16 - shift - 32
#endif
    FOR( i = 0; i < voic_band; i++ ) /* up to maximum allowed voiced critical band  */
    {
        band_ener = 0;
        move64();
        start_freq = freq;
        move16();
#ifdef OPT_MCT_ENC_V3_BE
        FOR( ; LE_32( freq, crit_bands_fx[i] ); )
#else
        WHILE( LE_32( freq, crit_bands_fx[i] ) )
#endif
        {
            /*
               *ptE = *ptR * *ptR + *ptI * *ptI;
@@ -795,7 +805,11 @@ static void ivas_find_enr(
            freq = add( freq, BIN_FREQ_FX );
        }

#ifdef OPT_MCT_ENC_V3_BE
        band[i] = W_shl_sat_l( band_ener, tmp_shift ); // *q_band
#else
        band[i] = W_extract_h( W_shl( band_ener, sub( Q16, shift ) ) ); // *q_band
#endif
        move32();

        band_energies[i] = band[i]; /* per band energy without E_MIN   */ // *q_band
@@ -820,7 +834,11 @@ static void ivas_find_enr(
            move64();
            start_freq = freq;
            move16();
#ifdef OPT_MCT_ENC_V3_BE
            FOR( ; LE_32( freq, crit_bands_fx[i] ); )
#else
            WHILE( LE_32( freq, crit_bands_fx[i] ) )
#endif
            {
                /*
                  *Bin_E = *ptR * *ptR + *ptI * *ptI;
@@ -851,7 +869,11 @@ static void ivas_find_enr(
                freq = add( freq, BIN_FREQ_FX );
            }

#ifdef OPT_MCT_ENC_V3_BE
            band[i] = W_shl_sat_l( band_ener, tmp_shift ); // *q_band
#else
            band[i] = W_extract_h( W_shl_nosat( band_ener, sub( Q16, shift ) ) ); // *q_band
#endif
            move32();

            band_energies[i] = band[i]; /* per band energy without E_MIN   */ // *q_band
+4 −0
Original line number Diff line number Diff line
@@ -135,7 +135,11 @@ static Word16 IGF_getCrest_new_fx(
    {
        x = logSpec[i];
        move16();
#ifdef OPT_MCT_ENC_V3_BE
        x_eff = L_mac0( x_eff, x, x );
#else
        x_eff = L_add( x_eff, L_mult0( x, x ) );
#endif

        if ( GT_16( x, x_max ) )
        {
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ static Word16 sns_1st_cod_fx(
            }

            /* for second split shift by five bits to store both indices as one 10 bit value */
            IF( EQ_16( split, 1 ) )
            if ( EQ_16( split, 1 ) )
            {
                index_split = shl( index_split, 5 );
            }
Loading