diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index fc4be3127ec907a976eec67784f175d0b9fa9b16..75ef0a2ae7a789310abe5f3ec0fab03e0659ccb4 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -199,7 +199,11 @@ ivas_error ivas_ism_config( diff = 0; for ( ch = 0; ch < n_ISms; ch++ ) { +#ifdef FIX_ISM_INACTIVE_BITS + int16_t limit; +#else int32_t limit; +#endif limit = MIN_BRATE_SWB_BWE / FRMS_PER_SECOND; if ( element_brate[ch] < MIN_BRATE_SWB_STEREO ) /* replicate function set_bw() -> check the coded audio band-width */ @@ -219,12 +223,20 @@ ivas_error ivas_ism_config( else if ( ism_imp[ch] == ISM_LOW_IMP ) { tmp = (int16_t) ( BETA_ISM_LOW_IMP * bits_CoreCoder[ch] ); +#ifdef FIX_ISM_INACTIVE_BITS + tmp = max( limit, tmp ); +#else tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp ); +#endif } else if ( ism_imp[ch] == ISM_MEDIUM_IMP ) { tmp = (int16_t) ( BETA_ISM_MEDIUM_IMP * bits_CoreCoder[ch] ); +#ifdef FIX_ISM_INACTIVE_BITS + tmp = max( limit, tmp ); +#else tmp = (int16_t) max( limit, bits_CoreCoder[ch] - tmp ); +#endif } else /* ism_imp[ch] == ISM_HIGH_IMP */ { diff --git a/lib_com/options.h b/lib_com/options.h index e53bac6a6f78546fa901f225b7143aa8f9aaabe0..9c71abfd9040c6a17014a88ea51a77c815e26266 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -175,8 +175,9 @@ #define FIX_GET_DELAY_RETURN /* Issue 223: change return data type in function get_delay() */ #define NTT_REDUC_COMP_POC /* NTT Contribution 10: Complexity reduction of phase spectrum in stereo downmix*/ #define FIX_ISM_DECODER_PRINTOUT /* Issue 229: fix ISM decoder printout */ -#define FIX_ITD_CNG /* Eri: Fix for CNG ITD */ +#define FIX_ITD_CNG /* Eri Contribution 11: Fix for CNG ITD */ #define FIX_VBR_COMPLEXITY /* Issue 234: fix extremely high complexity numbers for IVAS EVS mode */ +#define FIX_ISM_INACTIVE_BITS /* Issue 230: fix bitbudget distribution in inactive frames in ISM format */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 60550bca0b304dd2d049ba5f8e1bdf4506567852..c4fcd2dee7d3af543431257faa591a6c0421bf75 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -105,6 +105,20 @@ static void rate_ism_importance( { ctype = hSCE[ch]->hCoreCoder[0]->coder_type_raw; +#ifdef FIX_ISM_INACTIVE_BITS + if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) + { + if ( hSCE[ch]->hCoreCoder[0]->localVAD == 0 ) + { + ctype = INACTIVE; + } + else if ( ctype == UNVOICED ) + { + ctype = GENERIC; + } + } +#endif + if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { ism_imp[ch] = ISM_NO_META;