From 9dbbfd3ce027b5145e1badc31f295432b4dd8699 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 13 Nov 2025 10:23:37 +0100 Subject: [PATCH 1/4] port fix from MR 2395 from float --- lib_com/options.h | 1 + lib_dec/core_switching_dec.c | 2 +- lib_dec/ivas_mdct_core_dec.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9134728a8..e3cff2681 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -198,6 +198,7 @@ #define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES /* Nokia: Fix for issues 1399: obj edit broken with MC/SBA output in VOIP, and 1400: negative energy estimate used for gaining. */ #define FIX_2192_OBJ_EDITING_EXT_METADATA /* Eri: Add support for extended metadata in object editing */ #define FIX_1318_ROOM_SIZE_CMD_LINE /* Philips/Nokia: Default room sizes support */ +#define FIX_BASOP_ISSUE_1585_CUT_BS_CRASH /* FhG: Fix for BASOP issue 1585 crash of a cut bitstream, also valid for float code*/ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index 6445970f2..f9ba20e70 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -663,7 +663,7 @@ ivas_error core_switching_post_dec( } else if ( ( ( st->last_core == ACELP_CORE || st->last_core_bfi == ACELP_CORE ) && !( st->prev_bfi == 1 && st->last_con_tcx == 1 ) ) || st->last_core == AMR_WB_CORE ) /*ACELP->TCX/HQ*/ { - /* if this is first active MDCT-Stereo frame after a CNG frame and output format is mono DMX, this should only be done for the zero-th channel, the other one will simply be copied over after this function */ + /* if output format is mono DMX, this should only be done for the zero-th channel, the other one will simply be copied over after this function */ if ( ( ( st->last_core_brate != SID_2k40 && st->last_core_brate != FRAME_NO_DATA ) || ( st->element_mode != IVAS_CPE_DFT && st->element_mode != IVAS_CPE_TD ) || nchan_out == 1 ) && !( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 && ( nchan_out == 1 || last_element_mode == IVAS_CPE_DFT ) ) ) { core_switch_lb_upsamp( st, output ); diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index ce9cf08e9..747e9d0f2 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -160,6 +160,10 @@ static void dec_prm_tcx_sidebits( st->last_core_from_bs = st->last_core; } +#ifdef FIX_BASOP_ISSUE_1585_CUT_BS_CRASH + /* for first frame reset last_core to initialization value for better error-robustness*/ + st->last_core = -1; +#endif getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); st->hTcxDec->kernel_type[0] = st->hTcxDec->kernel_type[1] = MDCT_IV; -- GitLab From 8179d2b1c52c57af2488391d1ba2c77415330306 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 13 Nov 2025 10:56:56 +0100 Subject: [PATCH 2/4] add if condition --- lib_dec/ivas_mdct_core_dec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 747e9d0f2..1feba1291 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -162,7 +162,10 @@ static void dec_prm_tcx_sidebits( #ifdef FIX_BASOP_ISSUE_1585_CUT_BS_CRASH /* for first frame reset last_core to initialization value for better error-robustness*/ - st->last_core = -1; + if ( st->ini_frame == 0 ) + { + st->last_core = -1; + } #endif getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); -- GitLab From 83dffca8c3e8e8a3f84f84064e413fb3b563dfac Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 13 Nov 2025 18:06:42 +0100 Subject: [PATCH 3/4] port fixes from float ivas-codec main --- lib_dec/ivas_mdct_core_dec.c | 2 +- lib_dec/ivas_stereo_switching_dec.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 1feba1291..5f96a8be5 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -164,7 +164,7 @@ static void dec_prm_tcx_sidebits( /* for first frame reset last_core to initialization value for better error-robustness*/ if ( st->ini_frame == 0 ) { - st->last_core = -1; + st->last_core = TCX_20_CORE; } #endif getTCXWindowing( st->core, st->last_core, st->element_mode, st->hTcxCfg, st0 ); diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index a0565824a..2de783d0f 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1581,6 +1581,9 @@ void stereo_switching_dec( sts[1]->pit_res_max_past = sts[0]->pit_res_max_past; sts[1]->hTcxDec->L_frameTCX = sts[0]->hTcxDec->L_frameTCX; sts[1]->hTcxDec->conceal_eof_gain = sts[0]->hTcxDec->conceal_eof_gain; +#ifdef FIX_BASOP_ISSUE_1585_CUT_BS_CRASH + sts[1]->ini_frame = sts[0]->ini_frame; +#endif } return; -- GitLab From 59d28cd9d5997d73eabea7a700ac3bebad0f2cc4 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Thu, 13 Nov 2025 22:41:31 +0100 Subject: [PATCH 4/4] remove stereo switching fix to retain BE --- lib_dec/ivas_stereo_switching_dec.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 2de783d0f..a0565824a 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -1581,9 +1581,6 @@ void stereo_switching_dec( sts[1]->pit_res_max_past = sts[0]->pit_res_max_past; sts[1]->hTcxDec->L_frameTCX = sts[0]->hTcxDec->L_frameTCX; sts[1]->hTcxDec->conceal_eof_gain = sts[0]->hTcxDec->conceal_eof_gain; -#ifdef FIX_BASOP_ISSUE_1585_CUT_BS_CRASH - sts[1]->ini_frame = sts[0]->ini_frame; -#endif } return; -- GitLab