From edb15cfc415b09eb8abcc5d8de6fa422a303ce16 Mon Sep 17 00:00:00 2001 From: naghibza Date: Tue, 11 Nov 2025 09:52:15 +0100 Subject: [PATCH 1/2] Adjust Q_real to prevent overflow in st->cldfbSyn->cldfb_state_fx scaling. --- lib_com/options.h | 1 + lib_dec/acelp_core_dec_fx.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index b139d74a3..68b09b3c8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -105,6 +105,7 @@ #define FIX_2148_OBJ_EDIT_ISSUE_WITH_OSBA /* Nokia: Add missing code to solve issue */ #define FIX_2200_ISAR_PLC_CRASH /* Dolby: Fix for ISAR PLC crash observed with newly added BASOP tests */ #define FIX_2210_ASSERT_IN_BW_DETEC_FX_FOR_OMASA /* FhG: Resolve overflow by swapping the order of addition and multiplication */ +#define FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC /* FhG: Adjust Q_real to prevent overflow in st->cldfbSyn->cldfb_state_fx scaling */ /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 513a9c692..6cab4b201 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -124,7 +124,11 @@ ivas_error acelp_core_dec_fx( ivas_error error; Word32 bpf_error_signal_fx[L_FRAME16k]; Word16 bpf_error_signal_16fx[L_FRAME16k]; +#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC + Word16 Q_real, scf; +#else Word16 Q_real; +#endif Word32 max_real, max_imag, max_val; set32_fx( bpf_error_signal_fx, 0, L_FRAME16k ); @@ -2083,11 +2087,16 @@ ivas_error acelp_core_dec_fx( } max_val = L_max( max_real, max_imag ); Q_real = sub( norm_l( max_val ), 3 ) /* Guard bits */; +#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC + scf = L_norm_arr( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length ); + Q_real = s_min( Q_real, scf ); +#endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { scale_sig32( realBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real } + scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); -- GitLab From c7525e86acbc5b5adf8113093201a0fc0d752bb3 Mon Sep 17 00:00:00 2001 From: naghibza Date: Tue, 11 Nov 2025 10:39:00 +0100 Subject: [PATCH 2/2] Adjust scf in st->cldfbSyn->cldfb_state_fx scaling --- lib_dec/acelp_core_dec_fx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index 6cab4b201..0bc1b8403 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -2089,7 +2089,8 @@ ivas_error acelp_core_dec_fx( Q_real = sub( norm_l( max_val ), 3 ) /* Guard bits */; #ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC scf = L_norm_arr( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length ); - Q_real = s_min( Q_real, scf ); + scf = s_min( scf, sub( Q_real, Q11 ) ); + Q_real = add( scf, Q11 ); #endif FOR( i = 0; i < CLDFB_NO_COL_MAX; i++ ) { @@ -2097,7 +2098,11 @@ ivas_error acelp_core_dec_fx( scale_sig32( imagBuffer_fx[i], CLDFB_NO_CHANNELS_MAX, Q_real ); // Q_real } +#ifdef FIX_2217_ASSERT_IN_IVAS_CORE_DECODER_WITH_MC + scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, scf ); // Q10 - > (Q_real-1) +#else scale_sig32( st->cldfbSyn->cldfb_state_fx, st->cldfbSyn->p_filter_length, sub( Q_real, Q11 ) ); // Q10 - > (Q_real-1) +#endif st->cldfbSyn->Q_cldfb_state = sub( Q_real, 1 ); move16(); -- GitLab