Commit 5a744a05 authored by Jan Kiene's avatar Jan Kiene
Browse files

cleanup fix for 2272

- rename variable
- use BASOP for addition
- move calculation out of loop
parent 561090e2
Loading
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -293,7 +293,7 @@ static void tcx_ltp_pitch_search_ivas_fx(
    Word16 *border_case )
{
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
    Word16 i, t, t0, t_offset, t1, step, fraction, t0_min, t0_max, t_min, t_max, delta, temp_m, temp_e, s, s_wsp;
    Word16 i, t, t0, cor_idx, t1, 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
@@ -423,7 +423,7 @@ static void tcx_ltp_pitch_search_ivas_fx(
     * the interpolated normalized correlation.
     *--------------FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH---------------------------------------------------*/
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
    t_offset = sub( L_INTERPOL1, t0_min );
    cor_idx = sub( L_INTERPOL1, t0_min );
#else

    pt_cor = cor + sub( L_INTERPOL1, t0_min );
@@ -443,19 +443,29 @@ static void tcx_ltp_pitch_search_ivas_fx(

    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[t0 + t_offset], fraction, pitres );
        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[t0 + t_offset], fraction, pitres );
        cor_max = interpolate_corr( &cor[cor_idx_tmp], fraction, pitres );
#else
        cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres );
#endif
@@ -463,7 +473,7 @@ static void tcx_ltp_pitch_search_ivas_fx(
        FOR( i = fraction + step; i < pitres; i += step )
        {
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
            temp = interpolate_corr( &cor[t0 + t_offset], i, pitres );
            temp = interpolate_corr( &cor[cor_idx_tmp], i, pitres );
#else
            temp = interpolate_corr( &pt_cor[t0], i, pitres );
#endif
@@ -477,10 +487,13 @@ static void tcx_ltp_pitch_search_ivas_fx(
        }
    }

#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[t1 + t_offset], i, pitres );
        temp = interpolate_corr( &cor[cor_idx], i, pitres );
#else
        temp = interpolate_corr( &pt_cor[t1], i, pitres );
#endif