From c64034ada5a98c760f459cb7bf3676a11340a00a Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 9 Oct 2025 21:01:53 +0200 Subject: [PATCH 1/8] fix missing frame length --- lib_com/ivas_limiter_fx.c | 33 +++++++++++++++++++++++++++++++-- lib_com/options.h | 1 + 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 4250d7a7a..979abb1f1 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -41,13 +41,18 @@ #include #include "ivas_prot_fx.h" - +#ifdef FIX_2089_NONBE_LIMITER_CONSTS +#define RELEASE_CNST_20MS ( 85899345 ) // Q30 +#define RELEASE_CNST_2_20MS_5MS ( 21474836 ) // Q30 +#define RELEASE_CNST_10MS ( 42949672 ) // Q30 +#define RELEASE_CNST_2_10MS ( 10737418 ) // Q30 +#define RELEASE_CNST_2_5MS ( 5368709 ) // Q30 +#endif #define ATTACK_CNST_48k ( 2106670080 ) // Q31 #define ATTACK_CNST_32k ( 2086555136 ) // Q31 #define ATTACK_CNST_16k ( 2027355264 ) // Q31 #define ATTACK_CNST_8k ( 1913946752 ) // Q31 - /*-------------------------------------------------------------------* * detect_strong_saturations() * @@ -349,6 +354,29 @@ void limiter_process_fx( * keep the gain curve smoother if the threshold is exceeded in many frames * in a short span of time. */ +#ifdef FIX_2089_NONBE_LIMITER_CONSTS + IF( EQ_32( L_msu( hLimiter->sampling_rate, output_frame, 25 ), 0 ) ) + { + releaseHeuristic_cnst = RELEASE_CNST_20MS; + move32(); + releaseHeuristic_cnst_2 = RELEASE_CNST_2_20MS_5MS; + move32(); + } + ELSE IF( EQ_32( L_msu( hLimiter->sampling_rate, output_frame, 50 ), 0 ) ) + { + releaseHeuristic_cnst = RELEASE_CNST_10MS; + move32(); + releaseHeuristic_cnst_2 = RELEASE_CNST_2_10MS; + move32(); + } + ELSE + { + releaseHeuristic_cnst = RELEASE_CNST_2_20MS_5MS; + move32(); + releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS; + move32(); + } +#else SWITCH( output_frame ) { case 960: @@ -367,6 +395,7 @@ void limiter_process_fx( move32(); BREAK; } +#endif releaseHeuristic = hLimiter->release_heuristic_fx; /* Q30 */ move32(); diff --git a/lib_com/options.h b/lib_com/options.h index 1adebda25..03a400938 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -110,6 +110,7 @@ #define OPT_TCXLTP_FILTER_LOOP /* FhG: optimize loop in tcx_ltp_synth_filter */ #define FIX_2049_DIFF_IN_DECORR_TAIL /* FhG: correct scale values in ivas_dirac_dec_binaural_process_output_fx() */ #define FIX_2602_NONBE_SAT_IN_SWB_TBE_SCALE /* Dolby/FhG: fix for issue 2026: Saturation in SWB TBE re-scaling function preventing StereoDownmix complexity job to complete */ +#define FIX_2089_NONBE_LIMITER_CONSTS /* Orange : fix issuer 2089 : Limiter attack and release constants differ from float version*/ /* #################### Start BASOP porting switches ############################ */ -- GitLab From f1d51c63e9b1c1726309dc583e04463bf061b1cd Mon Sep 17 00:00:00 2001 From: marc emerit Date: Fri, 10 Oct 2025 09:43:22 +0200 Subject: [PATCH 2/8] Trigger Build -- GitLab From 2a6dae178bd8c8c1409b843d14fc5dd41f52b3e4 Mon Sep 17 00:00:00 2001 From: emerit Date: Wed, 15 Oct 2025 13:24:06 +0000 Subject: [PATCH 3/8] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: sagnowski --- lib_com/ivas_limiter_fx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 979abb1f1..2b5b0b13c 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -43,9 +43,10 @@ #ifdef FIX_2089_NONBE_LIMITER_CONSTS #define RELEASE_CNST_20MS ( 85899345 ) // Q30 -#define RELEASE_CNST_2_20MS_5MS ( 21474836 ) // Q30 +#define RELEASE_CNST_2_20MS ( 21474836 ) // Q30 #define RELEASE_CNST_10MS ( 42949672 ) // Q30 #define RELEASE_CNST_2_10MS ( 10737418 ) // Q30 +#define RELEASE_CNST_5MS ( 21474836 ) // Q30 #define RELEASE_CNST_2_5MS ( 5368709 ) // Q30 #endif #define ATTACK_CNST_48k ( 2106670080 ) // Q31 -- GitLab From 99d65418586260186b3823ef74d7177bd6b603b9 Mon Sep 17 00:00:00 2001 From: emerit Date: Wed, 15 Oct 2025 13:25:07 +0000 Subject: [PATCH 4/8] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: sagnowski --- lib_com/ivas_limiter_fx.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 2b5b0b13c..16ad394e9 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -356,27 +356,32 @@ void limiter_process_fx( * in a short span of time. */ #ifdef FIX_2089_NONBE_LIMITER_CONSTS - IF( EQ_32( L_msu( hLimiter->sampling_rate, output_frame, 25 ), 0 ) ) + IF( EQ_32( L_mult0( output_frame, 50 ), hLimiter->sampling_rate ) ) { releaseHeuristic_cnst = RELEASE_CNST_20MS; move32(); - releaseHeuristic_cnst_2 = RELEASE_CNST_2_20MS_5MS; + releaseHeuristic_cnst_2 = RELEASE_CNST_2_20MS; move32(); } - ELSE IF( EQ_32( L_msu( hLimiter->sampling_rate, output_frame, 50 ), 0 ) ) + ELSE IF( EQ_32( L_mult0( output_frame, 100 ), hLimiter->sampling_rate ) ) { releaseHeuristic_cnst = RELEASE_CNST_10MS; move32(); releaseHeuristic_cnst_2 = RELEASE_CNST_2_10MS; move32(); } - ELSE + ELSE IF( EQ_32( L_mult0( output_frame, 200 ), hLimiter->sampling_rate ) ) { - releaseHeuristic_cnst = RELEASE_CNST_2_20MS_5MS; + releaseHeuristic_cnst = RELEASE_CNST_5MS; move32(); releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS; move32(); } + ELSE + { + assert( 0 && "Unreachable: unsupported frame size" ); + } + #else SWITCH( output_frame ) { -- GitLab From 57b3284146ddd7a5b92370d540935bb46d36a00d Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 16 Oct 2025 13:13:35 +0200 Subject: [PATCH 5/8] fix clang format error --- lib_com/ivas_limiter_fx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 16ad394e9..f9495a58f 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -42,12 +42,12 @@ #include "ivas_prot_fx.h" #ifdef FIX_2089_NONBE_LIMITER_CONSTS -#define RELEASE_CNST_20MS ( 85899345 ) // Q30 -#define RELEASE_CNST_2_20MS ( 21474836 ) // Q30 -#define RELEASE_CNST_10MS ( 42949672 ) // Q30 -#define RELEASE_CNST_2_10MS ( 10737418 ) // Q30 -#define RELEASE_CNST_5MS ( 21474836 ) // Q30 -#define RELEASE_CNST_2_5MS ( 5368709 ) // Q30 +#define RELEASE_CNST_20MS ( 85899345 ) // Q30 +#define RELEASE_CNST_2_20MS ( 21474836 ) // Q30 +#define RELEASE_CNST_10MS ( 42949672 ) // Q30 +#define RELEASE_CNST_2_10MS ( 10737418 ) // Q30 +#define RELEASE_CNST_5MS ( 21474836 ) // Q30 +#define RELEASE_CNST_2_5MS ( 5368709 ) // Q30 #endif #define ATTACK_CNST_48k ( 2106670080 ) // Q31 #define ATTACK_CNST_32k ( 2086555136 ) // Q31 -- GitLab From ac872be29eb1536355a6881c791f79e90391d5e8 Mon Sep 17 00:00:00 2001 From: muxe6256 Date: Thu, 16 Oct 2025 13:45:53 +0200 Subject: [PATCH 6/8] fix windows build warning --- lib_com/ivas_limiter_fx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index f9495a58f..278980089 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -379,6 +379,10 @@ void limiter_process_fx( } ELSE { + releaseHeuristic_cnst = 0; + move32(); + releaseHeuristic_cnst_2 = 0; + move32(); assert( 0 && "Unreachable: unsupported frame size" ); } -- GitLab From 78ac5f219638b9187009dde1b6c014ac474cebe4 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 16 Oct 2025 16:39:03 +0200 Subject: [PATCH 7/8] fix crash --- lib_com/ivas_limiter_fx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 278980089..097f264df 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -379,11 +379,12 @@ void limiter_process_fx( } ELSE { - releaseHeuristic_cnst = 0; + // todo compute release constantes for others output_frame + // assert( 0 && "Unreachable: unsupported frame size" ); + releaseHeuristic_cnst = RELEASE_CNST_5MS; move32(); - releaseHeuristic_cnst_2 = 0; + releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS; move32(); - assert( 0 && "Unreachable: unsupported frame size" ); } #else -- GitLab From 563669226ad9d3a6c265d1d56c9a68723adeb954 Mon Sep 17 00:00:00 2001 From: marc emerit Date: Thu, 16 Oct 2025 22:50:45 +0200 Subject: [PATCH 8/8] fix output_frame != 5, 10 or 20 ms due to jbm --- lib_com/ivas_limiter_fx.c | 20 ++++++++++++++++++-- lib_com/options.h | 5 ++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 097f264df..37790166e 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -379,12 +379,28 @@ void limiter_process_fx( } ELSE { - // todo compute release constantes for others output_frame - // assert( 0 && "Unreachable: unsupported frame size" ); +#ifdef FIX_2089_NONBE_LIMITER_CONSTS_WITH_DIV + // computing output_frame/hLimiter->sampling_rate in Q30 + i = norm_s( output_frame ); + c = norm_l( hLimiter->sampling_rate ); + scale = extract_h( L_shl( hLimiter->sampling_rate, c ) ); + idx = shl( output_frame, i ); + IF( GT_16( idx, scale ) ) + { + idx = shr( idx, 1 ); + i = sub( i, 1 ); + } + scale = div_s( idx, scale ); + i = sub( sub( c, i ), 1 ); // Q30 + releaseHeuristic_cnst_2 = L_shl( scale, i ); + releaseHeuristic_cnst = L_shl( releaseHeuristic_cnst_2, 2 ); +#else + /* or same default values as previous code version */ releaseHeuristic_cnst = RELEASE_CNST_5MS; move32(); releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS; move32(); +#endif } #else diff --git a/lib_com/options.h b/lib_com/options.h index ccec7e190..dd81358ad 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -76,7 +76,10 @@ #define FIX_1990_SANITIZER_IN_REVERB_LOAD /* Nokia: Fix issue part of issue 1990 by introducing missing free of structure - keep until #2059 is addressed */ #define FIX_1999_TEMPORARY_DISABLE_DIST_ATT_CHECK /* Eri: Issue 1999: Range check on float values of distance attenuation, while the float values are not propagated to this function. The test is not correct, but configurable distance attenuation is not used in Characterization.*/ #define OPT_IGF_GET_WHITE_SPEC_DATA /* FhG: optimized version of IGF_getWhiteSpectralData_ivas() */ -#define FIX_2089_NONBE_LIMITER_CONSTS /* Orange : fix issuer 2089 : Limiter attack and release constants differ from float version */ +#define FIX_2089_NONBE_LIMITER_CONSTS /* Orange : fix issue 2089 : Limiter attack and release constants differ from float version */ +#ifdef FIX_2089_NONBE_LIMITER_CONSTS +#define FIX_2089_NONBE_LIMITER_CONSTS_WITH_DIV /* Orange : compute release const for other output frame generate by jbm */ +#endif #define FIX_1785_ASSERT_IN_IVAS_JBM_DEC_RENDER_FX /* Orange: 10ms Rendering: Assert in ivas_jbm_dec_render_fx() -> scale_sig32 */ #define FIX_2081_REVISE_H1_SCALING /* VA: accommodate for H1 overshoot that was causing assert in set_impule. Not BE with MASA on LTV with bitrate switching for only 2 instances */ #define TEMP_FIX_2088_MSAN_INIT_ERROR /* Eri: Temporary fix for Issue 2088 - MSAN error. Will come with later port of JBM+Split rendering update */ -- GitLab