From 63651f47cc4328432c6cd2cf4b8d7157dfca9152 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 23 Jan 2026 10:59:07 +0100 Subject: [PATCH 1/2] port fix for issue 1283 in BASOP --- lib_com/options.h | 1 + lib_enc/cod_tcx_fx.c | 12 ++++++++++++ lib_enc/lib_enc_fx.c | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index c7cd38dd8..f51133d4f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -119,6 +119,7 @@ #define FIX_1500_ISM_MD_DTX /* VA: float issue 1500: fix ISM elevation metadata smoothing in DTX */ #define FIX_2348_REPLACE_FEC_ENC /* VA: basop issue 2348: replace FEC_encode_ivas_fx with FEC_encode_fx */ #define FIX_2338_HARM_GSC_GAIN_COMP /* VA: basop issue 2338: harmonization of band gain computation for both EVS and IVAS */ +#define FIX_1283_STEREO_DFT_COLLAPSE /* FhG: float issue 1283: fix for critical issue with DFT stereo core coder */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/cod_tcx_fx.c b/lib_enc/cod_tcx_fx.c index 8e40d9530..3ca520e1c 100644 --- a/lib_enc/cod_tcx_fx.c +++ b/lib_enc/cod_tcx_fx.c @@ -621,7 +621,13 @@ void ShapeSpectrum_ivas_fx( } test(); + test(); + test(); +#ifndef FIX_1283_STEREO_DFT_COLLAPSE IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) +#else + IF( ( LE_32( total_brate, ACELP_13k20 ) || ( LE_32( st->element_brate, IVAS_16k4 ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( st->bwidth, SWB ) ) +#endif { max_low_pre = 0; move32(); @@ -697,7 +703,13 @@ void ShapeSpectrum_ivas_fx( /* reduce the peaks in the IGF region, to make life of the core-coder easier... */ test(); + test(); + test(); +#ifndef FIX_1283_STEREO_DFT_COLLAPSE IF( LE_32( total_brate, ACELP_13k20 ) && EQ_16( st->bwidth, SWB ) ) +#else + IF( ( LE_32( total_brate, ACELP_13k20 ) || ( LE_32( st->element_brate, IVAS_16k4 ) && EQ_16( st->element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( st->bwidth, SWB ) ) +#endif { Word16 sf_width; Word16 dist_low, dist_high; diff --git a/lib_enc/lib_enc_fx.c b/lib_enc/lib_enc_fx.c index 3c6baff39..b2f1cf529 100644 --- a/lib_enc/lib_enc_fx.c +++ b/lib_enc/lib_enc_fx.c @@ -1475,6 +1475,10 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( { hCoreCoder->total_brate = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ move32(); +#ifdef FIX_1283_STEREO_DFT_COLLAPSE + hCoreCoder->element_brate = hEncoderConfig->ivas_total_brate; /* needed in checks in core-coder functions other than mono*/ + move32(); +#endif IF( EQ_16( hEncoderConfig->stereo_dmx_evs, 1 ) ) { -- GitLab From f394632c919b894a80d0dd4dc7e1bd4fc99b815d Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Wed, 28 Jan 2026 12:28:38 +0100 Subject: [PATCH 2/2] move st->element_brate initialization --- lib_enc/ivas_sce_enc_fx.c | 4 ++++ lib_enc/lib_enc_fx.c | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 4d639c961..bff27b1ec 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -489,6 +489,10 @@ ivas_error create_sce_enc_fx( } st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ +#ifdef FIX_1283_STEREO_DFT_COLLAPSE + st->element_brate = -1; + move32(); +#endif st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; move32(); move32(); diff --git a/lib_enc/lib_enc_fx.c b/lib_enc/lib_enc_fx.c index b2f1cf529..3c6baff39 100644 --- a/lib_enc/lib_enc_fx.c +++ b/lib_enc/lib_enc_fx.c @@ -1475,10 +1475,6 @@ ivas_error IVAS_ENC_EncodeFrameToSerial( { hCoreCoder->total_brate = hEncoderConfig->ivas_total_brate; /* needed in case of bitrate switching */ move32(); -#ifdef FIX_1283_STEREO_DFT_COLLAPSE - hCoreCoder->element_brate = hEncoderConfig->ivas_total_brate; /* needed in checks in core-coder functions other than mono*/ - move32(); -#endif IF( EQ_16( hEncoderConfig->stereo_dmx_evs, 1 ) ) { -- GitLab