Commit 343bb6a7 authored by Sumeyra Demir Kanik's avatar Sumeyra Demir Kanik
Browse files

Merge branch '356-ism-audio-and-meta-out-of-sync-in-decoder' into 'main'

Resolve "ISM audio and meta out-of-sync in decoder" [Non-BE] [Rend non-BE]

See merge request !676
parents bed1c9a0 99da7bb2
Loading
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -388,12 +388,20 @@ int main(
    /*------------------------------------------------------------------------------------------*
     * Configure the decoder
     *------------------------------------------------------------------------------------------*/

#ifdef FIX_356_ISM_METADATA_SYNC
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
#else
#ifdef FIX_439_OTR_PARAMS
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK )
#endif
#endif

    {
        fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) );
        goto cleanup;
+0 −14
Original line number Diff line number Diff line
@@ -69,17 +69,10 @@ int32_t get_delay(
        {
            delay = IVAS_ENC_DELAY_NS;

#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA/ISM */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay = 0; /* All delay is compensated in the decoder with MASA */
            }
#endif
        }

        if ( ivas_format == SBA_FORMAT )
@@ -111,17 +104,10 @@ int32_t get_delay(
                delay += IVAS_FB_DEC_DELAY_NS;
            }

#ifdef FIX_356_ISM_METADATA_SYNC
            if ( ivas_format == ISM_FORMAT || ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with ISM/MASA */
            }
#else
            if ( ivas_format == MASA_FORMAT )
            {
                delay += IVAS_ENC_DELAY_NS; /* Compensate also the encoder delay in the decoder with MASA */
            }
#endif
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -268,6 +268,7 @@ ivas_error ivas_dec(
            /* Binaural rendering */
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD )
            {

#ifdef JBM_TSM_ON_TCS
                if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK )
#else
+22 −2
Original line number Diff line number Diff line
@@ -76,7 +76,16 @@ ivas_error ivas_td_binaural_renderer(
)
{
#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t ism_md_subframe_update = 2;
    int16_t ism_md_subframe_update;

    if ( st_ivas->hDecoderConfig->Opt_delay_comp )
    {
        ism_md_subframe_update = 1;
    }
    else
    {
        ism_md_subframe_update = 2;
    }
    return ivas_td_binaural_renderer_unwrap(
        st_ivas->hReverb,
        st_ivas->transport_config,
@@ -113,8 +122,19 @@ void ObjRenderIVASSubframe(
    float *tc_local[MAX_TRANSPORT_CHANNELS];
    int16_t ch, slot_size, slots_to_render, output_frame;
#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2; /* Number of subframes to delay metadata to sync with audio */
    int16_t ism_md_subframe_update_jbm;
    int16_t c_indx, nS;

    /* Number of subframes to delay metadata to sync with audio */
    if ( st_ivas->hDecoderConfig->Opt_delay_comp )
    {
        ism_md_subframe_update_jbm = max( 0, st_ivas->hTcBuffer->nb_subframes - 3 );
    }
    else
    {
        ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2;
    }

#endif
    for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
    {
+3 −1
Original line number Diff line number Diff line
@@ -1224,7 +1224,9 @@ typedef struct decoder_config_structure
#ifdef JBM_TSM_ON_TCS
    int16_t voip_active;
#endif

#ifdef FIX_356_ISM_METADATA_SYNC
    int16_t Opt_delay_comp; /* flag indicating delay compensation active */
#endif
} DECODER_CONFIG, *DECODER_CONFIG_HANDLE;


Loading