From 9533c4e9d0cf522840d7de7559fc44b707e566e5 Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 7 Jul 2025 11:40:20 +0200 Subject: [PATCH 1/2] Correct range of L_norm_arr() over xn_buf_fx_32 --- lib_com/options.h | 2 ++ lib_dec/dec_tcx_fx.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 3c6148817..25425b0ca 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -104,6 +104,8 @@ #define FIX_1348_BIT_PRECISION_IMPROVEMENT_QWIN #define FIX_1348_BIT_PRECISION_IMPROVEMENT_DYNAMIC_QOLD +#define FIX_1802 + #define FIX_USAN_BASOP_UTIL_DIVIDE3232 /* Eri: Fix USAN error in BASOP_Util_Divide3232_Scale_newton by adding explicit type cast for -1 in hex */ #define FIX_1740_MISING_POP_WMOPS /* VA: fix issue 1740: missing pop_wmops() */ diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index 6206577c1..a289fc733 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3464,7 +3464,11 @@ void IMDCT_ivas_fx( // sub( q_xn_buf_fx_32, q_win ) == 16 - L_norm_arr( xn_buf_fx_32, L_frame ) // q_xn_buf_fx_32 - q_win == 16 - L_norm_arr( xn_buf_fx_32, L_frame ) // q_win == - 16 + L_norm_arr( xn_buf_fx_32, L_frame ) + q_xn_buf_fx_32 +#ifdef FIX_1802 + q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 1 ) ) ); +#else q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), L_norm_arr( xn_buf_fx_32, L_frame ) ) - 2 ); +#endif } IMDCT_ivas_fx_rescale( xn_buf_fx, &q_xn_buf_fx, syn_Overl_TDAC_fx, Q_syn_Overl_TDAC_fx, old_syn_overl_fx, Q_old_syn_overl_fx, hTcxDec->old_syn_Overl, &hTcxDec->Q_old_syn_Overl, old_out_fx, q_old_out_fx, q_win, FB_flag ); #endif -- GitLab From 7ea9581747c2cfbafaf8dc997ee975ee0f4d408f Mon Sep 17 00:00:00 2001 From: Manuel Jander Date: Mon, 7 Jul 2025 15:34:24 +0200 Subject: [PATCH 2/2] Increase headroom of xn_buf_fx_32 / q_win to same value as in main branch. --- lib_dec/dec_tcx_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/dec_tcx_fx.c b/lib_dec/dec_tcx_fx.c index a289fc733..62db44e96 100644 --- a/lib_dec/dec_tcx_fx.c +++ b/lib_dec/dec_tcx_fx.c @@ -3465,7 +3465,7 @@ void IMDCT_ivas_fx( // q_xn_buf_fx_32 - q_win == 16 - L_norm_arr( xn_buf_fx_32, L_frame ) // q_win == - 16 + L_norm_arr( xn_buf_fx_32, L_frame ) + q_xn_buf_fx_32 #ifdef FIX_1802 - q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 1 ) ) ); + q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), sub( L_norm_arr( xn_buf_fx_32 + ( overlap / 2 ) + nz, L_frame ), 2 ) ) ); #else q_win = s_min( q_win, add( sub( q_xn_buf_fx_32, 16 ), L_norm_arr( xn_buf_fx_32, L_frame ) ) - 2 ); #endif -- GitLab