Loading apps/decoder.c +69 −51 Original line number Diff line number Diff line Loading @@ -41,10 +41,6 @@ #ifdef IVAS_RTPDUMP #include "ivas_rtp_file.h" #endif #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #include "ivas_cnst.h" #endif #include "jbm_file_writer.h" #include "hrtf_file_reader.h" #include "ls_custom_file_reader.h" Loading @@ -67,9 +63,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_DEC ( 0xFEEDFADE ) #endif #define WMC_TOOL_SKIP Loading @@ -85,8 +78,11 @@ static #ifdef DEBUGGING #define MIN_NUM_BITS_ACTIVE_FRAME 56 #define NUM_BITS_SID_IVAS_5K2 104 #endif #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_DEC ( 0xFEEDFADE ) #endif /*------------------------------------------------------------------------------------------* * Local structure for storing cmdln arguments Loading Loading @@ -232,10 +228,11 @@ static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBs static int16_t app_own_random( int16_t *seed ); #endif static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #ifdef DECODER_FORMAT_SWITCHING static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ); static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ); #endif /*------------------------------------------------------------------------------------------* * main() * Loading Loading @@ -549,7 +546,6 @@ int main( fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifndef IVAS_RTPDUMP arg.enableHeadRotation = true; #endif Loading Loading @@ -690,6 +686,7 @@ int main( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) Loading Loading @@ -928,6 +925,7 @@ cleanup: free( pAE ); } #endif if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); Loading Loading @@ -1921,6 +1919,10 @@ static void usage_dec( void ) fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); fprintf( stdout, "-render_config File : Renderer configuration File\n" ); #ifdef FIX_1318_ROOM_SIZE_CMD_LINE fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); #endif fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with panning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); Loading @@ -1944,10 +1946,6 @@ static void usage_dec( void ) fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #ifdef FIX_1318_ROOM_SIZE_CMD_LINE fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); #endif fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO Loading Loading @@ -2051,6 +2049,7 @@ static ivas_error initOnFirstGoodFrame( ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; int16_t splitRendIsarFrameSizeMs; int16_t lc3plusHighRes; #ifdef FIXED_RTP_SEQUENCE_NUM /* Ideally ssrc is negotiated via SDP and sequence number is radomized but we use fixed seed for random num generator for regression based tests. Any realtime Loading Loading @@ -2638,7 +2637,7 @@ static ivas_error decodeG192( fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" ); goto cleanup; } /* Head-tracking input simulation */ /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { Loading Loading @@ -3458,6 +3457,7 @@ static ivas_error decodeVoIP( int16_t i; #ifdef DECODER_FORMAT_SWITCHING IVAS_DEC_HANDLE hIvasDec = *phIvasDec; bool restartNeeded; #endif #ifdef IVAS_RTPDUMP IVAS_RTP ivasRtp = { 0 }; Loading Loading @@ -3662,12 +3662,13 @@ static ivas_error decodeVoIP( nSamplesRendered = 0; #ifdef DECODER_FORMAT_SWITCHING /* restart decoder in case of format switching */ if ( ivasRtp.restartNeeded ) { IVAS_DEC_MODE newCodecInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = restartDecoder( &hIvasDec, newCodecInPacket, newDecModeInPacket, &arg, #ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART renderConfig, Loading @@ -3675,12 +3676,12 @@ static ivas_error decodeVoIP( NULL, /* ToDo : Provide rendererConfig */ #endif NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newCodecInPacket ); fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newDecModeInPacket ); goto cleanup; } *phIvasDec = hIvasDec; /* Update for main()' s free */ ivasRtp.restartNeeded = false; } Loading Loading @@ -3719,6 +3720,7 @@ static ivas_error decodeVoIP( goto cleanup; } } int16_t num_subframes; if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { Loading @@ -3726,7 +3728,6 @@ static ivas_error decodeVoIP( goto cleanup; } /* Head-tracking input simulation */ /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { Loading Loading @@ -3868,12 +3869,17 @@ static ivas_error decodeVoIP( /* we are finished when all packets have been received and jitter buffer is empty */ /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ /* last clause should make sure that for BE tests we end up with the same number of samples...*/ if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) bool isEmpty; if ( ( error = IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples, &isEmpty ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( isEmpty || nFramesFed < 2 ) ) { break; } /* decode and get samples */ while ( nSamplesRendered < nOutSamples ) { Loading @@ -3890,7 +3896,7 @@ static ivas_error decodeVoIP( numPiData++; } if ( ( error = IVAS_RTP_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -3938,26 +3944,30 @@ static ivas_error decodeVoIP( return error; } /* Placeholder for memory reallocation */ /* ... */ #ifdef DECODER_FORMAT_SWITCHING if ( IVAS_DEC_isRestartNeeded( hIvasDec ) ) /* restart decoder in case of format switching */ if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK ) { return error; } if ( restartNeeded ) { IVAS_DEC_BS_FORMAT tempFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK ) IVAS_DEC_BS_FORMAT tempBsFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempBsFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( IVAS_DEC_MODE newDecModeInPacket = ( tempBsFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = restartDecoder( &hIvasDec, codecMode, newDecModeInPacket, &arg, NULL, /* ToDo : Provide rendererConfig */ NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder\n" ); goto cleanup; Loading @@ -3966,6 +3976,9 @@ static ivas_error decodeVoIP( } #endif /* Placeholder for memory reallocation */ /* ... */ /* Load HRTF binary file data */ if ( arg.hrtfReaderEnabled ) { Loading Loading @@ -4166,7 +4179,6 @@ static ivas_error decodeVoIP( } #endif vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; if ( vec_pos_update == 0 ) { Loading Loading @@ -4686,9 +4698,15 @@ static ivas_error load_hrtf_from_file( #ifdef DECODER_FORMAT_SWITCHING ivas_error restartDecoder( /*---------------------------------------------------------------------* * restartDecoder() * * Restart decoder in case of IVAS format switching *---------------------------------------------------------------------*/ static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ) Loading @@ -4706,19 +4724,19 @@ ivas_error restartDecoder( IVAS_DEC_Close( phIvasDec ); } if ( ( error = IVAS_DEC_Open( phIvasDec, codec ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_Open( phIvasDec, decMode ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } arg->decMode = codec; arg->decMode = decMode; hIvasDec = *phIvasDec; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535; IVAS_AUDIO_CONFIG outputConfig = ( codec == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; #ifdef FIX_1318_ROOM_SIZE_CMD_LINE if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled, arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled, Loading apps/encoder.c +13 −7 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* Loading @@ -65,6 +61,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ Loading Loading @@ -474,14 +474,14 @@ int main( if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; case IVAS_ENC_INPUT_MASA_ISM: if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; default: Loading Loading @@ -678,6 +678,10 @@ int main( } #endif /*------------------------------------------------------------------------------------------* * Run the encoder *------------------------------------------------------------------------------------------*/ int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; Loading Loading @@ -1084,7 +1088,6 @@ static bool parseCmdlIVAS_enc( arg->sceneOrientationTrajFileName = NULL; arg->deviceOrientationTrajFileName = NULL; #endif #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; arg->forcedModeFile = NULL; Loading Loading @@ -1887,6 +1890,7 @@ static bool parseCmdlIVAS_enc( { i++; arg->rtpdumpOutput = true; if ( i < argc - 4 ) { if ( !is_digits_only( argv[i] ) ) Loading @@ -1903,6 +1907,7 @@ static bool parseCmdlIVAS_enc( } } } fprintf( stdout, "Output format: RTPDump using %d frames/packet \n", arg->numFramesPerPacket ); } Loading Loading @@ -1961,6 +1966,7 @@ static bool parseCmdlIVAS_enc( usage_enc(); return false; } if ( arg->deviceOrientationTrajFileName != NULL && arg->rtpdumpOutput == false ) { fprintf( stderr, "Error: Device orientations are only enabled with rtpdump output!\n\n" ); Loading apps/encoder_fmtsw.c +39 −14 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* Loading @@ -68,6 +64,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ Loading Loading @@ -193,14 +193,14 @@ static int encoder_main( int argc, char *argv[] ); * main() * * Main IVAS encoder function for command-line interface * supporting format switching * supporting IVAS format switching *------------------------------------------------------------------------------------------*/ int main( int argc, char *argv[] ) { bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ FILE *FmtSWFile = NULL; char line[2048]; int argc_local = 0; Loading @@ -217,14 +217,14 @@ int main( { fprintf( stdout, "Usage: IVAS_cod_fmtsw.exe format_switching_file\n\n" ); fprintf( stdout, "where format_switching_file is a text file containg a valid encoder command line in each line\n\n" ); exit( 0 ); goto cleanup; } fprintf( stdout, "Input format switching file: %s\n", argv[1] ); if ( ( FmtSWFile = fopen( argv[1], "r" ) ) == NULL ) { fprintf( stdout, "error: cannot open format switching file %s\n", argv[1] ); exit( 0 ); goto cleanup; } while ( fgets( line, sizeof( line ), FmtSWFile ) ) Loading @@ -237,7 +237,10 @@ int main( if ( strcmp( argv_local[argc_local - 1], (char *) prev_outputBitstreamFilename ) == 0 ) { /* append to last Rtp file */ encoder_main( argc_local, argv_local, &ivasRtp, 0 ); if ( encoder_main( argc_local, argv_local, &ivasRtp, 0 ) != 0 ) { goto cleanup; } } else { Loading @@ -245,8 +248,13 @@ int main( { IVAS_RTP_Term( &ivasRtp ); } /* write in separate Rtp file */ encoder_main( argc_local, argv_local, &ivasRtp, 1 ); if ( encoder_main( argc_local, argv_local, &ivasRtp, 1 ) != 0 ) { goto cleanup; } rtp_term = 1; } strcpy( (char *) prev_outputBitstreamFilename, argv_local[argc_local - 1] ); Loading @@ -254,11 +262,24 @@ int main( encoder_main( argc_local, argv_local ); #endif } /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ cleanup: #ifdef IVAS_RTPDUMP IVAS_RTP_Term( &ivasRtp ); #endif if ( FmtSWFile ) { fclose( FmtSWFile ); exit( 0 ); } return mainFailed ? -1 : 0; } Loading Loading @@ -576,14 +597,14 @@ int encoder_main( if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; case IVAS_ENC_INPUT_MASA_ISM: if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; default: Loading Loading @@ -780,6 +801,10 @@ int encoder_main( } #endif /*------------------------------------------------------------------------------------------* * Run the encoder *------------------------------------------------------------------------------------------*/ int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; Loading lib_com/common_api_types.h +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,9 @@ #define IVAS_ROOM_ABS_COEFF 6 #define IVAS_REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define IVAS_ER_LIST_HEIGHT 1.6f #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #define IVAS_DEFAULT_AEID 65535 #endif /* JBM constants for adaptive-playout */ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ Loading lib_com/ivas_cnst.h +0 −3 Original line number Diff line number Diff line Loading @@ -1608,9 +1608,6 @@ typedef enum #else #define IVAS_REVERB_DEFAULT_N_BANDS 31 #endif #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #define IVAS_DEFAULT_AEID ( 65535 ) #endif #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) #define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) Loading Loading
apps/decoder.c +69 −51 Original line number Diff line number Diff line Loading @@ -41,10 +41,6 @@ #ifdef IVAS_RTPDUMP #include "ivas_rtp_file.h" #endif #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #include "ivas_cnst.h" #endif #include "jbm_file_writer.h" #include "hrtf_file_reader.h" #include "ls_custom_file_reader.h" Loading @@ -67,9 +63,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_DEC ( 0xFEEDFADE ) #endif #define WMC_TOOL_SKIP Loading @@ -85,8 +78,11 @@ static #ifdef DEBUGGING #define MIN_NUM_BITS_ACTIVE_FRAME 56 #define NUM_BITS_SID_IVAS_5K2 104 #endif #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_DEC ( 0xFEEDFADE ) #endif /*------------------------------------------------------------------------------------------* * Local structure for storing cmdln arguments Loading Loading @@ -232,10 +228,11 @@ static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBs static int16_t app_own_random( int16_t *seed ); #endif static void do_object_editing( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); #ifdef DECODER_FORMAT_SWITCHING static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ); static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ); #endif /*------------------------------------------------------------------------------------------* * main() * Loading Loading @@ -549,7 +546,6 @@ int main( fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifndef IVAS_RTPDUMP arg.enableHeadRotation = true; #endif Loading Loading @@ -690,6 +686,7 @@ int main( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) Loading Loading @@ -928,6 +925,7 @@ cleanup: free( pAE ); } #endif if ( arg.aeSequence.count > 0 ) { free( arg.aeSequence.pID ); Loading Loading @@ -1921,6 +1919,10 @@ static void usage_dec( void ) fprintf( stdout, "-rvf File : Reference vector specified by external trajectory File\n" ); fprintf( stdout, " works only in combination with '-otr ref_vec' and 'ref_vec_lev' modes\n" ); fprintf( stdout, "-render_config File : Renderer configuration File\n" ); #ifdef FIX_1318_ROOM_SIZE_CMD_LINE fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); #endif fprintf( stdout, "-om File : Metadata output File for BINAURAL_SPLIT_PCM OutputConf (only for Fs = 48 kHz)\n" ); fprintf( stdout, "-non_diegetic_pan P : panning mono non-diegetic sound to stereo with panning P, -90<= P <=90,\n" ); fprintf( stdout, " left or l or 90->left, right or r or -90->right, center or c or 0->middle\n" ); Loading @@ -1944,10 +1946,6 @@ static void usage_dec( void ) fprintf( stdout, "-obj_edit File : Object editing instructions file or NULL for built-in example\n" ); fprintf( stdout, "-level level : Complexity level, level = (1, 2, 3), will be defined after characterisation. \n" ); fprintf( stdout, " Currently, all values default to level 3 (full functionality).\n" ); #ifdef FIX_1318_ROOM_SIZE_CMD_LINE fprintf( stdout, "-room_size (S|M|L) : Selects default reverb based on a room size (S - small | M - medium | L - large)\n" ); fprintf( stdout, " for BINAURAL_ROOM_REVERB output configuration,\n" ); #endif fprintf( stdout, "-q : Quiet mode, no frame counter\n" ); fprintf( stdout, " default is deactivated\n" ); #ifdef DEBUG_MODE_INFO Loading Loading @@ -2051,6 +2049,7 @@ static ivas_error initOnFirstGoodFrame( ISAR_SPLIT_REND_POSE_CORRECTION_MODE poseCorrection; int16_t splitRendIsarFrameSizeMs; int16_t lc3plusHighRes; #ifdef FIXED_RTP_SEQUENCE_NUM /* Ideally ssrc is negotiated via SDP and sequence number is radomized but we use fixed seed for random num generator for regression based tests. Any realtime Loading Loading @@ -2638,7 +2637,7 @@ static ivas_error decodeG192( fprintf( stderr, "\nIVAS_DEC_GetNumOrientationSubframes failed: \n" ); goto cleanup; } /* Head-tracking input simulation */ /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { Loading Loading @@ -3458,6 +3457,7 @@ static ivas_error decodeVoIP( int16_t i; #ifdef DECODER_FORMAT_SWITCHING IVAS_DEC_HANDLE hIvasDec = *phIvasDec; bool restartNeeded; #endif #ifdef IVAS_RTPDUMP IVAS_RTP ivasRtp = { 0 }; Loading Loading @@ -3662,12 +3662,13 @@ static ivas_error decodeVoIP( nSamplesRendered = 0; #ifdef DECODER_FORMAT_SWITCHING /* restart decoder in case of format switching */ if ( ivasRtp.restartNeeded ) { IVAS_DEC_MODE newCodecInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( IVAS_DEC_MODE newDecModeInPacket = ( ivasRtp.codecId == IVAS_RTP_EVS ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = restartDecoder( &hIvasDec, newCodecInPacket, newDecModeInPacket, &arg, #ifdef FIX_SPLIT_RENDERING_ON_DECODER_RESTART renderConfig, Loading @@ -3675,12 +3676,12 @@ static ivas_error decodeVoIP( NULL, /* ToDo : Provide rendererConfig */ #endif NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newCodecInPacket ); fprintf( stderr, "\nFailed to restart decoder from %d to %d\n", arg.decMode, newDecModeInPacket ); goto cleanup; } *phIvasDec = hIvasDec; /* Update for main()' s free */ ivasRtp.restartNeeded = false; } Loading Loading @@ -3719,6 +3720,7 @@ static ivas_error decodeVoIP( goto cleanup; } } int16_t num_subframes; if ( ( error = IVAS_DEC_GetNumOrientationSubframes( hIvasDec, &num_subframes ) ) != IVAS_ERR_OK ) { Loading @@ -3726,7 +3728,6 @@ static ivas_error decodeVoIP( goto cleanup; } /* Head-tracking input simulation */ /* Head-tracking input simulation */ if ( arg.enableHeadRotation ) { Loading Loading @@ -3868,12 +3869,17 @@ static ivas_error decodeVoIP( /* we are finished when all packets have been received and jitter buffer is empty */ /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ /* last clause should make sure that for BE tests we end up with the same number of samples...*/ if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) bool isEmpty; if ( ( error = IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples, &isEmpty ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( isEmpty || nFramesFed < 2 ) ) { break; } /* decode and get samples */ while ( nSamplesRendered < nOutSamples ) { Loading @@ -3890,7 +3896,7 @@ static ivas_error decodeVoIP( numPiData++; } if ( ( error = IVAS_RTP_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_FeedPiDataToDecoder( hIvasDec, &ivasRtp.piData[ivasRtp.nProcPiData], numPiData ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading Loading @@ -3938,26 +3944,30 @@ static ivas_error decodeVoIP( return error; } /* Placeholder for memory reallocation */ /* ... */ #ifdef DECODER_FORMAT_SWITCHING if ( IVAS_DEC_isRestartNeeded( hIvasDec ) ) /* restart decoder in case of format switching */ if ( ( error = IVAS_DEC_isRestartNeeded( hIvasDec, &restartNeeded ) ) != IVAS_ERR_OK ) { return error; } if ( restartNeeded ) { IVAS_DEC_BS_FORMAT tempFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempFormat ) ) != IVAS_ERR_OK ) IVAS_DEC_BS_FORMAT tempBsFormat; if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &tempBsFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } IVAS_DEC_MODE codecMode = ( tempFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; error = restartDecoder( IVAS_DEC_MODE newDecModeInPacket = ( tempBsFormat == IVAS_DEC_BS_MONO ) ? IVAS_DEC_MODE_EVS : IVAS_DEC_MODE_IVAS; if ( ( error = restartDecoder( &hIvasDec, codecMode, newDecModeInPacket, &arg, NULL, /* ToDo : Provide rendererConfig */ NULL /* ToDo : Provide LS Custom Data */ ); if ( error != IVAS_ERR_OK ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nFailed to restart decoder\n" ); goto cleanup; Loading @@ -3966,6 +3976,9 @@ static ivas_error decodeVoIP( } #endif /* Placeholder for memory reallocation */ /* ... */ /* Load HRTF binary file data */ if ( arg.hrtfReaderEnabled ) { Loading Loading @@ -4166,7 +4179,6 @@ static ivas_error decodeVoIP( } #endif vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; if ( vec_pos_update == 0 ) { Loading Loading @@ -4686,9 +4698,15 @@ static ivas_error load_hrtf_from_file( #ifdef DECODER_FORMAT_SWITCHING ivas_error restartDecoder( /*---------------------------------------------------------------------* * restartDecoder() * * Restart decoder in case of IVAS format switching *---------------------------------------------------------------------*/ static ivas_error restartDecoder( IVAS_DEC_HANDLE *phIvasDec, IVAS_DEC_MODE codec, const IVAS_DEC_MODE decMode, DecArguments *arg, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_CUSTOM_LS_DATA *hLsCustomData ) Loading @@ -4706,19 +4724,19 @@ ivas_error restartDecoder( IVAS_DEC_Close( phIvasDec ); } if ( ( error = IVAS_DEC_Open( phIvasDec, codec ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_DEC_Open( phIvasDec, decMode ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } arg->decMode = codec; arg->decMode = decMode; hIvasDec = *phIvasDec; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535; IVAS_AUDIO_CONFIG outputConfig = ( codec == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; #ifdef FIX_1318_ROOM_SIZE_CMD_LINE if ( ( error = IVAS_DEC_Configure( hIvasDec, arg->output_Fs, outputConfig, arg->renderFramesize, arg->customLsOutputEnabled, arg->hrtfReaderEnabled, arg->enableHeadRotation, arg->enableExternalOrientation, arg->orientation_tracking, arg->renderConfigEnabled, arg->roomSize, arg->non_diegetic_pan_enabled, Loading
apps/encoder.c +13 −7 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* Loading @@ -65,6 +61,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ Loading Loading @@ -474,14 +474,14 @@ int main( if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; case IVAS_ENC_INPUT_MASA_ISM: if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; default: Loading Loading @@ -678,6 +678,10 @@ int main( } #endif /*------------------------------------------------------------------------------------------* * Run the encoder *------------------------------------------------------------------------------------------*/ int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; Loading Loading @@ -1084,7 +1088,6 @@ static bool parseCmdlIVAS_enc( arg->sceneOrientationTrajFileName = NULL; arg->deviceOrientationTrajFileName = NULL; #endif #ifdef DEBUGGING arg->forcedMode = IVAS_ENC_FORCE_UNFORCED; arg->forcedModeFile = NULL; Loading Loading @@ -1887,6 +1890,7 @@ static bool parseCmdlIVAS_enc( { i++; arg->rtpdumpOutput = true; if ( i < argc - 4 ) { if ( !is_digits_only( argv[i] ) ) Loading @@ -1903,6 +1907,7 @@ static bool parseCmdlIVAS_enc( } } } fprintf( stdout, "Output format: RTPDump using %d frames/packet \n", arg->numFramesPerPacket ); } Loading Loading @@ -1961,6 +1966,7 @@ static bool parseCmdlIVAS_enc( usage_enc(); return false; } if ( arg->deviceOrientationTrajFileName != NULL && arg->rtpdumpOutput == false ) { fprintf( stderr, "Error: Device orientations are only enabled with rtpdump output!\n\n" ); Loading
apps/encoder_fmtsw.c +39 −14 Original line number Diff line number Diff line Loading @@ -50,10 +50,6 @@ #include "flp_debug.h" #endif #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define WMC_TOOL_SKIP /*------------------------------------------------------------------------------------------* Loading @@ -68,6 +64,10 @@ static #endif int32_t frame = 0; /* Counter of frames */ #ifdef FIXED_RTP_SEQUENCE_NUM #define RANDOM_INITSEED_ENC ( 0xFEEDDEAF ) #endif #define DEFAULT_FIXED_SID_RATE 8 /* DTX SID rate */ /* Additional config info for each input format */ Loading Loading @@ -193,14 +193,14 @@ static int encoder_main( int argc, char *argv[] ); * main() * * Main IVAS encoder function for command-line interface * supporting format switching * supporting IVAS format switching *------------------------------------------------------------------------------------------*/ int main( int argc, char *argv[] ) { bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ FILE *FmtSWFile = NULL; char line[2048]; int argc_local = 0; Loading @@ -217,14 +217,14 @@ int main( { fprintf( stdout, "Usage: IVAS_cod_fmtsw.exe format_switching_file\n\n" ); fprintf( stdout, "where format_switching_file is a text file containg a valid encoder command line in each line\n\n" ); exit( 0 ); goto cleanup; } fprintf( stdout, "Input format switching file: %s\n", argv[1] ); if ( ( FmtSWFile = fopen( argv[1], "r" ) ) == NULL ) { fprintf( stdout, "error: cannot open format switching file %s\n", argv[1] ); exit( 0 ); goto cleanup; } while ( fgets( line, sizeof( line ), FmtSWFile ) ) Loading @@ -237,7 +237,10 @@ int main( if ( strcmp( argv_local[argc_local - 1], (char *) prev_outputBitstreamFilename ) == 0 ) { /* append to last Rtp file */ encoder_main( argc_local, argv_local, &ivasRtp, 0 ); if ( encoder_main( argc_local, argv_local, &ivasRtp, 0 ) != 0 ) { goto cleanup; } } else { Loading @@ -245,8 +248,13 @@ int main( { IVAS_RTP_Term( &ivasRtp ); } /* write in separate Rtp file */ encoder_main( argc_local, argv_local, &ivasRtp, 1 ); if ( encoder_main( argc_local, argv_local, &ivasRtp, 1 ) != 0 ) { goto cleanup; } rtp_term = 1; } strcpy( (char *) prev_outputBitstreamFilename, argv_local[argc_local - 1] ); Loading @@ -254,11 +262,24 @@ int main( encoder_main( argc_local, argv_local ); #endif } /*------------------------------------------------------------------------------------------* * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ cleanup: #ifdef IVAS_RTPDUMP IVAS_RTP_Term( &ivasRtp ); #endif if ( FmtSWFile ) { fclose( FmtSWFile ); exit( 0 ); } return mainFailed ? -1 : 0; } Loading Loading @@ -576,14 +597,14 @@ int encoder_main( if ( ( error = IVAS_ENC_ConfigureForSBAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.sba_ism.numObjects, arg.inputFormatConfig.sba_ism.order, arg.inputFormatConfig.sba_ism.isPlanar, arg.pca ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForSBAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; case IVAS_ENC_INPUT_MASA_ISM: if ( ( error = IVAS_ENC_ConfigureForMASAObjects( hIvasEnc, arg.inputFs, totalBitrate, bandwidth, arg.dtxConfig, arg.inputFormatConfig.masa_ism.numObjects, arg.inputFormatConfig.masa_ism.masaVariant ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_ENC_ConfigureForMASAObjects failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); exit( -1 ); goto cleanup; } break; default: Loading Loading @@ -780,6 +801,10 @@ int encoder_main( } #endif /*------------------------------------------------------------------------------------------* * Run the encoder *------------------------------------------------------------------------------------------*/ int16_t numSamplesRead = 0; uint16_t bitStream[IVAS_MAX_BITS_PER_FRAME]; uint16_t numBits = 0; Loading
lib_com/common_api_types.h +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,9 @@ #define IVAS_ROOM_ABS_COEFF 6 #define IVAS_REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define IVAS_ER_LIST_HEIGHT 1.6f #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #define IVAS_DEFAULT_AEID 65535 #endif /* JBM constants for adaptive-playout */ #define IVAS_TIME_SCALE_MIN 50 /* min. time-scaling [%] */ Loading
lib_com/ivas_cnst.h +0 −3 Original line number Diff line number Diff line Loading @@ -1608,9 +1608,6 @@ typedef enum #else #define IVAS_REVERB_DEFAULT_N_BANDS 31 #endif #ifdef IVAS_RTPDUMP_ACOUSTIC_ENVIRONMENT #define IVAS_DEFAULT_AEID ( 65535 ) #endif #define LR_IAC_LENGTH_NR_FC ( RV_LENGTH_NR_FC ) #define LR_IAC_LENGTH_NR_FC_16KHZ ( RV_LENGTH_NR_FC_16KHZ ) Loading