From 9723e7db98ad9915d3f1c8bbdc982d9a8d3b8f3b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 30 Jan 2026 11:22:10 +0100 Subject: [PATCH 1/3] fix copy of uninit values in MDCT-stereo core for bfi == 1 --- lib_com/options.h | 1 + lib_dec/ivas_stereo_mdct_core_dec_fx.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index b584b6931..171cc33f0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -107,6 +107,7 @@ #define FIX_2383_INIT_Q_A_ITF /* FhG: Initialize Q_A_itf, to avoid reading of uninitialized memory in case ITF is not triggered */ #define FIX_2382_COPY_AQ_IN_MCT /* FhG: basop issue 2382: 2nd instance of prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX */ #define FIX_2391_INIT_HQ_GENERIC_OFFSET /* FhG/Eri: basop issue 2391: make sure hq_generic_offset is initialized inside hq_hr_dec_fx() */ +#define FIX_2397_COPY_AQ_MDCT_CORE_BFI /* FhG: prevent copying of uninit memory in MDCT stereo core if bfi is set */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index cb3173ea6..cdbe4a84c 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -382,6 +382,23 @@ void stereo_mdct_core_dec_fx( } } +#ifdef FIX_2397_COPY_AQ_MDCT_CORE_BFI + IF( NE_16( bfi, 1 ) ) + { +#ifdef FIX_2352_COPY_AQ_IN_TCX + FOR( ch = 0; ch < nChannels; ch++ ) +#else + FOR( ch = 0; ch < CPE_CHANNELS; ch++ ) +#endif + { +#ifdef FIX_2352_COPY_AQ_IN_TCX + Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], nSubframes[ch] * M, sub( Q16, Q12 ) ); /* Q16 */ +#else + Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], ( NB_SUBFR16k + 1 ) * ( M + 1 ), sub( Q16, Q12 ) ); /* Q16 */ +#endif + } + } +#else #ifdef FIX_2352_COPY_AQ_IN_TCX FOR( ch = 0; ch < nChannels; ch++ ) #else @@ -394,6 +411,7 @@ void stereo_mdct_core_dec_fx( Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], ( NB_SUBFR16k + 1 ) * ( M + 1 ), sub( Q16, Q12 ) ); /* Q16 */ #endif } +#endif /*--------------------------------------------------------------------------------* * Stereo processing -- GitLab From a6dcf4cbdaaf2229583c2558624a65a1a2bd3892 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 30 Jan 2026 14:00:33 +0100 Subject: [PATCH 2/3] address open questions --- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index cdbe4a84c..d61e541e9 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -383,7 +383,7 @@ void stereo_mdct_core_dec_fx( } #ifdef FIX_2397_COPY_AQ_MDCT_CORE_BFI - IF( NE_16( bfi, 1 ) ) + IF( !bfi ) { #ifdef FIX_2352_COPY_AQ_IN_TCX FOR( ch = 0; ch < nChannels; ch++ ) @@ -392,7 +392,7 @@ void stereo_mdct_core_dec_fx( #endif { #ifdef FIX_2352_COPY_AQ_IN_TCX - Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], nSubframes[ch] * M, sub( Q16, Q12 ) ); /* Q16 */ + Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], i_mult( nSubframes[ch], M ), sub( Q16, Q12 ) ); /* Q16 */ #else Copy_Scale_sig_16_32_DEPREC( Aq_fx[ch], Aq_fx_32[ch], ( NB_SUBFR16k + 1 ) * ( M + 1 ), sub( Q16, Q12 ) ); /* Q16 */ #endif -- GitLab From a5f9279d6a8aed9f53ab9bd9534c33d9ec8b8bf6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 30 Jan 2026 15:12:58 +0100 Subject: [PATCH 3/3] add equivalent fix in MCT code --- lib_dec/ivas_mct_dec_fx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index eb52b8ec1..b50fb4ae9 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -228,7 +228,12 @@ ivas_error ivas_mct_dec_fx( FOR( n = 0; n < CPE_CHANNELS; n++ ) { #ifdef FIX_2382_COPY_AQ_IN_MCT +#ifdef FIX_2397_COPY_AQ_MDCT_CORE_BFI + test(); + IF( !st_ivas->bfi && NE_16( hCPE->hCoreCoder[n]->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) +#else IF( NE_16( hCPE->hCoreCoder[n]->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) +#endif { Word16 nSubframes; -- GitLab