Commit d153767e authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH

parent a84a67d7
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -162,7 +162,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_1342_WORKAROUND_DEC_FLUSH_BROKEN_IN_SR      /* FhG: Temporary workaround for incorrect implementation of decoder flush with split rendering */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH /* FhG: fix oob indexing USAN complaint */
#define FIX_2287_MCT_MDCT_STEREO_DATA_MALLOC_SIZE       /* FhG: correct allocation size for STEREO_MDCT_DEC_DATA struct */
#define FIX_1486_INIT_OUTPUT_POINTERS                   /* FhG: always initialize pointers in renderer flush */
#define FIX_1474_USAN_TRANS_INV                         /* Eri: Fix USAN out-of-bounds warning. No OOB occurs, but the pointer is set to point to uninitialized memory. */
+0 −43
Original line number Diff line number Diff line
@@ -147,11 +147,7 @@ int16_t E_GAIN_closed_loop_search(
{
    float corr_v[32 + 2 * L_INTERPOL1 + 1];
    float cor_max, max_val, temp;
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    int16_t corr_idx;
#else
    float *corr;
#endif
    int16_t i, fraction, frac1, frac2, step;
    int16_t t0, t_min, t_max;

@@ -163,30 +159,16 @@ int16_t E_GAIN_closed_loop_search(
    t_min = t0_min - L_INTERPOL1;
    t_max = t0_max + L_INTERPOL1;

#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    corr_idx = -t_min;
#else
    /* allocate memory to normalized correlation vector */
    corr = &corr_v[-t_min]; /* corr[t_min..t_max] */
#endif

    /* Compute normalized correlation between target and filtered excitation */
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    norm_corr( exc, xn, h, t_min, t_max, &corr_v[0] + corr_idx, L_subfr );
#else
    norm_corr( exc, xn, h, t_min, t_max, corr, L_subfr );
#endif

    /*  find integer pitch */
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    max_val = corr_v[t0_min + corr_idx];
#else
    max_val = corr[t0_min];
#endif
    t0 = t0_min;
    for ( i = t0_min + 1; i <= t0_max; i++ )
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        float corr_tmp;

        corr_tmp = corr_v[corr_idx + i];
@@ -195,13 +177,6 @@ int16_t E_GAIN_closed_loop_search(
            max_val = corr_tmp;
            t0 = i;
        }
#else
        if ( corr[i] >= max_val )
        {
            max_val = corr[i];
            t0 = i;
        }
#endif
    }

    /* If first subframe and t0 >= pit_fr1, do not search fractionnal pitch */
@@ -247,24 +222,14 @@ int16_t E_GAIN_closed_loop_search(
        frac2 = t0_max_frac;
    }
    assert( frac1 <= 0 && frac2 >= 0 && frac2 > frac1 );
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    corr_idx += t0;
#endif
    if ( pit_res_max == 6 )
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        cor_max = E_GAIN_norm_corr_interpolate6( &corr_v[corr_idx], frac1 );
#else
        cor_max = E_GAIN_norm_corr_interpolate6( &corr[t0], frac1 );
#endif
        fraction = frac1;
        for ( i = ( frac1 + step ); i <= frac2; i += step )
        {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
            temp = E_GAIN_norm_corr_interpolate6( &corr_v[corr_idx], i );
#else
            temp = E_GAIN_norm_corr_interpolate6( &corr[t0], i );
#endif
            if ( temp > cor_max )
            {
                cor_max = temp;
@@ -274,19 +239,11 @@ int16_t E_GAIN_closed_loop_search(
    }
    else
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        cor_max = E_GAIN_norm_corr_interpolate( &corr_v[corr_idx], frac1 );
#else
        cor_max = E_GAIN_norm_corr_interpolate( &corr[t0], frac1 );
#endif
        fraction = frac1;
        for ( i = ( frac1 + step ); i <= frac2; i += step )
        {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
            temp = E_GAIN_norm_corr_interpolate( &corr_v[corr_idx], i );
#else
            temp = E_GAIN_norm_corr_interpolate( &corr[t0], i );
#endif
            if ( temp > cor_max )
            {
                cor_max = temp;