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

Move quantization of delay to lower level

parent 6bde2591
Loading
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ static const CmdLnParser_Option cliOptions[] = {
        .id = CmdLnOptionId_syncMdDelay,
        .match = "sync_md_delay",
        .matchShort = "smd",
        .description = "Metadata Synchronization Delay in ms, Default is 0",
        .description = "Metadata Synchronization Delay in ms, Default is 0. Quantized by 5ms subframes for TDRenderer (13ms -> 10ms -> 2subframes)",
    },
#endif
};
@@ -1400,6 +1400,13 @@ int main(

    fprintf( stdout, "\n\nRendering of %d frames finished\n\n", frame );

#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) floor( args.syncMdDelay / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) ) );
    }
#endif

#ifdef DEBUGGING
    int32_t cnt_frames_limited, noClipping;
    if ( ( cnt_frames_limited = IVAS_REND_GetCntFramesLimited( hIvasRend ) ) > 0 )
@@ -2054,8 +2061,8 @@ static void parseOption(
#ifdef FIX_488_SYNC_DELAY
        case CmdLnOptionId_syncMdDelay:
            assert( numOptionValues == 1 );
            /* Metadata Delay to sync with audio delay converted from ms to 5ms (1000/50/4) subframe index */
            args->syncMdDelay = (int16_t) floor( strtof( optionValues[0], NULL ) / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
            /* Metadata Delay to sync with audio delay in ms */
            args->syncMdDelay = (int16_t) strtof( optionValues[0], NULL );
            break;
#endif
        default:
+16 −4
Original line number Diff line number Diff line
@@ -4669,9 +4669,14 @@ 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 = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif
    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpTDRendBuffer );

    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
@@ -4681,7 +4686,7 @@ static ivas_error renderIsmToBinaural(
                                                  &ismInput->currentPos,
                                                  ismInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                  ismInput->ism_md_subframe_update_ext,
                                                  ism_md_subframe_update_ext,
#endif
                                                  outAudio.config.numSamplesPerChannel,
                                                  tmpTDRendBuffer ) ) != IVAS_ERR_OK )
@@ -4846,6 +4851,9 @@ static ivas_error renderIsmToBinauralReverb(
#endif
    float tmpRendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k];
    ivas_error error;
#ifdef FIX_488_SYNC_DELAY
    int16_t ism_md_subframe_update_ext;
#endif
#ifdef JBM_TSM_ON_TCS
    float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS];

@@ -4857,6 +4865,10 @@ static ivas_error renderIsmToBinauralReverb(

    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 = floor( ismInput->ism_md_subframe_update_ext / ( 1000 / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES ) );
#endif
    copyBufferTo2dArray( ismInput->base.inputBuffer, tmpRendBuffer );

    if ( ( error = ivas_td_binaural_renderer_ext( &ismInput->tdRendWrapper,
@@ -4866,7 +4878,7 @@ static ivas_error renderIsmToBinauralReverb(
                                                  &ismInput->currentPos,
                                                  ismInput->hReverb,
#ifdef FIX_488_SYNC_DELAY
                                                  ismInput->ism_md_subframe_update_ext,
                                                  ism_md_subframe_update_ext,
#endif
                                                  outAudio.config.numSamplesPerChannel,
                                                  tmpRendBuffer ) ) != IVAS_ERR_OK )