From d051961f77ba72d7c5562ea67fa90e4a9f69e861 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 13 Jan 2023 15:24:16 +0100 Subject: [PATCH 1/8] add reconfig on every first good frame --- lib_com/options.h | 1 + lib_dec/ivas_tcx_core_dec.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index bea3e2670e..53351450ff 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,6 +151,7 @@ #define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ +#define FIX_288_RECONF_TCX_ON_1ST_GOOD_FRAME_ALWAYS /* FhG: fix for issue 288: fixes range coder crash in unified stereo with frameloss */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index ecf8bfbc3f..53d3d8422f 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -128,6 +128,9 @@ void stereo_tcx_init_dec( if ( ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || +#ifdef FIX_288_RECONF_TCX_ON_1ST_GOOD_FRAME_ALWAYS + (st->prev_bfi && !st->bfi) || +#endif ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ) ) { /*re-initialization*/ -- GitLab From 5b603fc4cae5532bb8e90a8aeaf9b9f219ba1903 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 13 Jan 2023 15:36:37 +0100 Subject: [PATCH 2/8] apply clang-format --- lib_dec/ivas_tcx_core_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 53d3d8422f..b2535a449f 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -129,7 +129,7 @@ void stereo_tcx_init_dec( ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || #ifdef FIX_288_RECONF_TCX_ON_1ST_GOOD_FRAME_ALWAYS - (st->prev_bfi && !st->bfi) || + ( st->prev_bfi && !st->bfi ) || #endif ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ) ) { -- GitLab From 731e8fe8f5408c6d061edf68c87cf31187198c6f Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 20 Jan 2023 16:27:33 +0100 Subject: [PATCH 3/8] remove old fix --- lib_dec/ivas_tcx_core_dec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index b2535a449f..ecf8bfbc3f 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -128,9 +128,6 @@ void stereo_tcx_init_dec( if ( ( st->bits_frame_nominal != st->last_bits_frame_nominal ) || ( st->bwidth != st->last_bwidth ) || ( st->last_core != TCX_20_CORE && st->last_core != TCX_10_CORE && !( st->prev_bfi == 1 && st->last_core == ACELP_CORE && st->last_con_tcx == 1 ) ) || -#ifdef FIX_288_RECONF_TCX_ON_1ST_GOOD_FRAME_ALWAYS - ( st->prev_bfi && !st->bfi ) || -#endif ( st->idchan == 1 && st->element_mode == IVAS_CPE_MDCT && last_element_mode != IVAS_CPE_MDCT ) ) { /*re-initialization*/ -- GitLab From 045a3da1794427edc894645e0c1f0f6ff4d20f30 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 20 Jan 2023 16:28:33 +0100 Subject: [PATCH 4/8] add new fix --- lib_com/options.h | 6 ++---- lib_dec/core_dec_init.c | 6 ++++++ lib_dec/ivas_tcx_core_dec.c | 6 ++++++ lib_enc/ivas_tcx_core_enc.c | 6 ++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2f1a5fd35a..39815aafa7 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -152,14 +152,12 @@ #define FIX_235 /* Issue 235: Deallocation of HR filter memory separately for lib_rend (ROM) and lib_util (from file) */ #define ENV_STAB_FIX /* Contribution 23: HQ envelope stability memory fix */ #define STABILIZE_GIPD /* FhG: Contribution 22: gIPD stabilization */ -<<<<<<< HEAD -#define FIX_288_RECONF_TCX_ON_1ST_GOOD_FRAME_ALWAYS /* FhG: fix for issue 288: fixes range coder crash in unified stereo with frameloss */ -======= #define FIX_292_VBAP_CALLOC_REMOVAL /* Nokia: Fixes issue 292 by removing the remnant callocs */ #define FIX_293_EXT_RENDERER_CLI /* FhG: Fix bugs in external renderer CLI */ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ ->>>>>>> main + +#define SET_TNS_FLAG_IN_EVERY_FRAME /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index ae18893d8e..47c6834bf9 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -670,6 +670,12 @@ void open_decoder_LPD( st->last_tns_active = 0; st->second_last_tns_active = 0; st->second_last_core = -1; +#ifdef SET_TNS_FLAG_IN_EVERY_FRAME + if ( st->hTcxCfg != NULL && !MCT_flag && st->element_mode != EVS_MONO ) + { + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + } +#endif if ( hTcxDec != NULL ) { hTcxDec->tcxltp_second_last_pitch = st->old_fpitch; diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index ecf8bfbc3f..e1b2e1ec87 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -96,6 +96,12 @@ void stereo_tcx_init_dec( st->hTcxCfg->resq = getResq( st->bits_frame_nominal * FRAMES_PER_SEC ); 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, st->mct_chan_mode ); +#ifdef SET_TNS_FLAG_IN_EVERY_FRAME + if ( !MCT_flag && st->element_mode != EVS_MONO ) + { + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + } +#endif if ( hTcxLtpDec != NULL ) { hTcxLtpDec->tcxltp = getTcxLtp( st->sr_core ); diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index 4f17a3979b..577f0025a8 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -100,6 +100,12 @@ 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, st->mct_chan_mode ); +#ifdef SET_TNS_FLAG_IN_EVERY_FRAME + if ( st->element_mode != EVS_MONO ) + { + st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); + } +#endif st->core_brate = st->total_brate; -- GitLab From 49ed75c1b1c0df581d8591779b4c01aa3b68ade5 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 23 Jan 2023 13:32:41 +0100 Subject: [PATCH 5/8] add comments --- lib_dec/core_dec_init.c | 1 + lib_dec/ivas_tcx_core_dec.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index 47c6834bf9..572fb17805 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -671,6 +671,7 @@ void open_decoder_LPD( st->second_last_tns_active = 0; st->second_last_core = -1; #ifdef SET_TNS_FLAG_IN_EVERY_FRAME + /* TODO: also apply for MCT modes, once issue #24 is solved */ if ( st->hTcxCfg != NULL && !MCT_flag && st->element_mode != EVS_MONO ) { st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( is_init ? total_brate : st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index e1b2e1ec87..191692c0c9 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -97,6 +97,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, st->mct_chan_mode ); #ifdef SET_TNS_FLAG_IN_EVERY_FRAME + /* TODO: also apply for MCT modes, once issue #24 is solved */ if ( !MCT_flag && st->element_mode != EVS_MONO ) { st->hTcxCfg->fIsTNSAllowed = getTnsAllowed( st->bits_frame_nominal * FRAMES_PER_SEC, st->igf, st->element_mode, st->mct_chan_mode ); -- GitLab From 0137c183788f6415210056f4e4591208e85dd1ed Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 23 Jan 2023 13:39:20 +0100 Subject: [PATCH 6/8] correct path in .prm file --- scripts/config/self_test_evs.prm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config/self_test_evs.prm b/scripts/config/self_test_evs.prm index a252dd4380..6c4936a0d4 100644 --- a/scripts/config/self_test_evs.prm +++ b/scripts/config/self_test_evs.prm @@ -41,7 +41,7 @@ ../IVAS_dec -fec 5 8 bit testv/stv8c_13k20_8-8_DTX20_FEC5.tst // Codec A at 32 kbps, 32kHz in, 8kHz out, random FEC at 6% -../IVAS_cod 32000 32 scripts/testv/stv32c.pcm bit +../IVAS_cod 32000 32 testv/stv32c.pcm bit ../IVAS_dec -fec testv/FEC_6pct2.bin 8 bit stv32c_32k_32-8_FEC6.tst -- GitLab From eb0d7de8ce362929347c70eb2f3635ec7550733c Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 23 Jan 2023 13:56:51 +0100 Subject: [PATCH 7/8] dummy commit to trigger ci -- GitLab From 0eea976c9596e85d40bf02d4152b5496dedc1e05 Mon Sep 17 00:00:00 2001 From: knj Date: Tue, 24 Jan 2023 15:34:07 +0100 Subject: [PATCH 8/8] add comment --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 76b61cdbff..6766aa136d 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -157,7 +157,7 @@ #define FIX_268 /* Issue 268: Add low cost dry-run of memory analysis */ #define LOW_RATE_TRANS_FIX /* Eri: Fix for critical item during transitions */ #define FIX_197_CREND_INTERFACE -#define SET_TNS_FLAG_IN_EVERY_FRAME +#define SET_TNS_FLAG_IN_EVERY_FRAME /* FhG: issue 288 - mismatch between encoder and decoder wrt TNS usage in unified stereo with frameloss */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ -- GitLab