From d093d407c42e5474e55af7e30cade416caf6a75c Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 2 Jun 2025 11:32:34 +0200 Subject: [PATCH 1/2] port NONBE_FIX_1075 --- lib_com/options.h | 1 + lib_dec/ivas_init_dec_fx.c | 18 ++++++++++++++++++ lib_dec/ivas_mct_dec_fx.c | 9 +++++++++ lib_dec/ivas_omasa_dec_fx.c | 9 +++++++++ lib_dec/ivas_sba_dec_fx.c | 9 +++++++++ 5 files changed, 46 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 73a8f082f..1befefad8 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -135,6 +135,7 @@ #define FIX_1003_PARAMISM_BINAURAL_RECONFIG_USAN /* FhG: fix for #1003: fix USAN caused by ParamISM reconfig */ #define FIX_1001_ARI_HM_OVERFLOW /* FhG: (no changes needed in BASOP) fix for undef behaviour in in the harmonic TCX model arithmetic coder */ #define NONBE_FIX_1005_MC_RS_TCBUFFER_UPDATE /* FhG: issue #1005: fix TC Buffer update at a MC rate switch */ +#define NONBE_FIX_1075 /* FhG: fix segfault for bitrate switching + BINAURAL_ROOM_REVERB output in MC */ /* #################### End BASOP porting switches ############################ */ diff --git a/lib_dec/ivas_init_dec_fx.c b/lib_dec/ivas_init_dec_fx.c index fea9c5b97..6c0251214 100644 --- a/lib_dec/ivas_init_dec_fx.c +++ b/lib_dec/ivas_init_dec_fx.c @@ -2389,6 +2389,15 @@ ivas_error ivas_init_decoder_fx( SrcSpatial_p->q_Pos_p = Q31; move16(); } +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) @@ -2473,6 +2482,15 @@ ivas_error ivas_init_decoder_fx( SrcSpatial_p->q_Pos_p = Q31; move16(); } +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif } } diff --git a/lib_dec/ivas_mct_dec_fx.c b/lib_dec/ivas_mct_dec_fx.c index 6b2cdff41..ffe5fb0fc 100644 --- a/lib_dec/ivas_mct_dec_fx.c +++ b/lib_dec/ivas_mct_dec_fx.c @@ -1553,6 +1553,15 @@ static ivas_error ivas_mc_dec_reconfig_fx( { return error; } +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif IF( EQ_16( st_ivas->hIntSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { #ifdef SPLIT_REND_WITH_HEAD_ROT diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 9d8b43515..a1224edb4 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -367,6 +367,15 @@ ivas_error ivas_omasa_dec_config_fx( { return error; } +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif } /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ diff --git a/lib_dec/ivas_sba_dec_fx.c b/lib_dec/ivas_sba_dec_fx.c index 121b8a795..59edcd39c 100644 --- a/lib_dec/ivas_sba_dec_fx.c +++ b/lib_dec/ivas_sba_dec_fx.c @@ -578,6 +578,15 @@ ivas_error ivas_sba_dec_reconfigure_fx( { return error; } +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) + { + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) + { + return error; + } + } +#endif } } -- GitLab From 136dd5de6ac96820ddc07a6b617a5e312027d33c Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 1 Aug 2025 15:43:57 +0200 Subject: [PATCH 2/2] apply formatting patch --- lib_dec/ivas_omasa_dec_fx.c | 228 ++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 115 deletions(-) diff --git a/lib_dec/ivas_omasa_dec_fx.c b/lib_dec/ivas_omasa_dec_fx.c index 59827575b..08da97c57 100644 --- a/lib_dec/ivas_omasa_dec_fx.c +++ b/lib_dec/ivas_omasa_dec_fx.c @@ -692,144 +692,142 @@ ivas_error ivas_omasa_dec_config_fx( IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) { /* Allocate TD renderer for the objects in DISC mode */ - IF( st_ivas->hBinRendererTd == NULL ) - { - IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, num_src ) ), IVAS_ERR_OK ) ) - { + IF( st_ivas->hBinRendererTd == NULL ){ + IF( NE_32( ( error = ivas_td_binaural_open_fx( st_ivas, SrcInd, num_src ) ), IVAS_ERR_OK ) ){ return error; - } -#ifdef NONBE_FIX_1075 - IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - { - IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) - { - return error; - } - } -#endif - } - - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) - { - return error; - } } - ELSE - { - /* TD renderer handle */ - test(); - IF( st_ivas->hBinRendererTd != NULL && EQ_16( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, TRUE ) ) - { - ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - - st_ivas->hHrtfTD = NULL; - } - - /* ISM renderer handle + ISM data handle */ - ivas_omasa_separate_object_renderer_close( st_ivas ); - } - } - - IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) - { - IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) ) - { - return error; - } - - test(); - test(); - IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) +#ifdef NONBE_FIX_1075 + IF( EQ_32( st_ivas->hOutSetup.output_config, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = ivas_reverb_open_fx( &st_ivas->hReverb, st_ivas->hHrtfStatistics, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ) ), IVAS_ERR_OK ) ) { return error; } } - ELSE - { - /* ISM renderer handle + ISM data handle */ - ivas_omasa_separate_object_renderer_close( st_ivas ); - } +#endif } -#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT - IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ) + + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) { - /* Allocate 'hIsmRendererData' handle */ - error = ivas_omasa_combine_separate_ism_with_masa_open_fx( st_ivas ); - move32(); - IF( NE_32( error, IVAS_ERR_OK ) ) - { - return error; - } + return error; } - - IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) + } + ELSE + { + /* TD renderer handle */ + test(); + IF( st_ivas->hBinRendererTd != NULL && EQ_16( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM, TRUE ) ) { - DIRAC_CONFIG_FLAG common_rend_config_flag; - IF( st_ivas->hSpatParamRendCom == NULL ) - { - common_rend_config_flag = DIRAC_OPEN; - } - ELSE - { - common_rend_config_flag = DIRAC_RECONFIGURE; - } - move32(); - - /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ - error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas ); - move32(); - IF( NE_32( error, IVAS_ERR_OK ) ) - { - return error; - } + ivas_td_binaural_close_fx( &st_ivas->hBinRendererTd ); - error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, - common_rend_config_flag, 0, - st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs, 0, 0 ); - move32(); - IF( NE_32( error, IVAS_ERR_OK ) ) - { - return error; - } + st_ivas->hHrtfTD = NULL; } -#endif - /*-----------------------------------------------------------------* - * TD Decorrelator - *-----------------------------------------------------------------*/ - IF( st_ivas->hDiracDecBin[0] != NULL ) - { - IF( NE_32( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ), IVAS_ERR_OK ) ) - { - return error; - } - } + /* ISM renderer handle + ISM data handle */ + ivas_omasa_separate_object_renderer_close( st_ivas ); + } +} - /*-----------------------------------------------------------------* - * CLDFB instances - *-----------------------------------------------------------------*/ +IF( EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) ) +{ + IF( NE_32( ( error = ivas_dirac_dec_config_fx( st_ivas, DIRAC_RECONFIGURE ) ), IVAS_ERR_OK ) ) + { + return error; + } - IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) ) + test(); + test(); + IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_MASA_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) || EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) ) + { + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + IF( NE_32( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ), IVAS_ERR_OK ) ) { return error; } + } + ELSE + { + /* ISM renderer handle + ISM data handle */ + ivas_omasa_separate_object_renderer_close( st_ivas ); + } +} +#ifdef NONBE_FIX_984_OMASA_EXT_OUTPUT +IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_MIX_EXT ) ) +{ + /* Allocate 'hIsmRendererData' handle */ + error = ivas_omasa_combine_separate_ism_with_masa_open_fx( st_ivas ); + move32(); + IF( NE_32( error, IVAS_ERR_OK ) ) + { + return error; + } +} - /*-----------------------------------------------------------------* - * floating-point output audio buffers - *-----------------------------------------------------------------*/ +IF( EQ_32( st_ivas->renderer_type, RENDERER_OMASA_OBJECT_EXT ) ) +{ + DIRAC_CONFIG_FLAG common_rend_config_flag; + IF( st_ivas->hSpatParamRendCom == NULL ) + { + common_rend_config_flag = DIRAC_OPEN; + } + ELSE + { + common_rend_config_flag = DIRAC_RECONFIGURE; + } + move32(); - nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) - { - return error; - } + /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */ + error = ivas_omasa_render_objects_from_mix_open_fx( st_ivas ); + move32(); + IF( NE_32( error, IVAS_ERR_OK ) ) + { + return error; } - return IVAS_ERR_OK; + error = ivas_spat_hSpatParamRendCom_config_fx( &st_ivas->hSpatParamRendCom, + common_rend_config_flag, 0, + st_ivas->ivas_format, st_ivas->mc_mode, st_ivas->hDecoderConfig->output_Fs, 0, 0 ); + move32(); + IF( NE_32( error, IVAS_ERR_OK ) ) + { + return error; + } +} +#endif +/*-----------------------------------------------------------------* + * TD Decorrelator + *-----------------------------------------------------------------*/ + +IF( st_ivas->hDiracDecBin[0] != NULL ) +{ + IF( NE_32( ( error = ivas_td_decorr_reconfig_dec( st_ivas->ivas_format, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hDecoderConfig->output_Fs, &( st_ivas->hDiracDecBin[0]->hTdDecorr ), &( st_ivas->hDiracDecBin[0]->useTdDecorr ) ) ), IVAS_ERR_OK ) ) + { + return error; + } +} + +/*-----------------------------------------------------------------* + * CLDFB instances + *-----------------------------------------------------------------*/ + +IF( NE_32( ( error = ivas_cldfb_dec_reconfig_fx( st_ivas, 2, numCldfbAnalyses_old, numCldfbSyntheses_old ) ), IVAS_ERR_OK ) ) +{ + return error; +} + +/*-----------------------------------------------------------------* + * floating-point output audio buffers + *-----------------------------------------------------------------*/ + +nchan_out_buff = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); +IF( NE_32( ( error = ivas_output_buff_dec_fx( st_ivas->p_output_fx, nchan_out_buff_old, nchan_out_buff ) ), IVAS_ERR_OK ) ) +{ + return error; +} +} + +return IVAS_ERR_OK; } -- GitLab