From 3e5cad68ea72fd343e7bfc382d5d2d8dc5803bfa Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 18 Aug 2025 22:01:51 +0200 Subject: [PATCH 1/3] port CR --- lib_com/options.h | 1 + lib_enc/swb_pre_proc_fx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 49f6e68e9..813802b1a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -117,6 +117,7 @@ #define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */ #define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ #define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */ +#define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1894_OSBA_SCALING /* FhG: do not scale OSBA inputs by 0.5 any more */ #define NONBE_FIX_1141_OSBA_ROOM_RENDERING /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */ #define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index 85277e298..ca7233c95 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -583,7 +583,11 @@ void swb_pre_proc_fx( IF( NE_16( st_fx->last_extl, SWB_BWE ) && NE_16( st_fx->last_extl, FB_BWE ) ) { /* resample 48 kHz to 32kHz */ +#ifdef NONBE_1244_FIX_SWB_BWE_MEMORY + IF( ( st_fx->last_bwidth == FB && st_fx->element_mode == EVS_MONO ) || ( EQ_16( st_fx->bwidth, FB ) && st_fx->element_mode > EVS_MONO ) ) // note: once EVS i CR fixed, the condition will simplify to "if ( st->bwidth == FB )" only +#else IF( EQ_16( st_fx->last_bwidth, FB ) ) +#endif { inner_frame = L_FRAME48k; inner_Fs = 48000; @@ -986,7 +990,11 @@ void swb_pre_proc_ivas_fx( IF( NE_16( st->last_extl, SWB_BWE ) && NE_16( st->last_extl, FB_BWE ) ) { /* resample 48 kHz to 32kHz */ +#ifdef NONBE_1244_FIX_SWB_BWE_MEMORY + IF( ( st->last_bwidth == FB && st->element_mode == EVS_MONO ) || ( EQ_16( st->bwidth, FB ) && st->element_mode > EVS_MONO ) ) // note: once EVS i CR fixed, the condition will simplify to "if ( st->bwidth == FB )" only +#else IF( EQ_16( st->last_bwidth, FB ) ) +#endif { inner_frame = L_FRAME48k; move16(); -- GitLab From 719df5dfd21ae7a821233ac70a9085cfc798fb7f Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 18 Aug 2025 22:06:34 +0200 Subject: [PATCH 2/3] revert CR (wrong #) --- lib_com/options.h | 1 - lib_enc/swb_pre_proc_fx.c | 8 -------- 2 files changed, 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 86d53609d..40c604253 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -118,7 +118,6 @@ #define NONBE_FIX_1097_SBA_DTX_BRATE_SWITCHING_ENC /* FhG: fix out-of-bound errors when switching from SID frame to active frame*/ #define NONBE_FIX_1052_SBA_EXT_FIX /* VA: SBA external output support fix - do not overwrite "output_config" parameter */ #define NONBE_FIX_1110_STEREO_DTX_BRATE_SWITCHING /* VA: issue 1110: fix encoder crash in the stereo DTX bitrate switching condition */ -#define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define FIX_1099_JBM_MD_HANDLE_ALLOC /* VA: issue 1099: Limit the allocation of `hJbmMetadata` handle to MASA and OMASA only */ #define FIX_1121_MASA_DESCRIPTOR /* VA: issue 1121: Define 'ivasmasaFormatDescriptor' at one common place */ #define NONBE_1894_OSBA_SCALING /* FhG: do not scale OSBA inputs by 0.5 any more */ diff --git a/lib_enc/swb_pre_proc_fx.c b/lib_enc/swb_pre_proc_fx.c index ca7233c95..85277e298 100644 --- a/lib_enc/swb_pre_proc_fx.c +++ b/lib_enc/swb_pre_proc_fx.c @@ -583,11 +583,7 @@ void swb_pre_proc_fx( IF( NE_16( st_fx->last_extl, SWB_BWE ) && NE_16( st_fx->last_extl, FB_BWE ) ) { /* resample 48 kHz to 32kHz */ -#ifdef NONBE_1244_FIX_SWB_BWE_MEMORY - IF( ( st_fx->last_bwidth == FB && st_fx->element_mode == EVS_MONO ) || ( EQ_16( st_fx->bwidth, FB ) && st_fx->element_mode > EVS_MONO ) ) // note: once EVS i CR fixed, the condition will simplify to "if ( st->bwidth == FB )" only -#else IF( EQ_16( st_fx->last_bwidth, FB ) ) -#endif { inner_frame = L_FRAME48k; inner_Fs = 48000; @@ -990,11 +986,7 @@ void swb_pre_proc_ivas_fx( IF( NE_16( st->last_extl, SWB_BWE ) && NE_16( st->last_extl, FB_BWE ) ) { /* resample 48 kHz to 32kHz */ -#ifdef NONBE_1244_FIX_SWB_BWE_MEMORY - IF( ( st->last_bwidth == FB && st->element_mode == EVS_MONO ) || ( EQ_16( st->bwidth, FB ) && st->element_mode > EVS_MONO ) ) // note: once EVS i CR fixed, the condition will simplify to "if ( st->bwidth == FB )" only -#else IF( EQ_16( st->last_bwidth, FB ) ) -#endif { inner_frame = L_FRAME48k; move16(); -- GitLab From 0242127a760946cc12955a3eadad666401c6d57a Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 20 Aug 2025 12:14:49 +0200 Subject: [PATCH 3/3] port MR --- lib_com/options.h | 1 + lib_dec/core_switching_dec_fx.c | 8 ++++++++ lib_enc/core_switching_enc_fx.c | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index d222b7a6b..3278a5926 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -136,6 +136,7 @@ #define NONBE_1240_FIX_CORE_SELECTION_ISM_SW /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */ #define FIX_1101_CLEANING_JBM_CALL /* VA: issue 1101: remove obsolete call of ivas_jbm_dec_tc_buffer_open() */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ +#define NONBE_1214_PLC_LSF_MEMORY /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/core_switching_dec_fx.c b/lib_dec/core_switching_dec_fx.c index 7fd3001c0..328d7667c 100644 --- a/lib_dec/core_switching_dec_fx.c +++ b/lib_dec/core_switching_dec_fx.c @@ -2480,8 +2480,16 @@ ivas_error core_switching_pre_dec_ivas_fx( test(); test(); test(); +#ifdef NONBE_1214_PLC_LSF_MEMORY + test(); + test(); + IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) || + ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) && NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) || + ( st->core == ACELP_CORE && GT_16( st->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) +#else IF( ( ( ( st->core == ACELP_CORE ) || EQ_16( st->core, AMR_WB_CORE ) ) && EQ_16( st->last_core, HQ_CORE ) ) || ( ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) || ( EQ_16( st->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( nchan_out, 2 ) && NE_32( st->core_brate, SID_2k40 ) && ( st->core_brate != FRAME_NO_DATA ) && ( ( last_core_brate_st0 == FRAME_NO_DATA ) || EQ_32( last_core_brate_st0, SID_2k40 ) ) ) ) +#endif { test(); if ( EQ_16( st->element_mode, IVAS_CPE_DFT ) || EQ_16( st->element_mode, IVAS_CPE_TD ) ) diff --git a/lib_enc/core_switching_enc_fx.c b/lib_enc/core_switching_enc_fx.c index 46e980f5a..fcfe151f6 100644 --- a/lib_enc/core_switching_enc_fx.c +++ b/lib_enc/core_switching_enc_fx.c @@ -178,8 +178,21 @@ void core_switching_pre_enc_fx( test(); test(); + test(); + test(); + test(); + test(); + test(); +#ifdef NONBE_1214_PLC_LSF_MEMORY + test(); + test(); + IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ || + ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) || + ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) +#else IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) || ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ) +#endif { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { @@ -793,8 +806,16 @@ void core_switching_pre_enc_ivas_fx( test(); test(); test(); +#ifdef NONBE_1214_PLC_LSF_MEMORY + test(); + test(); + IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) /* EVS and HQ -> ACELP */ || + ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) || + ( st_fx->core == ACELP_CORE && GT_16( st_fx->last_L_frame, L_FRAME16k ) ) /* TCX @ 25.6/32 kHz -> ACELP */ ) +#else IF( ( ( ( st_fx->core == ACELP_CORE ) || EQ_16( st_fx->core, AMR_WB_CORE ) ) && EQ_16( st_fx->last_core, HQ_CORE ) ) || ( ( EQ_16( st_fx->element_mode, IVAS_CPE_DFT ) || EQ_16( st_fx->element_mode, IVAS_CPE_TD ) || ( EQ_16( st_fx->element_mode, IVAS_CPE_MDCT ) && EQ_16( last_element_mode, IVAS_CPE_DFT ) ) ) && EQ_16( active_cnt, 1 ) ) ) +#endif { IF( EQ_16( st_fx->L_frame, L_FRAME16k ) ) { -- GitLab