From 03bd34bd77c95de3f769d83d2d7620b25f39df37 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 15 Dec 2025 16:59:17 +0100 Subject: [PATCH 1/2] introduce FIX_1381_BWD --- lib_com/options.h | 1 + lib_enc/bw_detect_fx.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ee8c6be3a..af4afa19d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -102,6 +102,7 @@ #define FIX_2250_LARGE_DIFFERENCES_BETWEEN_BASOP_AND_FLOAT /* Dolby: Issue 2250: random vector generation in GenShapedSHBExcitation() */ #define FIX_2254_IMPROV_PRECISION_OR_COMPLEXITY_NON_BE /* VA: Precision improvement without increasing complexity, or complexity reduction that might be not BE on the LSB */ #define FIX_2252_LP_CNG_STARTS_SID /* VA: issues 2251 and 2252: fix LP CNG uninitialized value in bitstream that starts with an SID */ +#define FIX_1381_BWD /* VA: issue 1381: apply no hysteresis in BWD at higher bitrates also in mono MASA and OMASA */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index 33e00aae1..b1283ff5c 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -16,7 +16,11 @@ /*-------------------------------------------------------------------* * Local constants *-------------------------------------------------------------------*/ + #define BWD_MIN_BRATE_WIDER_BW_MDCT IVAS_48k +#ifdef FIX_1381_BWD +#define BWD_MIN_BRATE_WIDER_BW_MASA IVAS_48k +#endif #define BWD_MIN_BRATE_WIDER_BW_ISM IVAS_32k #define BWD_MAX_BRATE_WIDER_BW_MDCT IVAS_80k #define BWD_MAX_BRATE_WIDER_BW_ISM IVAS_64k @@ -28,8 +32,6 @@ #define BWD_COUNT_WIDER_BW 10 #define BWD_COUNT_WIDER_BW_MDCT 0 -#define BWD_N_BINS_MAX 13 - #define CLDFB_ENER_OFFSET_FX 26214 /* 1.6 in Q14 */ /*-------------------------------------------------------------------* @@ -40,8 +42,8 @@ void bw_detect_fx( Encoder_State *st, /* i/o: Encoder State */ - const Word16 signal_in[], /* i : input signal */ - Word16 *spectrum, /* i : MDCT spectrum Q_spec */ + const Word16 signal_in[], /* i : input signal */ + Word16 *spectrum, /* i : MDCT spectrum Q_spec */ const Word32 *enerBuffer, /* i : CLDFB Energy Q31 */ const Word16 *cldfbBuf_Ener_Exp, /* i : CLDFB Energy Exponent */ const IVAS_FORMAT ivas_format, /* i : IVAS format */ @@ -75,12 +77,22 @@ void bw_detect_fx( test(); test(); test(); +#ifdef FIX_1381_BWD + test(); + test(); +#endif if ( st->ini_frame > 0 && ( ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && ( GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_MDCT ) || mct_on ) ) || +#ifdef FIX_1381_BWD + ( st->is_ism_format && GE_32(st->element_brate , BWD_MIN_BRATE_WIDER_BW_ISM) ) || + ( EQ_16(ivas_format , MASA_FORMAT) && GE_32(st->element_brate , BWD_MIN_BRATE_WIDER_BW_MASA )) ) ) +#else ( EQ_16( ivas_format, ISM_FORMAT ) && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM ) ) ) ) +#endif { bwd_count_wider_bw = BWD_COUNT_WIDER_BW_MDCT; move16(); } + IF( GT_32( st->input_Fs, 8000 ) ) { -- GitLab From c7f24ebfa1e56462d51f21a9756c781d6f72c904 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 15 Dec 2025 17:53:57 +0100 Subject: [PATCH 2/2] clang-format --- lib_enc/bw_detect_fx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_enc/bw_detect_fx.c b/lib_enc/bw_detect_fx.c index b1283ff5c..37b79491a 100644 --- a/lib_enc/bw_detect_fx.c +++ b/lib_enc/bw_detect_fx.c @@ -83,8 +83,8 @@ void bw_detect_fx( #endif if ( st->ini_frame > 0 && ( ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && ( GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_MDCT ) || mct_on ) ) || #ifdef FIX_1381_BWD - ( st->is_ism_format && GE_32(st->element_brate , BWD_MIN_BRATE_WIDER_BW_ISM) ) || - ( EQ_16(ivas_format , MASA_FORMAT) && GE_32(st->element_brate , BWD_MIN_BRATE_WIDER_BW_MASA )) ) ) + ( st->is_ism_format && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM ) ) || + ( EQ_16( ivas_format, MASA_FORMAT ) && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_MASA ) ) ) ) #else ( EQ_16( ivas_format, ISM_FORMAT ) && GE_32( st->element_brate, BWD_MIN_BRATE_WIDER_BW_ISM ) ) ) ) #endif -- GitLab