diff --git a/lib_com/options.h b/lib_com/options.h index ef136cb6bed6f1f9b24ce98df9c3fcad2830cd76..195cd6512eada2dcadacddf9e3d7273873676c7c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,6 +170,7 @@ #define FIX_632_USAN_ERROR_NULL_POINTER /* FhG: issue 632 USAN offset to null pointer proto_diffuse_buffer_f in dirac rendering*/ #define FIX_759_CODE_COVERAGE_OSBA /* VA: issue 759: remove obsolete code in the OSBA encoder */ #define FIX_708_AEID_COMMAND_LINE /* VA: issue 708: improve AEID command-line robustness */ +#define FIX_513_REND_MC_ALLOC /* FhG: issue 513, optimise external renderer allocation for multichannel */ #define FIX_518_ISM_BRIR_EXTREND /* FhG: fix issue #518, cleanup ISM to BINAURAL_ROOM_IR rendering in the external renderer */ #define FIX_764_HARM_CODE /* VA: issue 764: introduce new function for the same code block at four different places */ #define FIX_747_ISM_TODOS /* VA: issue 747 - address ISM ToDos */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 87566670acce011e2e78ed7a9571f246a5088467..3482d8d9e7c91ed3fbe14a53af3efd835b7dc5b5 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 @@ -2179,61 +2184,99 @@ 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 != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + useTDRend = TRUE; + } + else if ( ( inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_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 + !reconfigureFlag || ( !useTDRend && +#endif + inputMc->tdRendWrapper.hBinRendererTd != NULL ) +#ifdef FIX_513_REND_MC_ALLOC + ) +#endif { ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); inputMc->tdRendWrapper.hHrtfTD = NULL; } #ifdef SPLIT_REND_WITH_HEAD_ROT - for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i ) +#ifdef FIX_513_REND_MC_ALLOC + if ( !reconfigureFlag || !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 - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); -#else - 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 +#endif + ); +#ifdef FIX_513_REND_MC_ALLOC + } #endif - ivas_reverb_close( &inputMc->hReverb ); +#ifdef FIX_513_REND_MC_ALLOC + if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_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 ( !reconfigureFlag || ( inConfig == IVAS_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 != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) - // #else - // if ( outConfig != IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM ) - // #endif - // { - // if ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - // { - // initTDRend = true; - // } - // else if ( ( inConfig == IVAS_AUDIO_CONFIG_5_1 || inConfig == IVAS_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 ) { @@ -2257,7 +2300,11 @@ static ivas_error initMcBinauralRendering( } #endif - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + if ( outConfig == IVAS_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 ) { @@ -2265,19 +2312,29 @@ static ivas_error initMcBinauralRendering( } } } - +#ifdef FIX_513_REND_MC_ALLOC + else if ( !useTDRend && inputMc->crendWrapper == NULL ) /* open CREND */ +#endif + { #ifdef SPLIT_REND_WITH_HEAD_ROT - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate, ( ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) || ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) ) ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputMc->crendWrapper, ( inConfig == IVAS_AUDIO_CONFIG_LS_CUSTOM ) ? IVAS_AUDIO_CONFIG_7_1_4 : inConfig, outConfig, hRendCfg, NULL, outSampleRate ) ) != IVAS_ERR_OK ) #endif - { - return error; + { + return error; + } +#ifdef FIX_513_REND_MC_ALLOC } +#endif /* Initialise the EFAP handle for rotation on input layout */ - if ( inConfig != IVAS_AUDIO_CONFIG_LS_CUSTOM && inputMc->base.ctx.pHeadRotData->headRotEnabled ) + if ( inConfig != IVAS_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 ) { @@ -2314,7 +2371,7 @@ static ivas_error initMcMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2442,10 +2499,13 @@ static ivas_error setRendInputActiveMc( initRotGains( inputMc->rot_gains_prev[pos_idx] ); } #else - initRotGains( inputMc->rot_gains_prev ); + initRotGains( inputMc->rot_gains_prev ); #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 ) @@ -2455,10 +2515,15 @@ static ivas_error setRendInputActiveMc( if ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + 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 + , + FALSE +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -2505,7 +2570,7 @@ static void clearInputMc( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputMc->crendWrapper ); + ivas_rend_closeCrend( &inputMc->crendWrapper ); #endif ivas_reverb_close( &inputMc->hReverb ); @@ -2717,7 +2782,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { @@ -2735,7 +2800,7 @@ static ivas_error updateSbaPanGains( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2805,7 +2870,7 @@ static ivas_error initSbaMasaRendering( #ifdef SPLIT_REND_WITH_HEAD_ROT ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses ); #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) @@ -2843,7 +2908,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #else - if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) + if ( ( error = allocateInputBaseBufferData( &inputSba->bufferData, MAX_BUFFER_LENGTH ) ) != IVAS_ERR_OK ) #endif { return error; @@ -2852,7 +2917,7 @@ static ivas_error setRendInputActiveSba( #ifdef SPLIT_REND_WITH_HEAD_ROT initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_CLDFB_BUFFER_LENGTH ); #else - initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); + initRendInputBase( &inputSba->base, inConfig, id, rendCtx, inputSba->bufferData, MAX_BUFFER_LENGTH ); #endif setZeroPanMatrix( inputSba->hoaDecMtx ); @@ -2864,9 +2929,9 @@ static ivas_error setRendInputActiveSba( initRotGains( inputSba->rot_gains_prev[pos_idx] ); } #else - inputSba->crendWrapper = NULL; - inputSba->hDirAC = NULL; - initRotGains( inputSba->rot_gains_prev ); + inputSba->crendWrapper = NULL; + inputSba->hDirAC = NULL; + initRotGains( inputSba->rot_gains_prev ); #endif if ( outConfig == IVAS_AUDIO_CONFIG_MASA1 || outConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -2938,7 +3003,7 @@ static void clearInputSba( ivas_rend_closeCldfbRend( &inputSba->cldfbRendWrapper ); } #else - ivas_rend_closeCrend( &inputSba->crendWrapper ); + ivas_rend_closeCrend( &inputSba->crendWrapper ); #endif ivas_dirac_ana_close( &( inputSba->hDirAC ) ); @@ -3254,7 +3319,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDiracDecBin[i] = NULL; } #else - decDummy->hDiracDecBin = NULL; + decDummy->hDiracDecBin = NULL; #endif decDummy->hDirACRend = NULL; decDummy->hSpatParamRendCom = NULL; @@ -3376,7 +3441,7 @@ static ivas_error setRendInputActiveMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0, rendCtx.pSplitRendWrapper ); #else - inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); + inputMasa->decDummy = initDecoderDummy( *rendCtx.pOutSampleRate, numInChannels, outConfig, 0 ); #endif inputMasa->metadataHasBeenFed = false; @@ -3486,7 +3551,7 @@ static void freeDecoderDummy( #ifdef SPLIT_REND_WITH_HEAD_ROT_PARAMBIN ivas_dirac_dec_close_binaural_data( pDecDummy->hDiracDecBin ); #else - ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); + ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); #endif /* TC buffer */ @@ -4347,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; } @@ -4357,10 +4427,18 @@ ivas_error IVAS_REND_ConfigureCustomInputLoudspeakerLayout( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) #else - if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + 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 + , + FALSE +#endif + ) ) != IVAS_ERR_OK ) { return error; } @@ -4768,7 +4846,7 @@ ivas_error IVAS_REND_FeedInputAudio( if ( inputAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < inputAudio.config.numSamplesPerChannel && inputAudio.config.is_cldfb == 1 ) ) #else - if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) + if ( inputAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < inputAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Buffer size outside of supported range" ); @@ -4785,8 +4863,8 @@ ivas_error IVAS_REND_FeedInputAudio( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( inputAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + inputAudio.config.numSamplesPerChannel * 1000 != ( BINAURAL_RENDERING_FRAME_SIZE_MS * hIvasRend->num_subframes ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -4818,7 +4896,7 @@ ivas_error IVAS_REND_FeedInputAudio( #ifdef SPLIT_REND_WITH_HEAD_ROT inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel / cldfb2tdSampleFact; #else - inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; + inputBase->numNewSamplesPerChannel = inputAudio.config.numSamplesPerChannel; #endif return IVAS_ERR_OK; @@ -5176,6 +5254,9 @@ ivas_error IVAS_REND_SetHeadRotation( #endif const int16_t sf_idx ) { +#ifdef FIX_513_REND_MC_ALLOC + int16_t i; +#endif IVAS_QUATERNION rotQuat; ivas_error error; @@ -5191,6 +5272,23 @@ 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 ) + { + if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig, + TRUE ); + } + } +#endif /* check for Euler angle signaling */ if ( headRot.w == -3.0f ) { @@ -5226,6 +5324,9 @@ ivas_error 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 ) { @@ -5233,7 +5334,25 @@ ivas_error 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 ) + { + if ( hIvasRend->inputsMc[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) + { + initMcBinauralRendering( &hIvasRend->inputsMc[i], + hIvasRend->inputsMc[i].base.inConfig, + hIvasRend->outputConfig, + hIvasRend->hRendererConfig, + TRUE ); + } + } + } +#endif return IVAS_ERR_OK; } @@ -5874,7 +5993,7 @@ static int16_t getNumSubframesInBuffer( #ifdef SPLIT_REND_WITH_HEAD_ROT return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES * cldfb2tdSampleFact ) ); #else - return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); + return (int16_t) ( buffer->config.numSamplesPerChannel / ( sampleRate / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ); #endif } @@ -5976,18 +6095,18 @@ static ivas_error renderIsmToBinauralRoom( return error; } #else - /* get previous position */ - if ( combinedOrientationEnabled ) - { - rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); - rotatedPosPrev.azimuth = (float) azi_rot; - rotatedPosPrev.elevation = (float) ele_rot; - } - else - { - rotatedPosPrev.azimuth = ismInput->previousPos.azimuth; - rotatedPosPrev.elevation = ismInput->previousPos.elevation; - } + /* get previous position */ + if ( combinedOrientationEnabled ) + { + rotateAziEle( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &azi_rot, &ele_rot, ismInput->rot_mat_prev, 0 ); + rotatedPosPrev.azimuth = (float) azi_rot; + rotatedPosPrev.elevation = (float) ele_rot; + } + else + { + rotatedPosPrev.azimuth = ismInput->previousPos.azimuth; + rotatedPosPrev.elevation = ismInput->previousPos.elevation; + } #endif /* get current position */ @@ -6021,8 +6140,8 @@ static ivas_error renderIsmToBinauralRoom( rotatedPos.azimuth, rotatedPos.elevation, #else - ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, - ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, + ( combinedOrientationEnabled ) ? rotatedPos.azimuth : ismInput->currentPos.azimuth, + ( combinedOrientationEnabled ) ? rotatedPos.elevation : ismInput->currentPos.elevation, #endif currentPanGains ) ) != IVAS_ERR_OK ) { @@ -6049,8 +6168,8 @@ static ivas_error renderIsmToBinauralRoom( position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else - currentPanGains, - previousPanGains, + currentPanGains, + previousPanGains, #endif tmpMcBuffer ); @@ -6076,9 +6195,9 @@ static ivas_error renderIsmToBinauralRoom( NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, - NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR, + NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *ismInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { @@ -6142,7 +6261,7 @@ static ivas_error renderIsmToMc( #ifdef FIX_518_ISM_BRIR_EXTREND position_changed = !ismInput->firstFrameRendered || checkObjectPositionChanged( &ismInput->currentPos, &ismInput->previousPos ); #else - /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ + /* TODO(sgi): Possible optimization: less processing needed if position didn't change */ #endif if ( *ismInput->base.ctx.pOutConfig == IVAS_AUDIO_CONFIG_STEREO ) { @@ -6152,9 +6271,9 @@ static ivas_error renderIsmToMc( ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; #else - previousPanGains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; - previousPanGains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; - error = IVAS_ERR_OK; + previousPanGains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f; + previousPanGains[1] = currentPanGains[1] = 1.f - currentPanGains[0]; + error = IVAS_ERR_OK; #endif } else @@ -6168,9 +6287,9 @@ static ivas_error renderIsmToMc( ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &ismInput->prev_pan_gains[0], &ismInput->prev_pan_gains[1] ); #else - set_zero( previousPanGains, MAX_OUTPUT_CHANNELS ); + set_zero( previousPanGains, MAX_OUTPUT_CHANNELS ); - ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &previousPanGains[0], &previousPanGains[1] ); + ivas_ism_get_stereo_gains( ismInput->previousPos.azimuth, ismInput->previousPos.elevation, &previousPanGains[0], &previousPanGains[1] ); #endif } } @@ -6203,7 +6322,7 @@ static ivas_error renderIsmToMc( #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains #else - previousPanGains + previousPanGains #endif ) ) != IVAS_ERR_OK ) { @@ -6221,8 +6340,8 @@ static ivas_error renderIsmToMc( position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else - currentPanGains, - previousPanGains, + currentPanGains, + previousPanGains, #endif outAudio ); @@ -6284,7 +6403,7 @@ static ivas_error renderIsmToSba( #ifdef FIX_518_ISM_BRIR_EXTREND ismInput->prev_pan_gains, #else - previousPanGains, + previousPanGains, #endif ambiOrderOut ); #ifdef FIX_518_ISM_BRIR_EXTREND @@ -6295,13 +6414,13 @@ static ivas_error renderIsmToSba( { #else - if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) && - ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) ) - { - mvr2r( previousPanGains, currentPanGains, MAX_OUTPUT_CHANNELS ); - } - else - { + if ( ( ismInput->currentPos.azimuth == ismInput->previousPos.azimuth ) && + ( ismInput->currentPos.elevation == ismInput->previousPos.elevation ) ) + { + mvr2r( previousPanGains, currentPanGains, MAX_OUTPUT_CHANNELS ); + } + else + { #endif // TODO tmu review when #215 is resolved ivas_dirac_dec_get_response( (int16_t) floorf( ismInput->currentPos.azimuth + 0.5f ), @@ -6317,8 +6436,8 @@ static ivas_error renderIsmToSba( position_changed ? currentPanGains : ismInput->prev_pan_gains, position_changed ? ismInput->prev_pan_gains : NULL, #else - currentPanGains, - previousPanGains, + currentPanGains, + previousPanGains, #endif outAudio ); @@ -6575,7 +6694,7 @@ static ivas_error renderLfeToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT assert( ( getAudioConfigType( outConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL ) && "Must be binaural output" ); #else - assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); + assert( ( outAudio.config.numChannels == 2 ) && "Must be binaural output" ); #endif push_wmops( "renderLfeToBinaural" ); @@ -6634,12 +6753,12 @@ static ivas_error renderLfeToBinaural( } } #else /* SPLIT_REND_WITH_HEAD_ROT */ - /* Copy LFE to left and right ears */ - for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) - { - writePtr = getSmplPtr( outAudio, ear_idx, 0 ); - v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); - } + /* Copy LFE to left and right ears */ + for ( ear_idx = 0; ear_idx < BINAURAL_CHANNELS; ++ear_idx ) + { + writePtr = getSmplPtr( outAudio, ear_idx, 0 ); + v_add( writePtr, tmpLfeBuffer, writePtr, frame_size ); + } #endif /* SPLIT_REND_WITH_HEAD_ROT */ pop_wmops(); @@ -6709,7 +6828,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6729,8 +6848,8 @@ static ivas_error renderMcToBinaural( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6742,7 +6861,7 @@ static ivas_error renderMcToBinaural( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { @@ -6816,7 +6935,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6836,8 +6955,8 @@ static ivas_error renderMcToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, mcInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6849,7 +6968,7 @@ static ivas_error renderMcToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6912,7 +7031,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT mcInput->rot_gains_prev[0], #else - mcInput->rot_gains_prev, + mcInput->rot_gains_prev, #endif mcInput->efapInWrapper.hEfap, tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -6944,8 +7063,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, - p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, NULL, NULL, NULL, NULL, + p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *mcInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -6956,7 +7075,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT if ( ( error = renderLfeToBinaural( mcInput, outConfig, outAudio ) ) != IVAS_ERR_OK ) #else - if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) + if ( ( error = renderLfeToBinaural( mcInput, outAudio ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7887,8 +8006,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev[0], tmpRotBuffer ) ) != IVAS_ERR_OK ) #else - if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, - sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) + if ( ( error = rotateFrameSba( sbaInput->base.inputBuffer, sbaInput->base.inConfig, sbaInput->base.ctx.pHeadRotData, + sbaInput->base.ctx.pCombinedOrientationData, sbaInput->rot_gains_prev, tmpRotBuffer ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7907,8 +8026,8 @@ static ivas_error renderSbaToBinaural( if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, sbaInput->base.inConfig, outConfig, NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate, + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -7977,7 +8096,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT sbaInput->rot_gains_prev[0], #else - sbaInput->rot_gains_prev, + sbaInput->rot_gains_prev, #endif tmpRotBuffer ) ) != IVAS_ERR_OK ) { @@ -8011,7 +8130,7 @@ static ivas_error renderSbaToBinauralRoom( #ifdef SPLIT_REND_WITH_HEAD_ROT getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ), 0 ) ) != IVAS_ERR_OK ) #else - getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) + getNumSubframesInBuffer( &outAudio, *sbaInput->base.ctx.pOutSampleRate ) ) ) != IVAS_ERR_OK ) #endif { return error; @@ -8102,7 +8221,7 @@ static ivas_error renderInputSba( if ( ( sbaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( sbaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8515,7 +8634,7 @@ static ivas_error renderInputMasa( if ( ( masaInput->base.numNewSamplesPerChannel * cldfb2tdSampleFact != outAudio.config.numSamplesPerChannel ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) && ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) ) #else - if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) + if ( masaInput->base.numNewSamplesPerChannel != outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Mismatch between the number of input samples vs number of requested output samples - currently not allowed" ); @@ -8544,7 +8663,7 @@ static ivas_error renderInputMasa( #ifdef SPLIT_REND_WITH_HEAD_ROT renderMasaToBinaural( masaInput, outAudio, 0 ); #else - renderMasaToBinaural( masaInput, outAudio ); + renderMasaToBinaural( masaInput, outAudio ); #endif break; /* ToDo */ @@ -8821,7 +8940,7 @@ static ivas_error getSamplesInternal( if ( outAudio.config.numSamplesPerChannel <= 0 || ( MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 0 ) || ( ( MAX_BUFFER_LENGTH_PER_CHANNEL * cldfb2tdSampleFact ) < outAudio.config.numSamplesPerChannel && outAudio.config.is_cldfb == 1 ) ) #else - if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) + if ( outAudio.config.numSamplesPerChannel <= 0 || MAX_BUFFER_LENGTH_PER_CHANNEL < outAudio.config.numSamplesPerChannel ) #endif { return IVAS_ERR_INVALID_BUFFER_SIZE; @@ -8838,8 +8957,8 @@ static ivas_error getSamplesInternal( hIvasRend->outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && ( outAudio.config.numSamplesPerChannel * 1000 / cldfb2tdSampleFact ) != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #else - if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && - outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) + if ( getAudioConfigType( hIvasRend->outputConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_BINAURAL && + outAudio.config.numSamplesPerChannel * 1000 != ( hIvasRend->num_subframes * BINAURAL_RENDERING_FRAME_SIZE_MS ) * hIvasRend->sampleRateOut ) #endif { return IVAS_ERROR( IVAS_ERR_INVALID_BUFFER_SIZE, "Binaural rendering requires specific frame size" ); @@ -8952,9 +9071,9 @@ static ivas_error getSamplesInternal( #ifndef DISABLE_LIMITER #ifdef DEBUGGING - hIvasRend->numClipping += + hIvasRend->numClipping += #endif - limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); + limitRendererOutput( hIvasRend->hLimiter, outAudio.data, outAudio.config.numSamplesPerChannel, IVAS_LIMITER_THRESHOLD ); #endif #endif /* SPLIT_REND_WITH_HEAD_ROT */ @@ -9036,7 +9155,7 @@ ivas_error IVAS_REND_GetSamples( return getSamplesInternal( hIvasRend, outAudio, NULL ); #else - return getSamplesInternal( hIvasRend, outAudio ); + return getSamplesInternal( hIvasRend, outAudio ); #endif }