diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 1ef95583c37274d4d13a7001987fd5467bffd361..cdd5a6bfd0c2bb4b043902e299b98c5e18eeefc9 100755 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1155,7 +1155,11 @@ int16_t ivas_ism_dtx_enc( int16_t *sid_flag /* o : indication of SID frame */ ); +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH +void ivas_ism_dtx_dec( +#else ivas_error ivas_ism_dtx_dec( +#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t *nb_bits_metadata /* o : number of metadata bits */ ); diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index 870006c6fbbb58365a65c1228056000e27ce674a..388e939538cce6edfe3f7417965f215adef2d011 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,8 @@ #define NONBE_FIX_906_SBA_LBR_SMOOTHING /* FhG: issue #906: fix SBA low bit rate smoothing for HOA2/HOA3 output */ #define NONBE_FIX_878_RS_FEC_STEREO_CNG /* Eri: Frame loss and Unified Stereo CNG may cause false BER detection which results in corrupt bitstream decoding */ #define NONBE_FIX_904_JBM_SBA_RS_FOA /* FhG: issue #904: fix JBM SBA RS to FOA decoding */ +#define NONBE_FIX_898_ISM_BRATE_CRASH /* VA: issue 898: fix decoder crash in ISM bitrate switching with DTX and binaural output */ + /* ##################### End NON-BE switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index a936cf5a628b83687c32fcee1cb48a847a68409c..7ed71d5d6cd8987721f5b476a512e3e7d61890f8 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -185,10 +185,14 @@ ivas_error ivas_dec( /* Metadata decoding and configuration */ if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) { +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ); +#else if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } +#endif /* decode dominant object first so the noise energy of the other objects can be limited */ if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &p_output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index d9e32229c83c7ae819e373f79a5d535519e1f7ee..ea60e71a2f25b9e8f25e057fdc538580b8d13263 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -636,8 +636,16 @@ ivas_error ivas_dec_setup( } } +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + if ( st_ivas->ivas_format == ISM_FORMAT ) +#else if ( st_ivas->ini_frame == 0 && st_ivas->ivas_format == ISM_FORMAT ) +#endif { +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + ISM_MODE last_ism_mode = st_ivas->ism_mode; +#endif + /* read the number of objects */ st_ivas->nchan_transport = 1; nchan_ism = 1; @@ -649,6 +657,13 @@ ivas_error ivas_dec_setup( } k--; +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + if ( st_ivas->ini_frame > 0 && nchan_ism != st_ivas->nchan_ism ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); + } +#endif + st_ivas->nchan_ism = nchan_ism; /* read ism_mode */ @@ -660,10 +675,25 @@ ivas_error ivas_dec_setup( st_ivas->ism_mode = (ISM_MODE) ( idx + 1 ); } +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + if ( st_ivas->ini_frame == 0 ) + { + last_ism_mode = st_ivas->ism_mode; + } +#endif + #ifdef SPLIT_REND_WITH_HEAD_ROT +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, pcm_resolution, data ) ) != IVAS_ERR_OK ) +#endif +#else +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) #else if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) +#endif #endif { return error; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 8899696bec571b852630a64aac2b090c80ccae13..446b9aa9e42801cfabb7eebc8c75b07c19bcd5b4 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -47,17 +47,29 @@ * ISM DTX Metadata decoding routine *-------------------------------------------------------------------*/ +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH +void ivas_ism_dtx_dec( +#else ivas_error ivas_ism_dtx_dec( +#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t *nb_bits_metadata /* o : number of metadata bits */ ) { +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + int16_t ch, nchan_ism, nchan_ism_prev; +#else int16_t ch, pos, nchan_ism, nchan_ism_prev; +#endif int32_t ivas_total_brate; int16_t md_diff_flag[MAX_NUM_OBJECTS]; +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + int16_t flag_noisy_speech, sce_id_dtx; +#else int16_t idx, flag_noisy_speech, sce_id_dtx; ISM_MODE last_ism_mode, ism_mode_bstr; ivas_error error; +#endif Decoder_State *st; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -67,6 +79,12 @@ ivas_error ivas_ism_dtx_dec( if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + /* 'nchan_ism' was read in ivas_dec_setup() */ + nchan_ism = st_ivas->nchan_ism; + + /* ism_mode was read in ivas_dec_setup() as well as reconfiguration ivas_ism_dec_config() */ +#else /* read number of objects */ nchan_ism = 1; pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); @@ -104,6 +122,7 @@ ivas_error ivas_ism_dtx_dec( { return error; } +#endif } else { @@ -159,7 +178,11 @@ ivas_error ivas_ism_dtx_dec( } } +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + return; +#else return IVAS_ERR_OK; +#endif } diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 999a6e68c96df4a960fb5f4ae513c7b12449d574..f5b5d5d08a06d897f5ef513d60d53e6ed1fc1721 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -163,10 +163,14 @@ ivas_error ivas_jbm_dec_tc( /* Metadata decoding and configuration */ if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) { +#ifdef NONBE_FIX_898_ISM_BRATE_CRASH + ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ); +#else if ( ( error = ivas_ism_dtx_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } +#endif /* decode dominant object first so the noise energy of the other objects can be limited */ if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &p_output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK )