Commit 0e6b46c0 authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Update object position at subframe level

parent 00ba1339
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -337,6 +337,14 @@ void ivas_ism_reset_metadata(
    hIsmMeta->yaw = 0.0f;
    hIsmMeta->pitch = 0.0f;
    hIsmMeta->radius = 1.0f;
#ifdef FIX_356_ISM_METADATA_SYNC
    // st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f;
    hIsmMeta->prev_azimuth = 0.0f;
    hIsmMeta->prev_elevation = 0.0f;
    hIsmMeta->prev_radius = 1.0f;
    hIsmMeta->prev_yaw = 0.0f;
    hIsmMeta->prev_pitch = 0.0f;
#endif

    return;
}
+3 −0
Original line number Diff line number Diff line
@@ -227,6 +227,9 @@ ivas_error ivas_dec(
            /* Binaural rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {
#ifdef FIX_356_ISM_METADATA_SYNC
                dbgwrite( &output[0], sizeof( float ), L_FRAME48k, 1, "out.float" );
#endif
                if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK )
                {
                    return error;
+1 −8
Original line number Diff line number Diff line
@@ -556,14 +556,7 @@ ivas_error ivas_ism_metadata_dec_create(

        st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0;
        st_ivas->hIsmMetaData[ch]->last_true_elevation = 0;
#ifdef FIX_356_ISM_METADATA_SYNC
        // st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f;
        st_ivas->hIsmMetaData[ch]->prev_azimuth = 0.0f;
        st_ivas->hIsmMetaData[ch]->prev_elevation = 0.0f;
        st_ivas->hIsmMetaData[ch]->prev_radius = 1.0f;
        st_ivas->hIsmMetaData[ch]->prev_yaw = 0.0f;
        st_ivas->hIsmMetaData[ch]->prev_pitch = 0.0f;
#endif

        ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] );
    }

+31 −5
Original line number Diff line number Diff line
@@ -286,6 +286,17 @@ ivas_error ivas_td_binaural_renderer_unwrap(
    subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES;

#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t c_indx, nS;
    c_indx = 0;
    for (nS = 0; nS < num_src; nS++)
    {
        if ( !( ivas_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */
        {
            hBinRendererTd->Sources[c_indx]->InputFrame_p = output[nS];
            hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE;
            c_indx++;
        }
    }
    TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, Opt_delay_comp, output );
#else
    /* Update object position(s) */
@@ -312,7 +323,11 @@ ivas_error ivas_td_binaural_renderer_unwrap(
        }

        /* Render subframe */
#ifdef FIX_356_ISM_METADATA_SYNC
        if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_update, subframe_length, subframe_idx ) ) != IVAS_ERR_OK )
#else
        if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -339,6 +354,9 @@ ivas_error ivas_td_binaural_renderer_unwrap(
ivas_error TDREND_GetMix(
    BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle                        */
    float output[][L_FRAME48k],                        /* i/o: ISM object synth / rendered output in 0,1 */
#ifdef FIX_356_ISM_METADATA_SYNC
    const int16_t subframe_update,
#endif
    const int16_t subframe_length, /* i/o: subframe length                           */
    const int16_t subframe_idx     /* i  : Subframe index to 5 ms subframe           */
)
@@ -375,7 +393,13 @@ ivas_error TDREND_GetMix(
        if ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated )
        {
            TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev,
                                                            Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_idx );
                                                            Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p,
#ifdef FIX_356_ISM_METADATA_SYNC
                                                            subframe_update,
#endif
                                                            subframe_idx

            );
        }

        /* Render source if needed */
@@ -446,16 +470,19 @@ void TDREND_Update_object_positions(
    DirAtten_p = hBinRendererTd->DirAtten_p;

    /* For each source, write the frame data to the source object*/
#ifndef FIX_356_ISM_METADATA_SYNC
    c_indx = 0;
#endif
    for ( nS = 0; nS < num_src; nS++ )
    {
#ifndef FIX_356_ISM_METADATA_SYNC
        if ( !( in_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */
        {
            hBinRendererTd->Sources[c_indx]->InputFrame_p = output[nS];
            hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE;
            c_indx++;
        }

#endif
        if ( in_format == ISM_FORMAT )
        {
            /* Update the source positions */
@@ -485,7 +512,6 @@ void TDREND_Update_object_positions(
            TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING );

            TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir );

        }
    }

+7 −0
Original line number Diff line number Diff line
@@ -259,6 +259,9 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    int16_t *itd,                                      /*   o: ITD value                       */
    float *Gain,                                       /*   o: Gain value                      */
    TDREND_SRC_t *Src_p,                               /* i/o: Source pointer                  */
#ifdef FIX_356_ISM_METADATA_SYNC
    const int16_t subframe_update,
#endif
    const int16_t subframe_idx                         /* i  : Subframe index to 5 ms subframe */
)
{
@@ -353,7 +356,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */
    *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) );

#ifdef FIX_356_ISM_METADATA_SYNC
    if ( ( *intp_count > 0 ) && subframe_idx == subframe_update )
#else
    if ( ( *intp_count > 0 ) && subframe_idx == 0 )
#endif
    {
        /* Set deltas for interpolation */
        v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength );
Loading