diff --git a/apps/renderer.c b/apps/renderer.c index 24967f2cd2dabc7691cc683f4fe6e64ca1342794..2676cb752162ededbe6986a58313ff26832a96e7 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -433,8 +433,7 @@ static int16_t getTotalNumInChannels( IVAS_REND_InputId mcIds[RENDERER_MAX_MC_INPUTS], IVAS_REND_InputId ismIds[RENDERER_MAX_ISM_INPUTS], IVAS_REND_InputId sbaIds[RENDERER_MAX_SBA_INPUTS], - IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] -) + IVAS_REND_InputId masaIds[RENDERER_MAX_MASA_INPUTS] ) { int16_t totalNumInChannels = 0; int16_t i, numInputChannels; @@ -520,8 +519,7 @@ static void setupWithSingleFormatInput( CmdlnArgs args, char *audioFilePath, IsmPositionProvider *positionProvider, - MasaFileReader **masaReaders -) + MasaFileReader **masaReaders ) { /* With single-format input, inputFilePath is the path to input audio file. */ strncpy( audioFilePath, args.inputFilePath, FILENAME_MAX - 1 ); @@ -580,8 +578,6 @@ static float dBToLin( } - - /*------------------------------------------------------------------------------------------* * main() * @@ -641,6 +637,8 @@ int main( lfeRoutingConfigs[i] = NULL; } + IVAS_REND_PrintDisclaimer(); + CmdlnArgs args = parseCmdlnArgs( argc, argv ); if ( args.nonDiegeticPan && !( ( args.inConfig.numAudioObjects == 0 && args.inConfig.multiChannelBuses[0].audioConfig == IVAS_AUDIO_CONFIG_MONO ) || @@ -749,14 +747,14 @@ int main( } } - if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error opening file: %s\n", audioFilePath ); - exit( -1 ); - } + if ( AudioFileReader_open( &audioReader, audioFilePath ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Error opening file: %s\n", audioFilePath ); + exit( -1 ); + } int32_t inFileSampleRate = 0; - error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); + error = AudioFileReader_getSamplingRate( audioReader, &inFileSampleRate ); switch ( error ) { @@ -786,12 +784,12 @@ int main( } int16_t inFileNumChannels = 0; - error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); - if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) - { - fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); - exit( -1 ); - } + error = AudioFileReader_getNumChannels( audioReader, &inFileNumChannels ); + if ( error != IVAS_ERR_OK && error != IVAS_ERR_NUM_CHANNELS_UNKNOWN ) + { + fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) ); + exit( -1 ); + } const int16_t frameSize_smpls = (int16_t) ( ( args.render_framesize ) * args.sampleRate * 5 / ( 1000 ) ); if ( ( error = IVAS_REND_Open( &hIvasRend, args.sampleRate, args.outConfig.audioConfig, args.nonDiegeticPan, args.nonDiegeticPanGain, (int16_t) args.render_framesize ) ) != IVAS_ERR_OK ) @@ -800,6 +798,48 @@ int main( exit( -1 ); } + fprintf( stdout, "Input audio file: %s\n", args.inputFilePath ); + fprintf( stdout, "Output audio file: %s\n\n", args.outputFilePath ); + + if ( args.inConfig.numAudioObjects > 0 ) + { + if ( args.inConfig.numAudioObjects == 1 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM1 ); + } + else if ( args.inConfig.numAudioObjects == 2 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM2 ); + } + else if ( args.inConfig.numAudioObjects == 3 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM3 ); + } + else if ( args.inConfig.numAudioObjects == 4 ) + { + IVAS_REND_PrintInputConfig( IVAS_AUDIO_CONFIG_ISM4 ); + } + } + for ( i = 0; i < args.inConfig.numMultiChannelBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.multiChannelBuses[i].audioConfig ); + } + for ( i = 0; i < args.inConfig.numMasaBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.masaBuses[i].audioConfig ); + } + for ( i = 0; i < args.inConfig.numAmbisonicsBuses; i++ ) + { + IVAS_REND_PrintInputConfig( args.inConfig.ambisonicsBuses[i].audioConfig ); + } + + if ( ( error = IVAS_REND_PrintConfig( hIvasRend ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\n IVAS_REND_PrintConfig failed: %s\n\n", ivas_error_to_string( error ) ); + //goto cleanup; + exit( -1 ); + } + /* === Configure === */ if ( ( error = IVAS_REND_InitConfig( hIvasRend, args.outConfig.audioConfig ) ) != IVAS_ERR_OK ) { @@ -855,7 +895,6 @@ int main( fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed\n" ); exit( -1 ); } - } if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) @@ -1091,11 +1130,11 @@ int main( } - if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); - exit( -1 ); - } + if ( AudioFileWriter_open( &audioWriter, args.outputFilePath, args.sampleRate, numOutChannels ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to open file: %s\n", args.outputFilePath ); + exit( -1 ); + } inBufferSize = frameSize_smpls * totalNumInChannels; outBufferSize = frameSize_smpls * numOutChannels; @@ -1136,12 +1175,12 @@ int main( num_in_channels = inBuffer.config.numChannels; const bool isCurrentFrameMultipleOf20ms = frame % ( 4 / args.render_framesize ) == 0; - /* Read the input data */ - if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); - exit( -1 ); - } + /* Read the input data */ + if ( ( error = AudioFileReader_read( audioReader, inpInt16Buffer, (int16_t) inBufferSize, &numSamplesRead ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError reading from file %s\n", audioFilePath ); + exit( -1 ); + } if ( numSamplesRead == 0 && splitBinNeedsNewFrame ) { @@ -1366,12 +1405,11 @@ int main( } - - if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) - { + if ( ( error = IVAS_REND_GetSamples( hIvasRend, outBuffer ) ) != IVAS_ERR_OK ) + { fprintf( stderr, "Error in getting samples\n" ); - exit( -1 ); - } + exit( -1 ); + } int16_t num_out_channels; num_out_channels = outBuffer.config.numChannels; @@ -1400,19 +1438,19 @@ int main( zeroPad = delayNumSamples; } - if ( delayNumSamples * num_out_channels < outBufferSize ) - { - if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); - exit( -1 ); - } - delayNumSamples = 0; - } - else + if ( delayNumSamples * num_out_channels < outBufferSize ) + { + if ( AudioFileWriter_write( audioWriter, &outInt16Buffer[delayNumSamples * num_out_channels], outBufferSize - ( delayNumSamples * num_out_channels ) ) != IVAS_ERR_OK ) { - delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels ); + fprintf( stderr, "Error writing audio file %s\n", args.outputFilePath ); + exit( -1 ); } + delayNumSamples = 0; + } + else + { + delayNumSamples -= (int16_t) ( outBufferSize / num_out_channels ); + } /* Write MASA metadata for MASA outputs */ if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_MASA1 || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) @@ -1517,23 +1555,23 @@ int main( } /* add zeros at the end to have equal length of synthesized signals */ - 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" ); - exit( -1 ); - } - } - - memset( outInt16Buffer, 0, zeroPadToWrite * outBuffer.config.numChannels * sizeof( int16_t ) ); - if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPadToWrite * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) + 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" ); exit( -1 ); } - zeroPadToWrite = 0; + } + + 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" ); + exit( -1 ); + } + zeroPadToWrite = 0; if ( args.inConfig.numAudioObjects != 0 && ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL || args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) @@ -3270,29 +3308,28 @@ static void convertInputBuffer( const int16_t numIntSamplesPerChannel, const int16_t numFloatSamplesPerChannel, const int16_t numChannels, - float *floatBuffer -) + float *floatBuffer ) { int16_t chnl, smpl, i; i = 0; - for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) + for ( smpl = 0; smpl < numFloatSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( chnl = 0; chnl < numChannels; ++chnl ) + if ( i < numIntSamplesPerChannel ) { - if ( i < numIntSamplesPerChannel ) - { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; - } - else - { - floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; - } - - ++i; + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = (float) intBuffer[i]; + } + else + { + floatBuffer[chnl * numFloatSamplesPerChannel + smpl] = 0.f; } + + ++i; } + } return; } @@ -3308,33 +3345,32 @@ static void convertOutputBuffer( const float *floatBuffer, const int16_t numSamplesPerChannel, const int16_t numChannels, - int16_t *intBuffer -) + int16_t *intBuffer ) { int16_t chnl, smpl, i; float temp; i = 0; - for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) + for ( smpl = 0; smpl < numSamplesPerChannel; ++smpl ) + { + for ( chnl = 0; chnl < numChannels; ++chnl ) { - for ( chnl = 0; chnl < numChannels; ++chnl ) + temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; + temp = (float) floor( temp + 0.5f ); + if ( temp > IVAS_MAX16B_FLT ) { - temp = floatBuffer[chnl * numSamplesPerChannel + smpl]; - temp = (float) floor( temp + 0.5f ); - if ( temp > IVAS_MAX16B_FLT ) - { - temp = IVAS_MAX16B_FLT; - } - else if ( temp < IVAS_MIN16B_FLT ) - { - temp = IVAS_MIN16B_FLT; - } - intBuffer[i] = (int16_t) temp; - - ++i; + temp = IVAS_MAX16B_FLT; + } + else if ( temp < IVAS_MIN16B_FLT ) + { + temp = IVAS_MIN16B_FLT; } + intBuffer[i] = (int16_t) temp; + + ++i; } + } return; } diff --git a/lib_com/disclaimer.c b/lib_com/disclaimer.c index 10a31d94c079da17168d2a3c79591fadc728f47b..5587bdd090f72b558a14d5356b3e027ab168f98f 100644 --- a/lib_com/disclaimer.c +++ b/lib_com/disclaimer.c @@ -47,7 +47,7 @@ int16_t print_disclaimer( FILE *fPtr ) { fprintf( fPtr, "\n==================================================================================================\n" ); - fprintf( fPtr, " IVAS Codec Baseline\n" ); + fprintf( fPtr, " \n IVAS Codec Version IVAS-FL-1.0\n" ); fprintf( fPtr, " \n" ); fprintf( fPtr, " Based on EVS Codec (Floating Point) 3GPP TS26.443 Nov 04, 2021,\n" ); fprintf( fPtr, " Version 12.14.0 / 13.10.0 / 14.6.0 / 15.4.0 / 16.3.0\n" ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index 000ed618adff56f97e600cf89bee487ee68d3425..2858051cbe93ae6bf39e945ff34e0abcaab93d63 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -40,7 +40,6 @@ #include "jbm_pcmdsp_fifo.h" #include #include -#include #ifdef DEBUGGING #include "debug.h" #endif @@ -347,11 +346,11 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const AUDIO_CONFIG outputConfig, /* i : output configuration */ - const int16_t tsmEnabled, /* i : enable time scale modification */ - const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const AUDIO_CONFIG outputConfig, /* i : output configuration */ + const int16_t tsmEnabled, /* i : enable time scale modification */ + const IVAS_RENDER_FRAMESIZE renderFramesize, /* i : rendering frame size */ const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ @@ -458,7 +457,6 @@ ivas_error IVAS_DEC_Configure( } - /*---------------------------------------------------------------------* * get_render_framesize_ms( ) * @@ -780,9 +778,9 @@ ivas_error IVAS_DEC_FeedFrame_Serial( ivas_error IVAS_DEC_GetSamples( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesAsked, /* i : number of samples wanted by the caller */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ - bool *needNewFrame /* o :indication that the decoder needs a new frame */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + int16_t *nOutSamples, /* o : number of samples per channel written to output buffer */ + bool *needNewFrame /* o :indication that the decoder needs a new frame */ ) { ivas_error error; @@ -938,8 +936,6 @@ ivas_error IVAS_DEC_GetSamples( } - - /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * @@ -952,7 +948,7 @@ static ivas_error IVAS_DEC_Setup( uint8_t *nTransportChannels, /* o : number of decoded transport PCM channels */ uint8_t *nOutChannels, /* o : number of decoded out channels (PCM or CLDFB) */ uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame */ - int16_t *data /* o : output synthesis signal */ + int16_t *data /* o : output synthesis signal */ ) { ivas_error error; @@ -1094,8 +1090,7 @@ static ivas_error IVAS_DEC_GetRenderedSamples( const uint16_t nSamplesForRendering, /* i : number of TC samples wanted from the renderer */ uint16_t *nSamplesRendered, /* o : number of samples rendered */ uint16_t *nSamplesAvailableNext, /* o : number of samples still available in the renerer pipeline */ - int16_t *pcmBuf -) + int16_t *pcmBuf ) { Decoder_Struct *st_ivas; ivas_error error; @@ -1386,7 +1381,7 @@ ivas_error IVAS_DEC_FeedHeadTrackData( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ IVAS_QUATERNION orientation, /* i : head-tracking data, listener orientation */ IVAS_VECTOR3 Pos, /* i : listener position */ - const int16_t subframe_idx /* i : subframe index */ + const int16_t subframe_idx /* i : subframe index */ ) { HEAD_TRACK_DATA_HANDLE hHeadTrackData; @@ -2104,9 +2099,9 @@ ivas_error IVAS_DEC_TSM_SetQuality( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_VoIP_GetSamples( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ #ifdef SUPPORT_JBM_TRACEFILE , @@ -2291,8 +2286,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( ivas_error IVAS_DEC_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ - int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ - int16_t *nSamplesFlushed /* o : number of samples flushed */ + int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ + int16_t *nSamplesFlushed /* o : number of samples flushed */ ) { ivas_error error; @@ -2453,85 +2448,6 @@ const char *IVAS_DEC_GetErrorMessage( } -/*---------------------------------------------------------------------* - * get_channel_config() - * - * Gets a str related to input config - *---------------------------------------------------------------------*/ - -static ivas_error get_channel_config( - AUDIO_CONFIG config, - char *str ) -{ - if ( config == IVAS_AUDIO_CONFIG_MONO ) - { - strcpy( str, "Mono" ); - } - else if ( config == IVAS_AUDIO_CONFIG_STEREO ) - { - strcpy( str, "Stereo" ); - } - else if ( config == IVAS_AUDIO_CONFIG_5_1 ) - { - strcpy( str, "Multichannel 5.1 (CICP6)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_7_1 ) - { - strcpy( str, "Multichannel 7.1 (CICP12)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_5_1_2 ) - { - strcpy( str, "Multichannel 5.1+2 (CICP14)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_5_1_4 ) - { - strcpy( str, "Multichannel 5.1+4 (CICP16)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_7_1_4 ) - { - strcpy( str, "Multichannel 7.1+4 (CICP19)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) - { - strcpy( str, "Multichannel (custom loudspeaker layout)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_FOA ) - { - strcpy( str, "Ambisonics: First Order (FOA)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_HOA2 ) - { - strcpy( str, "Ambisonics: Second Order (HOA2)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_HOA3 ) - { - strcpy( str, "Ambisonics: Third Order (HOA3)" ); - } - else if ( config == IVAS_AUDIO_CONFIG_BINAURAL ) - { - strcpy( str, "Binaural: no room" ); - } - else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) - { - strcpy( str, "Binaural: room with impulse responses" ); - } - else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) - { - strcpy( str, "Binaural: room with reverb" ); - } - else if ( config == IVAS_AUDIO_CONFIG_EXTERNAL ) - { - strcpy( str, "External renderer" ); - } - else - { - return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" ); - } - - return IVAS_ERR_OK; -} - - /*---------------------------------------------------------------------* * printConfigInfo_dec( ) * @@ -3216,7 +3132,3 @@ static ivas_error IVAS_DEC_VoIP_reconfigure( return IVAS_ERR_OK; } - - - - diff --git a/lib_rend/ivas_output_init.c b/lib_rend/ivas_output_init.c index 3c92765d421e9d8d6e56b8ba0227203bd27c1dda..2e53001449ed54c9416abf074cbf129d915e6286 100644 --- a/lib_rend/ivas_output_init.c +++ b/lib_rend/ivas_output_init.c @@ -37,6 +37,7 @@ #include "ivas_prot_rend.h" #include "ivas_rom_com.h" #include "ivas_prot.h" +#include #ifdef DEBUGGING #include "debug.h" #include @@ -435,3 +436,114 @@ ivas_error ivas_output_buff_dec( return IVAS_ERR_OK; } + + +/*---------------------------------------------------------------------* + * get_channel_config() + * + * Gets a str related to input config + *---------------------------------------------------------------------*/ + +ivas_error get_channel_config( + const AUDIO_CONFIG config, + char *str ) +{ + if ( config == IVAS_AUDIO_CONFIG_MONO ) + { + strcpy( str, "Mono" ); + } + else if ( config == IVAS_AUDIO_CONFIG_STEREO ) + { + strcpy( str, "Stereo" ); + } + else if ( config == IVAS_AUDIO_CONFIG_ISM1 ) + { + strcpy( str, "Object-based audio (1 object)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_ISM2 ) + { + strcpy( str, "Object-based audio (2 objects)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_ISM3 ) + { + strcpy( str, "Object-based audio (3 objects)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_ISM4 ) + { + strcpy( str, "Object-based audio (4 objects)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_5_1 ) + { + strcpy( str, "Multichannel 5.1 (CICP6)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_7_1 ) + { + strcpy( str, "Multichannel 7.1 (CICP12)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_5_1_2 ) + { + strcpy( str, "Multichannel 5.1+2 (CICP14)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_5_1_4 ) + { + strcpy( str, "Multichannel 5.1+4 (CICP16)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_7_1_4 ) + { + strcpy( str, "Multichannel 7.1+4 (CICP19)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_LS_CUSTOM ) + { + strcpy( str, "Multichannel (custom loudspeaker layout)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_MASA1 ) + { + strcpy( str, "Metadata-Assisted Spatial Audio mono (MASA1)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_MASA2 ) + { + strcpy( str, "Metadata-Assisted Spatial Audio stereo (MASA2)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_FOA ) + { + strcpy( str, "Ambisonics: First Order (FOA)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_HOA2 ) + { + strcpy( str, "Ambisonics: Second Order (HOA2)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_HOA3 ) + { + strcpy( str, "Ambisonics: Third Order (HOA3)" ); + } + else if ( config == IVAS_AUDIO_CONFIG_BINAURAL ) + { + strcpy( str, "Binaural: no room" ); + } + else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + { + strcpy( str, "Binaural: room with impulse responses" ); + } + else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + { + strcpy( str, "Binaural: room with reverb" ); + } + else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) + { + strcpy( str, "BINAURAL_SPLIT_CODED" ); + } + else if ( config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + strcpy( str, "Binaural_Split_PCM" ); + } + else if ( config == IVAS_AUDIO_CONFIG_EXTERNAL ) + { + strcpy( str, "External renderer" ); + } + else + { + return IVAS_ERROR( IVAS_ERR_INVALID_OUTPUT_FORMAT, "Error: Incorrect Input/Output Configuration" ); + } + + return IVAS_ERR_OK; +} diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ef1e6f7f3cbd8c3f1dc635839ccdb0b38ffdc193..20c375b611f9453891efc9b85e9af2bdd1c2476e 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -77,6 +77,12 @@ int16_t ivas_get_nchan_buffers_dec( const int32_t ivas_total_brate /* i : total IVAS bitrate */ ); +ivas_error get_channel_config( + const AUDIO_CONFIG config, + char *str +); + + /*----------------------------------------------------------------------------------* * Limiter prototypes *----------------------------------------------------------------------------------*/ @@ -1532,7 +1538,6 @@ void masaPrerendClose( ); - /* clang-format on */ #endif /* IVAS_PROT_REND_H */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index ce38f288d46087cb6199c6d51b8f8f0ec4e880a3..1ec24b43efb9476e66901c49cbafef263cb48a7d 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -170,7 +170,6 @@ typedef struct } input_sba; - typedef struct { input_base base; @@ -486,17 +485,17 @@ static ivas_error validateOutputSampleRate( return IVAS_ERR_OK; } - /* Otherwise rendering to binaural, support the same set as IVAS decoder */ - switch ( sampleRate ) - { - case 8000: - case 16000: - case 32000: - case 48000: - return IVAS_ERR_OK; - } + /* Otherwise rendering to binaural, support the same set as IVAS decoder */ + switch ( sampleRate ) + { + case 8000: + case 16000: + case 32000: + case 48000: + return IVAS_ERR_OK; + } - return IVAS_ERR_INVALID_SAMPLING_RATE; + return IVAS_ERR_INVALID_SAMPLING_RATE; } @@ -2268,8 +2267,6 @@ static ivas_error initSbaPanGainsForSbaOut( } - - static ivas_error updateSbaPanGains( input_sba *inputSba, const AUDIO_CONFIG outConfig, @@ -2297,14 +2294,14 @@ static ivas_error updateSbaPanGains( switch ( outConfig ) { case IVAS_AUDIO_CONFIG_BINAURAL: - { + { if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, NULL, *rendCtx.pOutSampleRate ) ) != IVAS_ERR_OK ) - { - return error; - } + { + return error; } - break; + } + break; case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: if ( ( error = initSbaPanGainsForMcOut( inputSba, IVAS_AUDIO_CONFIG_7_1_4, NULL ) ) != IVAS_ERR_OK ) @@ -2338,8 +2335,6 @@ static ivas_error updateSbaPanGains( } - - static ivas_error initSbaMasaRendering( input_sba *inputSba, int32_t inSampleRate ) @@ -2407,8 +2402,6 @@ static ivas_error setRendInputActiveSba( } - - static void clearInputSba( input_sba *inputSba ) { @@ -2502,8 +2495,6 @@ static void clearInputMasa( } - - /*------------------------------------------------------------------------- * IVAS_REND_Open() * @@ -3015,8 +3006,6 @@ static ivas_error findFreeInputSlot( } - - /*-------------------------------------------------------------------* * IVAS_REND_AddInput() * @@ -3792,8 +3781,6 @@ int16_t IVAS_REND_FeedRenderConfig( } - - /*-------------------------------------------------------------------* * IVAS_REND_SetHeadRotation() * @@ -3804,7 +3791,7 @@ ivas_error IVAS_REND_SetHeadRotation( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const IVAS_QUATERNION headRot, /* i : head orientations for next rendering call */ const IVAS_VECTOR3 Pos, /* i : listener positions for next rendering call */ - const int16_t sf_idx /* i : subframe index */ + const int16_t sf_idx /* i : subframe index */ ) { int16_t i; @@ -3900,8 +3887,6 @@ ivas_error IVAS_REND_DisableHeadRotation( } - - /*-------------------------------------------------------------------* * IVAS_REND_SetOrientationTrackingMode() * @@ -4840,8 +4825,6 @@ static ivas_error renderIsmToSba( } - - static void renderIsmToMasa( input_ism *ismInput, IVAS_REND_AudioBuffer outAudio ) @@ -5354,8 +5337,6 @@ static void renderMcToMasa( } - - static ivas_error renderInputMc( input_mc *mcInput, const AUDIO_CONFIG outConfig, @@ -5486,7 +5467,6 @@ static void renderSbaToSba( } - static ivas_error renderSbaToBinaural( input_sba *sbaInput, const AUDIO_CONFIG outConfig, @@ -5658,8 +5638,6 @@ static ivas_error renderSbaToBinauralRoom( } - - static void renderSbaToMasa( input_sba *sbaInput, IVAS_REND_AudioBuffer outAudio ) @@ -5732,8 +5710,6 @@ static ivas_error renderInputSba( } - - static ivas_error renderActiveInputsSba( IVAS_REND_HANDLE hIvasRend, IVAS_REND_AudioBuffer outAudio ) @@ -5980,25 +5956,25 @@ static ivas_error renderInputMasa( num_subframes = (int16_t) ( masaInput->base.inputBuffer.config.numSamplesPerChannel / ( *masaInput->base.ctx.pOutSampleRate / ( IVAS_NUM_FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ) ); - switch ( masaInput->hMasaExtRend->renderer_type ) - { - case RENDERER_DIRAC: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); - ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); - break; - case RENDERER_STEREO_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC: - case RENDERER_BINAURAL_PARAMETRIC_ROOM: - copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + switch ( masaInput->hMasaExtRend->renderer_type ) + { + case RENDERER_DIRAC: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); + ivas_masa_ext_dirac_render( masaInput->hMasaExtRend, tmpBuffer, num_subframes ); + break; + case RENDERER_STEREO_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC: + case RENDERER_BINAURAL_PARAMETRIC_ROOM: + copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->hMasaExtRend->hSpatParamRendCom, maxBin ); ivas_masa_ext_rend_parambin_render( masaInput->hMasaExtRend, *masaInput->base.ctx.pCombinedOrientationData, tmpBuffer, num_subframes ); - break; - case RENDERER_DISABLE: - break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ - default: - return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); - } + break; + case RENDERER_DISABLE: + break; /* This happens for 1TC MASA to MONO where we just copy input transport to output */ + default: + return ( IVAS_ERROR( IVAS_ERR_IO_CONFIG_PAIR_NOT_SUPPORTED, "Wrong output config for MASA input in external renderer\n" ) ); + } - accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); + accumulate2dArrayToBuffer( tmpBuffer_buff, &outAudio ); } return IVAS_ERR_OK; @@ -6208,7 +6184,7 @@ ivas_error IVAS_REND_SetIsmMetadataDelay( *-------------------------------------------------------------------*/ static ivas_error getSamplesInternal( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ IVAS_REND_AudioBuffer outAudio /* i/o: buffer for output audio */ ) { @@ -6334,8 +6310,6 @@ ivas_error IVAS_REND_GetSamples( } - - /*-------------------------------------------------------------------* * IVAS_REND_Close() * @@ -6397,8 +6371,6 @@ void IVAS_REND_Close( } - - #ifdef DEBUGGING /*-------------------------------------------------------------------* * IVAS_REND_GetNoCLipping() @@ -6809,99 +6781,99 @@ static ivas_error ivas_masa_ext_rend_parambin_init( hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin; - /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ - if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); - } + /* Init assumes that no reconfiguration is required in external renderer. Instead, free and rebuild whole rendering. */ + if ( ( hDiracDecBin = (DIRAC_DEC_BIN_HANDLE) malloc( sizeof( DIRAC_DEC_BIN_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC binaural handle " ); + } - hDiracDecBin->hTdDecorr = NULL; - hDiracDecBin->hReverb = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; - hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; - hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ - hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ + hDiracDecBin->hTdDecorr = NULL; + hDiracDecBin->hReverb = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_params = NULL; + hDiracDecBin->h_freq_domain_decorr_ap_state = NULL; + hDiracDecBin->hDiffuseDist = NULL; /* Not used in external renderer */ + hDiracDecBin->useTdDecorr = 0; /* Always use frequency domain decorrelator in external renderer */ - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + { + for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) { - for ( k = 0; k < BINAURAL_CHANNELS + MAX_NUM_OBJECTS; k++ ) - { - set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); - } - - for ( k = 0; k < BINAURAL_CHANNELS; k++ ) - { - set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); - set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); - } - set_zero( hDiracDecBin->ChEnePrev[j], nBins ); - set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + set_zero( hDiracDecBin->processMtxRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxIm[j][k], nBins ); } - set_zero( hDiracDecBin->ChCrossRePrev, nBins ); - set_zero( hDiracDecBin->ChCrossImPrev, nBins ); - set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); - set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - for ( bin = 0; bin < nBins; bin++ ) + for ( k = 0; k < BINAURAL_CHANNELS; k++ ) { - binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); - /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ - tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); - hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + set_zero( hDiracDecBin->processMtxDecRe[j][k], nBins ); + set_zero( hDiracDecBin->processMtxDecIm[j][k], nBins ); } + set_zero( hDiracDecBin->ChEnePrev[j], nBins ); + set_zero( hDiracDecBin->ChEneOutPrev[j], nBins ); + } + set_zero( hDiracDecBin->ChCrossRePrev, nBins ); + set_zero( hDiracDecBin->ChCrossImPrev, nBins ); + set_zero( hDiracDecBin->ChCrossReOutPrev, nBins ); + set_zero( hDiracDecBin->ChCrossImOutPrev, nBins ); + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 0; - /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ - set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); - set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + for ( bin = 0; bin < nBins; bin++ ) + { + binCenterFreq = ( (float) bin + 0.5f ) / (float) nBins * ( (float) output_Fs / 2.0f ); + /* These formulas and values are from Christian Borss's publication for binaural diffuse field coherence */ + tmpFloat = max( 0.0f, 1.0f - binCenterFreq / 2700.0f ); + hDiracDecBin->diffuseFieldCoherence[bin] = tmpFloat * sinf( binCenterFreq * EVS_PI / 550.0f ) / ( binCenterFreq * EVS_PI / 550.0f ); + } - if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ - { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - } - else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ - { - mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); + /* No SPAR in external renderer so set directive diffuse field coherence tables to zero */ + set_zero( hDiracDecBin->diffuseFieldCoherenceX, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceY, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + set_zero( hDiracDecBin->diffuseFieldCoherenceZ, BINAURAL_COHERENCE_DIFFERENCE_BINS ); + + if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC ) /* Indication of binaural rendering without room effect */ + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + } + else if ( renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Indication of binaural rendering with room effect */ + { + mvr2r( hHrtfParambin->parametricEarlyPartEneCorrection, hDiracDecBin->earlyPartEneCorrection, nBins ); if ( hDiracDecBin->hReverb == NULL ) - { - /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ - if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) { - set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); - hDiracDecBin->hReverb = NULL; - hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; - } - else /* Not valid renderer type for this renderer */ - { - assert( false ); - } - - /* Always open frequency domain decorrelator */ - ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); - if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), - &( hDiracDecBin->h_freq_domain_decorr_ap_state ), - nBins, - BINAURAL_CHANNELS, - BINAURAL_CHANNELS, - DIRAC_SYNTHESIS_PSD_LS, - frequency_axis, - BINAURAL_CHANNELS, - output_Fs ) ) != IVAS_ERR_OK ) + /* Todo Philips: Room acoustics should be passed here once the underlying part works. In this case, it probably should come from render context or somewhere else suitable. */ + if ( ( error = ivas_binaural_reverb_open_parambin( &hDiracDecBin->hReverb, nBins, CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES, NULL, output_Fs, hHrtfParambin ) ) != IVAS_ERR_OK ) { return error; } - /* External renderer uses constant regularization factor */ - hDiracDecBin->reqularizationFactor = 0.4f; + } + } + else if ( renderer_type == RENDERER_STEREO_PARAMETRIC ) + { + set_f( hDiracDecBin->earlyPartEneCorrection, 1.0f, CLDFB_NO_CHANNELS_MAX ); + hDiracDecBin->hReverb = NULL; + hDiracDecBin->renderStereoOutputInsteadOfBinaural = 1; + } + else /* Not valid renderer type for this renderer */ + { + assert( false ); + } + + /* Always open frequency domain decorrelator */ + ivas_dirac_dec_get_frequency_axis( frequency_axis, output_Fs, nBins ); + if ( ( error = ivas_dirac_dec_decorr_open( &( hDiracDecBin->h_freq_domain_decorr_ap_params ), + &( hDiracDecBin->h_freq_domain_decorr_ap_state ), + nBins, + BINAURAL_CHANNELS, + BINAURAL_CHANNELS, + DIRAC_SYNTHESIS_PSD_LS, + frequency_axis, + BINAURAL_CHANNELS, + output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } + /* External renderer uses constant regularization factor */ + hDiracDecBin->reqularizationFactor = 0.4f; inputMasa->hMasaExtRend->hDiracDecBin = hDiracDecBin; @@ -7135,3 +7107,97 @@ static void freeMasaExtRenderer( return; } + + +static ivas_error printConfigInfo_rend( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +) +{ + ivas_error error; + char config_str[50]; + + /*-----------------------------------------------------------------* + * Print output audio configuration + *-----------------------------------------------------------------*/ + + if ( ( error = get_channel_config( hIvasRend->outputConfig, &config_str[0] ) ) != IVAS_ERR_OK ) + { + return error; + } + + fprintf( stdout, "Output configuration: %s\n", config_str ); + + /*-----------------------------------------------------------------* + * Print renderer configurations + *-----------------------------------------------------------------*/ + + fprintf( stdout, "Output sampling rate: %d Hz\n", hIvasRend->sampleRateOut ); + + if ( hIvasRend->headRotData.headRotEnabled == 1 ) + { + fprintf( stdout, "Head-tracking: ON\n" ); + } + + if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL || + hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR || + hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB || + hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || + hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) + { + fprintf( stdout, "Render framesize: %dms\n", hIvasRend->num_subframes * 5 ); + } + + return IVAS_ERR_OK; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintInputConfig() + * + * + *---------------------------------------------------------------------*/ + +void IVAS_REND_PrintInputConfig( + const IVAS_AUDIO_CONFIG inputConfig /* i : input audio configuration */ +) +{ + char config_str[50]; + + get_channel_config( inputConfig, &config_str[0] ); + fprintf( stdout, "Input configuration: %s\n", config_str ); + + return; +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintConfig() + * + * + *---------------------------------------------------------------------*/ + +ivas_error IVAS_REND_PrintConfig( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +) +{ + if ( hIvasRend == NULL ) + { + return IVAS_ERR_UNEXPECTED_NULL_POINTER; + } + + return printConfigInfo_rend( hIvasRend ); +} + + +/*---------------------------------------------------------------------* + * IVAS_REND_PrintDisclaimer() + * + * Print IVAS disclaimer to console + *---------------------------------------------------------------------*/ + +void IVAS_REND_PrintDisclaimer( void ) +{ + print_disclaimer( stderr ); + + return; +} diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index a6a4797334215517c093a5a6b804db17474a5e0b..9fd8e08fe5868960e1ec1c2031e2ba0640bf0ac9 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -326,6 +326,20 @@ int32_t IVAS_REND_GetCntFramesLimited( ); #endif +/* Disclaimer and info printing */ + +void IVAS_REND_PrintInputConfig( + const IVAS_AUDIO_CONFIG inputConfig /* i : input audio configuration */ +); + +ivas_error IVAS_REND_PrintConfig( + IVAS_REND_HANDLE hIvasRend /* i : IVAS renderer handle */ +); + +void IVAS_REND_PrintDisclaimer( + void +); + /* clang-format on */ #endif