From 4051f3c87ab93631c2349cd81ac35652e5c966c7 Mon Sep 17 00:00:00 2001 From: naghibza Date: Tue, 11 Nov 2025 16:35:30 +0100 Subject: [PATCH 1/3] Add headroom to p_output_fx to prevent overflow in ivas_rend_crendProcessSubframe_fx(). --- lib_com/options.h | 1 + lib_dec/ivas_jbm_dec_fx.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index b6d1ca2b6..f814ac861 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_2211_ASSERT_IN_REND_CREND_CONVOLER /* FhG: Add headroom to p_output_fx to prevent overflow in ivas_rend_crendProcessSubframe_fx() */ /* ################### End FIXES switches ########################### */ /* #################### Start BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 42270d50d..3dbc4f15f 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2766,9 +2766,19 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( { return error; } +#ifdef FIX_2211_ASSERT_IN_REND_CREND_CONVOLER + Word16 subframe_len, gd_bits; + subframe_len = imult1616( st_ivas->hTcBuffer->subframe_nbslots[0], st_ivas->hTcBuffer->n_samples_granularity ); + gd_bits = find_guarded_bits_fx( subframe_len ); + *st_ivas->hCrendWrapper->p_io_qfactor = sub( 13, gd_bits ); + FOR( Word16 i = 0; i < nchan_in; i++ ) + { + scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor + } +#else *st_ivas->hCrendWrapper->p_io_qfactor = 11; move16(); - +#end IF( NE_32( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ), IVAS_ERR_OK ) ) @@ -2777,6 +2787,12 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( } ivas_binaural_add_LFE_fx( st_ivas, hTcBuffer->n_samples_granularity, st_ivas->hTcBuffer->tc_fx, p_output_fx ); +#ifdef FIX_2211_ASSERT_IN_REND_CREND_CONVOLER + FOR( Word16 i = 0; i < nchan_in; i++ ) + { + scale_sig32( p_output_fx[i], *nSamplesRendered, sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ); // Q11 + } +#endif } ELSE IF( EQ_16( renderer_type_old, RENDERER_BINAURAL_OBJECTS_TD ) ) { -- GitLab From a75f0f0e90eb32b35bd23fd191ae8f3646b83843 Mon Sep 17 00:00:00 2001 From: naghibza Date: Tue, 11 Nov 2025 16:40:44 +0100 Subject: [PATCH 2/3] Fix macro terminator --- lib_dec/ivas_jbm_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 3dbc4f15f..988013697 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2778,7 +2778,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( #else *st_ivas->hCrendWrapper->p_io_qfactor = 11; move16(); -#end +#endif IF( NE_32( error = ivas_rend_crendProcessSubframe_fx( st_ivas->hCrendWrapper, intern_config_old, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData, hIntSetupOld, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output_fx : st_ivas->hTcBuffer->tc_fx, p_output_fx, hTcBuffer->n_samples_granularity, st_ivas->hDecoderConfig->output_Fs, 0 ), IVAS_ERR_OK ) ) -- GitLab From 01a8a6636c287207b347164f757af349bae52ff0 Mon Sep 17 00:00:00 2001 From: naghibza Date: Tue, 11 Nov 2025 17:25:52 +0100 Subject: [PATCH 3/3] Remove redundant negate() usage. --- lib_dec/ivas_jbm_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec_fx.c b/lib_dec/ivas_jbm_dec_fx.c index 988013697..1f2f77791 100644 --- a/lib_dec/ivas_jbm_dec_fx.c +++ b/lib_dec/ivas_jbm_dec_fx.c @@ -2773,7 +2773,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx( *st_ivas->hCrendWrapper->p_io_qfactor = sub( 13, gd_bits ); FOR( Word16 i = 0; i < nchan_in; i++ ) { - scale_sig32( p_output_fx[i], *nSamplesRendered, negate( sub( Q11, *st_ivas->hCrendWrapper->p_io_qfactor ) ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor + scale_sig32( p_output_fx[i], *nSamplesRendered, sub( *st_ivas->hCrendWrapper->p_io_qfactor, Q11 ) ); // Q = *st_ivas->hCrendWrapper->p_io_qfactor } #else *st_ivas->hCrendWrapper->p_io_qfactor = 11; -- GitLab