Commit 3bbcd7f3 authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH

parent 07780a73
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@
#define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK       /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/
#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_1904_HARM_GSC_ENC                           /* VA: #1904 Harmonization of EVS and IVAS GSC code */
#define FIX_1474_USAN_TRANS_INV                         /* Eri: Float issue 1474: Fix USAN out-of-bounds warning. No OOB occurs, but the pointer is set to point to uninitialized memory. */
+0 −41
Original line number Diff line number Diff line
@@ -254,11 +254,7 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/
{
    Word16 corr_v[32 + 2 * L_INTERPOL1 + 1];
    Word16 cor_max, max, temp;
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    Word16 corr_idx;
#else
    Word16 *corr;
#endif
    Word16 i, fraction, frac1, frac2, step;
    Word16 t0, t_min, t_max;

@@ -274,48 +270,29 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/
    move16();
    move16();

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

    /* Compute normalized correlation between target and filtered excitation */
    E_GAIN_norm_corr_fx( exc, xn, h, t_min, t_max, corr_v, L_subfr );

    /*  find integer pitch */
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    max = corr_v[add( t0_min, corr_idx )]; /*(Q15+(Q_new+shift-1)+scale)*/
#else
    max = corr[t0_min];              /*(Q15+(Q_new+shift-1)+scale)*/
#endif
    move16();
    t0 = t0_min; /*Q0*/
    move16();

    FOR( i = t0_min + 1; i <= t0_max; i++ )
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        Word16 corr_tmp;

        corr_tmp = corr_v[add( corr_idx, i )];
#endif
        BASOP_SATURATE_WARNING_OFF_EVS;
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        if ( GE_16( corr_tmp, max ) )
#else
        if ( GE_16( corr[i], max ) )
#endif
        {
            t0 = i;
            move16();
        }
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        max = s_max( max, corr_tmp );
#else
        max = s_max( max, corr[i] );
#endif
        BASOP_SATURATE_WARNING_ON_EVS;
    }

@@ -380,26 +357,16 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/
    }
    assert( frac1 <= 0 && frac2 >= 0 && frac2 > frac1 );

#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
    corr_idx = add( corr_idx, t0 );
#endif
    IF( EQ_16( pit_res_max, 6 ) )
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        cor_max = E_GAIN_norm_corr_interpolate6_fx( &corr_v[corr_idx], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/
#else
        cor_max = E_GAIN_norm_corr_interpolate6_fx( &corr[t0], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/
#endif
        fraction = frac1; /*Q0*/
        move16();

        FOR( i = ( frac1 + step ); i <= frac2; i += step )
        {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
            temp = E_GAIN_norm_corr_interpolate6_fx( &corr_v[corr_idx], i ); /*(Q15+(Q_new+shift-1)+scale)*/
#else
            temp = E_GAIN_norm_corr_interpolate6_fx( &corr[t0], i );    /*(Q15+(Q_new+shift-1)+scale)*/
#endif
            IF( GT_16( temp, cor_max ) )
            {
                cor_max = temp; /*(Q15+(Q_new+shift-1)+scale)*/
@@ -411,21 +378,13 @@ Word16 E_GAIN_closed_loop_search_fx( Word16 exc[], /*Q_new*/
    }
    ELSE
    {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
        cor_max = E_GAIN_norm_corr_interpolate_fx( &corr_v[corr_idx], frac1 ); /*(Q15+(Q_new+shift-1)+scale)*/
#else
        cor_max = E_GAIN_norm_corr_interpolate_fx( &corr[t0], frac1 );  /*(Q15+(Q_new+shift-1)+scale)*/
#endif
        fraction = frac1; /*Q0*/
        move16();

        FOR( i = ( frac1 + step ); i <= frac2; i += step )
        {
#ifdef FIX_2278_OOB_INDEXING_IN_CLOSED_LOOP_PIT_SEARCH
            temp = E_GAIN_norm_corr_interpolate_fx( &corr_v[corr_idx], i ); /*(Q15+(Q_new+shift-1)+scale)*/
#else
            temp = E_GAIN_norm_corr_interpolate_fx( &corr[t0], i );     /*(Q15+(Q_new+shift-1)+scale)*/
#endif
            IF( GT_16( temp, cor_max ) )
            {
                cor_max = temp; /*(Q15+(Q_new+shift-1)+scale)*/