diff --git a/lib_com/options.h b/lib_com/options.h index 3e87df4e8d499c8bcc57d0cc853239964a1f4c9c..355f7dc1babe3cc8ff0364d064bcf6cdb2c8b791 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -93,7 +93,8 @@ /* any switch which is non-be wrt. TS 26.251 V3.0 */ #define FIX_1454_FIX_STEREO_TO_FOA_JBM /* VA: issue 1454: fix buggy stereo to FOA in JBM */ -#define FIX_2015_PREMPH_SAT_ALT_PART2 /* VA: Add missing scaling factor to be passed to AVQ_cod() */ +#define FIX_2015_PREMPH_SAT_ALT_PART2 /* VA: Add missing scaling factor to be passed to AVQ_cod() */ +#define FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH /* VA: Fix Issue 2253 where the encoder and decoder could get out of sync */ diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index 0aa1e1835d1f954de974e801b51d7e8ab6d5eb5d..b9ea2d49e442f76dd864cf37b2ed88905a7e7c9b 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -422,8 +422,10 @@ Word16 Pit_exc_contribution_len_ivas_fx( /* o : bin wher const Word16 *dct_res, /* i : DCT of residual Q_new*/ Word16 *dct_pitex, /* i/o: DCT of pitch contribution Q_new*/ Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ +#ifndef FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ - Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ +#endif + Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ Word16 Qnew ) { @@ -455,8 +457,11 @@ Word16 Pit_exc_contribution_len_ivas_fx( /* o : bin wher Mbands_loc = MBANDS_LOC; move16(); } - +#ifndef FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH minimum_fx( pitch_buf, nb_subfr, &low_pit ); +#else + minimum_fx( pitch_buf, shr( st_fx->L_frame, 6 ), &low_pit ); +#endif exp1 = norm_s( low_pit ); tmp = shl( low_pit, exp1 ); tmp_dec = 12800; diff --git a/lib_enc/gs_enc_fx.c b/lib_enc/gs_enc_fx.c index 472b9f7659e6adc26745c2071510f8ab30d73654..f3e85bd291818277c610845e1a5d90843f1fb2a9 100644 --- a/lib_enc/gs_enc_fx.c +++ b/lib_enc/gs_enc_fx.c @@ -675,7 +675,11 @@ void encod_audio_ivas_fx( * Find and encode the last band where the adaptive (pitch) contribution is significant *---------------------------------------------------------------*/ +#ifndef FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH last_pit_bin = Pit_exc_contribution_len_ivas_fx( st_fx, dct_res, dct_epit, pitch_buf, nb_subfr, &hGSCEnc->pit_exc_hangover, Q_new ); +#else + last_pit_bin = Pit_exc_contribution_len_ivas_fx( st_fx, dct_res, dct_epit, pitch_buf, &hGSCEnc->pit_exc_hangover, Q_new ); +#endif IF( last_pit_bin == 0 ) { diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 9d7de9eeb9dad7116aab710365b94565958e5bfe..feaefcf5399277180f1e07c3029227c91596e173 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -4039,8 +4039,10 @@ Word16 Pit_exc_contribution_len_ivas_fx( const Word16 *dct_res, /* i : DCT of residual Qnew*/ Word16 *dct_pitex, /* i/o: DCT of pitch contribution Qnew*/ Word16 *pitch_buf, /* i/o: Pitch per subframe Q6*/ +#ifndef FIX_2253_CORRECT_GSC_MINIMUM_PIT_SEARCH const Word16 nb_subfr, /* i : Number of subframe considered Q0*/ - Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ +#endif + Word16 *hangover, /* i : hangover for the time contribution switching Q0*/ Word16 Qnew ); Word16 pvq_core_enc_fx(