Commit 8fbd3627 authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Keep subframe update idx as a variable, not constant

parent 0a6223ab
Loading
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -364,9 +364,6 @@ typedef enum
#endif
#define ISM_EXTENDED_METADATA_BITS              1
#define ISM_METADATA_RS_MAX_FRAMES              5 /* Number of frames with opposite extended metadata flags before switching */
#ifdef FIX_356_ISM_METADATA_SYNC
#define ISM_METADATA_DELAY_SUBFRAME             2  /* Number of subframes to delay metadata to sync with audio */
#endif

/* Parametric ISM */
#define MAX_PARAM_ISM_NBANDS                    11
+7 −1
Original line number Diff line number Diff line
@@ -102,6 +102,9 @@ void ObjRenderIVASSubframe(
    float *output_f_local[BINAURAL_CHANNELS];
    float *tc_local[MAX_TRANSPORT_CHANNELS];
    int16_t ch, slot_size, slots_to_render, output_frame;
#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t subframe_update = 0;
#endif
    for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
    {
        p_reverb_signal[ch] = reverb_signal[ch];
@@ -149,8 +152,11 @@ void ObjRenderIVASSubframe(
        }

        /* Render subframe */
#ifdef FIX_356_ISM_METADATA_SYNC
        TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, subframe_update );
#else
        TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0 );

#endif
        if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */
        {
            if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on )
+21 −4
Original line number Diff line number Diff line
@@ -290,7 +290,8 @@ 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;
    int16_t c_indx, nS, subframe_update;
    subframe_update = 2;
    c_indx = 0;

    for ( nS = 0; nS < num_src; nS++ )
@@ -310,7 +311,7 @@ ivas_error ivas_td_binaural_renderer_unwrap(
    for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ )
    {
#ifdef FIX_356_ISM_METADATA_SYNC
        if ( subframe_idx == ISM_METADATA_DELAY_SUBFRAME )
        if ( subframe_idx == subframe_update )
        {
            /* Update object position(s) */
            TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData );
@@ -332,7 +333,11 @@ ivas_error ivas_td_binaural_renderer_unwrap(
        }

        /* Render subframe */
#ifdef FIX_356_ISM_METADATA_SYNC
        if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx, subframe_update ) ) != IVAS_ERR_OK )
#else
        if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK )
#endif
        {
            return error;
        }
@@ -365,6 +370,10 @@ ivas_error TDREND_GetMix(
#endif
    const int16_t subframe_length, /* i/o: subframe length                           */
    const int16_t subframe_idx     /* i  : Subframe index to 5 ms subframe           */
#ifdef FIX_356_ISM_METADATA_SYNC
    ,
    const int16_t subframe_update
#endif
)
{
    int16_t i;
@@ -379,7 +388,10 @@ ivas_error TDREND_GetMix(
#ifdef ISM_NON_DIEGETIC_PAN
    float pan_left, pan_right;
#endif

#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t subframe_update_flag;
    subframe_update_flag = subframe_idx == subframe_update;
#endif
    error = IVAS_ERR_OK;

    /* Clear the output buffer to accumulate rendered sources */
@@ -408,7 +420,12 @@ ivas_error TDREND_GetMix(
        {
            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 );
#ifdef FIX_356_ISM_METADATA_SYNC
                                                            subframe_update_flag
#else
                                                            subframe_idx
#endif
            );
        }

        /* Render source if needed */
+5 −1
Original line number Diff line number Diff line
@@ -259,7 +259,11 @@ 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_flag
#else
    const int16_t subframe_idx                         /* i  : Subframe index to 5 ms subframe */
#endif
)
{
    TDREND_MIX_Listener_t *Listener_p;
@@ -354,7 +358,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    *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 == ISM_METADATA_DELAY_SUBFRAME )
    if ( ( *intp_count > 0 ) && subframe_update_flag )
#else
    if ( ( *intp_count > 0 ) && subframe_idx == 0 )
#endif
+8 −0
Original line number Diff line number Diff line
@@ -299,6 +299,10 @@ ivas_error TDREND_GetMix(
#endif
    const int16_t subframe_length,                              /* i/o: subframe length                           */
    const int16_t subframe_idx                                  /* i  : Subframe index to 5 ms subframe           */
#ifdef FIX_356_ISM_METADATA_SYNC
    ,
    const int16_t subframe_update                               /* Number of subframes to delay metadata to sync with audio */
#endif
);

void TDREND_Update_listener_orientation(
@@ -394,7 +398,11 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    int16_t *itd,                                               /*   o: ITD value                               */
    float *Gain,                                                /*   o: Gain value                              */
    TDREND_SRC_t *Src_p,
#ifdef FIX_356_ISM_METADATA_SYNC
    const int16_t subframe_update_flag                          /* i  : Flag to determine update subframe idx   */
#else
    const int16_t subframe_idx                                  /* i  : Subframe index to 5 ms subframe         */
#endif
);

ivas_error TDREND_SRC_Alloc(