From 53cc344bae42154f64d02b5b4f73447b9c9f9cbc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 26 Jan 2026 14:50:34 +0100 Subject: [PATCH 1/4] FIX_2379_REMOVE_previoussynth_fx_32 --- lib_com/options.h | 1 + lib_dec/acelp_core_dec_fx.c | 4 ++++ lib_dec/core_switching_dec_fx.c | 10 +++++++++- lib_dec/init_dec_fx.c | 2 ++ lib_dec/ivas_core_dec_fx.c | 6 ++++-- lib_dec/stat_dec.h | 2 ++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c7cd38dd8..02a324541 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_2379_REMOVE_previoussynth_fx_32 /* VA: basop issue 2379: remove duplicated buffer st->previoussynth_fx_32[] */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/acelp_core_dec_fx.c b/lib_dec/acelp_core_dec_fx.c index a11a25b1b..a0eb8e629 100644 --- a/lib_dec/acelp_core_dec_fx.c +++ b/lib_dec/acelp_core_dec_fx.c @@ -2103,7 +2103,11 @@ ivas_error acelp_core_dec_fx( } /* save synthesis - needed in case of core switching */ +#ifdef FIX_2379_REMOVE_previoussynth_fx_32 + Copy_Scale_sig_32_16( synth_fx, st->previoussynth_fx, output_frame, 0 ); // Q0 +#else Copy32( synth_fx, st->previoussynth_fx_32, output_frame ); // Q0 +#endif } ELSE { diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 3bfcb453d..165822a27 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1596,9 +1596,13 @@ ivas_error core_switching_pre_dec_fx( move16(); } } - ELSE + ELSE { +#ifdef FIX_2379_REMOVE_previoussynth_fx_32 + frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ +#else fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ +#endif st->lp_gainp_fx = 0; move16(); st->lp_gainc_fx = extract_h( Sqrt32( st->lp_ener_fx, &exp ) ); /*Q=15-exp*/ @@ -1681,7 +1685,11 @@ ivas_error core_switching_pre_dec_fx( set16_fx( st->dm_fx.prev_gain_pit, 0, 6 ); st->last_coder_type = GENERIC; move16(); +#ifdef FIX_2379_REMOVE_previoussynth_fx_32 + frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ +#else fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ +#endif st->lp_gainp_fx = 0; move16(); diff --git a/lib_dec/init_dec_fx.c b/lib_dec/init_dec_fx.c index e031fd696..a3e2c48e3 100644 --- a/lib_dec/init_dec_fx.c +++ b/lib_dec/init_dec_fx.c @@ -436,7 +436,9 @@ ivas_error init_decoder_fx( set16_fx( st_fx->previoussynth_fx, 0, L_FRAME48k ); set32_fx( st_fx->delay_buf_out32_fx, 0, HQ_DELTA_MAX * HQ_DELAY_COMP ); +#ifndef FIX_2379_REMOVE_previoussynth_fx_32 set32_fx( st_fx->previoussynth_fx_32, 0, L_FRAME48k ); +#endif IF( st_fx->element_mode == EVS_MONO ) { diff --git a/lib_dec/ivas_core_dec_fx.c b/lib_dec/ivas_core_dec_fx.c index b71f0df7d..6bd91a2f7 100644 --- a/lib_dec/ivas_core_dec_fx.c +++ b/lib_dec/ivas_core_dec_fx.c @@ -446,8 +446,9 @@ ivas_error ivas_core_dec_fx( move16(); move16(); +#ifndef FIX_2379_REMOVE_previoussynth_fx_32 Copy_Scale_sig_16_32_DEPREC( st->previoussynth_fx, st->previoussynth_fx_32, L_FRAME48k, 0 ); // Q0 - +#endif IF( NE_32( ( error = core_switching_pre_dec_fx( st, output_frame, sts[0]->last_core_brate, nchan_out, last_element_mode, last_element_brate, st->Q_syn, &Q_olapBufferSynth, &Q_olapBufferSynth2 ) ), IVAS_ERR_OK ) ) { return error; @@ -557,8 +558,9 @@ ivas_error ivas_core_dec_fx( } } +#ifndef FIX_2379_REMOVE_previoussynth_fx_32 Copy_Scale_sig_32_16( st->previoussynth_fx_32, st->previoussynth_fx, L_FRAME48k, 0 ); // Q0 - +#endif test(); test(); IF( ( EQ_16( st->core, TCX_20_CORE ) || EQ_16( st->core, TCX_10_CORE ) ) && NE_16( st->element_mode, IVAS_CPE_MDCT ) ) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 429070d85..a1646e82e 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1258,7 +1258,9 @@ typedef struct Decoder_State Word16 last_L_frame_ori; Word16 previoussynth_fx[L_FRAME48k]; +#ifndef FIX_2379_REMOVE_previoussynth_fx_32 Word32 previoussynth_fx_32[L_FRAME48k]; +#endif Word16 old_synth_sw_fx[NS2SA( 48000, FRAME_SIZE_NS - ACELP_LOOK_NS - DELAY_BWE_TOTAL_NS )]; Word16 delay_buf_out_fx[HQ_DELTA_MAX * HQ_DELAY_COMP]; /*Q0*/ Word32 delay_buf_out32_fx[HQ_DELTA_MAX * HQ_DELAY_COMP]; /*Q11*/ -- GitLab From 8b9c3c909276ec0143a02b684a503c41e0590880 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 26 Jan 2026 14:56:26 +0100 Subject: [PATCH 2/4] clang-format --- lib_dec/core_switching_dec_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 165822a27..b8fad90c6 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1596,7 +1596,7 @@ ivas_error core_switching_pre_dec_fx( move16(); } } - ELSE + ELSE { #ifdef FIX_2379_REMOVE_previoussynth_fx_32 frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ @@ -1688,7 +1688,7 @@ ivas_error core_switching_pre_dec_fx( #ifdef FIX_2379_REMOVE_previoussynth_fx_32 frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ #else - fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ + fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ #endif st->lp_gainp_fx = 0; -- GitLab From 3ac7ee7885f50409366d2264ccc395e69d8ea8fc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 27 Jan 2026 19:43:53 +0100 Subject: [PATCH 3/4] clang-format --- lib_dec/core_switching_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 1d02014f3..24d9efda9 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1687,7 +1687,7 @@ ivas_error core_switching_pre_dec_fx( move16(); #ifdef FIX_2379_REMOVE_previoussynth_fx_32 frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ - st->enr_old_fx--; // just to keep the value identical + st->enr_old_fx--; // just to keep the value identical #else fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ #endif -- GitLab From 3e191ba3f946f43b0a770e284d7d43f0b6e97411 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 28 Jan 2026 10:43:50 +0100 Subject: [PATCH 4/4] fix to prevent saturations --- lib_dec/core_switching_dec_fx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 24d9efda9..9d36d2c5e 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -1599,7 +1599,9 @@ ivas_error core_switching_pre_dec_fx( ELSE { #ifdef FIX_2379_REMOVE_previoussynth_fx_32 - frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ + Word32 previoussynth_fx_32[L_FRAME48k]; + Copy_Scale_sig_16_32_no_sat( st->previoussynth_fx, previoussynth_fx_32, output_frame, 0 ); + fer_energy_fx( output_frame, UNVOICED_CLAS, previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q0*/ #else fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ #endif @@ -1686,8 +1688,9 @@ ivas_error core_switching_pre_dec_fx( st->last_coder_type = GENERIC; move16(); #ifdef FIX_2379_REMOVE_previoussynth_fx_32 - frame_ener_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx, -1, &st->enr_old_fx, 1, 0, 0, 0 ); /*Q-0*/ - st->enr_old_fx--; // just to keep the value identical + Word32 previoussynth_fx_32[L_FRAME48k]; + Copy_Scale_sig_16_32_no_sat( st->previoussynth_fx, previoussynth_fx_32, output_frame, 0 ); + fer_energy_fx( output_frame, UNVOICED_CLAS, previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q0*/ #else fer_energy_fx( output_frame, UNVOICED_CLAS, st->previoussynth_fx_32, 0, -1, &st->enr_old_fx, 1 ); /*Q-0*/ #endif -- GitLab