From 3133641f4a9c8002d14de756ea5f9cb8567048a3 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Thu, 7 Aug 2025 21:16:15 +0200 Subject: [PATCH] porting of patch --- lib_com/options.h | 2 +- lib_dec/jbm_jb4sb_fx.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 065e4bdff..32159eb99 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -101,7 +101,7 @@ #define FIX_WARNING_RENDER_CONFIG /* Orange: fix warning on windows build */ #define FIX_1052_EXT_OUTPUT /* VA: issue 1052: define EXT decoder output configuration for stereo and MC formats */ - +#define NONBE_1215_FIX_JBM_MAX_SCALING /* FhG: issue 1215: Fix assert hit in a specific VoIP decoder config. Caused by integer overflow in max scaling calculation. */ #define NONBE_FIX_991_PARAMBIN_BINARY_HRTF /* Nokia: issue #991: fix using of binary file HRTF in ParamBin (to activate when USE_NEW_HRTF_BINARY_FILE_FORMAT and FIX_777_COMBI_RENDER_CONFIG_FILE are on ) */ #define NONBE_FIX_1091_PMC_LOW_SIGNAL_BURSTS /* FhG: fix for #1091, fix limit calculation for the regularized inverse of Kx to avoid bursts in very low signals */ diff --git a/lib_dec/jbm_jb4sb_fx.c b/lib_dec/jbm_jb4sb_fx.c index d1f782b55..47cc52177 100644 --- a/lib_dec/jbm_jb4sb_fx.c +++ b/lib_dec/jbm_jb4sb_fx.c @@ -922,7 +922,15 @@ static void JB4_adaptActivePlayout( } rate = (UWord32) W_add( temp3, dropRateMin ); *scale = idiv1616( sub( 1000, (Word16) rate ), 10 ); +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = (UWord32) JB4_MIN( W_sub( currPlayoutDelay, targetMax ), 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = (UWord32) W_sub( currPlayoutDelay, targetMax ); +#endif move32(); move32(); } @@ -943,7 +951,15 @@ static void JB4_adaptActivePlayout( { *scale = 120; move32(); +#ifdef NONBE_1215_FIX_JBM_MAX_SCALING + /* Limit max scaling to the duration of one frame. APA will not exceed this limit + * anyway due to the 50% limitation of APA_MIN_SCALE and APA_MAX_SCALE. Limiting + * the value to a sensible range here avoids integer overflows at later stages when + * converting maxScaling from milliseconds to samples. */ + *maxScaling = (UWord32) JB4_MIN( W_sub( targetMaxStretch, currPlayoutDelay ), 1000 / IVAS_NUM_FRAMES_PER_SEC ); +#else *maxScaling = (UWord32) W_sub( targetMaxStretch, currPlayoutDelay ); +#endif move32(); } } -- GitLab