From d69b86f69a1825377c6565c208788c71619c822a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 22 Aug 2023 17:55:10 +0200 Subject: [PATCH 1/8] [fix] allocate only the necessary renderer when headrotation is switched in external renderer --- lib_com/options.h | 1 + lib_rend/lib_rend.c | 142 +++++++++++++++++++++++++++++++++----------- 2 files changed, 107 insertions(+), 36 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index be3261f808..7044a36aad 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -167,6 +167,7 @@ #define FIX_718_JBM_MD_UDPATE /* Fhg: fix issue #718, wrong setting of the update flag in the TD obj renderer in the JBM path */ #define FIX_719_CRASH_IN_CLEANUP /* VA: issue 719: fix Decoder crash after call to goto to cleanup */ +#define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ /* ################## End BE DEVELOPMENT switches ######################### */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 96f2d4952a..cdeb7c069a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2182,9 +2182,32 @@ static ivas_error initMcBinauralRendering( #endif int32_t binauralDelayNs; int32_t outSampleRate; +#ifdef FIX_513_REND_MC_ALLOC + int8_t useTDRend; - /* check if re-initialization */ - if ( inputMc->tdRendWrapper.hBinRendererTd != NULL ) + /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) + or planar MC layouts with headrotation, CREND for the rest */ + useTDRend = FALSE; + if ( outConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + if ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) + { + useTDRend = TRUE; + } + else if ( ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) && + ( inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) + { + useTDRend = TRUE; + } + } +#endif + + /* if TD renderer was open and we need to use CREND, close it */ + if ( +#ifdef FIX_513_REND_MC_ALLOC + !useTDRend && +#endif + inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; @@ -2201,45 +2224,47 @@ static ivas_error initMcBinauralRendering( } #endif - ivas_rend_closeCrend( &inputMc->crendWrapper +#ifdef FIX_513_REND_MC_ALLOC + /* if we need to use TD renderer and CREND was open, close it */ + if ( useTDRend ) + { +#endif + ivas_rend_closeCrend( &inputMc->crendWrapper #ifdef SPLIT_REND_WITH_HEAD_ROT - , - inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses + , + inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses +#endif + ); +#ifdef FIX_513_REND_MC_ALLOC + } #endif - ); - ivas_reverb_close( &inputMc->hReverb ); +#ifdef FIX_513_REND_MC_ALLOC + if ( !useTDRend && outConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) + { +#endif + ivas_reverb_close( &inputMc->hReverb ); +#ifdef FIX_513_REND_MC_ALLOC + } +#endif - if ( inputMc->efapInWrapper.hEfap != NULL ) +#ifdef FIX_513_REND_MC_ALLOC + if ( inConfig == AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) { - efap_free_data( &inputMc->efapInWrapper.hEfap ); +#endif + if ( inputMc->efapInWrapper.hEfap != NULL ) + { + efap_free_data( &inputMc->efapInWrapper.hEfap ); + } +#ifdef FIX_513_REND_MC_ALLOC } +#endif outSampleRate = *inputMc->base.ctx.pOutSampleRate; - /* Needs optimization, see issue 513 */ - // bool initTDRend; - // initTDRend = false; - // #ifdef FIX_196_REFACTOR_RENDERER_OUTPUT_CONFIG - // if ( ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) && - // ( outConfig != AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( outConfig != AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - // #else - // if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) - // #endif - // { - // if ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) - // { - // initTDRend = true; - // } - // else if ( ( inConfig == AUDIO_CONFIG_5_1 || inConfig == AUDIO_CONFIG_7_1 ) && - // ( inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) - // { - // initTDRend = true; - // } - // } - - // if ( initTDRend ) - /* Allocate TD binaural renderer for planar MC layouts or custom MC layouts with headrotation, CREND for the rest */ +#ifdef FIX_513_REND_MC_ALLOC + if ( useTDRend && inputMc->tdRendWrapper.hBinRendererTd == NULL ) +#endif { if ( ( error = ivas_td_binaural_open_ext( &inputMc->tdRendWrapper, inConfig, hRendCfg, &inputMc->customLsInput, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -2263,7 +2288,11 @@ static ivas_error initMcBinauralRendering( } #endif - if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == AUDIO_CONFIG_BINAURAL_ROOM_REVERB +#ifdef FIX_513_REND_MC_ALLOC + && inputMc->hReverb == NULL +#endif + ) { if ( ( error = ivas_reverb_open( &( inputMc->hReverb ), outConfig, NULL, inputMc->tdRendWrapper.hBinRendererTd->HrFiltSet_p->lr_energy_and_iac, hRendCfg, outSampleRate ) ) != IVAS_ERR_OK ) { @@ -2271,7 +2300,9 @@ static ivas_error initMcBinauralRendering( } } } - +#ifdef FIX_513_REND_MC_ALLOC + else if ( !useTDRend && inputMc->crendWrapper->hCrend == NULL ) /* open CREND */ +#endif { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2285,7 +2316,11 @@ static ivas_error initMcBinauralRendering( } /* Initialise the EFAP handle for rotation on input layout */ - if ( inConfig != AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) + if ( inConfig != AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled +#ifdef FIX_513_REND_MC_ALLOC + && inputMc->efapInWrapper.hEfap == NULL +#endif + ) { if ( ( error = initEfap( &inputMc->efapInWrapper, inConfig, NULL ) ) != IVAS_ERR_OK ) { @@ -2455,6 +2490,9 @@ static ivas_error setRendInputActiveMc( #endif inputMc->lfeRouting = defaultLfeRouting( inConfig, inputMc->customLsInput, outConfig, *inputMc->base.ctx.pCustomLsOut ); set_zero( inputMc->lfeDelayBuffer, MAX_BIN_DELAY_SAMPLES ); +#ifdef FIX_513_REND_MC_ALLOC + inputMc->binauralDelaySmp = 0; +#endif #ifdef SPLIT_REND_WITH_HEAD_ROT for ( i = 0; i < (int16_t) ( sizeof( inputMc->splitTdRendWrappers ) / sizeof( *inputMc->splitTdRendWrappers ) ); ++i ) @@ -5277,7 +5315,7 @@ ivas_error IVAS_REND_SetHeadRotation( #endif ) { -#ifndef API_5MS +#if !defined( API_5MS ) || defined( FIX_513_REND_MC_ALLOC ) int16_t i; #endif IVAS_QUATERNION rotQuat; @@ -5294,6 +5332,20 @@ ivas_error IVAS_REND_SetHeadRotation( return IVAS_ERR_INVALID_OUTPUT_FORMAT; } +#ifdef FIX_513_REND_MC_ALLOC + hIvasRend->headRotData.headRotEnabled = 1; + + /* reconfigure binaural rendering to allocate + the necessary renderers and free unused ones */ + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig ); + } +#endif + #ifdef API_5MS /* check for Euler angle signaling */ if ( headRot.w == -3.0f ) @@ -5379,6 +5431,9 @@ IVAS_REND_DisableHeadRotation( IVAS_REND_HANDLE hIvasRend /* i/o: Renderer handle */ ) { +#ifdef FIX_513_REND_MC_ALLOC + int16_t i; +#endif /* Validate function arguments */ if ( hIvasRend == NULL ) { @@ -5386,6 +5441,21 @@ IVAS_REND_DisableHeadRotation( } hIvasRend->headRotData.headRotEnabled = 0; +#ifdef FIX_513_REND_MC_ALLOC + /* reconfigure binaural rendering to allocate + the necessary renderers and free unused ones */ + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) + { + for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig ); + } + } + +#endif return IVAS_ERR_OK; } #endif -- GitLab From c010b67ce141a91de023fb1b75625703e5c0f1c1 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 23 Aug 2023 10:09:55 +0200 Subject: [PATCH 2/8] [fix] missing checks for valid MC input --- lib_rend/lib_rend.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index cdeb7c069a..13ad937060 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2301,7 +2301,7 @@ static ivas_error initMcBinauralRendering( } } #ifdef FIX_513_REND_MC_ALLOC - else if ( !useTDRend && inputMc->crendWrapper->hCrend == NULL ) /* open CREND */ + else if ( !useTDRend && inputMc->crendWrapper == NULL ) /* open CREND */ #endif { if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == AUDIO_CONFIG_LS_CUSTOM ) ? AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate @@ -5339,10 +5339,13 @@ ivas_error IVAS_REND_SetHeadRotation( the necessary renderers and free unused ones */ for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initMcBinauralRendering( &hIvasRend->inputsMc[i], - hIvasRend->inputsMc[i].base.inConfig, - hIvasRend->outputConfig, - hIvasRend->hRendererConfig ); + if ( hIvasRend->inputsMc[i].base.inConfig != AUDIO_CONFIG_INVALID ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig ); + } } #endif @@ -5448,10 +5451,13 @@ IVAS_REND_DisableHeadRotation( { for ( i = 0; i < RENDERER_MAX_MC_INPUTS; ++i ) { - initMcBinauralRendering( &hIvasRend->inputsMc[i], - hIvasRend->inputsMc[i].base.inConfig, - hIvasRend->outputConfig, - hIvasRend->hRendererConfig ); + if ( hIvasRend->inputsMc[i].base.inConfig != AUDIO_CONFIG_INVALID ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig ); + } } } -- GitLab From 8f2770b1aaef989c1ad0283fb5ad69236e8b9737 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 23 Aug 2023 10:50:39 +0200 Subject: [PATCH 3/8] [fix] init checks for split rendering --- lib_rend/lib_rend.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 13ad937060..900b2e3dd1 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2214,15 +2214,22 @@ static ivas_error initMcBinauralRendering( } #ifdef SPLIT_REND_WITH_HEAD_ROT - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) +#ifdef FIX_513_REND_MC_ALLOC + if ( !useTDRend ) { - if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) +#endif + for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) { - ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); - inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + if ( inputMc->splitTdRendWrappers[i].hBinRendererTd != NULL ) + { + ivas_td_binaural_close( &inputMc->splitTdRendWrappers[i].hBinRendererTd ); + inputMc->splitTdRendWrappers[i].hHrtfTD = NULL; + } } +#ifdef FIX_513_REND_MC_ALLOC } #endif +#endif #ifdef FIX_513_REND_MC_ALLOC /* if we need to use TD renderer and CREND was open, close it */ -- GitLab From f908077eabb7f8160908d35cbf716b765334d6b9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 25 Sep 2023 13:03:19 +0200 Subject: [PATCH 4/8] [fix] indicate whether a full reconfiguration is needed for initMcBinauralRendering() --- lib_rend/lib_rend.c | 52 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 27b9799cfe..b4069c5a09 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2171,7 +2171,12 @@ static ivas_error initMcBinauralRendering( input_mc *inputMc, const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, - RENDER_CONFIG_DATA *hRendCfg ) + RENDER_CONFIG_DATA *hRendCfg +#ifdef FIX_513_REND_MC_ALLOC + , + uint8_t reconfigureFlag +#endif +) { ivas_error error; #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2202,9 +2207,12 @@ static ivas_error initMcBinauralRendering( /* if TD renderer was open and we need to use CREND, close it */ if ( #ifdef FIX_513_REND_MC_ALLOC - !useTDRend && + reconfigureFlag || ( !useTDRend && +#endif + inputMc->tdRendWrapper.hBinRendererTd != NULL ) +#ifdef FIX_513_REND_MC_ALLOC + ) #endif - inputMc->tdRendWrapper.hBinRendererTd != NULL ) { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; @@ -2212,7 +2220,7 @@ static ivas_error initMcBinauralRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef FIX_513_REND_MC_ALLOC - if ( !useTDRend ) + if ( reconfigureFlag || !useTDRend ) { #endif for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -2244,7 +2252,7 @@ static ivas_error initMcBinauralRendering( #endif #ifdef FIX_513_REND_MC_ALLOC - if ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) + if ( reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) { #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2253,7 +2261,7 @@ static ivas_error initMcBinauralRendering( #endif #ifdef FIX_513_REND_MC_ALLOC - if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) + if ( reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { #endif if ( inputMc->efapInWrapper.hEfap != NULL ) @@ -2510,7 +2518,12 @@ static ivas_error setRendInputActiveMc( if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { - if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg ) ) != IVAS_ERR_OK ) + if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg +#ifdef FIX_513_REND_MC_ALLOC + , + TRUE +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4399,9 +4412,14 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( * set for the MC input. */ inputMc->customLsInput = makeCustomLsSetup( layout ); - inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, inputMc->customLsInput, hIvasRend->outputConfig, *inputMc->base.ctx.pCustomLsOut ); + inputMc->lfeRouting = defaultLfeRouting( inputMc->base.inConfig, + inputMc->customLsInput, + hIvasRend->outputConfig, + *inputMc->base.ctx.pCustomLsOut ); - if ( ( error = initEfap( &inputMc->efapInWrapper, inputMc->base.inConfig, &inputMc->customLsInput ) ) != IVAS_ERR_OK ) + if ( ( error = initEfap( &inputMc->efapInWrapper, + inputMc->base.inConfig, + &inputMc->customLsInput ) ) != IVAS_ERR_OK ) { return error; } @@ -4412,7 +4430,15 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) #endif { - if ( ( error = initMcBinauralRendering( inputMc, inputMc->base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig ) ) != IVAS_ERR_OK ) + if ( ( error = initMcBinauralRendering( inputMc, + inputMc->base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig +#ifdef FIX_513_REND_MC_ALLOC + , + TRUE +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -5258,7 +5284,8 @@ ivas_error IVAS_REND_SetHeadRotation( initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, - hIvasRend->hRendererConfig ); + hIvasRend->hRendererConfig, + FALSE ); } } #endif @@ -5319,7 +5346,8 @@ ivas_error IVAS_REND_DisableHeadRotation( initMcBinauralRendering( &hIvasRend->inputsMc[i], hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, - hIvasRend->hRendererConfig ); + hIvasRend->hRendererConfig, + FALSE ); } } } -- GitLab From 3d6fa32416b889d7adf78f910c278f0fdcfd3771 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 25 Sep 2023 13:08:25 +0200 Subject: [PATCH 5/8] [fix] condition check for useTDRend; both _ROOM_IR and _ROOM_REVERB need to use CREND --- 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 b4069c5a09..f3551235a3 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2190,7 +2190,7 @@ static ivas_error initMcBinauralRendering( /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ useTDRend = FALSE; - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) { -- GitLab From 2e3e3913b8d8ad4998302c9229e371f0febd4d4e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 25 Sep 2023 13:17:09 +0200 Subject: [PATCH 6/8] dummy commit to trigger CI -- GitLab From 3b3d5416c0ec8b0667ad783581281e0b8459dd35 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 25 Sep 2023 13:46:33 +0200 Subject: [PATCH 7/8] [fix] correct logic of reconfigureFlag to match naming --- lib_rend/lib_rend.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f3551235a3..8e8c19cf92 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2207,9 +2207,9 @@ static ivas_error initMcBinauralRendering( /* if TD renderer was open and we need to use CREND, close it */ if ( #ifdef FIX_513_REND_MC_ALLOC - reconfigureFlag || ( !useTDRend && + !reconfigureFlag || ( !useTDRend && #endif - inputMc->tdRendWrapper.hBinRendererTd != NULL ) + inputMc->tdRendWrapper.hBinRendererTd != NULL ) #ifdef FIX_513_REND_MC_ALLOC ) #endif @@ -2220,7 +2220,7 @@ static ivas_error initMcBinauralRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT #ifdef FIX_513_REND_MC_ALLOC - if ( reconfigureFlag || !useTDRend ) + if ( !reconfigureFlag || !useTDRend ) { #endif for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) @@ -2252,7 +2252,7 @@ static ivas_error initMcBinauralRendering( #endif #ifdef FIX_513_REND_MC_ALLOC - if ( reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) + if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) { #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2261,7 +2261,7 @@ static ivas_error initMcBinauralRendering( #endif #ifdef FIX_513_REND_MC_ALLOC - if ( reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) + if ( !reconfigureFlag || ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && !inputMc->base.ctx.pHeadRotData->headRotEnabled ) ) { #endif if ( inputMc->efapInWrapper.hEfap != NULL ) @@ -2521,7 +2521,7 @@ static ivas_error setRendInputActiveMc( if ( ( error = initMcBinauralRendering( inputMc, inConfig, outConfig, hRendCfg #ifdef FIX_513_REND_MC_ALLOC , - TRUE + FALSE #endif ) ) != IVAS_ERR_OK ) { @@ -4436,7 +4436,7 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( hIvasRend->hRendererConfig #ifdef FIX_513_REND_MC_ALLOC , - TRUE + FALSE #endif ) ) != IVAS_ERR_OK ) { @@ -5285,7 +5285,7 @@ ivas_error IVAS_REND_SetHeadRotation( hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, - FALSE ); + TRUE ); } } #endif @@ -5347,7 +5347,7 @@ ivas_error IVAS_REND_DisableHeadRotation( hIvasRend->inputsMc[i].base.inConfig, hIvasRend->outputConfig, hIvasRend->hRendererConfig, - FALSE ); + TRUE ); } } } -- GitLab From 572556c79a46e0c397211b88b70077905b548c60 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 25 Sep 2023 14:28:23 +0200 Subject: [PATCH 8/8] [fix] update condition for useTDRend again --- lib_rend/lib_rend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 8e8c19cf92..3482d8d9e7 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2190,9 +2190,9 @@ static ivas_error initMcBinauralRendering( /* Allocate TD binaural renderer for custom loudspeaker layouts (regardless of headrotation) or planar MC layouts with headrotation, CREND for the rest */ useTDRend = FALSE; - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) { - if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { useTDRend = TRUE; } -- GitLab