Commit 561090e2 authored by Jan Kiene's avatar Jan Kiene
Browse files

use offset instead of pre-set pointer

parent d3508f9d
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@
#define FIX_2252_SCALING_SAVE_HB_SYNTH                  /* VA: issue 2252: fix use-of-uninit-value in save_hb_synth_fx[] scaling in FOA decoding with bitstream that starts with an SID */
#define FIX_2248_EVS_ASSERT                             /* VA: Include _sat in an EVS related part of the code */
#define FIX_2254_IMPROV_COMPLEXITY_BE                   /* VA: BE small complexity reduction  */
#define FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH         /* FhG: fix OOB index USAN error in TCX LTP pitch search */

/* #################### End BE switches ################################## */

+26 −2
Original line number Diff line number Diff line
@@ -292,7 +292,11 @@ static void tcx_ltp_pitch_search_ivas_fx(
    const Word16 check_border_case,
    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;
#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];

@@ -417,9 +421,13 @@ static void tcx_ltp_pitch_search_ivas_fx(
     * Search fractional pitch with 1/4 subsample resolution.
     * search the fractions around t0 and choose the one which maximizes
     * 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 );
#else

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

@@ -437,16 +445,28 @@ static void tcx_ltp_pitch_search_ivas_fx(
    {
        fraction = 0;
        move16();
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        cor_max = interpolate_corr( &cor[t0 + t_offset], fraction, pitres );
#else
        cor_max = interpolate_corr( &pt_cor[t0], fraction, pitres );
#endif
    }
    ELSE /* Process negative fractions */
    {
        t0 = sub( t0, 1 );
#ifdef FIX_2272_OOB_INDEXING_IN_LTP_PIT_SEARCH
        cor_max = interpolate_corr( &cor[t0 + t_offset], 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[t0 + t_offset], i, pitres );
#else
            temp = interpolate_corr( &pt_cor[t0], i, pitres );
#endif

            IF( GT_32( temp, cor_max ) )
            {
@@ -459,7 +479,11 @@ static void tcx_ltp_pitch_search_ivas_fx(

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

        IF( GT_32( temp, cor_max ) )
        {