Commit 984969c9 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

[fix] issue for TD object renderer in 20ms split-pre mode

parent 1de55766
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -794,7 +794,7 @@ ivas_error ivas_td_binaural_renderer_ext(
                                                     ism_md_subframe_update_ext, p_output, output_frame
#ifdef API_5MS
                                                     ,
                                                     1
                                                     ( output_frame == L_FRAME48k ) ? 4 : 1
#endif
                                                     ) ) != IVAS_ERR_OK )
    {
+27 −54
Original line number Diff line number Diff line
@@ -1480,6 +1480,22 @@ static ivas_error setRendInputActiveIsm(
        {
            return error;
        }

        /* Open TD renderer wrappers */
        for ( i = 0; i < MAX_HEAD_ROT_POSES - 1; ++i )
        {
            if ( ( error = ivas_td_binaural_open_ext( &inputIsm->splitTdRendWrappers[i],
                                                      inConfig,
                                                      hRendCfg,
                                                      NULL,
                                                      *inputIsm->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
            {
                return error;
            }

            /* Assert same delay as main TD renderer */
            assert( inputIsm->splitTdRendWrappers[i].binaural_latency_ns == inputIsm->tdRendWrapper.binaural_latency_ns );
        }
#endif
    }
    else if ( outConfig == IVAS_REND_AUDIO_CONFIG_MASA1 || outConfig == IVAS_REND_AUDIO_CONFIG_MASA2 )
@@ -6357,7 +6373,6 @@ static ivas_error renderIsmToSplitBinaural(
    input_ism *ismInput,
    const IVAS_REND_AudioBuffer outAudio )
{
    int32_t i;
    ivas_error error;
    float tmpProcessing[MAX_NUM_OBJECTS][L_FRAME48k];
    int16_t pos_idx;
@@ -6384,27 +6399,6 @@ static ivas_error renderIsmToSplitBinaural(
    ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif

    /* If not yet allocated, open additional instances of TD renderer */
    for ( i = 0; i < pMultiBinPoseData->num_poses - 1; ++i )
    {
        if ( ismInput->splitTdRendWrappers[i].hBinRendererTd != NULL )
        {
            continue;
        }

        /* ToDo: Could re-use already existing HRTF (ismInput->tdRendWrapper.hHrtfTD), but this complicates internal memory handling in TD renderer */
        ismInput->splitTdRendWrappers[i].hHrtfTD = NULL;

        /* Open TD renderer wrapper */
        if ( ( error = ivas_td_binaural_open_ext( &ismInput->splitTdRendWrappers[i], ismInput->base.inConfig, *ismInput->base.ctx.hhRendererConfig, NULL, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK )
        {
            return error;
        }

        /* Assert same delay as main TD renderer */
        assert( ismInput->splitTdRendWrappers[i].binaural_latency_ns == ismInput->tdRendWrapper.binaural_latency_ns );
    }

    pCombinedOrientationData = *ismInput->base.ctx.pCombinedOrientationData;

    if ( pMultiBinPoseData->poseCorrectionMode == IVAS_SPLIT_REND_POSE_CORRECTION_MODE_CLDFB )
@@ -6482,9 +6476,7 @@ static ivas_error renderIsmToSplitBinaural(
        }

        /* Render */
        if ( pos_idx == 0 )
        {
            error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
        error = ivas_td_binaural_renderer_ext( ( pos_idx == 0 ) ? &ismInput->tdRendWrapper : &ismInput->splitTdRendWrappers[pos_idx - 1],
                                               ismInput->base.inConfig,
                                               NULL,
                                               ismInput->base.ctx.pCombinedOrientationData,
@@ -6499,25 +6491,6 @@ static ivas_error renderIsmToSplitBinaural(
        {
            return error;
        }
        }
        else
        {
            error = ivas_td_binaural_renderer_ext( &ismInput->splitTdRendWrappers[pos_idx - 1],
                                                   ismInput->base.inConfig,
                                                   NULL,
                                                   ismInput->base.ctx.pCombinedOrientationData,
                                                   &ismInput->currentPos,
                                                   NULL,
#ifdef FIX_488_SYNC_DELAY
                                                   ism_md_subframe_update_ext,
#endif
                                                   output_frame,
                                                   tmpProcessing );
            if ( error != IVAS_ERR_OK )
            {
                return error;
            }
        }

        /* Copy rendered audio to tmp storage buffer. Copying directly to output would
         * overwrite original audio, which is still needed for rendering next head pose. */