diff --git a/lib_com/ivas_limiter_fx.c b/lib_com/ivas_limiter_fx.c index 4250d7a7a46db4ebc5500b6754d015d1f25a601d..37790166e4e407900fa81a5d07a7a5d748837a54 100644 --- a/lib_com/ivas_limiter_fx.c +++ b/lib_com/ivas_limiter_fx.c @@ -41,13 +41,19 @@ #include #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 +#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 +355,55 @@ 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_mult0( output_frame, 50 ), hLimiter->sampling_rate ) ) + { + releaseHeuristic_cnst = RELEASE_CNST_20MS; + move32(); + releaseHeuristic_cnst_2 = RELEASE_CNST_2_20MS; + move32(); + } + 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 IF( EQ_32( L_mult0( output_frame, 200 ), hLimiter->sampling_rate ) ) + { + releaseHeuristic_cnst = RELEASE_CNST_5MS; + move32(); + releaseHeuristic_cnst_2 = RELEASE_CNST_2_5MS; + move32(); + } + ELSE + { +#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 SWITCH( output_frame ) { case 960: @@ -367,6 +422,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 a43f4053df65dd7d350fa0f34d88c6200da80c0b..773d74ef5d8fc63b2e3ea96734bcfb94938d0b2b 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -76,6 +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 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 */