From 052d5b7f219fd1b971efb6aab718ce64dbf82621 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Tue, 26 Aug 2025 13:13:26 +0300 Subject: [PATCH 1/2] Port float MR 1748 to BASOP. --- lib_com/options.h | 1 + lib_dec/ivas_masa_dec_fx.c | 20 ++++++++++++++++++++ lib_dec/ivas_mct_dec_fx.c | 14 ++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 933e8f6b4..9b883fdbf 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,7 @@ #define FIX_1959_assert_in_gain_enc_mless_fx /* VA: Fix saturation introduced by the usage of the non-EVS basop operators =, the saturation was expected */ #define NONBE_1328_FIX_NON_LINEARITY /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0, float issue 1328 */ +#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 */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index 0f22a8b29..c83b3a2cc 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -1753,7 +1753,13 @@ ivas_error ivas_masa_dec_reconfigure_fx( move32(); test(); +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + test(); + /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */ + IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) ) +#else IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) ) +#endif { Copy( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes; @@ -1773,6 +1779,9 @@ ivas_error ivas_masa_dec_reconfigure_fx( test(); test(); test(); +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + test(); +#endif IF( ( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) && st_ivas->hDirACRend == NULL ) || ( ( EQ_32( st_ivas->renderer_type, RENDERER_STEREO_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC ) || EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) && st_ivas->hDiracDecBin[0] == NULL ) ) { @@ -1782,6 +1791,16 @@ ivas_error ivas_masa_dec_reconfigure_fx( return error; } } +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) || EQ_32( 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_fx( &( st_ivas->hDirACRend ) ); + ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); + ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); + } +#else ELSE IF( EQ_32( st_ivas->renderer_type, RENDERER_DISABLE ) || EQ_32( st_ivas->renderer_type, RENDERER_MONO_DOWNMIX ) ) { IF( st_ivas->hDirAC != NULL ) @@ -1793,6 +1812,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); } } +#endif /* possible reconfigure is done later */ /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index af49f142a..68b7e7f55 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -1048,13 +1048,17 @@ static ivas_error ivas_mc_dec_reconfig_fx( ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); ivas_qmetadata_close_fx( &st_ivas->hQMetaData ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN IF( st_ivas->hDirAC != NULL ) { +#endif ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN } +#endif /* init LS conversion if the renderer type asks for it */ test(); @@ -1134,13 +1138,17 @@ static ivas_error ivas_mc_dec_reconfig_fx( ivas_masa_dec_close_fx( &( st_ivas->hMasa ) ); ivas_qmetadata_close_fx( &st_ivas->hQMetaData ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN IF( st_ivas->hDirAC != NULL ) { +#endif ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); ivas_dirac_dec_close_fx( &( st_ivas->hDirAC ) ); vbap_free_data_fx( &( st_ivas->hVBAPdata ) ); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN } +#endif IF( EQ_16( last_mc_mode, MC_MODE_MCT ) ) { @@ -1400,7 +1408,9 @@ static ivas_error ivas_mc_dec_reconfig_fx( IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { test(); +#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN test(); +#endif IF( ( NE_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) && ( NE_16( st_ivas->renderer_type, RENDERER_MCMASA_MONO_STEREO ) ) ) { IF( st_ivas->hDirAC != NULL ) @@ -1420,7 +1430,11 @@ static ivas_error ivas_mc_dec_reconfig_fx( } } } +#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN + ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) ) +#else ELSE IF( EQ_16( st_ivas->renderer_type, RENDERER_DISABLE ) && st_ivas->hDirAC != NULL ) +#endif { ivas_dirac_rend_close_fx( &( st_ivas->hDirACRend ) ); ivas_spat_hSpatParamRendCom_close_fx( &( st_ivas->hSpatParamRendCom ) ); -- GitLab From b3cffb9a687259eba87840cf158aa7d75c77b624 Mon Sep 17 00:00:00 2001 From: Tapani Pihlajakuja Date: Fri, 5 Sep 2025 13:13:59 +0300 Subject: [PATCH 2/2] Fix unfortunate parenthesis placement bug. --- lib_dec/ivas_masa_dec_fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_masa_dec_fx.c b/lib_dec/ivas_masa_dec_fx.c index aaad417a2..2011dae83 100644 --- a/lib_dec/ivas_masa_dec_fx.c +++ b/lib_dec/ivas_masa_dec_fx.c @@ -1696,7 +1696,7 @@ ivas_error ivas_masa_dec_reconfigure_fx( #ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN test(); /* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */ - IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) ) + IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) && NE_32( st_ivas->hDecoderConfig->output_config, IVAS_AUDIO_CONFIG_EXTERNAL ) ) #else IF( st_ivas->hSpatParamRendCom != NULL && EQ_16( st_ivas->hSpatParamRendCom->slot_size, st_ivas->hTcBuffer->n_samples_granularity ) ) #endif -- GitLab