Commit bbbb7390 authored by malenov's avatar malenov
Browse files

correction of malloc()/free() instrumentation within FIX_VBR_COMPLEXITY

parent ed00a751
Loading
Loading
Loading
Loading
Loading
+54 −8
Original line number Diff line number Diff line
@@ -42,10 +42,6 @@
#include "rom_com.h"
#include "wmc_auto.h"

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
#endif

/*-------------------------------------------------------------------*
 * Local constants
 *-------------------------------------------------------------------*/
@@ -85,9 +81,11 @@ ivas_error DTFS_new(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MOVE( 2 );
    LOOP( 1 );
    MOVE( 2 );
#undef WMC_TOOL_SKIP
#endif
    dtfs->lag = 0;
    dtfs->nH = 0;
@@ -120,6 +118,7 @@ void DTFS_copy(
{
    int16_t k;
#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( k = 0; k < MAXLAG_WI; k++ )
    {
@@ -138,6 +137,7 @@ void DTFS_copy(
    Xout->nH_4kHz = Xinp.nH_4kHz;
    Xout->upper_cut_off_freq_of_interest = Xinp.upper_cut_off_freq_of_interest;
    Xout->upper_cut_off_freq = Xinp.upper_cut_off_freq;
#undef WMC_TOOL_SKIP
#else
    for ( k = 0; k < MAXLAG_WI; k++ )
    {
@@ -174,6 +174,7 @@ void DTFS_sub(
    int16_t i;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MULT( 1 );
    LOOP( 1 );
    for ( i = 0; i <= X1.lag / 2; i++ )
@@ -199,6 +200,7 @@ void DTFS_sub(
    tmp->nH_4kHz = max( X1.nH_4kHz, X2.nH_4kHz );
    tmp->upper_cut_off_freq_of_interest = X1.upper_cut_off_freq_of_interest;
    tmp->upper_cut_off_freq = X1.upper_cut_off_freq;
#undef WMC_TOOL_SKIP
#else
    for ( i = 0; i <= X1.lag / 2; i++ )
    {
@@ -241,6 +243,7 @@ static void DTFS_fast_fs_inv(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    /* Populate the dbuf array */
    dbuf[1] = X1_DTFS->a[0];
    dbuf[2] = 0.0;
@@ -276,6 +279,7 @@ static void DTFS_fast_fs_inv(
        ADD( 1 );
        out[i - 1] = dbuf[i] / N_2;
    }
#undef WMC_TOOL_SKIP
#else
    /* Populate the dbuf array */
    dbuf[1] = X1_DTFS->a[0];
@@ -334,6 +338,7 @@ static float DTFS_alignment_weight(
    DTFS_STRUCTURE X1_DTFS;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 2 );
    DTFS_copy( &X1_DTFS, refX1_DTFS );
    FUNC( 2 );
@@ -351,7 +356,6 @@ static float DTFS_alignment_weight(
        tmplpc[k] = LPC1[k] * ( tmp *= pwf );
    }


    FUNC( 3 );
    DTFS_zeroFilter( &X1_DTFS, tmplpc, M + 1 );
    FUNC( 3 );
@@ -421,6 +425,7 @@ static float DTFS_alignment_weight(
            maxcorr = wcorr;
        }
    }
#undef WMC_TOOL_SKIP
#else
    DTFS_copy( &X1_DTFS, refX1_DTFS );
    DTFS_adjustLag( &X1_DTFS, X2_DTFS.lag );
@@ -491,6 +496,7 @@ float DTFS_alignment_full(
    float maxcorr, corr, tmp, tmp1, fshift, n, diff;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOGIC( 1 );
    if ( X1_DTFS.lag < X2_DTFS.lag )
    {
@@ -536,6 +542,7 @@ float DTFS_alignment_full(
            maxcorr = corr;
        }
    }
#undef WMC_TOOL_SKIP
#else
    if ( X1_DTFS.lag < X2_DTFS.lag )
    {
@@ -587,6 +594,7 @@ void DTFS_phaseShift(
    float tmp, tmp2 = 0.0f;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    ADD( 1 );
    LOOP( 1 );
    for ( k = 0; k <= min( X->lag >> 1, X->nH ); k++, tmp2 += ph )
@@ -601,6 +609,7 @@ void DTFS_phaseShift(
        MAC( 1 );
        X->b[k] = (float) ( tmp * sin( tmp2 ) + X->b[k] * cos( tmp2 ) );
    }
#undef WMC_TOOL_SKIP
#else
    for ( k = 0; k <= min( X->lag >> 1, X->nH ); k++, tmp2 += ph )
    {
@@ -629,6 +638,7 @@ void DTFS_zeroPadd(
    float diff;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOGIC( 1 );
    if ( N == X->lag )
    {
@@ -655,6 +665,7 @@ void DTFS_zeroPadd(
    {
        X->nH++;
    }
#undef WMC_TOOL_SKIP
#else
    if ( N == X->lag )
    {
@@ -719,6 +730,7 @@ void DTFS_to_fs(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    X->lag = N;
    MOVE( 1 );
    MULT( 1 );
@@ -813,6 +825,7 @@ void DTFS_to_fs(
    }
    X->nH = nH_band;
    X->nH_4kHz = nH_4kHz;
#undef WMC_TOOL_SKIP
#else
    X->lag = N;
    nH_band = (int16_t) floor( X->upper_cut_off_freq / ( 12800.0 / X->lag ) );
@@ -898,6 +911,7 @@ void DTFS_fs_inv(
    int16_t k, n;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( n = 0; n < N; n++ )
    {
@@ -915,6 +929,7 @@ void DTFS_fs_inv(
            x[n] += (float) ( X->a[k] * cos( tmp ) + X->b[k] * sin( tmp ) );
        }
    }
#undef WMC_TOOL_SKIP
#else
    for ( n = 0; n < N; n++ )
    {
@@ -977,6 +992,7 @@ static void DTFS_transform(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 2 );
    DTFS_copy( tmp1_dtfs, X );
    FUNC( 2 );
@@ -1087,6 +1103,7 @@ static void DTFS_transform(

        out[i] = sum1;
    }
#undef WMC_TOOL_SKIP
#else
    DTFS_copy( tmp1_dtfs, X );
    DTFS_copy( tmp2_dtfs, X2 );
@@ -1204,6 +1221,7 @@ void DTFS_zeroFilter(
    int16_t k, n;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MOVE( 1 );
    MULT( 1 );
    tmp1 = (float) ( PI2 / X->lag );
@@ -1239,6 +1257,7 @@ void DTFS_zeroFilter(
        MAC( 1 );
        X->b[k] = X->b[k] * sum1 + tmp * sum2;
    }
#undef WMC_TOOL_SKIP
#else
    tmp1 = (float) ( PI2 / X->lag );
    for ( k = 0; k <= min( X->lag >> 1, X->nH ); k++ )
@@ -1279,6 +1298,7 @@ void DTFS_poleFilter(
    int16_t k, n;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MOVE( 1 );
    MULT( 1 );
    tmp1 = (float) ( PI2 / X->lag );
@@ -1316,6 +1336,7 @@ void DTFS_poleFilter(
        ADD( 1 );
        X->b[k] = ( -tmp * sum2 + X->b[k] * sum1 ) / tmp2;
    }
#undef WMC_TOOL_SKIP
#else
    tmp1 = (float) ( PI2 / X->lag );
    for ( k = 0; k <= min( X->lag >> 1, X->nH ); k++ )
@@ -1356,6 +1377,7 @@ static float DTFS_setEngy(
    float en1, tmp;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 1 );
    MOVE( 1 );
    en1 = DTFS_getEngy( *X_DTFS );
@@ -1376,6 +1398,7 @@ static float DTFS_setEngy(
        MULT( 1 );
        X_DTFS->b[k] *= tmp;
    }
#undef WMC_TOOL_SKIP
#else
    en1 = DTFS_getEngy( *X_DTFS );
    if ( en1 == 0.0 )
@@ -1409,6 +1432,7 @@ void DTFS_adjustLag(
    float en, diff;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOGIC( 1 );
    if ( N == X_DTFS->lag )
    {
@@ -1459,6 +1483,7 @@ void DTFS_adjustLag(
            X_DTFS->nH_4kHz++;
        }
    }
#undef WMC_TOOL_SKIP
#else
    if ( N == X_DTFS->lag )
    {
@@ -1514,6 +1539,7 @@ float DTFS_getEngy(

    en = 0.0f;
#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( k = 1; k <= min( ( X.lag - 1 ) >> 1, X.nH ); k++ )
    {
@@ -1533,6 +1559,7 @@ float DTFS_getEngy(
        ADD( 1 );
        en += X.a[k] * X.a[k] + X.b[k] * X.b[k];
    }
#undef WMC_TOOL_SKIP
#else
    for ( k = 1; k <= min( ( X.lag - 1 ) >> 1, X.nH ); k++ )
    {
@@ -1564,6 +1591,7 @@ void DTFS_car2pol(
    float tmp;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( k = 1; k <= min( ( X->lag - 1 ) >> 1, X->nH ); k++ )
    {
@@ -1587,6 +1615,7 @@ void DTFS_car2pol(
        MOVE( 1 );
        X->b[k] = (float) atan2( X->b[k], tmp );
    }
#undef WMC_TOOL_SKIP
#else
    for ( k = 1; k <= min( ( X->lag - 1 ) >> 1, X->nH ); k++ )
    {
@@ -1621,6 +1650,7 @@ void DTFS_pol2car(
    float tmp;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( k = 1; k <= min( ( X->lag - 1 ) >> 1, X->nH ); k++ )
    {
@@ -1645,6 +1675,7 @@ void DTFS_pol2car(
        MULT( 1 );
        X->a[k] = (float) ( X->a[k] * cos( tmp ) );
    }
#undef WMC_TOOL_SKIP
#else
    for ( k = 1; k <= min( ( X->lag - 1 ) >> 1, X->nH ); k++ )
    {
@@ -1690,6 +1721,7 @@ float DTFS_setEngyHarm(
    count = 0;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOGIC( 1 );
    if ( f1 == 0.0 )
    {
@@ -1767,6 +1799,7 @@ float DTFS_setEngyHarm(
            X->a[k] *= factor;
        }
    }
#undef WMC_TOOL_SKIP
#else
    if ( f1 == 0.0 )
    {
@@ -1844,6 +1877,7 @@ static void cubicPhase(
    double diff;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    ADD( 1 );
    N -= (int16_t) L2;

@@ -1911,6 +1945,7 @@ static void cubicPhase(
        ADD( 2 );
        phOut[n] = (float) ( phOut[n - 1] + diff );
    }
#undef WMC_TOOL_SKIP
#else
    N -= (int16_t) L2;

@@ -1978,6 +2013,7 @@ void DTFS_to_erb(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( i = 0; i < num_erb; i++ )
    {
@@ -2027,6 +2063,7 @@ void DTFS_to_erb(
            out[i] /= count[i];
        }
    }
#undef WMC_TOOL_SKIP
#else
    for ( i = 0; i < num_erb; i++ )
    {
@@ -2101,6 +2138,7 @@ void erb_slot(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MOVE( 1 );
    MULT( 1 );
    nH_band = (int16_t) floor( upper_cut_off_freq / ( 12800.0 / lag ) );
@@ -2160,6 +2198,7 @@ void erb_slot(
            mfreq[j] /= out[j];
        }
    }
#undef WMC_TOOL_SKIP
#else
    nH_band = (int16_t) floor( upper_cut_off_freq / ( 12800.0 / lag ) );

@@ -2240,6 +2279,7 @@ void DTFS_erb_inv(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    MOVE( 1 );
    f[m] = 0.0;
    MOVE( 1 );
@@ -2312,6 +2352,7 @@ void DTFS_erb_inv(

        X->a[0] = 0.0f;
    }
#undef WMC_TOOL_SKIP
#else
    f[m] = 0.0;
    amp[m] = 0.0;
@@ -2386,6 +2427,7 @@ static void LPCPowSpect(
    int16_t i, k;

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    LOOP( 1 );
    for ( k = 0; k < Nf; k++ )
    {
@@ -2414,6 +2456,7 @@ static void LPCPowSpect(
        DIV( 1 );
        out[k] = 1.0f / ( Re * Re + Im * Im );
    }
#undef WMC_TOOL_SKIP
#else
    for ( k = 0; k < Nf; k++ )
    {
@@ -2466,6 +2509,7 @@ void erb_diff(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 3 );
    erb_slot( l, cslot, mfreq, num_erb );
    FUNC( 3 );
@@ -2702,6 +2746,7 @@ void erb_diff(

    MOVE( 1 );
    index[1] = mmseindex;
#undef WMC_TOOL_SKIP
#else
    erb_slot( l, cslot, mfreq, num_erb );
    erb_slot( pl, pslot, t_prev_erb, num_erb );
@@ -2894,6 +2939,7 @@ void erb_add(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 3 );
    erb_slot( l, cslot, t_prev_erb, num_erb );
    FUNC( 3 );
@@ -3000,6 +3046,7 @@ void erb_add(
            curr_erb[i] = 0.0f;
        }
    }
#undef WMC_TOOL_SKIP
#else
    erb_slot( l, cslot, t_prev_erb, num_erb );
    erb_slot( pl, pslot, t_prev_erb, num_erb );
@@ -3117,6 +3164,7 @@ ivas_error WIsyn(
    }

#ifdef FIX_VBR_COMPLEXITY
#define WMC_TOOL_SKIP
    FUNC( 2 );
    DTFS_copy( CURRCW_DTFS, *CURRCW_DTFS_out );

@@ -3187,6 +3235,7 @@ ivas_error WIsyn(
    MOVE( 1 );
    DIV( 1 );
    *ph_offset = (float) fmod( (double) ( tmp ), PI2 );
#undef WMC_TOOL_SKIP
#else
    DTFS_copy( CURRCW_DTFS, *CURRCW_DTFS_out );

@@ -3239,6 +3288,3 @@ ivas_error WIsyn(
    return error;
}
#ifdef FIX_VBR_COMPLEXITY
#undef WMC_TOOL_SKIP
#endif
+0 −2
Original line number Diff line number Diff line
@@ -285,10 +285,8 @@ ivas_error decod_gen_voic(
                }
            }

#define WMC_TOOL_SKIP
            free( PREVP );
            free( CURRP );
#undef WMC_TOOL_SKIP
        }
    }

+0 −2
Original line number Diff line number Diff line
@@ -177,9 +177,7 @@ ivas_error ppp_quarter_decoder(
    tmp = (float) get_next_indice( st, 3 );
    DTFS_phaseShift( CURRCW_Q_DTFS, (float) ( PI2 * ( tmp - 3 ) / CURRCW_Q_DTFS->lag ) );

#define WMC_TOOL_SKIP
    free( PREVDTFS );
#undef WMC_TOOL_SKIP

    return error;
}
+0 −2
Original line number Diff line number Diff line
@@ -233,11 +233,9 @@ ivas_error ppp_voiced_decoder(
    mvr2r( dtfs_temp->a, hSC_VBR->dtfs_dec_a, MAXLAG_WI );
    mvr2r( dtfs_temp->b, hSC_VBR->dtfs_dec_b, MAXLAG_WI );

#define WMC_TOOL_SKIP
    free( TMPDTFS );
    free( CURRP_Q_D );
    free( dtfs_temp );
#undef WMC_TOOL_SKIP

    return error;
}
+0 −2
Original line number Diff line number Diff line
@@ -355,9 +355,7 @@ ivas_error ppp_quarter_encoder(

    push_indice( hBstr, IND_GLOBAL_ALIGNMENT, (int16_t) ( tmp + 3 ), 3 );

#define WMC_TOOL_SKIP
    free( PREVDTFS );
#undef WMC_TOOL_SKIP

    return error;
}
Loading