diff --git a/lib_com/options.h b/lib_com/options.h index e5c80bffc4ee4fe673cf9435f280ae9fd7e7fa46..b777de1c0040dc3dfb8b25f9e1e42a970c696542 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -202,6 +202,7 @@ #define NONBE_FIX_738_SBA_BR_SW_ASAN /* FhG: issue 738: fixes bug when switching to an MCT bitrate and previous frame was ACELP */ #define NONBE_CR_FIX_735_SBA_HP20_BRATE_SWITCHING /* VA: Issue 735: Resolve "HP20 filtering bug in SBA/OSBA bitrate switching" */ #define NONBE_FIX_588_UPDATE_FASTCONV_SD /* FhG: issue 588: update FastConv SD HRTFs in CLDFB domain with new conversion method */ +#define NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN /* FhG: Issue 778: MSAN error due to uninitialized TNS configuration */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index f40b313125079ed9d7926152eb591c329b1facd6..71e20a5df75453183d18dbcc4f1613aad8f2a04a 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -95,8 +95,7 @@ void stereo_tcx_init_dec( hTcxDec->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_flag, st->element_mode ); st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_flag ); - if ( - st->element_mode != EVS_MONO ) + if ( st->element_mode != EVS_MONO ) { st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 7bcd80301ad575b1710cc32e3a6d6ab5f8a6f990..757a68dbac2680819fdedf5fca915d5ef425fbad 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -54,6 +54,9 @@ void stereo_tcx_init_enc( Encoder_State *st /* i/o: encoder state structure */ ) { +#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN + int16_t prev_IsTNSAllowed; +#endif assert( st->core_brate != SID_2k40 && st->core_brate != FRAME_NO_DATA ); /* Get the raw coder type from signal analysis*/ @@ -100,16 +103,27 @@ void stereo_tcx_init_enc( st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); st->hTcxEnc->tcx_lpc_shaped_ari = getTcxLpcShapedAri( st->bits_frame_nominal * FRAMES_PER_SEC, st->rf_mode, st->element_mode ); st->igf = getIgfPresent( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->rf_mode ); +#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN + prev_IsTNSAllowed = st->hTcxCfg->fIsTNSAllowed; +#endif if ( st->element_mode != EVS_MONO ) { st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode ); } +#ifdef NONBE_FIX_778_TNS_UNFIED_STEREO_MSAN + if ( !prev_IsTNSAllowed && st->hTcxCfg->fIsTNSAllowed && st->element_mode == IVAS_CPE_DFT ) /* may happen in unified stereo when switching stereo technologies */ + { + InitTnsConfigs( st->bwidth, st->hTcxCfg->tcx_coded_lines, st->hTcxCfg->tnsConfig, st->hIGFEnc->infoStopFrequency, st->bits_frame_nominal * FRAMES_PER_SEC, st->element_mode, 0 ); + SetAllowTnsOnWhite( st->hTcxCfg->tnsConfig, 0 ); + } +#endif st->core_brate = st->total_brate; return; } + /*-------------------------------------------------------------------* * stereo_tcx_core_enc() *