Loading apps/renderer.c +30 −21 Original line number Diff line number Diff line Loading @@ -698,6 +698,7 @@ int main( SplitFileReadWrite *hSplitRendFileReadWrite; int16_t delayNumSamples_temp; int32_t delayTimeScale_temp; bool flushRendererLastFrame = false; int16_t numSamplesRead; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; Loading Loading @@ -1576,10 +1577,12 @@ int main( if ( numSamplesRead == 0 ) { /* end of input data */ break; flushRendererLastFrame = true; } /* Convert from int to float and from interleaved to packed */ if ( !flushRendererLastFrame ) { convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, Loading @@ -1587,11 +1590,12 @@ int main( inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna ); } int16_t num_subframes, sf_idx; num_subframes = (int16_t) args.render_framesize; if ( isCurrentFrameMultipleOf20ms ) if ( isCurrentFrameMultipleOf20ms && !flushRendererLastFrame ) { IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); Loading Loading @@ -1716,7 +1720,7 @@ int main( (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1733,7 +1737,7 @@ int main( (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, args.inConfig.numAudioObjects ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1752,7 +1756,7 @@ int main( (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, 1 ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1777,7 +1781,7 @@ int main( (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1795,13 +1799,13 @@ int main( (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "IVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; } if ( isCurrentFrameMultipleOf20ms ) if ( isCurrentFrameMultipleOf20ms && !flushRendererLastFrame ) { if ( masaReaders[i] != NULL ) { Loading Loading @@ -1879,7 +1883,7 @@ int main( } } if ( audioWriter != NULL ) if ( audioWriter != NULL && !flushRendererLastFrame ) { if ( delayNumSamples * num_out_channels < outBufferSize ) { Loading Loading @@ -1992,6 +1996,13 @@ int main( } } /* no new input was actually read, only delay buffers were flushed * therefore this is not a real frame */ if ( flushRendererLastFrame ) { break; } frame++; if ( !args.quietModeEnabled ) { Loading @@ -2004,14 +2015,13 @@ int main( #endif } /* TODO a flush method is needed to empty the delay buffers */ /* add zeros at the end to have equal length of synthesized signals */ /* add zeros at the end to have equal length of synthesized signals * the output buffer will contain either leftover input samples from delay aligned inputs * or zeros for padding */ if ( audioWriter != NULL ) { for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls ) { memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); Loading @@ -2019,7 +2029,6 @@ int main( } } memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); Loading lib_rend/lib_rend.c +11 −8 Original line number Diff line number Diff line Loading @@ -1348,7 +1348,8 @@ static ivas_error alignInputDelay( const IVAS_REND_ReadOnlyAudioBuffer inputAudio, const int32_t maxGlobalDelayNs, const int32_t sampleRateOut, const int16_t cldfb2tdSampleFact ) const int16_t cldfb2tdSampleFact, const bool flushInputs ) { ivas_error error; input_ism *inputIsm; Loading Loading @@ -1381,7 +1382,7 @@ static ivas_error alignInputDelay( if ( getAudioConfigType( inputBase->inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) { inputIsm = (input_ism *) inputBase; inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs * 1000; inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs * 1000.f; } } Loading @@ -1391,7 +1392,7 @@ static ivas_error alignInputDelay( inputAudio.config.numSamplesPerChannel ); TD_RINGBUF_Pop( inputBase->delayBuffer, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel ); flushInputs ? TD_RINGBUF_Size( inputBase->delayBuffer ) : inputAudio.config.numSamplesPerChannel ); return IVAS_ERR_OK; } Loading Loading @@ -4134,7 +4135,8 @@ ivas_error IVAS_REND_GetDelay( ivas_error IVAS_REND_FeedInputAudio( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio, /* i : buffer with input audio */ const bool flushInputs /* i : flush input audio */ ) { ivas_error error; Loading Loading @@ -4195,7 +4197,8 @@ ivas_error IVAS_REND_FeedInputAudio( inputAudio, hIvasRend->maxGlobalDelayNs, hIvasRend->sampleRateOut, cldfb2tdSampleFact ) ) != IVAS_ERR_OK ) cldfb2tdSampleFact, flushInputs ) ) != IVAS_ERR_OK ) { return error; } Loading lib_rend/lib_rend.h +16 −15 Original line number Diff line number Diff line Loading @@ -221,7 +221,8 @@ ivas_error IVAS_REND_GetHrtfStatisticsHandle( ivas_error IVAS_REND_FeedInputAudio( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio, /* i : buffer with input audio */ const bool flushInputs /* i : flush input audio */ ); ivas_error IVAS_REND_FeedInputObjectMetadata( Loading Loading
apps/renderer.c +30 −21 Original line number Diff line number Diff line Loading @@ -698,6 +698,7 @@ int main( SplitFileReadWrite *hSplitRendFileReadWrite; int16_t delayNumSamples_temp; int32_t delayTimeScale_temp; bool flushRendererLastFrame = false; int16_t numSamplesRead; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; Loading Loading @@ -1576,10 +1577,12 @@ int main( if ( numSamplesRead == 0 ) { /* end of input data */ break; flushRendererLastFrame = true; } /* Convert from int to float and from interleaved to packed */ if ( !flushRendererLastFrame ) { convertInputBuffer( inpInt16Buffer, numSamplesRead, inBuffer.config.numSamplesPerChannel, Loading @@ -1587,11 +1590,12 @@ int main( inFloatBuffer, inBuffer.config.is_cldfb, cldfbAna ); } int16_t num_subframes, sf_idx; num_subframes = (int16_t) args.render_framesize; if ( isCurrentFrameMultipleOf20ms ) if ( isCurrentFrameMultipleOf20ms && !flushRendererLastFrame ) { IsmPositionProvider_getNextFrame( positionProvider, &mtdBuffer ); Loading Loading @@ -1716,7 +1720,7 @@ int main( (int16_t) args.inConfig.multiChannelBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, mcIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1733,7 +1737,7 @@ int main( (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, args.inConfig.numAudioObjects ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1752,7 +1756,7 @@ int main( (int16_t) args.inConfig.audioObjects[i].inputChannelIndex, 1 ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, ismIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1777,7 +1781,7 @@ int main( (int16_t) args.inConfig.ambisonicsBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, sbaIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; Loading @@ -1795,13 +1799,13 @@ int main( (int16_t) args.inConfig.masaBuses[i].inputChannelIndex, numChannels ); if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_FeedInputAudio( hIvasRend, masaIds[i], tmpBuffer, flushRendererLastFrame ) ) != IVAS_ERR_OK ) { fprintf( stderr, "IVAS_REND_FeedInputAudio failed: %s\n", ivas_error_to_string( error ) ); goto cleanup; } if ( isCurrentFrameMultipleOf20ms ) if ( isCurrentFrameMultipleOf20ms && !flushRendererLastFrame ) { if ( masaReaders[i] != NULL ) { Loading Loading @@ -1879,7 +1883,7 @@ int main( } } if ( audioWriter != NULL ) if ( audioWriter != NULL && !flushRendererLastFrame ) { if ( delayNumSamples * num_out_channels < outBufferSize ) { Loading Loading @@ -1992,6 +1996,13 @@ int main( } } /* no new input was actually read, only delay buffers were flushed * therefore this is not a real frame */ if ( flushRendererLastFrame ) { break; } frame++; if ( !args.quietModeEnabled ) { Loading @@ -2004,14 +2015,13 @@ int main( #endif } /* TODO a flush method is needed to empty the delay buffers */ /* add zeros at the end to have equal length of synthesized signals */ /* add zeros at the end to have equal length of synthesized signals * the output buffer will contain either leftover input samples from delay aligned inputs * or zeros for padding */ if ( audioWriter != NULL ) { for ( zeroPadToWrite = zeroPad; zeroPadToWrite > frameSize_smpls; zeroPadToWrite -= frameSize_smpls ) { memset( outInt16Buffer, 0, outBufferSize * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, outBufferSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); Loading @@ -2019,7 +2029,6 @@ int main( } } memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); Loading
lib_rend/lib_rend.c +11 −8 Original line number Diff line number Diff line Loading @@ -1348,7 +1348,8 @@ static ivas_error alignInputDelay( const IVAS_REND_ReadOnlyAudioBuffer inputAudio, const int32_t maxGlobalDelayNs, const int32_t sampleRateOut, const int16_t cldfb2tdSampleFact ) const int16_t cldfb2tdSampleFact, const bool flushInputs ) { ivas_error error; input_ism *inputIsm; Loading Loading @@ -1381,7 +1382,7 @@ static ivas_error alignInputDelay( if ( getAudioConfigType( inputBase->inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED ) { inputIsm = (input_ism *) inputBase; inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs * 1000; inputIsm->ism_metadata_delay_ms = maxGlobalDelayNs * 1000.f; } } Loading @@ -1391,7 +1392,7 @@ static ivas_error alignInputDelay( inputAudio.config.numSamplesPerChannel ); TD_RINGBUF_Pop( inputBase->delayBuffer, inputBase->inputBuffer.data, inputAudio.config.numSamplesPerChannel ); flushInputs ? TD_RINGBUF_Size( inputBase->delayBuffer ) : inputAudio.config.numSamplesPerChannel ); return IVAS_ERR_OK; } Loading Loading @@ -4134,7 +4135,8 @@ ivas_error IVAS_REND_GetDelay( ivas_error IVAS_REND_FeedInputAudio( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio, /* i : buffer with input audio */ const bool flushInputs /* i : flush input audio */ ) { ivas_error error; Loading Loading @@ -4195,7 +4197,8 @@ ivas_error IVAS_REND_FeedInputAudio( inputAudio, hIvasRend->maxGlobalDelayNs, hIvasRend->sampleRateOut, cldfb2tdSampleFact ) ) != IVAS_ERR_OK ) cldfb2tdSampleFact, flushInputs ) ) != IVAS_ERR_OK ) { return error; } Loading
lib_rend/lib_rend.h +16 −15 Original line number Diff line number Diff line Loading @@ -221,7 +221,8 @@ ivas_error IVAS_REND_GetHrtfStatisticsHandle( ivas_error IVAS_REND_FeedInputAudio( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_REND_InputId inputId, /* i : ID of the input */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio /* i : buffer with input audio */ const IVAS_REND_ReadOnlyAudioBuffer inputAudio, /* i : buffer with input audio */ const bool flushInputs /* i : flush input audio */ ); ivas_error IVAS_REND_FeedInputObjectMetadata( Loading