From e61d9db8fbbaaad4db03b2dbc290e27ef09526fe Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 9 Aug 2024 13:57:31 +0200 Subject: [PATCH 1/2] issue 1159: Execute split rendering config only for split rendering outputs; under FIX_1159_SPLIT_RENDERING_CONFIG --- lib_com/options.h | 1 + lib_dec/lib_dec.c | 11 +++++++++-- lib_rend/lib_rend.c | 31 ++++++++++++++++++++----------- lib_rend/lib_rend.h | 4 ++-- 4 files changed, 32 insertions(+), 15 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9401a6f974..c313a39f88 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define FIX_1152_UNINIT_VAL_IN_ITD_VAD_COMPUTATION /* FhG: fix uninitialized value being used in ITD VAD mid signal computation that does not affect synthesis, but crashes BASOPs */ #define FIX_1157_OBSOLETE_DMX_TABLE /* FhG: remove obsolte ParamMC DMX table ivas_param_mc_dmx_fac_CICP19_4tc[] */ #define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */ +#define FIX_1159_SPLIT_RENDERING_CONFIG /* VA: issue 1159: Execute split rendering config only for split rendering outputs. */ /* #################### End BE switches ################################## */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index da4bc04392..c95d24f0ea 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -2230,10 +2230,17 @@ ivas_error IVAS_DEC_FeedRenderConfig( hRenderConfig->split_rend_config.poseCorrectionMode = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; } - if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG + if ( is_split_rendering_enabled( hIvasDec->st_ivas->hDecoderConfig, hRenderConfig ) ) { - return error; +#endif + if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasDec->st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG } +#endif return IVAS_ERR_OK; } diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 15e4c20ab3..8702c8738b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -609,7 +609,9 @@ static ivas_error validateOutputSampleRate( /* Otherwise rendering to binaural, support the same set as IVAS decoder */ switch ( sampleRate ) { +#ifndef FIX_1159_SPLIT_RENDERING_CONFIG case 8000: +#endif case 16000: case 32000: case 48000: @@ -2930,7 +2932,7 @@ ivas_error IVAS_REND_Open( { if ( ( hIvasRend->splitRendWrapper = (SPLIT_REND_WRAPPER *) malloc( sizeof( SPLIT_REND_WRAPPER ) ) ) == NULL ) { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS decoder handle" ); + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for IVAS renderer handle" ); } isar_init_split_rend_handles( hIvasRend->splitRendWrapper ); @@ -4253,7 +4255,7 @@ ivas_error IVAS_REND_InitConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ) { @@ -4316,7 +4318,7 @@ ivas_error IVAS_REND_GetRenderConfig( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ) { @@ -4466,10 +4468,17 @@ ivas_error IVAS_REND_FeedRenderConfig( hRenderConfig->split_rend_config.codec = renderConfig.split_rend_config.codec; - if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) { - return error; +#endif + if ( ( error = isar_split_rend_validate_config( &hRenderConfig->split_rend_config, ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ? 1 : 0 ) ) != IVAS_ERR_OK ) + { + return error; + } +#ifdef FIX_1159_SPLIT_RENDERING_CONFIG } +#endif /* Must re-initialize split rendering config in case renderer config is updated after adding renderer inputs */ /* if its not initialized yet then no need to re-initialize, initialization will happen while adding inputs*/ @@ -7628,7 +7637,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, @@ -7975,7 +7984,7 @@ int32_t IVAS_REND_GetCntFramesLimited( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */ ) { @@ -7997,7 +8006,7 @@ ivas_error IVAS_REND_GetHrtfHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfCRendHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */ ) { @@ -8019,7 +8028,7 @@ ivas_error IVAS_REND_GetHrtfCRendHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfFastConvHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */ ) { @@ -8041,7 +8050,7 @@ ivas_error IVAS_REND_GetHrtfFastConvHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfParamBinHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */ ) { @@ -8062,7 +8071,7 @@ ivas_error IVAS_REND_GetHrtfParamBinHandle( *---------------------------------------------------------------------*/ ivas_error IVAS_REND_GetHrtfStatisticsHandle( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ IVAS_DEC_HRTF_STATISTICS_HANDLE **hHrtfStatistics /* o : HRTF statistics handle */ ) { diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 819d85b189..299e4ede26 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -243,12 +243,12 @@ ivas_error IVAS_REND_InitConfig( ); ivas_error IVAS_REND_GetRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_HANDLE hRCout /* o : Render configuration handle */ ); ivas_error IVAS_REND_FeedRenderConfig( - IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS renderer handle */ const IVAS_RENDER_CONFIG_DATA renderConfig /* i : Render configuration struct */ ); -- GitLab From 643885c231c02bd232da850ca980a7c84778beb5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 9 Aug 2024 14:20:33 +0200 Subject: [PATCH 2/2] clang-format --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8702c8738b..5d47e23e3b 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7637,7 +7637,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab