Commit cbef8154 authored by Jan Kiene's avatar Jan Kiene
Browse files

apply fix also to EVS part of code

fixes #2279, too
parent 03d286d7
Loading
Loading
Loading
Loading
+37 −2
Original line number Diff line number Diff line
@@ -88,7 +88,11 @@ static void tcx_ltp_pitch_search(
    Word16 pitmax,
    Word16 pitres )
{
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
    Word16 i, t, t0, t1, cor_idx, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp;
#else
    Word16 i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp;
#endif
    Word32 cor_max, cor[256], *pt_cor, temp;
    Word16 wsp2[L_FRAME_PLUS + PIT_MAX_MAX + L_INTERPOL1];

@@ -203,7 +207,11 @@ static void tcx_ltp_pitch_search(
     * the interpolated normalized correlation.
     *-----------------------------------------------------------------*/

#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
    cor_idx = sub( L_INTERPOL1, t0_min );
#else
    pt_cor = cor + sub( L_INTERPOL1, t0_min );
#endif
    t0 = t1;
    move16();

@@ -219,18 +227,40 @@ static void tcx_ltp_pitch_search(

    IF( EQ_16( t0, t0_min ) ) /* Limit case */
    {
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        Word16 cor_idx_tmp;

        cor_idx_tmp = add( cor_idx, t0 );
#endif
        fraction = 0;
        move16();
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        cor_max = interpolate_corr( &cor[cor_idx_tmp], fraction, pitres );
#else
        cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres );
#endif
    }
    ELSE /* Process negative fractions */
    {
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        Word16 cor_idx_tmp;

        cor_idx_tmp = add( cor_idx, t0 );
#endif
        t0 = sub( t0, 1 );
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        cor_max = interpolate_corr( &cor[cor_idx_tmp], fraction, pitres );
#else
        cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres );
#endif

        FOR( i = fraction + step; i < pitres; i += step )
        {
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
            temp = interpolate_corr( &cor[cor_idx_tmp], i, pitres );
#else
            temp = interpolate_corr( &pt_cor[t0], i, pitres );
#endif

            IF( GT_32( temp, cor_max ) )
            {
@@ -241,11 +271,16 @@ static void tcx_ltp_pitch_search(
        }
    }

    i = 0;
    move16();
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
    cor_idx = add( t1, cor_idx );
#endif
    FOR( i = 0; i < pitres; i += step ) /* Process positive fractions */
    {
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        temp = interpolate_corr( &cor[cor_idx], i, pitres );
#else
        temp = interpolate_corr( &pt_cor[t1], i, pitres );
#endif

        IF( GT_32( temp, cor_max ) )
        {