Commit 449b92ed authored by vaclav's avatar vaclav
Browse files

Merge branch 'basop-2271-usan-oob-indexing-in-pitch_ol2_fx-function' into 'main'

Fix for 2271 to silence clang18

See merge request !2656
parents cd8f6ce0 4b039d7d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@
#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_2271_OOB_INDEXING_IN_PIT_OL2                /* VA: Fix for issue 2271, to silence clang18 */

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

+24 −2
Original line number Diff line number Diff line
@@ -50,7 +50,9 @@ void pitch_ol2_fx(
    Word32 R1, R2;
    Word16 R0, exp_R0, exp_R1, exp_R2, j;
    Word16 pit_max;

#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    Word16 base_idx;
#endif
    /* initialization */
    pit_max = PIT_MAX;
    move16();
@@ -104,9 +106,14 @@ void pitch_ol2_fx(
     * search the fractions around t0 and choose the one which maximizes
     * the interpolated normalized correlation.
     *----------------------------------------------------------------*/
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    pt_cor_fx = cor_fx + sub( L_INTERPOL1, t0_min );
#endif
    t0s = t1s;
    move16();
#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2
    base_idx = sub( L_INTERPOL1, t0_min );
#endif

    step = 1;
    move16(); /* 1/4 subsample resolution */
@@ -116,10 +123,18 @@ void pitch_ol2_fx(
    IF( NE_16( t0s, t0_min ) ) /* Process negative fractions */
    {
        t0s = sub( t0s, 1 );
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction );
#else
        cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction );
#endif
        FOR( i = fraction + step; i <= 3; i += step )
        {
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
            temp_fx = Interpol_4( &pt_cor_fx[t0s], i );
#else
            temp_fx = Interpol_4( &cor_fx[t0s + base_idx], i );
#endif
            if ( GT_16( temp_fx, cor_max_fx ) )
            {
                fraction = i;
@@ -132,13 +147,20 @@ void pitch_ol2_fx(
    {
        fraction = 0;
        move16();
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        cor_max_fx = Interpol_4( &pt_cor_fx[t0s], fraction );
#else
        cor_max_fx = Interpol_4( &cor_fx[t0s + base_idx], fraction );
#endif
        move16();
    }
    FOR( i = 0; i <= 3; i += step ) /* Process positive fractions */
    {
#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2
        temp_fx = Interpol_4( &pt_cor_fx[t1s], i );

#else
        temp_fx = Interpol_4( &cor_fx[t1s + base_idx], i );
#endif
        IF( GT_16( temp_fx, cor_max_fx ) )
        {
            cor_max_fx = temp_fx;