Commit a1649dba authored by multrus's avatar multrus
Browse files

[cleanup] accept FIX_488_SYNC_DELAY

parent 9d4a3fd0
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -175,9 +175,7 @@ typedef struct
    float lfeConfigElevation;
    bool lfeCustomRoutingEnabled;
    char inLfePanningMatrixFile[RENDERER_MAX_CLI_ARG_LENGTH];
#ifdef FIX_488_SYNC_DELAY
    float syncMdDelay;
#endif
    uint16_t directivityPatternId[RENDERER_MAX_ISM_INPUTS];
    uint16_t acousticEnvironmentId;
} CmdlnArgs;
@@ -208,9 +206,7 @@ typedef enum
#endif
    CmdLnOptionId_referenceVectorFile,
    CmdLnOptionId_exteriorOrientationFile,
#ifdef FIX_488_SYNC_DELAY
    CmdLnOptionId_syncMdDelay,
#endif
    CmdLnOptionId_directivityPatternId,
    CmdLnOptionId_acousticEnvironmentId
} CmdLnOptionId;
@@ -352,14 +348,12 @@ static const CmdLnParser_Option cliOptions[] = {
        .matchShort = "exof",
        .description = "External orientation trajectory file for simulation of external orientations",
    },
#ifdef FIX_488_SYNC_DELAY
    {
        .id = CmdLnOptionId_syncMdDelay,
        .match = "sync_md_delay",
        .matchShort = "smd",
        .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)",
    },
#endif
    {
        .id = CmdLnOptionId_directivityPatternId,
        .match = "ism_directivity_pattern_id",
@@ -1154,9 +1148,7 @@ int main(
    if ( args.inConfig.numAudioObjects > 0 )
    {
        IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects );
#ifdef FIX_488_SYNC_DELAY
        IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay );
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
@@ -1943,12 +1935,10 @@ int main(
    }
#endif

#ifdef FIX_488_SYNC_DELAY
    if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_REND_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) )
    {
        fprintf( stdout, "\n\nMetadata delayed %d subframes\n\n", (int16_t) round( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) );
    }
