From 64ad20339d9efe72510b1e3c1122da65f0547081 Mon Sep 17 00:00:00 2001 From: naghibza Date: Mon, 1 Jun 2026 14:21:43 +0200 Subject: [PATCH] reserve Q_new headroom for the resampler output transient on the secondary-channel DFT->TD switch (st->q_mem_decim16k_fx) --- lib_com/options.h | 1 + lib_enc/ivas_core_pre_proc_front_fx.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index a1b758cfc..3df5b1efe 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -106,6 +106,7 @@ #define FIX_BASOP_2599_TCA_OVERFLOW /* VA: issue 2599, Fix TCA overflow */ #define FIX_2588_MISSING_CONDITIONS /* VA: Proposed fix to 2588, addition of a condition in lsf_dec */ #define FIX_BASOP_2442_MASA2TC_TO_MONO_AND_AMBI /* Nokia: BASOP issue 2442: Increase accuracy of computations and add additional gain clamp for low energy decorrelated signal rendering. */ +#define FIX_BASOP_2612_RESAMP_OVERSHOOT /* FhG: #2612: reserve Q_new headroom for the resampler output transient on the secondary-channel DFT->TD switch (st->q_mem_decim16k_fx) */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index 016e6adfe..2b15bff61 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -625,7 +625,19 @@ void pre_proc_front_ivas_fx( shift = add( shift, st->q_inp ); /* Avoid saturation of resampling/delay decimation buffer. */ +#ifdef FIX_BASOP_2612_RESAMP_OVERSHOOT + test(); + IF( EQ_16( element_mode, IVAS_CPE_TD ) && EQ_16( hCPE->last_element_mode, IVAS_CPE_DFT ) && EQ_16( st->idchan, 1 ) ) + { + shift = s_min( shift, sub( st->q_mem_decim16k_fx, 1 ) ); + } + ELSE + { + shift = s_min( shift, st->q_mem_decim16k_fx ); + } +#else shift = s_min( shift, st->q_mem_decim16k_fx ); +#endif shift = s_min( shift, add( -1, norm_arr( &st->mem_preemph16k_fx, 1 ) ) ); /* Limit Q_new here to st->q_inp because inside ivas_compute_core_buffers_fx() st->input is rescaled to Q_new */ -- GitLab