Loading lib_rend/lib_rend.c +27 −26 Original line number Diff line number Diff line Loading @@ -1272,8 +1272,10 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) int16_t i; int32_t latency_ns; int32_t max_latency_ns; bool splitPreRendCldfb; max_latency_ns = 0; splitPreRendCldfb = ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ); /* Compute the maximum delay across all inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) Loading @@ -1300,22 +1302,10 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { if ( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) { if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_BIN_RENDERER_TYPE_FASTCONV ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; } else { latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; } max_latency_ns = max( max_latency_ns, latency_ns ); } else if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; latency_ns += IVAS_FB_DEC_DELAY_NS; latency_ns += splitPreRendCldfb ? 0.f : IVAS_FB_DEC_DELAY_NS; max_latency_ns = max( max_latency_ns, latency_ns ); } else Loading @@ -1330,7 +1320,7 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { latency_ns = (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); latency_ns = splitPreRendCldfb ? 0 : (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); max_latency_ns = max( max_latency_ns, latency_ns ); } } Loading Loading @@ -1424,7 +1414,9 @@ static ivas_error initIsmMasaRendering( return IVAS_ERR_OK; } static void setRendInputDelayIsm( void *input ) static void setRendInputDelayIsm( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_ism *inputIsm; Loading @@ -1444,7 +1436,7 @@ static void setRendInputDelayIsm( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputIsm->base.delayNumSamples = latencyNsToSamples( *inputIsm->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2445,7 +2437,9 @@ static lfe_routing defaultLfeRouting( return routing; } static void setRendInputDelayMc( void *input ) static void setRendInputDelayMc( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_mc *inputMc; Loading @@ -2465,7 +2459,7 @@ static void setRendInputDelayMc( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputMc->base.delayNumSamples = latencyNsToSamples( *inputMc->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2816,7 +2810,9 @@ static ivas_error initSbaMasaRendering( return IVAS_ERR_OK; } static void setRendInputDelaySba( void *input ) static void setRendInputDelaySba( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_sba *inputSba; Loading @@ -2828,7 +2824,8 @@ static void setRendInputDelaySba( void *input ) if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { latency_ns = max( latency_ns, inputSba->cldfbRendWrapper.binaural_latency_ns + IVAS_FB_DEC_DELAY_NS ); inputSba->cldfbRendWrapper.binaural_latency_ns + ( splitPreRendCldfb ? 0 : IVAS_FB_DEC_DELAY_NS ) ); } if ( inputSba->crendWrapper != NULL ) { Loading @@ -2839,7 +2836,7 @@ static void setRendInputDelaySba( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputSba->base.delayNumSamples = latencyNsToSamples( *inputSba->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2929,7 +2926,9 @@ static void clearInputSba( return; } static void setRendInputDelayMasa( void *input ) static void setRendInputDelayMasa( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_masa *inputMasa; Loading @@ -2941,7 +2940,7 @@ static void setRendInputDelayMasa( void *input ) if ( inputMasa->hMasaExtRend != NULL && inputMasa->hMasaExtRend->renderer_type != RENDERER_DISABLE ) { latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputMasa->base.delayNumSamples = latencyNsToSamples( *inputMasa->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -3734,8 +3733,10 @@ ivas_error IVAS_REND_AddInput( void *inputsArray; int32_t inputStructSize; ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); void ( *setInputDelay )( void * ); void ( *setInputDelay )( void *, bool ); int32_t inputIndex; bool splitPreRendCldfb; splitPreRendCldfb = ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ); /* Validate function arguments */ if ( hIvasRend == NULL || inputId == NULL ) Loading Loading @@ -3799,7 +3800,7 @@ ivas_error IVAS_REND_AddInput( { return error; } setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex ); setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex, splitPreRendCldfb ); /* update global maximum delay after adding an input */ updateMaxGlobalDelayNs( hIvasRend ); Loading Loading
lib_rend/lib_rend.c +27 −26 Original line number Diff line number Diff line Loading @@ -1272,8 +1272,10 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) int16_t i; int32_t latency_ns; int32_t max_latency_ns; bool splitPreRendCldfb; max_latency_ns = 0; splitPreRendCldfb = ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ); /* Compute the maximum delay across all inputs */ for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; i++ ) Loading @@ -1300,22 +1302,10 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) { if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { if ( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL ) { if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == IVAS_BIN_RENDERER_TYPE_FASTCONV ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; } else { latency_ns = ( hIvasRend->inputsSba[i].crendWrapper != NULL ) ? hIvasRend->inputsSba[i].crendWrapper->binaural_latency_ns : 0; } max_latency_ns = max( max_latency_ns, latency_ns ); } else if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) if ( hIvasRend->inputsSba[i].cldfbRendWrapper.hCldfbRend != NULL ) { latency_ns = hIvasRend->inputsSba[i].cldfbRendWrapper.binaural_latency_ns; latency_ns += IVAS_FB_DEC_DELAY_NS; latency_ns += splitPreRendCldfb ? 0.f : IVAS_FB_DEC_DELAY_NS; max_latency_ns = max( max_latency_ns, latency_ns ); } else Loading @@ -1330,7 +1320,7 @@ static int32_t getMaxGlobalDelayNs( IVAS_REND_CONST_HANDLE hIvasRend ) { if ( hIvasRend->inputsMasa[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID ) { latency_ns = (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); latency_ns = splitPreRendCldfb ? 0 : (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ); max_latency_ns = max( max_latency_ns, latency_ns ); } } Loading Loading @@ -1424,7 +1414,9 @@ static ivas_error initIsmMasaRendering( return IVAS_ERR_OK; } static void setRendInputDelayIsm( void *input ) static void setRendInputDelayIsm( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_ism *inputIsm; Loading @@ -1444,7 +1436,7 @@ static void setRendInputDelayIsm( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputIsm->base.delayNumSamples = latencyNsToSamples( *inputIsm->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2445,7 +2437,9 @@ static lfe_routing defaultLfeRouting( return routing; } static void setRendInputDelayMc( void *input ) static void setRendInputDelayMc( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_mc *inputMc; Loading @@ -2465,7 +2459,7 @@ static void setRendInputDelayMc( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputMc->base.delayNumSamples = latencyNsToSamples( *inputMc->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2816,7 +2810,9 @@ static ivas_error initSbaMasaRendering( return IVAS_ERR_OK; } static void setRendInputDelaySba( void *input ) static void setRendInputDelaySba( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_sba *inputSba; Loading @@ -2828,7 +2824,8 @@ static void setRendInputDelaySba( void *input ) if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { latency_ns = max( latency_ns, inputSba->cldfbRendWrapper.binaural_latency_ns + IVAS_FB_DEC_DELAY_NS ); inputSba->cldfbRendWrapper.binaural_latency_ns + ( splitPreRendCldfb ? 0 : IVAS_FB_DEC_DELAY_NS ) ); } if ( inputSba->crendWrapper != NULL ) { Loading @@ -2839,7 +2836,7 @@ static void setRendInputDelaySba( void *input ) { /* TODO tmu: verify what should be set for MASA prerendering */ latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputSba->base.delayNumSamples = latencyNsToSamples( *inputSba->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -2929,7 +2926,9 @@ static void clearInputSba( return; } static void setRendInputDelayMasa( void *input ) static void setRendInputDelayMasa( void *input, bool splitPreRendCldfb ) { int32_t latency_ns; input_masa *inputMasa; Loading @@ -2941,7 +2940,7 @@ static void setRendInputDelayMasa( void *input ) if ( inputMasa->hMasaExtRend != NULL && inputMasa->hMasaExtRend->renderer_type != RENDERER_DISABLE ) { latency_ns = max( latency_ns, (int32_t) ( (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ); (int32_t) ( ( splitPreRendCldfb ? 0 : (float) IVAS_FB_DEC_DELAY_NS + 0.5f ) ) ); } inputMasa->base.delayNumSamples = latencyNsToSamples( *inputMasa->base.ctx.pOutSampleRate, latency_ns ); Loading Loading @@ -3734,8 +3733,10 @@ ivas_error IVAS_REND_AddInput( void *inputsArray; int32_t inputStructSize; ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); void ( *setInputDelay )( void * ); void ( *setInputDelay )( void *, bool ); int32_t inputIndex; bool splitPreRendCldfb; splitPreRendCldfb = ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ); /* Validate function arguments */ if ( hIvasRend == NULL || inputId == NULL ) Loading Loading @@ -3799,7 +3800,7 @@ ivas_error IVAS_REND_AddInput( { return error; } setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex ); setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex, splitPreRendCldfb ); /* update global maximum delay after adding an input */ updateMaxGlobalDelayNs( hIvasRend ); Loading