diff --git a/lib_com/options.h b/lib_com/options.h index 60447f9d398df1635c473a5b705d575f617adca5..d7daa9187c03ea40bad2c1e563e1bf03edf30ff8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,6 +102,7 @@ #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 */ +#define FIX_2273_OOB_INDEXING_IN_PIT_FR4 /* VA: Fix to silence clang on ptr init */ /* #################### End BE switches ################################## */ diff --git a/lib_enc/pit_enc_fx.c b/lib_enc/pit_enc_fx.c index b812bd6fc2c3bdc2edbffdd8fd7ccb77e203c857..5c9a5bdcddce50b07dda40d5f68f08958c662b12 100644 --- a/lib_enc/pit_enc_fx.c +++ b/lib_enc/pit_enc_fx.c @@ -762,6 +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 +808,17 @@ 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 +827,46 @@ 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 +880,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 +935,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 +968,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;