Commit b7e5f832 authored by JÜRGEN Gerstacker's avatar JÜRGEN Gerstacker
Browse files

issue _1965_ fix

parent 3ad96d7b
Loading
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -1115,21 +1115,27 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
)
{
    Word16 /*Q0*/ sfb;
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Word16 /*Q0*/ line;
    Word32 L_c;
#endif

#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Flag Overflow = 0;
    Flag Carry = 0;
    Flag Carry = 0; //done
#endif
    move16();
    move16();
#endif

#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
    {
        sfbEnergy[sfb] = L_deposit_l( 0 );
        move32();
    }
#endif
    IF( NULL == pPowerSpectrum )
    {
        return;
@@ -1137,6 +1143,7 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in

    FOR( sfb = startSfb; sfb < stopSfb; sfb++ )
    {
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
        L_c = L_deposit_l( 0 );
        FOR( line = swb_offset[sfb]; line < swb_offset[sfb + 1]; line++ )
        {
@@ -1150,6 +1157,23 @@ void IGFCommonFuncsCalcSfbEnergyPowerSpec( const Word16 startSfb, /**< in
        }
        sfbEnergy[sfb] = norm_llQ31( L_c, sfbEnergy[sfb], &( sfbEnergy_exp[sfb] ) );
        move32();
#else
#if 0
        Word16 sfbEnergy2_exp = 0;
        Word32 sfbEnergy2 = sum_array_norm(pPowerSpectrum + swb_offset[sfb],
                                           swb_offset[sfb + 1] - swb_offset[sfb],
                                          &( sfbEnergy2_exp ));
        if ( sfbEnergy[sfb] != sfbEnergy2 || sfbEnergy_exp[sfb] != sfbEnergy2_exp ) {
            fprintf(stderr, "ERROR %s:%d:  0x%08X 0x%08X   %d %d\n", __FILE__,__LINE__,
                sfbEnergy[sfb], sfbEnergy2, sfbEnergy_exp[sfb], sfbEnergy2_exp );

        }
#else
        sfbEnergy[sfb] = sum_array_norm(pPowerSpectrum + swb_offset[sfb],
                                        swb_offset[sfb + 1] - swb_offset[sfb],
                                       &( sfbEnergy_exp[sfb] ));
#endif
#endif
        sfbEnergy_exp[sfb] = add( sfbEnergy_exp[sfb], *pPowerSpectrum_exp );
        move16();
    }
+2 −2
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ static Word16 tcx_arith_decode_fx(
    Word16 tmp;
    Word32 L_tmp, Q;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOWxxx
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Flag Overflow = 0;
    move32();
    Flag Carry = 0; // not done
@@ -65,7 +65,7 @@ static Word16 tcx_arith_decode_fx(
        {
            bp = ari_decode_14bits_sign_fx( prm, bp, target_bits, &s, &as );

#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOWxxx
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
            L_tmp = L_macNs_co( L_tmp, q, k, &Carry, &Overflow );
#else
            L_tmp = L_macNs_sat( L_tmp, q, k );
+12 −0
Original line number Diff line number Diff line
@@ -1274,8 +1274,10 @@ void QuantizeSpectrum_fx(
    CONTEXT_HM_CONFIG *phm_cfg;
    TCX_ENC_HANDLE hTcxEnc = st->hTcxEnc;
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Flag Overflow = 0;
    Flag Carry = 0;
#endif
#endif

    /* Stack memory is split between encoder and internal decoder to reduce max
@@ -1852,7 +1854,11 @@ void QuantizeSpectrum_fx(
                spectrum[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) );
                move32();
                /* noise filling seed */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
                tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow );
#else
                tmp32 = L_macNs_sat( tmp32, abs_s( sqQ[i] ), i );
#endif
            }
            *spectrum_e = SPEC_EXP_DEC;
            move16();
@@ -2912,10 +2918,12 @@ void QuantizeTCXSpectrum_fx(
    Word16 att_fx = 0;
    move16();
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Flag Overflow = 0;
    move16();
    Flag Carry = 0;
    move16();
#endif
#endif
    /*-----------------------------------------------------------*
     * Init                                                      *
@@ -3543,7 +3551,11 @@ void QuantizeTCXSpectrum_fx(
            spectrum_fx[i] = L_mult( sqQ[i], 1 << ( 30 - SPEC_EXP_DEC ) );
            move32();
            /* noise filling seed */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
            tmp32 = L_macNs_co( tmp32, abs_s( sqQ[i] ), i, &Carry, &Overflow );
#else
            tmp32 = L_macNs_sat( tmp32, abs_s( sqQ[i] ), i );
#endif
        }
        *spectrum_e = SPEC_EXP_DEC;
        move16();
+32 −0
Original line number Diff line number Diff line
@@ -2358,10 +2358,16 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
{
    Word16 k, nb_pulse, i, t, pos[NPMAXPT], posno;
    Word16 sign, m;
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    UWord32 s;
#else
    UWord64 s;
#endif
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    Flag Overflow = 0;
    Flag Carry = 0;
#endif
    move32();
    move32();
#endif
@@ -2387,7 +2393,11 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
    }

    /* Iterate over the different pulse positions */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
    s = L_deposit_l( 0 );
#else
    s= 0;
#endif
    t = 0;
    move16();
    nb_pulse = 0;
@@ -2400,9 +2410,15 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
        /* Code m-1 pulses */
        FOR( i = 1; i < m; ++i )
        {
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
            Carry = 0;
#endif
            move32();
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
            s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow );
#else
            s = W_add( s, pulsestostates[pos[k]][t] );
#endif
            t = add( t, 1 );
            if ( sub( t, NPMAXPT ) > 0 )
            {
@@ -2413,18 +2429,34 @@ static void E_ACELP_codearithp_fx( const Word16 v[] /*Q9*/, UWord32 *n /*Q0*/, U
        /* Code sign */
        /* We use L_add_c since we want to work with unsigned UWord32 */
        /* Therefore, we have to clear carry */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
        Carry = 0;
#endif
        move32();
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
        s = L_lshl( s, 1 );
#else
        s = W_lshl( s, 1 );
#endif
        if ( sign < 0 )
        {
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
            s = L_add_co( s, 1, &Carry, &Overflow );
#else
            s = W_add( s, 1 );
#endif
        }

        /* Code last pulse */
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
        Carry = 0;
#endif
        move32();
#ifndef FIX_ISSUE_1965_REPLACE_CARRY_OVERFLOW
        s = L_add_co( s, pulsestostates[pos[k]][t], &Carry, &Overflow );
#else
        s = W_add( s, pulsestostates[pos[k]][t] );
#endif
        t = add( t, 1 );
    }