From e7975c7210db65140c6c259d40b752a1b624eaa4 Mon Sep 17 00:00:00 2001 From: Tommy Vaillancourt Date: Tue, 16 Dec 2025 06:25:29 -0500 Subject: [PATCH] Replicate fix from basop #2271 --- lib_com/options.h | 1 + lib_enc/pitch_ol2.c | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index daa8ace935..6fb683f69a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,6 +165,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 0c9b0f830c..8290e8c785 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; -- GitLab