Loading apps/decoder.c +20 −54 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "bitstream_reader.h" #include "evs_rtp_payload.h" #include "ism_file_writer.h" #include "ivas_rtp_file.h" #include "jbm_file_writer.h" #include "hrtf_file_reader.h" #include "ls_custom_file_reader.h" Loading @@ -50,7 +51,6 @@ #include "vector3_pair_file_reader.h" #include "wmc_auto.h" #include "stl.h" #include "ivas_rtp_file.h" #define WMC_TOOL_SKIP Loading Loading @@ -133,7 +133,6 @@ typedef struct bool applyPiData; char *piOutputFilename; bool rtpOutSR; bool evsMode; IVAS_ROOM_SIZE_T roomSize; } DecArguments; Loading Loading @@ -164,19 +163,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); 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 ); Loading Loading @@ -426,7 +413,6 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : IVAS_DEFAULT_AEID; arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, Loading Loading @@ -497,7 +483,6 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && Loading Loading @@ -564,6 +549,7 @@ int main( } } } if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); Loading Loading @@ -691,11 +677,7 @@ int main( if ( arg.voipMode ) { error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &renderConfig, &hIvasDec, pcmBuf ); error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &renderConfig, &hIvasDec, pcmBuf ); } else { Loading Loading @@ -901,7 +883,6 @@ static bool parseCmdlIVAS_dec( arg->output_Fs = IVAS_MAX_SAMPLING_RATE; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->evsMode = false; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->voipMode = false; Loading Loading @@ -1395,7 +1376,6 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-EVS" ) == 0 ) { arg->evsMode = true; arg->decMode = IVAS_DEC_MODE_EVS; i++; } Loading Loading @@ -1486,7 +1466,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->evsMode ) else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->decMode == IVAS_DEC_MODE_EVS ) { fprintf( stderr, "Error: Both non-diegetic panning and stereo output specified!\n\n" ); usage_dec(); Loading Loading @@ -2796,6 +2776,7 @@ static ivas_error decodeVoIP( int32_t delayTimeScale = -1; int16_t i; IVAS_DEC_HANDLE hIvasDec = *phIvasDec; bool restartNeeded; IVAS_RTP ivasRtp = { 0 }; IVAS_RTP srRtp = { 0 }; Loading Loading @@ -2876,7 +2857,6 @@ static ivas_error decodeVoIP( goto cleanup; } #ifdef SUPPORT_JBM_TRACEFILE if ( arg.jbmTraceFilename != NULL ) { Loading Loading @@ -2908,7 +2888,9 @@ static ivas_error decodeVoIP( else { auPtr = au; /* might have been set to RTP packet in prev call */ error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); initialTsOffsetSystemAndRTP = rtpTimeStamp - systemTime_ms * 16; /* For time mapping */ /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ Loading Loading @@ -3105,6 +3087,7 @@ static ivas_error decodeVoIP( else { auPtr = au; /* might have been set to RTP packet in prev call */ error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); /* IVAS RTP payload format has timescale 16000, JBM uses 1000 internally */ Loading Loading @@ -3294,22 +3277,8 @@ static ivas_error decodeVoIP( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) { goto cleanup; } Loading Loading @@ -3411,6 +3380,7 @@ static ivas_error decodeVoIP( srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms; srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD; srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms; if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while pushing SR audio bitstream to RTP pack\n", ivas_error_to_string( error ) ); Loading Loading @@ -3661,7 +3631,8 @@ static void do_object_editing_fx( editableParameters->ism_metadata[obj_idx].elevation_fx = (Word32) ( readInfo->obj_ele[obj_idx] * 4194304 ); /* Q22 */ } } /* object direction editing only for diegetic objects */ /* object orientation editing only for diegetic objects */ if ( readInfo->obj_yaw_edited[obj_idx] ) { if ( readInfo->obj_yaw_relative[obj_idx] ) Loading Loading @@ -3692,12 +3663,8 @@ static void do_object_editing_fx( if ( readInfo->obj_radius_relative[obj_idx] ) { /* radius: apply relative edit + saturation */ #define SQ 9 #define SHIFT_DUE_TO_SQxSQ ( SQ - ( SQ + SQ + 1 - 16 ) ) /* ^shift by 6 == mult by 2^6 = 64.0 */ Word32 L_tmp1 = L_mult( editableParameters->ism_metadata[obj_idx].radius_fx, (Word16) ( readInfo->obj_radius[obj_idx] * ( 1L << ( SQ ) ) ) ); /*SQ*SQ*/ Word32 L_tmp2 = L_shl_sat( L_tmp1, SHIFT_DUE_TO_SQxSQ ); /*shift back to Q(9+16)*/ Word32 L_tmp1 = L_mult( editableParameters->ism_metadata[obj_idx].radius_fx, (Word16) ( readInfo->obj_radius[obj_idx] * ( 1L << ( 9 ) ) ) ); /*SQ*SQ where SQ=9*/ Word32 L_tmp2 = L_shl_sat( L_tmp1, ( 9 - ( 9 + 9 + 1 - 16 ) ) /* ^shift by 6 == mult by 2^6 = 64.0 */ ); /*shift back to Q(9+16)*/ Word16 temp_radius = round_fx( L_tmp2 ); /* Q25 -> Q9 */ temp_radius = s_max( s_min( temp_radius, OBJ_EDIT_RADIUS_MAX_FX ), 0 ); Loading Loading @@ -3968,9 +3935,10 @@ static ivas_error restartDecoder( hIvasDec = *phIvasDec; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : IVAS_DEFAULT_AEID; IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; 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, arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK ) Loading @@ -3985,7 +3953,6 @@ static ivas_error restartDecoder( goto cleanup; } if ( arg->voipMode ) { if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg->inputFormat ) ) != IVAS_ERR_OK ) Loading Loading @@ -4034,5 +4001,4 @@ cleanup: return error; } #undef WMC_TOOL_SKIP apps/encoder.c +2 −2 Original line number Diff line number Diff line Loading @@ -43,9 +43,10 @@ #include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "rotation_file_reader.h" #include "ivas_rtp_file.h" #include "wmc_auto.h" #ifdef DEBUG_FORCE_DIR /* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do. Loading Loading @@ -1867,7 +1868,6 @@ static bool parseCmdlIVAS_enc( i++; } /*-----------------------------------------------------------------* * Option not recognized *-----------------------------------------------------------------*/ Loading apps/encoder_fmtsw.c +4 −2 Original line number Diff line number Diff line Loading @@ -43,9 +43,10 @@ #include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "rotation_file_reader.h" #include "ivas_rtp_file.h" #include "wmc_auto.h" #ifdef DEBUG_FORCE_DIR /* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do. Loading Loading @@ -185,6 +186,7 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ); static void str2arg( char *str, int *argc_local, char *argv_local[] ); static int encoder_main( int argc, char *argv[], IVAS_RTP *ivasRtp, int init_RtpWriter ); /*------------------------------------------------------------------------------------------* * main() * Loading Loading @@ -263,6 +265,7 @@ int main( cleanup: IVAS_RTP_Term( &ivasRtp ); if ( FmtSWFile ) { fclose( FmtSWFile ); Loading Loading @@ -1968,7 +1971,6 @@ static bool parseCmdlIVAS_enc( i++; } /*-----------------------------------------------------------------* * Option not recognized *-----------------------------------------------------------------*/ Loading apps/isar_post_rend.c +5 −1 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString, bool *srRtp static void convertOutputBuffer( const Word32 *fixedBuffer, Word16 q, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ Loading Loading @@ -399,6 +400,7 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( *srRtp = true; return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } return IVAS_AUDIO_CONFIG_INVALID; } Loading Loading @@ -456,6 +458,7 @@ static CmdlnArgs defaultArgs( clearString( args.inputFilePath ); clearString( args.outputFilePath ); clearString( args.srParamsFilePath ); args.sampleRate = 0; args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID; Loading Loading @@ -561,7 +564,6 @@ static void parseOption( fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] ); exit( -1 ); } break; case CmdLnOptionId_srParamsFile: assert( numOptionValues == 1 ); Loading Loading @@ -695,6 +697,7 @@ static void convertOutputBuffer( return; } static void trim( char *str ) { char c; Loading @@ -712,6 +715,7 @@ static void trim( char *str ) str[w] = 0; } static ivas_error parseSRParamsFile( const char *srParamsFilePath, const char *rtpFilePath, Loading apps/renderer.c +7 −12 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ typedef enum CmdLnOptionId_syncMdDelay, CmdLnOptionId_directivityPatternId, CmdLnOptionId_acousticEnvironmentId, CmdLnOptionId_roomSize, CmdLnOptionId_roomSize } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { Loading Loading @@ -1169,8 +1169,6 @@ int main( if ( args.renderConfigFilePath[0] != '\0' ) { /* sanity check */ if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && Loading Loading @@ -1205,7 +1203,7 @@ int main( } if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID; if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) Loading Loading @@ -1241,7 +1239,6 @@ int main( goto cleanup; } /* Set reverb room size if specified */ if ( args.reverbRoomSize != IVAS_ROOM_SIZE_AUTO ) { Loading Loading @@ -1534,12 +1531,7 @@ int main( audioWriter = NULL; } if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader(): %s!\n", ivas_error_to_string( error ) ); goto cleanup; Loading Loading @@ -1650,7 +1642,7 @@ int main( ObjectPositionBuffer mtdBuffer; outBuffer.pq_fact = &outBuffer.q_factor; Word16 subframe_len = (Word16) ( args.sampleRate / ( 200 ) ); // sample rate /FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES Word16 subframe_len = (Word16) ( args.sampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); Word16 gd_bits = find_guard_bits( subframe_len ); Word16 prev_q_fact = Q11; while ( 1 ) Loading Loading @@ -2640,7 +2632,9 @@ static bool parseAcousticEnvironmentIds( AcousticEnvironmentSequence *aeSequence ) { char config_string[RENDERER_MAX_METADATA_LINE_LENGTH]; strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH ); if ( !is_digits_only( config_string ) ) { aeidFileReader *aeidReader = NULL; Loading Loading @@ -3109,6 +3103,7 @@ void getMetadataFromFileReader( fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); exit( -1 ); } objectMetadataBuffer->positions[objIdx].azimuth_fx = ismMetadata.azimuth_fx; objectMetadataBuffer->positions[objIdx].elevation_fx = ismMetadata.elevation_fx; objectMetadataBuffer->positions[objIdx].radius_fx = ismMetadata.radius_fx; Loading Loading
apps/decoder.c +20 −54 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "bitstream_reader.h" #include "evs_rtp_payload.h" #include "ism_file_writer.h" #include "ivas_rtp_file.h" #include "jbm_file_writer.h" #include "hrtf_file_reader.h" #include "ls_custom_file_reader.h" Loading @@ -50,7 +51,6 @@ #include "vector3_pair_file_reader.h" #include "wmc_auto.h" #include "stl.h" #include "ivas_rtp_file.h" #define WMC_TOOL_SKIP Loading Loading @@ -133,7 +133,6 @@ typedef struct bool applyPiData; char *piOutputFilename; bool rtpOutSR; bool evsMode; IVAS_ROOM_SIZE_T roomSize; } DecArguments; Loading Loading @@ -164,19 +163,7 @@ typedef struct static bool parseCmdlIVAS_dec( int16_t argc, char **argv, DecArguments *arg ); static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtf, RotFileReader *headRotReader, RotFileReader *externalOrientationFileReader, RotFileReader *refRotReader, Vector3PairFileReader *referenceVectorReader, ObjectEditFileReader *objectEditFileReader, ISAR_SPLIT_REND_BITS_DATA *splitRendBits, IVAS_RENDER_CONFIG_DATA *renderConfig, IVAS_DEC_HANDLE *phIvasDec, int16_t *pcmBuf ); static ivas_error load_hrtf_from_file( IVAS_DEC_HRTF_BINARY_WRAPPER *hHrtfBinary, IVAS_DEC_HANDLE hIvasDec, const IVAS_AUDIO_CONFIG OutputConfig, const int32_t output_Fs ); static void do_object_editing_fx( IVAS_EDITABLE_PARAMETERS *editableParameters, ObjectEditFileReader *objectEditFileReader ); 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 ); Loading Loading @@ -426,7 +413,6 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : IVAS_DEFAULT_AEID; arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, Loading Loading @@ -497,7 +483,6 @@ int main( if ( arg.renderConfigEnabled ) { /* sanity check */ if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && Loading Loading @@ -564,6 +549,7 @@ int main( } } } if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, arg.directivityPatternId, renderConfig.directivity_fx ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", arg.directivityPatternId[0], arg.directivityPatternId[1], arg.directivityPatternId[2], arg.directivityPatternId[3] ); Loading Loading @@ -691,11 +677,7 @@ int main( if ( arg.voipMode ) { error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &renderConfig, &hIvasDec, pcmBuf ); error = decodeVoIP( arg, hBsReader, &hHrtfBinary, headRotReader, externalOrientationFileReader, refRotReader, referenceVectorReader, objectEditFileReader, &splitRendBits, &renderConfig, &hIvasDec, pcmBuf ); } else { Loading Loading @@ -901,7 +883,6 @@ static bool parseCmdlIVAS_dec( arg->output_Fs = IVAS_MAX_SAMPLING_RATE; arg->outputConfig = IVAS_AUDIO_CONFIG_MONO; arg->decMode = IVAS_DEC_MODE_IVAS; arg->evsMode = false; arg->quietModeEnabled = false; arg->delayCompensationEnabled = true; arg->voipMode = false; Loading Loading @@ -1395,7 +1376,6 @@ static bool parseCmdlIVAS_dec( } else if ( strcmp( argv_to_upper, "-EVS" ) == 0 ) { arg->evsMode = true; arg->decMode = IVAS_DEC_MODE_EVS; i++; } Loading Loading @@ -1486,7 +1466,7 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->evsMode ) else if ( arg->non_diegetic_pan_enabled && arg->outputConfig == IVAS_AUDIO_CONFIG_STEREO && arg->decMode == IVAS_DEC_MODE_EVS ) { fprintf( stderr, "Error: Both non-diegetic panning and stereo output specified!\n\n" ); usage_dec(); Loading Loading @@ -2796,6 +2776,7 @@ static ivas_error decodeVoIP( int32_t delayTimeScale = -1; int16_t i; IVAS_DEC_HANDLE hIvasDec = *phIvasDec; bool restartNeeded; IVAS_RTP ivasRtp = { 0 }; IVAS_RTP srRtp = { 0 }; Loading Loading @@ -2876,7 +2857,6 @@ static ivas_error decodeVoIP( goto cleanup; } #ifdef SUPPORT_JBM_TRACEFILE if ( arg.jbmTraceFilename != NULL ) { Loading Loading @@ -2908,7 +2888,9 @@ static ivas_error decodeVoIP( else { auPtr = au; /* might have been set to RTP packet in prev call */ error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); initialTsOffsetSystemAndRTP = rtpTimeStamp - systemTime_ms * 16; /* For time mapping */ /* EVS RTP payload format has timescale 16000, JBM uses 1000 internally */ Loading Loading @@ -3105,6 +3087,7 @@ static ivas_error decodeVoIP( else { auPtr = au; /* might have been set to RTP packet in prev call */ error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); /* IVAS RTP payload format has timescale 16000, JBM uses 1000 internally */ Loading Loading @@ -3294,22 +3277,8 @@ static ivas_error decodeVoIP( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) { goto cleanup; } Loading Loading @@ -3411,6 +3380,7 @@ static ivas_error decodeVoIP( srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms; srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD; srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms; if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError %s while pushing SR audio bitstream to RTP pack\n", ivas_error_to_string( error ) ); Loading Loading @@ -3661,7 +3631,8 @@ static void do_object_editing_fx( editableParameters->ism_metadata[obj_idx].elevation_fx = (Word32) ( readInfo->obj_ele[obj_idx] * 4194304 ); /* Q22 */ } } /* object direction editing only for diegetic objects */ /* object orientation editing only for diegetic objects */ if ( readInfo->obj_yaw_edited[obj_idx] ) { if ( readInfo->obj_yaw_relative[obj_idx] ) Loading Loading @@ -3692,12 +3663,8 @@ static void do_object_editing_fx( if ( readInfo->obj_radius_relative[obj_idx] ) { /* radius: apply relative edit + saturation */ #define SQ 9 #define SHIFT_DUE_TO_SQxSQ ( SQ - ( SQ + SQ + 1 - 16 ) ) /* ^shift by 6 == mult by 2^6 = 64.0 */ Word32 L_tmp1 = L_mult( editableParameters->ism_metadata[obj_idx].radius_fx, (Word16) ( readInfo->obj_radius[obj_idx] * ( 1L << ( SQ ) ) ) ); /*SQ*SQ*/ Word32 L_tmp2 = L_shl_sat( L_tmp1, SHIFT_DUE_TO_SQxSQ ); /*shift back to Q(9+16)*/ Word32 L_tmp1 = L_mult( editableParameters->ism_metadata[obj_idx].radius_fx, (Word16) ( readInfo->obj_radius[obj_idx] * ( 1L << ( 9 ) ) ) ); /*SQ*SQ where SQ=9*/ Word32 L_tmp2 = L_shl_sat( L_tmp1, ( 9 - ( 9 + 9 + 1 - 16 ) ) /* ^shift by 6 == mult by 2^6 = 64.0 */ ); /*shift back to Q(9+16)*/ Word16 temp_radius = round_fx( L_tmp2 ); /* Q25 -> Q9 */ temp_radius = s_max( s_min( temp_radius, OBJ_EDIT_RADIUS_MAX_FX ), 0 ); Loading Loading @@ -3968,9 +3935,10 @@ static ivas_error restartDecoder( hIvasDec = *phIvasDec; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : 65535; uint16_t aeID = arg->aeSequence.count > 0 ? arg->aeSequence.pID[0] : IVAS_DEFAULT_AEID; IVAS_AUDIO_CONFIG outputConfig = ( decMode == IVAS_DEC_MODE_IVAS ) ? arg->outputConfig : IVAS_AUDIO_CONFIG_MONO; 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, arg->non_diegetic_pan_gain_fx, arg->dpidEnabled, aeID, arg->objEditEnabled, arg->delayCompensationEnabled ) ) != IVAS_ERR_OK ) Loading @@ -3985,7 +3953,6 @@ static ivas_error restartDecoder( goto cleanup; } if ( arg->voipMode ) { if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg->inputFormat ) ) != IVAS_ERR_OK ) Loading Loading @@ -4034,5 +4001,4 @@ cleanup: return error; } #undef WMC_TOOL_SKIP
apps/encoder.c +2 −2 Original line number Diff line number Diff line Loading @@ -43,9 +43,10 @@ #include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "rotation_file_reader.h" #include "ivas_rtp_file.h" #include "wmc_auto.h" #ifdef DEBUG_FORCE_DIR /* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do. Loading Loading @@ -1867,7 +1868,6 @@ static bool parseCmdlIVAS_enc( i++; } /*-----------------------------------------------------------------* * Option not recognized *-----------------------------------------------------------------*/ Loading
apps/encoder_fmtsw.c +4 −2 Original line number Diff line number Diff line Loading @@ -43,9 +43,10 @@ #include "ism_file_reader.h" #include "jbm_file_reader.h" #include "masa_file_reader.h" #include "wmc_auto.h" #include "rotation_file_reader.h" #include "ivas_rtp_file.h" #include "wmc_auto.h" #ifdef DEBUG_FORCE_DIR /* Windows does not define the S_ISREG and S_ISDIR macros in stat.h, so we do. Loading Loading @@ -185,6 +186,7 @@ static IVAS_ENC_FORCED_MODE parseForcedMode( char *forcedModeChar ); static void str2arg( char *str, int *argc_local, char *argv_local[] ); static int encoder_main( int argc, char *argv[], IVAS_RTP *ivasRtp, int init_RtpWriter ); /*------------------------------------------------------------------------------------------* * main() * Loading Loading @@ -263,6 +265,7 @@ int main( cleanup: IVAS_RTP_Term( &ivasRtp ); if ( FmtSWFile ) { fclose( FmtSWFile ); Loading Loading @@ -1968,7 +1971,6 @@ static bool parseCmdlIVAS_enc( i++; } /*-----------------------------------------------------------------* * Option not recognized *-----------------------------------------------------------------*/ Loading
apps/isar_post_rend.c +5 −1 Original line number Diff line number Diff line Loading @@ -229,6 +229,7 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( const char *configString, bool *srRtp static void convertOutputBuffer( const Word32 *fixedBuffer, Word16 q, const int16_t numSamplesPerChannel, const int16_t numChannels, int16_t *intBuffer ); /*------------------------------------------------------------------------------------------* * Local functions *------------------------------------------------------------------------------------------*/ Loading Loading @@ -399,6 +400,7 @@ static IVAS_AUDIO_CONFIG parseAudioConfig( *srRtp = true; return IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED; } return IVAS_AUDIO_CONFIG_INVALID; } Loading Loading @@ -456,6 +458,7 @@ static CmdlnArgs defaultArgs( clearString( args.inputFilePath ); clearString( args.outputFilePath ); clearString( args.srParamsFilePath ); args.sampleRate = 0; args.outConfig.audioConfig = IVAS_AUDIO_CONFIG_INVALID; Loading Loading @@ -561,7 +564,6 @@ static void parseOption( fprintf( stderr, "Unknown or invalid option for frame size: %s\n", optionValues[0] ); exit( -1 ); } break; case CmdLnOptionId_srParamsFile: assert( numOptionValues == 1 ); Loading Loading @@ -695,6 +697,7 @@ static void convertOutputBuffer( return; } static void trim( char *str ) { char c; Loading @@ -712,6 +715,7 @@ static void trim( char *str ) str[w] = 0; } static ivas_error parseSRParamsFile( const char *srParamsFilePath, const char *rtpFilePath, Loading
apps/renderer.c +7 −12 Original line number Diff line number Diff line Loading @@ -230,7 +230,7 @@ typedef enum CmdLnOptionId_syncMdDelay, CmdLnOptionId_directivityPatternId, CmdLnOptionId_acousticEnvironmentId, CmdLnOptionId_roomSize, CmdLnOptionId_roomSize } CmdLnOptionId; static const CmdLnParser_Option cliOptions[] = { Loading Loading @@ -1169,8 +1169,6 @@ int main( if ( args.renderConfigFilePath[0] != '\0' ) { /* sanity check */ if ( ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL ) && ( args.outConfig.audioConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && Loading Loading @@ -1205,7 +1203,7 @@ int main( } if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : IVAS_DEFAULT_AEID; if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) Loading Loading @@ -1241,7 +1239,6 @@ int main( goto cleanup; } /* Set reverb room size if specified */ if ( args.reverbRoomSize != IVAS_ROOM_SIZE_AUTO ) { Loading Loading @@ -1534,12 +1531,7 @@ int main( audioWriter = NULL; } if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) if ( ( error = IVAS_REND_GetSplitRendBitstreamHeader( hIvasRend, &bitsBuffer.config.codec, &bitsBuffer.config.poseCorrection, &bitsBuffer.config.codec_frame_size_ms, &bitsBuffer.config.isar_frame_size_ms, &bitsBuffer.config.lc3plus_highres ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_GetSplitRendBitstreamHeader(): %s!\n", ivas_error_to_string( error ) ); goto cleanup; Loading Loading @@ -1650,7 +1642,7 @@ int main( ObjectPositionBuffer mtdBuffer; outBuffer.pq_fact = &outBuffer.q_factor; Word16 subframe_len = (Word16) ( args.sampleRate / ( 200 ) ); // sample rate /FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES Word16 subframe_len = (Word16) ( args.sampleRate / ( FRAMES_PER_SEC * MAX_PARAM_SPATIAL_SUBFRAMES ) ); Word16 gd_bits = find_guard_bits( subframe_len ); Word16 prev_q_fact = Q11; while ( 1 ) Loading Loading @@ -2640,7 +2632,9 @@ static bool parseAcousticEnvironmentIds( AcousticEnvironmentSequence *aeSequence ) { char config_string[RENDERER_MAX_METADATA_LINE_LENGTH]; strncpy( config_string, value, RENDERER_MAX_METADATA_LINE_LENGTH ); if ( !is_digits_only( config_string ) ) { aeidFileReader *aeidReader = NULL; Loading Loading @@ -3109,6 +3103,7 @@ void getMetadataFromFileReader( fprintf( stderr, "\nError (%s) while reading ISM metadata from: %s\n\n", ivas_error_to_string( error ), IsmFileReader_getFilePath( ismReader ) ); exit( -1 ); } objectMetadataBuffer->positions[objIdx].azimuth_fx = ismMetadata.azimuth_fx; objectMetadataBuffer->positions[objIdx].elevation_fx = ismMetadata.elevation_fx; objectMetadataBuffer->positions[objIdx].radius_fx = ismMetadata.radius_fx; Loading