#endif

    if ( !args.quietModeEnabled && args.delayCompensationEnabled )
    {
@@ -2537,9 +2527,7 @@ static CmdlnArgs defaultArgs(
    args.lfeCustomRoutingEnabled = false;
    clearString( args.inLfePanningMatrixFile );

#ifdef FIX_488_SYNC_DELAY
    args.syncMdDelay = 0;
#endif

    for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
    {
@@ -2699,13 +2687,11 @@ static void parseOption(
            assert( numOptionValues == 1 );
            args->acousticEnvironmentId = (int16_t) strtol( optionValues[0], NULL, 10 );
            break;
#ifdef FIX_488_SYNC_DELAY
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
            /* Metadata Delay to sync with audio delay in ms */
            args->syncMdDelay = strtof( optionValues[0], NULL );
            break;
#endif
        default:
            assert( 0 && "This should be unreachable - all command line options should be explicitly handled." );
            break;
+0 −1
Original line number Diff line number Diff line
@@ -151,7 +151,6 @@
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */


#define FIX_488_SYNC_DELAY                             /* Eri: Issue 488: Waveform and MD desynchronized in external renderer */

#define FIX_550_FIRST_FRAME_ACCESS                      /* Eri: Issue 550: TD Object renderer: first frame accesses wrong transport channel offsets */
#define FIX_550_FIRST_FRAME_ACCESS_ALT                  /* Eri: Issue 550: Should be merged with FIX_550_FIRST_FRAME_ACCESS above, or accepted at the same time */
+0 −8
Original line number Diff line number Diff line
@@ -712,9 +712,7 @@ ivas_error ivas_td_binaural_renderer_ext(
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i  : Combined head and external orientations */
    const IVAS_REND_AudioObjectPosition *currentPos,             /* i  : Object position                   */
    const REVERB_HANDLE hReverb,                                 /* i  : Reverberator handle               */
#ifdef FIX_488_SYNC_DELAY
    const int16_t ism_md_subframe_update_ext, /* i: Metadata Delay in subframes to sync with audio delay */
#endif
    const int16_t output_frame, /* i  : output frame length               */
    float output[][L_FRAME48k]  /* i/o: SCE channels / Binaural synthesis */
)
@@ -727,9 +725,6 @@ ivas_error ivas_td_binaural_renderer_ext(
    IVAS_REND_AudioConfigType inConfigType;
    AUDIO_CONFIG transport_config;
    ivas_error error;
#ifndef FIX_488_SYNC_DELAY
    int16_t ism_md_subframe_update_ext;
#endif
    float *p_output[MAX_OUTPUT_CHANNELS];
    int16_t ch;

@@ -744,9 +739,6 @@ ivas_error ivas_td_binaural_renderer_ext(
    lfe_idx = LFE_CHANNEL;
    hIsmMetaData[0] = NULL;

#ifndef FIX_488_SYNC_DELAY
    ism_md_subframe_update_ext = 0;
#endif

    if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED )
    {
+0 −2
Original line number Diff line number Diff line
@@ -600,9 +600,7 @@ ivas_error ivas_td_binaural_renderer_ext(
    const COMBINED_ORIENTATION_HANDLE *hCombinedOrientationData, /* i  : Combined head and external orientations */
    const IVAS_REND_AudioObjectPosition *currentPos,            /* i  : Object position                         */
    const REVERB_HANDLE hReverb,                                /* i  : Reverberator handle                     */
#ifdef FIX_488_SYNC_DELAY
    const int16_t ism_md_subframe_update_ext,                   /* i: Metadata Delay in subframes to sync with audio delay */
#endif
    const int16_t output_frame,                                 /* i  : output frame length                     */
    float output[][L_FRAME48k]                                  /* i/o: SCE channels / Binaural synthesis       */
);
+0 −30
Original line number Diff line number Diff line
@@ -146,9 +146,7 @@ typedef struct
    float nonDiegeticPanGain;
    OMASA_ANA_HANDLE hOMasa;
    uint16_t total_num_objects;
#ifdef FIX_488_SYNC_DELAY
    float ism_metadata_delay_ms;
#endif
} input_ism;

typedef struct
@@ -5790,14 +5788,10 @@ static ivas_error renderIsmToBinaural(
{
    float tmpTDRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
#ifdef FIX_488_SYNC_DELAY
    int16_t ism_md_subframe_update_ext;
#endif
    push_wmops( "renderIsmToBinaural" );
#ifdef FIX_488_SYNC_DELAY
    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
    ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif
    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer );

    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
@@ -5806,9 +5800,7 @@ static ivas_error renderIsmToBinaural(
                                                  ismInput->base.ctx.pCombinedOrientationData,
                                                  &ismInput->currentPos,
                                                  ismInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                  ism_md_subframe_update_ext,
#endif
                                                  outAudio.config.numSamplesPerChannel,
                                                  tmpTDRendBuffer ) ) != IVAS_ERR_OK )
    {
@@ -5974,16 +5966,12 @@ static ivas_error renderIsmToBinauralReverb(
{
    float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
#ifdef FIX_488_SYNC_DELAY
    int16_t ism_md_subframe_update_ext;
#endif

    push_wmops( "renderIsmToBinauralRoom" );

#ifdef FIX_488_SYNC_DELAY
    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
    ism_md_subframe_update_ext = (int16_t) round( ismInput->ism_metadata_delay_ms / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif
    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer );

    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
@@ -5992,9 +5980,7 @@ static ivas_error renderIsmToBinauralReverb(
                                                  ismInput->base.ctx.pCombinedOrientationData,
                                                  &ismInput->currentPos,
                                                  ismInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                  ism_md_subframe_update_ext,
#endif
                                                  outAudio.config.numSamplesPerChannel,
                                                  tmpRendBuffer ) ) != IVAS_ERR_OK )
    {
@@ -6138,18 +6124,14 @@ static ivas_error renderIsmToSplitBinaural(
    float tmpBinaural[MAX_HEAD_ROT_POSES * BINAURAL_CHANNELS][L_FRAME48k];
    int16_t output_frame = ismInput->base.inputBuffer.config.numSamplesPerChannel;
    COMBINED_ORIENTATION_HANDLE pCombinedOrientationData;
#ifdef FIX_488_SYNC_DELAY
    int16_t ism_md_subframe_update_ext;
#endif

    push_wmops( "renderIsmToSplitBinaural" );

    pSplitRendWrapper = ismInput->base.ctx.pSplitRendWrapper;
    pMultiBinPoseData = &pSplitRendWrapper->multiBinPoseData;
#ifdef FIX_488_SYNC_DELAY
    /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
    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 )
@@ -6228,9 +6210,7 @@ static ivas_error renderIsmToSplitBinaural(
                                                   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 )
@@ -6246,9 +6226,7 @@ static ivas_error renderIsmToSplitBinaural(
                                                   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 )
@@ -6563,9 +6541,7 @@ static ivas_error renderMcToBinaural(
                                                      mcInput->base.ctx.pCombinedOrientationData,
                                                      NULL,
                                                      mcInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                      0,
#endif
                                                      mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -6676,9 +6652,7 @@ static ivas_error renderMcToBinauralRoom(
        if ( ( error = ivas_td_binaural_renderer_ext( &mcInput->tdRendWrapper, mcInput->base.inConfig, &mcInput->customLsInput,
                                                      mcInput->base.ctx.pCombinedOrientationData,
                                                      NULL, mcInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                      0,
#endif
                                                      mcInput->base.inputBuffer.config.numSamplesPerChannel, tmpRendBuffer ) ) != IVAS_ERR_OK )
        {
            return error;
@@ -7007,9 +6981,7 @@ static ivas_error renderMcToSplitBinaural(
                                                          &pCombinedOrientationDataLocal,
                                                          NULL,
                                                          mcInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                          0, /* Ism Audio Metadata Delay Sync in ms for External Renderer */
#endif
                                                          mcInput->base.inputBuffer.config.numSamplesPerChannel,
                                                          tmpRendBuffer ) ) != IVAS_ERR_OK )
            {
@@ -8561,7 +8533,6 @@ ivas_error IVAS_REND_SetTotalNumberOfObjects(
    return IVAS_ERR_OK;
}

#ifdef FIX_488_SYNC_DELAY
/*---------------------------------------------------------------------*
 * IVAS_REND_SetIsmMetadataDelay( )
 *
@@ -8587,7 +8558,6 @@ ivas_error IVAS_REND_SetIsmMetadataDelay(

    return IVAS_ERR_OK;
}
#endif

/*-------------------------------------------------------------------*
 * IVAS_REND_GetSamples()
Loading