Commit db676f08 authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Correct the delay printout for decoder

parent 8ebd06f7
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -364,6 +364,9 @@ 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
+8 −0
Original line number Diff line number Diff line
@@ -1594,6 +1594,14 @@ ivas_error IVAS_DEC_GetDelay(
    nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f );
    nSamples[0] = nSamples[1] + nSamples[2];

#ifdef FIX_356_ISM_METADATA_SYNC 
    if (st_ivas->ivas_format == ISM_FORMAT)
    {
        /* note: in ISM, all delay is compensated at the decoder by default, so subtract the encoder delay for print-out */
        nSamples[1] -= NS2SA(hDecoderConfig->output_Fs, IVAS_ENC_DELAY_NS);
    }
#endif

    *timeScale = hDecoderConfig->output_Fs;

    return IVAS_ERR_OK;
+2 −17
Original line number Diff line number Diff line
@@ -290,10 +290,7 @@ ivas_error ivas_td_binaural_renderer_unwrap(
    subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES;

#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t subframe_update;
    int16_t c_indx, nS;

    subframe_update = 2;
    c_indx = 0;

    for (nS = 0; nS < num_src; nS++)
@@ -313,7 +310,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 == subframe_update )
        if ( subframe_idx == ISM_METADATA_DELAY_SUBFRAME )
        {
            /* Update object position(s) */
            TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output );
@@ -335,11 +332,7 @@ 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;
        }
@@ -369,9 +362,6 @@ ivas_error TDREND_GetMix(
    float *output[], /* i/o: ISM object synth / rendered output in 0,1 */
#else
    float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */
#endif
#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           */
@@ -418,12 +408,7 @@ 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,
#ifdef FIX_356_ISM_METADATA_SYNC
                                                            subframe_update,
#endif
                                                            subframe_idx

            );
                                                            subframe_idx );
        }

        /* Render source if needed */
+1 −4
Original line number Diff line number Diff line
@@ -259,9 +259,6 @@ 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 */
)
{
@@ -357,7 +354,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 == subframe_update )
    if ( ( *intp_count > 0 ) && subframe_idx == ISM_METADATA_DELAY_SUBFRAME )
#else
    if ( ( *intp_count > 0 ) && subframe_idx == 0 )
#endif
+0 −3
Original line number Diff line number Diff line
@@ -389,9 +389,6 @@ 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,
#endif
    const int16_t subframe_idx                                  /* i  : Subframe index to 5 ms subframe         */
);