diff --git a/lib_com/options.h b/lib_com/options.h index ccb4558dba698312b0c7c4d03b3530e08a044adb..e1b51996f86cc3458c921f09d7c17f2660de0b90 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,6 +149,8 @@ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ #define FIX_197_CREND_INTERFACE #define SET_TNS_FLAG_IN_EVERY_FRAME /* FhG: issue 288 - mismatch between encoder and decoder wrt TNS usage in unified stereo with frameloss */ +#define FIX_299_ISM_BWS /* VA: issue 299 - fix Band-width switching issues in ISM format */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index c79ecfacbde5104f4e5280c2c1598b3c40ea6c03..6ea717d07ea5543a3d8ef45b880bc8332c138d3b 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1028,7 +1028,11 @@ void bandwidth_switching_detect( { st->bws_cnt1 = 0; } - else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB ) + else if ( st->total_brate > ACELP_9k60 && st->last_core_brate < ACELP_9k60 && st->bwidth == SWB && st->last_bwidth == WB +#ifdef FIX_299_ISM_BWS + && st->last_low_rate_mode == 0 +#endif + ) { st->bws_cnt1++; } diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index d7862d2c56a46c7de3989d10f73195c6a2aa2181..05183e12f587add5b95c0247abc4c56afbbc537c 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -107,6 +107,9 @@ ivas_error init_decoder( st->last_good = UNVOICED_CLAS; st->clas_dec = UNVOICED_CLAS; st->low_rate_mode = 0; +#ifdef FIX_299_ISM_BWS + st->last_low_rate_mode = 0; +#endif st->lp_gainp = 0.0f; st->lp_gainc = 0.0f; diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index eee29406f6d5f3fb012e51e67d6b0dac678fcbb1..8bd367814fd111d6366cc60b296599745adef528 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -934,6 +934,9 @@ typedef struct Decoder_State int16_t ini_frame; /* initialization frames counter */ int16_t prev_coder_type; /* coding type of last frame */ int16_t low_rate_mode; /* low-rate mode flag */ +#ifdef FIX_299_ISM_BWS + int16_t last_low_rate_mode; /* previous frame low-rate mode flag */ +#endif /*----------------------------------------------------------------------------------* * ACELP core parameters diff --git a/lib_dec/updt_dec.c b/lib_dec/updt_dec.c index 1103a36d9f975e63c27bc44ade10fc6c1fb5858c..81f4027221fa6fefcc08ee46997f33fbda9179bf 100644 --- a/lib_dec/updt_dec.c +++ b/lib_dec/updt_dec.c @@ -641,6 +641,8 @@ void updt_dec_common( st->last_bits_frame_nominal = st->bits_frame_nominal; } + st->last_low_rate_mode = st->low_rate_mode; + /*-----------------------------------------------------------------* * Increase the counter of initialization frames * Limit the max number of init. frames