Commit 2b9d8012 authored by vaillancour's avatar vaillancour
Browse files

Fix 2273 to silence clang18 on ptr init

parent d3508f9d
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -89,7 +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_2273_OOB_INDEXING_IN_PIT_FR4                /* VA: Fix to silence clang on ptr init */
/* #################### End BE switches ################################## */

/* #################### Start NON-BE switches ############################ */
+52 −2
Original line number Diff line number Diff line
@@ -762,7 +762,9 @@ Word16 pitch_fr4_fx(
    Word16 corr_v[15 + 2 * L_INTERPOL1 + 1]; /* Total length = t0_max-t0_min+1+2*L_inter */
    Word16 pit_min;
    Word16 cor_max;

#ifdef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    Word16 corr_off;
#endif
    /* initialization */
    IF( limit_flag == 0 )
    {
@@ -805,8 +807,15 @@ Word16 pitch_fr4_fx(

    t_min = sub( t0_min, L_INTERPOL1 );
    t_max = add( t0_max, L_INTERPOL1 );
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    corr = &corr_v[-t_min];
#else
    corr = corr_v;
    corr_off = -t_min;
    move16();
#endif
    /* corr[t_min..t_max] */
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    if ( element_mode > EVS_MONO )
    {
        norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr, L_subfr, Q_new );
@@ -815,24 +824,45 @@ Word16 pitch_fr4_fx(
    {
        norm_corr_fx( exc, xn, h, t_min, t_max, corr, L_subfr );
    }

#else
    if ( element_mode > EVS_MONO )
    {
        norm_corr_ivas_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr, Q_new );
    }
    else
    {
        norm_corr_fx( exc, xn, h, t_min, t_max, corr + corr_off, L_subfr );
    }
#endif
    /*-----------------------------------------------------------------*
     * Find integer pitch
     *-----------------------------------------------------------------*/

#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
    max_val = corr[t0_min];
#else
    max_val = corr[t0_min + corr_off];
#endif
    move16();
    t0 = t0_min;
    move16();

    FOR( i = t0_min + 1; i <= t0_max; i++ )
    {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        if ( GE_16( corr[i], max_val ) )
#else
        if ( GE_16( corr[i + corr_off], max_val ) )
#endif
        {
            t0 = i;
            move16();
        }
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        max_val = s_max( corr[i], max_val );
#else
        max_val = s_max( corr[i + corr_off], max_val );
#endif
    }

    IF( EQ_16( t0_fr1, pit_min ) )
@@ -846,7 +876,11 @@ Word16 pitch_fr4_fx(
            {
                i = sub( i, 2 );
            }
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
            IF( GT_16( corr[i], corr[i + 2] ) )
#else
            IF( GT_16( corr[i + corr_off], corr[i + 2 + corr_off] ) )
#endif
            {
                t0 = i;
                move16();
@@ -897,15 +931,27 @@ Word16 pitch_fr4_fx(
    {
        fraction = 0;
        move16();
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        cor_max = Interpol_4( &corr[t0], fraction );
#else
        cor_max = Interpol_4( &corr[t0 + corr_off], fraction );
#endif
    }
    ELSE
    {
        t0 = sub( t0, 1 );
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        cor_max = Interpol_4( &corr[t0], fraction );
#else
        cor_max = Interpol_4( &corr[t0 + corr_off], fraction );
#endif
        FOR( i = fraction + step; i <= 3; i = ( i + step ) )
        {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
            temp = Interpol_4( &corr[t0], i );
#else
            temp = Interpol_4( &corr[t0 + corr_off], i );
#endif
            IF( GT_16( temp, cor_max ) )
            {
                cor_max = temp;
@@ -918,7 +964,11 @@ Word16 pitch_fr4_fx(

    FOR( i = 0; i <= 3; i = ( i + step ) )
    {
#ifndef FIX_2273_OOB_INDEXING_IN_PIT_FR4
        temp = Interpol_4( &corr[t1], i );
#else
        temp = Interpol_4( &corr[t1 + corr_off], i );
#endif
        IF( GT_16( temp, cor_max ) )
        {
            cor_max = temp;