From 0f694abe85a1bbc914ba8ca7fed86fa61c2877a5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 May 2025 08:25:32 +0200 Subject: [PATCH 1/2] port FIX_971_LOG2_IDX_GAIN_0 --- lib_com/options.h | 2 ++ lib_enc/swb_tbe_enc.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 2d952edea..6047b5f88 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -188,6 +188,8 @@ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ #define FIX_969_USAN_IGF_ARITH /* FhG: issue 969: fix USAN error in igf_sce_dec; same issue as #962 */ #define FIX_959_MASA_LINEAR_REND /* VA: issue 959: remove unused calling of ivas_sba_linear_renderer() in MASA rendering */ +#define FIX_971_LOG2_IDX_GAIN_0 /* VA: prevent -Inf due to log2(ratio==0) */ + /* #################### End BASOP porting switches ############################ */ diff --git a/lib_enc/swb_tbe_enc.c b/lib_enc/swb_tbe_enc.c index 70c8797bd..3b5b4da9f 100644 --- a/lib_enc/swb_tbe_enc.c +++ b/lib_enc/swb_tbe_enc.c @@ -2753,6 +2753,12 @@ void fb_tbe_enc( hBWE_TD->prev_fb_energy = sum2_f( input_fhb + L_FRAME48k / 2, L_FRAME48k / 2 ); fb_exc_energy = sum2_f( fb_exc, L_FRAME16k ) + EPSILON; ratio = (float) sqrt( temp2 / fb_exc_energy ); +#ifdef FIX_971_LOG2_IDX_GAIN_0 + if ( ratio < 1.0f ) + { + ratio = 1.0f; + } +#endif idxGain = (int16_t) ( log2_f( (float) ratio ) + 0.5f ); idxGain = max( 0, min( 15, idxGain ) ); ratio = (float) ( 1 << idxGain ); -- GitLab From 0257b4b36ebf6d84b190961e4f6bcfd9ca7af523 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 May 2025 08:44:26 +0200 Subject: [PATCH 2/2] white space --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6047b5f88..39f6b51f0 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -188,7 +188,7 @@ #define NONBE_FIX_968_ISM_BRIR_WITH_HEADROTATION_5MS_FIX /* FhG : issue #968: differences between 5ms and 20ms rendering for discrete ISM with BRIR and head rotation*/ #define FIX_969_USAN_IGF_ARITH /* FhG: issue 969: fix USAN error in igf_sce_dec; same issue as #962 */ #define FIX_959_MASA_LINEAR_REND /* VA: issue 959: remove unused calling of ivas_sba_linear_renderer() in MASA rendering */ -#define FIX_971_LOG2_IDX_GAIN_0 /* VA: prevent -Inf due to log2(ratio==0) */ +#define FIX_971_LOG2_IDX_GAIN_0 /* VA: prevent -Inf due to log2(ratio==0) */ /* #################### End BASOP porting switches ############################ */ -- GitLab