From 61180a9859283715d93ea04b8ee344521b9d15f4 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Wed, 28 Jan 2026 20:43:36 +0100 Subject: [PATCH 1/3] basop issue 2382: 2nd instance of prevent copying uninitialized values from Aq_fx[][] to Aq_fx_32[][] in TCX --- lib_com/options.h | 1 + lib_dec/ivas_mct_dec_fx.c | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index e11d5dffa..b8a91d440 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,6 +102,7 @@ #define FIX_2319_CLDFB_INIT_FLAGS /* FhG: basop issue 2319: init hs->flags during openCldfb(), to avoid reading of uninitialized memory */ #define FIX_BASOP_2357_OBJECT_EDIT_MSAN /* Nokia: basop issue 2357: initialize missing exponents in object edit */ #define FIX_BASOP_2354_MSAN_DIFF_Q_VALUE /* Nokia: Initialize Q value of diffuseness in rendering to Q30 */ +#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 */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index d44ebdb3f..676205a1b 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -214,22 +214,43 @@ ivas_error ivas_mct_dec_fx( } } +#ifndef FIX_2382_COPY_AQ_IN_MCT Word32 Aq_fx_32[6][2][102]; +#endif /* MCT reconstruction and CoreCoder updates */ FOR( cpe_id = 0; cpe_id < nCPE; cpe_id++ ) { +#ifdef FIX_2382_COPY_AQ_IN_MCT + Word32 Aq_fx_32[CPE_CHANNELS][( NB_SUBFR16k + 1 ) * ( M + 1 )]; +#endif hCPE = st_ivas->hCPE[cpe_id]; FOR( n = 0; n < CPE_CHANNELS; n++ ) { +#ifdef FIX_2382_COPY_AQ_IN_MCT + IF( NE_16( hCPE->hCoreCoder[n]->mct_chan_mode, MCT_CHAN_MODE_IGNORE ) ) + { + Word16 nSubframes; + + nSubframes = EQ_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ? NB_DIV : 1; /* Q0 */ + move16(); + + Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[n], i_mult( nSubframes, M ), Q16 - Q12 ); // Q16 + } +#else Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[cpe_id][n], 102, Q16 - Q12 ); // Q16 - x_fx[n][0] = output_fx[n + ( cpe_id * CPE_CHANNELS )]; // Q11 - x_fx[n][1] = output_fx[n + ( cpe_id * CPE_CHANNELS )] + ( L_FRAME48k / 2 ); // Q11 +#endif + x_fx[n][0] = output_fx[n + ( cpe_id * CPE_CHANNELS )]; // Q11 + x_fx[n][1] = output_fx[n + ( cpe_id * CPE_CHANNELS )] + ( L_FRAME48k / 2 ); // Q11 move16(); move16(); } +#ifdef FIX_2382_COPY_AQ_IN_MCT + ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32, 1, 20 ); +#else ivas_mdct_core_tns_ns_fx( hCPE, fUseTns[cpe_id], tnsData[cpe_id], x_fx, Aq_fx_32[cpe_id], 1, 20 ); +#endif } test(); -- GitLab From c4b90a512e049429a56550cfecfb324c1fb5eeba Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 29 Jan 2026 10:14:20 +0100 Subject: [PATCH 2/3] replace ternary operator by if()-statement --- lib_dec/ivas_mct_dec_fx.c | 7 ++++++- lib_dec/ivas_stereo_mdct_core_dec_fx.c | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 676205a1b..81b41d175 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -232,8 +232,13 @@ ivas_error ivas_mct_dec_fx( { Word16 nSubframes; - nSubframes = EQ_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ? NB_DIV : 1; /* Q0 */ + nSubframes = 1; /* Q0 */ move16(); + if ( EQ_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) + { + nSubframes = NB_DIV; + move16; + } Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[n], i_mult( nSubframes, M ), Q16 - Q12 ); // Q16 } diff --git a/lib_dec/ivas_stereo_mdct_core_dec_fx.c b/lib_dec/ivas_stereo_mdct_core_dec_fx.c index 118baa38b..cb3173ea6 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec_fx.c +++ b/lib_dec/ivas_stereo_mdct_core_dec_fx.c @@ -298,8 +298,19 @@ void stereo_mdct_core_dec_fx( FOR( ch = 0; ch < nChannels; ch++ ) { +#ifdef FIX_2382_COPY_AQ_IN_MCT + nSubframes[ch] = 1; /* Q0 */ + move16(); + + if ( EQ_16( sts[ch]->core, TCX_10_CORE ) ) + { + nSubframes[ch] = NB_DIV; + move16(); + } +#else nSubframes[ch] = EQ_16( sts[ch]->core, TCX_10_CORE ) ? NB_DIV : 1; /* Q0 */ move16(); +#endif FOR( k = 0; k < nSubframes[ch]; k++ ) { -- GitLab From 4de71fe54f1ab40465f1ca215a4d89f1f4575c8e Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 29 Jan 2026 10:27:30 +0100 Subject: [PATCH 3/3] fix compilation --- lib_dec/ivas_mct_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 81b41d175..eb52b8ec1 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -237,7 +237,7 @@ ivas_error ivas_mct_dec_fx( if ( EQ_16( hCPE->hCoreCoder[n]->core, TCX_10_CORE ) ) { nSubframes = NB_DIV; - move16; + move16(); } Copy_Scale_sig_16_32_DEPREC( Aq_fx[cpe_id][n], Aq_fx_32[n], i_mult( nSubframes, M ), Q16 - Q12 ); // Q16 -- GitLab