From 1972d64fda4353065a5cb844f968846f61d6152b Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Mon, 14 Jul 2025 15:55:09 +0530 Subject: [PATCH] Porting fix: Incorrect TNS grouping and TNS5 interleaving in Stereo MDCT core when output_fs != input_fs https://forge.3gpp.org/rep/ivas-codec-pc/ivas-codec/-/issues/1348 --- lib_com/options.h | 2 +- lib_dec/dec_tcx.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9b03463a1..47398d087 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -144,7 +144,7 @@ /* ################### Start FIXES switches ########################### */ #define NONBE_FIX_864_JBM_RENDER_FRAMESIZE /* FhG: issue #864: fix different behaviour of JBM TSM with different render frame sizes */ - +#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ /* #################### End FIXES switches ############################ */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index f68ba522b..fbe241128 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1501,7 +1501,11 @@ void decoder_tcx_tns( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && whitenedDomain ) || ( L_spec > L_frameTCX ) ) +#else if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 ) || ( L_spec > L_frameTCX ) ) +#endif { L = L_spec; } @@ -1543,7 +1547,12 @@ void decoder_tcx_tns( if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { + +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( st->element_mode == EVS_MONO || ( L_spec < L_frameTCX && !whitenedDomain ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#else if ( st->element_mode == EVS_MONO || L_spec < L_frameTCX ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#endif { tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); } -- GitLab