diff --git a/lib_com/options.h b/lib_com/options.h index 75eb46ce632726b5ecd600cdea87b0964fa3b2f5..b4dc79383ec0e4078e149f6ee1a996e6f0ec438a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,6 +170,7 @@ #define FIX_2274_OOB_INDEXING_IN_CORRMATRIX /* FhG: fix OOB indexing complaint */ #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_2271_OOB_INDEXING_IN_PIT_OL2 /* VA: Fix for issue 2271, to silence clang18 */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/pitch_ol2.c b/lib_enc/pitch_ol2.c index 0c9b0f830c1f682ac07edf6c748d505210c76ff0..8290e8c7853b450ea2a73a920b972981b9f707f9 100644 --- a/lib_enc/pitch_ol2.c +++ b/lib_enc/pitch_ol2.c @@ -72,7 +72,9 @@ void pitch_ol2( int16_t i, t, t0, t1, step, fraction, t0_min, t0_max, t_min, t_max; float temp, cor_max, enr_wsp, enr_old, cor[COR_BUF_LEN], *pt_cor, wsp_fr[L_SUBFR]; const float *pt_wsp; - +#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2 + int16_t base_idx; +#endif t0_min = pitch_ol - delta; t0_max = pitch_ol + delta - 1; @@ -114,24 +116,40 @@ void pitch_ol2( * the interpolated normalized correlation. *-----------------------------------------------------------------*/ +#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 pt_cor = cor + L_INTERPOL1 - t0_min; +#endif t0 = t1; - +#ifdef FIX_2271_OOB_INDEXING_IN_PIT_OL2 + base_idx = L_INTERPOL1 - t0_min; +#endif step = 1; /* 1/4 subsample resolution */ fraction = 1; if ( t0 == t0_min ) /* Limit case */ { fraction = 0; +#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 cor_max = interpolation( &pt_cor[t0], E_ROM_inter4_1, fraction, PIT_UP_SAMP, 4 ); +#else + cor_max = interpolation( &cor[t0 + base_idx], E_ROM_inter4_1, fraction, PIT_UP_SAMP, 4 ); +#endif } else /* Process negative fractions */ { t0--; +#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 cor_max = interpolation( &pt_cor[t0], E_ROM_inter4_1, fraction, PIT_UP_SAMP, 4 ); +#else + cor_max = interpolation( &cor[t0 + base_idx], E_ROM_inter4_1, fraction, PIT_UP_SAMP, 4 ); +#endif for ( i = ( fraction + step ); i <= 3; i = i + step ) { +#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 temp = interpolation( &pt_cor[t0], E_ROM_inter4_1, i, PIT_UP_SAMP, 4 ); +#else + temp = interpolation( &cor[t0 + base_idx], E_ROM_inter4_1, i, PIT_UP_SAMP, 4 ); +#endif if ( temp > cor_max ) { cor_max = temp; @@ -142,7 +160,11 @@ void pitch_ol2( for ( i = 0; i <= 3; i = i + step ) /* Process positive fractions */ { +#ifndef FIX_2271_OOB_INDEXING_IN_PIT_OL2 temp = interpolation( &pt_cor[t1], E_ROM_inter4_1, i, PIT_UP_SAMP, 4 ); +#else + temp = interpolation( &cor[t1 + base_idx], E_ROM_inter4_1, i, PIT_UP_SAMP, 4 ); +#endif if ( temp > cor_max ) { cor_max = temp;