From 608ea616aa4b1a1c29f19742695b43f91ab2fc55 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 26 Aug 2025 13:12:45 +0300 Subject: [PATCH] Port float MR 1748 to float reference. --- lib_com/options.h | 1 + lib_dec/ivas_masa_dec.c | 16 ++++++++++++++++ lib_dec/ivas_mct_dec.c | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 8556b7947..49d78657e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -221,6 +221,7 @@ #define FIX_1369_HQ_LR_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_enc(), brings floating-point code inline with FX */ #define NONBE_1118_EVS_LR_HQ_BITERROR /* VA: issue 1118: fix EVS decoder crash in LR-HQ in case of bit errors */ #define FIX_1139_REV_COLORATION_SHORT_T60 /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */ +#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0 */ diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 408318a34..d5a2ba51d 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1372,7 +1372,12 @@ ivas_error ivas_masa_dec_reconfigure( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */ + if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL ) +#else if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity ) +#endif { mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; @@ -1393,6 +1398,16 @@ ivas_error ivas_masa_dec_reconfigure( return error; } } +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX || st_ivas->renderer_type == RENDERER_OMASA_MIX_EXT ) + { + /* close all unnecessary parametric decoding and rendering */ + ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); + ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); + } +#else else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) { if ( st_ivas->hDirAC != NULL ) @@ -1404,6 +1419,7 @@ ivas_error ivas_masa_dec_reconfigure( ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); } } +#endif /* possible reconfigure is done later */ /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 586bd6490..a09b6bd15 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -857,13 +857,17 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN if ( st_ivas->hDirAC != NULL ) { +#endif ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN } +#endif /* init LS conversion if the renderer type asks for it */ if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) @@ -943,14 +947,18 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN if ( st_ivas->hDirAC != NULL ) { +#endif ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); vbap_free_data( &( st_ivas->hVBAPdata ) ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN } +#endif if ( last_mc_mode == MC_MODE_MCT ) { @@ -1204,7 +1212,11 @@ static ivas_error ivas_mc_dec_reconfig( } } } +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + else if ( st_ivas->renderer_type == RENDERER_DISABLE ) +#else else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL ) +#endif { ivas_dirac_rend_close( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) ); -- GitLab