Loading CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ file(GLOB libDecSrcs "lib_dec/*.c") file(GLOB libDecHeaders "lib_dec/*.h") add_library(lib_dec ${libDecSrcs} ${libDecHeaders}) target_link_libraries(lib_dec lib_com lib_rend lib_debug lib_isar) target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar) target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar lib_util) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") Loading Workspace_msvc/lib_dec.vcxproj +2 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling /> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> Loading Loading @@ -109,7 +109,7 @@ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed> <OmitFramePointers>false</OmitFramePointers> <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <ExceptionHandling /> Loading apps/decoder.c +214 −2 Original line number Diff line number Diff line Loading @@ -133,7 +133,9 @@ typedef struct bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; #ifdef IVAS_RTPDUMP bool applyPiData; char *piOutputFilename; bool rtpOutSR; #endif #ifdef DEBUGGING #ifdef DEBUG_FOA_AGC Loading Loading @@ -447,6 +449,9 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; #ifdef IVAS_RTPDUMP arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) Loading Loading @@ -485,7 +490,9 @@ int main( goto cleanup; } #ifndef IVAS_RTPDUMP arg.enableHeadRotation = true; #endif } /*------------------------------------------------------------------------------------------* Loading Loading @@ -976,7 +983,9 @@ static bool parseCmdlIVAS_dec( arg->enableExternalOrientation = false; arg->externalOrientationTrajFileName = NULL; #ifdef IVAS_RTPDUMP arg->applyPiData = false; arg->piOutputFilename = NULL; arg->rtpOutSR = false; #endif #ifdef SUPPORT_JBM_TRACEFILE Loading Loading @@ -1077,6 +1086,16 @@ static bool parseCmdlIVAS_dec( arg->piOutputFilename = argv[i++]; } else if ( strcmp( argv_to_upper, "-APPLYPIDATA" ) == 0 ) { arg->applyPiData = true; i++; } else if ( strcmp( argv_to_upper, "-RTPOUTSR" ) == 0 ) { arg->rtpOutSR = true; i++; } #endif #ifdef SUPPORT_JBM_TRACEFILE else if ( strcmp( argv_to_upper, "-TRACEFILE" ) == 0 ) Loading Loading @@ -1669,6 +1688,8 @@ static void usage_dec( void ) fprintf( stdout, " IVAS RTP Payload Format. The SDP parameter hf_only is required.\n" ); fprintf( stdout, " Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" ); fprintf( stdout, "-PiDataFile PF Log the timestampped PI data.\n" ); fprintf( stdout, "-ApplyPiData Apply the PI data found in the rtp packet.\n" ); fprintf( stdout, "-rtpOutSR : Split Rendering bitstream RTPDump output \n" ); #else fprintf( stdout, "-VOIP_hf_only=1 : VoIP mode: EVS RTP Payload Format hf_only=1 in rtpdump\n" ); fprintf( stdout, " The decoder may read rtpdump files containing TS26.445 Annex A.2.2\n" ); Loading Loading @@ -1777,6 +1798,9 @@ static ivas_error initOnFirstGoodFrame( IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o : */ int16_t *pNumOutChannels, /* o : */ uint16_t *pNumObj, /* o : */ #ifdef IVAS_RTPDUMP IVAS_RTP *srRtp, /* o : */ #endif SplitFileReadWrite **splitRendWriter ) { int16_t isSplitRend, isSplitCoded; Loading Loading @@ -1841,7 +1865,41 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef IVAS_RTPDUMP /* Split Rendering RTPDump Output file */ if ( arg.rtpOutSR && srRtp != NULL ) { FILE *fParamsSR = NULL; char srParamsFile[FILENAME_MAX], *ext = ".sr.txt"; strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - sizeof( ext ) ); strncat( srParamsFile, ext, sizeof( ext ) + 1 ); /* Write the Split Rendering Params passed from SDP to srParamsFile */ fParamsSR = fopen( srParamsFile, "w" ); if ( NULL != fParamsSR ) { fprintf( fParamsSR, "CODEC = %s;\nDOF = %d;\nFRAMESIZE = %d;\nRENDERSIZE = %d;\nLC3PLUS_HIGHRES = %d;\n", splitRendCodec == ISAR_SPLIT_REND_CODEC_LC3PLUS ? "LC3PLUS" : "LCLD", poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, lc3plusHighRes ); fclose( fParamsSR ); fParamsSR = NULL; } /* Split Rendering RTPDump Output file */ if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; } } else if ( isSplitCoded ) #else if ( isSplitCoded ) #endif { if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1875,6 +1933,74 @@ static ivas_error initOnFirstGoodFrame( } } #ifdef IVAS_RTPDUMP if ( !arg.rtpOutSR ) { int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetOutputBufferSize, error code: %d\n", error ); return error; } /* Write zeros to the output audio buffer */ int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) #else if ( *splitRendWriter != NULL ) #endif { ISAR_SPLIT_REND_BITS_DATA splitRendBitsZero; splitRendBitsZero.bits_buf = NULL; splitRendBitsZero.bits_read = 0; splitRendBitsZero.bits_written = 0; splitRendBitsZero.buf_len = 0; splitRendBitsZero.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRendBitsZero.pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; splitRendBitsZero.codec_frame_size_ms = 0; splitRendBitsZero.isar_frame_size_ms = 20; if ( split_rend_write_bitstream_to_file( *splitRendWriter, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); return error; } } #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( !isSplitCoded ) #else else #endif { if ( *pRemainingDelayNumSamples < *numOutSamples ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); return error; } *pRemainingDelayNumSamples = 0; } else { *pRemainingDelayNumSamples -= *numOutSamples; } } } free( zeroBuf ); } #else int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1939,6 +2065,8 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); #endif /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) { Loading Loading @@ -2031,7 +2159,11 @@ static ivas_error initOnFirstGoodFrame( } } #ifdef IVAS_RTPDUMP if ( arg.rtpOutSR || *splitRendWriter != NULL ) #else if ( *splitRendWriter != NULL ) #endif { if ( numOutSamples == NULL || vec_pos_len == NULL ) { Loading Loading @@ -2575,7 +2707,11 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { #ifdef IVAS_RTPDUMP if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, NULL, &splitRendWriter ) ) != IVAS_ERR_OK ) #else if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) #endif { goto cleanup; } Loading Loading @@ -2942,7 +3078,11 @@ static ivas_error printBitstreamInfoVoip( case IVAS_DEC_INPUT_FORMAT_RTPDUMP: case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: #ifdef IVAS_RTPDUMP if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename ) ) != IVAS_ERR_OK ) #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error ); goto cleanup; Loading Loading @@ -2984,7 +3124,11 @@ static ivas_error printBitstreamInfoVoip( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSizeBits, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSizeBits, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif #else rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSizeBits ); #endif Loading Loading @@ -3090,6 +3234,9 @@ static ivas_error decodeVoIP( int16_t i; #ifdef IVAS_RTPDUMP IVAS_RTP ivasRtp = { 0 }; IVAS_RTP srRtp = { 0 }; IVAS_RTP_SR_INFO srInfo = { true, false, 0, IVAS_SR_TRANSPORT_LCLD }; int32_t initialTsOffsetSystemAndRTP = 0; #else FILE *f_rtpstream = NULL; EVS_RTPDUMP_DEPACKER rtpdumpDepacker; Loading Loading @@ -3168,7 +3315,11 @@ static ivas_error decodeVoIP( case IVAS_DEC_INPUT_FORMAT_RTPDUMP: case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: #ifdef IVAS_RTPDUMP if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename ) ) != IVAS_ERR_OK ) #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error ); goto cleanup; Loading Loading @@ -3231,7 +3382,12 @@ static ivas_error decodeVoIP( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif initialTsOffsetSystemAndRTP = rtpTimeStamp - systemTime_ms * 16; /* For time mapping */ #else rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSize ); #endif Loading Loading @@ -3414,7 +3570,11 @@ static ivas_error decodeVoIP( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif /* IVAS RTP payload format has timescale 16000, JBM uses 1000 internally */ rtpTimeStamp = rtpTimeStamp / 16; Loading Loading @@ -3459,6 +3619,28 @@ static ivas_error decodeVoIP( /* decode and get samples */ while ( nSamplesRendered < nOutSamples ) { #ifdef IVAS_RTPDUMP if ( arg.applyPiData ) { /* Rudimentry Time Mapping to map system time to rtp timestamp */ uint32_t piTs = systemTime_ms * 16 + initialTsOffsetSystemAndRTP; uint32_t numPiData = 0; while ( ivasRtp.nProcPiData + numPiData < ivasRtp.nReadPiData && ivasRtp.piData[ivasRtp.nProcPiData + numPiData].timestamp <= piTs ) { numPiData++; } if ( ( error = IVAS_RTP_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; } ivasRtp.nProcPiData += numPiData; } #endif #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) { Loading Loading @@ -3575,7 +3757,11 @@ static ivas_error decodeVoIP( #else if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, #endif #ifdef IVAS_RTPDUMP &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) #else &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading @@ -3588,7 +3774,11 @@ static ivas_error decodeVoIP( } /* Write current frame */ #ifdef IVAS_RTPDUMP if ( !srRtp.hPack && decodedGoodFrame ) #else if ( decodedGoodFrame ) #endif { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) Loading Loading @@ -3673,8 +3863,25 @@ static ivas_error decodeVoIP( goto cleanup; } } IVAS_RTP_WriteExtPiData( ivasRtp.f_piExtOut, ivasRtp.piData, ivasRtp.nReadPiData, numObj ); } } #ifdef IVAS_RTPDUMP else if ( decodedGoodFrame ) { 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; 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 ) ); goto cleanup; } splitRendBits->bits_written = 0; splitRendBits->bits_read = 0; } #endif vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; if ( vec_pos_update == 0 ) Loading Loading @@ -3773,6 +3980,8 @@ static ivas_error decodeVoIP( goto cleanup; } } IVAS_RTP_WriteExtPiData( ivasRtp.f_piExtOut, ivasRtp.piData, ivasRtp.nReadPiData, numObj ); } } Loading Loading @@ -3826,6 +4035,8 @@ static ivas_error decodeVoIP( { fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } fprintf( stdout, "\nOutput PI data file: %s\n", IVAS_RTP_GetExtPiFilePath( &ivasRtp ) ); } /*------------------------------------------------------------------------------------------* Loading @@ -3837,6 +4048,7 @@ static ivas_error decodeVoIP( cleanup: #ifdef IVAS_RTPDUMP IVAS_RTP_Term( &srRtp ); IVAS_RTP_Term( &ivasRtp ); #else EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); Loading apps/encoder.c +4 −0 Original line number Diff line number Diff line Loading @@ -874,7 +874,11 @@ int main( goto cleanup; } #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, NULL, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError %s while pushing audio frame to RTP pack\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; Loading apps/isar_post_rend.c +227 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
CMakeLists.txt +1 −1 Original line number Diff line number Diff line Loading @@ -165,7 +165,7 @@ file(GLOB libDecSrcs "lib_dec/*.c") file(GLOB libDecHeaders "lib_dec/*.h") add_library(lib_dec ${libDecSrcs} ${libDecHeaders}) target_link_libraries(lib_dec lib_com lib_rend lib_debug lib_isar) target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar) target_include_directories(lib_dec PUBLIC lib_dec lib_rend PRIVATE lib_enc lib_isar lib_util) file(GLOB libUtilSrcs "lib_util/*.c") file(GLOB libUtilHeaders "lib_util/*.h") Loading
Workspace_msvc/lib_dec.vcxproj +2 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ </Midl> <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling /> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> Loading Loading @@ -109,7 +109,7 @@ <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed> <OmitFramePointers>false</OmitFramePointers> <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>..\lib_com;..\lib_debug;..\lib_dec;..\lib_enc;..\lib_isar;..\lib_rend;..\lib_lc3plus;..\lib_util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;$(Macros);WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <ExceptionHandling /> Loading
apps/decoder.c +214 −2 Original line number Diff line number Diff line Loading @@ -133,7 +133,9 @@ typedef struct bool tsmEnabled; IVAS_RENDER_FRAMESIZE renderFramesize; #ifdef IVAS_RTPDUMP bool applyPiData; char *piOutputFilename; bool rtpOutSR; #endif #ifdef DEBUGGING #ifdef DEBUG_FOA_AGC Loading Loading @@ -447,6 +449,9 @@ int main( asked_frame_size = arg.renderFramesize; uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535; #ifdef IVAS_RTPDUMP arg.enableHeadRotation = arg.enableHeadRotation || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM; #endif if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain, arg.dpidEnabled, aeID, arg.objEditEnabled, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) Loading Loading @@ -485,7 +490,9 @@ int main( goto cleanup; } #ifndef IVAS_RTPDUMP arg.enableHeadRotation = true; #endif } /*------------------------------------------------------------------------------------------* Loading Loading @@ -976,7 +983,9 @@ static bool parseCmdlIVAS_dec( arg->enableExternalOrientation = false; arg->externalOrientationTrajFileName = NULL; #ifdef IVAS_RTPDUMP arg->applyPiData = false; arg->piOutputFilename = NULL; arg->rtpOutSR = false; #endif #ifdef SUPPORT_JBM_TRACEFILE Loading Loading @@ -1077,6 +1086,16 @@ static bool parseCmdlIVAS_dec( arg->piOutputFilename = argv[i++]; } else if ( strcmp( argv_to_upper, "-APPLYPIDATA" ) == 0 ) { arg->applyPiData = true; i++; } else if ( strcmp( argv_to_upper, "-RTPOUTSR" ) == 0 ) { arg->rtpOutSR = true; i++; } #endif #ifdef SUPPORT_JBM_TRACEFILE else if ( strcmp( argv_to_upper, "-TRACEFILE" ) == 0 ) Loading Loading @@ -1669,6 +1688,8 @@ static void usage_dec( void ) fprintf( stdout, " IVAS RTP Payload Format. The SDP parameter hf_only is required.\n" ); fprintf( stdout, " Reading RFC4867 AMR/AMR-WB RTP payload format is not supported.\n" ); fprintf( stdout, "-PiDataFile PF Log the timestampped PI data.\n" ); fprintf( stdout, "-ApplyPiData Apply the PI data found in the rtp packet.\n" ); fprintf( stdout, "-rtpOutSR : Split Rendering bitstream RTPDump output \n" ); #else fprintf( stdout, "-VOIP_hf_only=1 : VoIP mode: EVS RTP Payload Format hf_only=1 in rtpdump\n" ); fprintf( stdout, " The decoder may read rtpdump files containing TS26.445 Annex A.2.2\n" ); Loading Loading @@ -1777,6 +1798,9 @@ static ivas_error initOnFirstGoodFrame( IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS], /* o : */ int16_t *pNumOutChannels, /* o : */ uint16_t *pNumObj, /* o : */ #ifdef IVAS_RTPDUMP IVAS_RTP *srRtp, /* o : */ #endif SplitFileReadWrite **splitRendWriter ) { int16_t isSplitRend, isSplitCoded; Loading Loading @@ -1841,7 +1865,41 @@ static ivas_error initOnFirstGoodFrame( return error; } #ifdef IVAS_RTPDUMP /* Split Rendering RTPDump Output file */ if ( arg.rtpOutSR && srRtp != NULL ) { FILE *fParamsSR = NULL; char srParamsFile[FILENAME_MAX], *ext = ".sr.txt"; strncpy( srParamsFile, arg.outputWavFilename, FILENAME_MAX - sizeof( ext ) ); strncat( srParamsFile, ext, sizeof( ext ) + 1 ); /* Write the Split Rendering Params passed from SDP to srParamsFile */ fParamsSR = fopen( srParamsFile, "w" ); if ( NULL != fParamsSR ) { fprintf( fParamsSR, "CODEC = %s;\nDOF = %d;\nFRAMESIZE = %d;\nRENDERSIZE = %d;\nLC3PLUS_HIGHRES = %d;\n", splitRendCodec == ISAR_SPLIT_REND_CODEC_LC3PLUS ? "LC3PLUS" : "LCLD", poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, lc3plusHighRes ); fclose( fParamsSR ); fParamsSR = NULL; } /* Split Rendering RTPDump Output file */ if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; } } else if ( isSplitCoded ) #else if ( isSplitCoded ) #endif { if ( ( error = split_rend_writer_open( splitRendWriter, arg.outputWavFilename, delayNumSamples_temp[0], delayTimeScale_temp, splitRendCodec, poseCorrection, splitRendCodecFrameSizeMs, splitRendIsarFrameSizeMs, arg.output_Fs, lc3plusHighRes ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1875,6 +1933,74 @@ static ivas_error initOnFirstGoodFrame( } } #ifdef IVAS_RTPDUMP if ( !arg.rtpOutSR ) { int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetOutputBufferSize, error code: %d\n", error ); return error; } /* Write zeros to the output audio buffer */ int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) #else if ( *splitRendWriter != NULL ) #endif { ISAR_SPLIT_REND_BITS_DATA splitRendBitsZero; splitRendBitsZero.bits_buf = NULL; splitRendBitsZero.bits_read = 0; splitRendBitsZero.bits_written = 0; splitRendBitsZero.buf_len = 0; splitRendBitsZero.codec = ISAR_SPLIT_REND_CODEC_DEFAULT; splitRendBitsZero.pose_correction = ISAR_SPLIT_REND_POSE_CORRECTION_MODE_NONE; splitRendBitsZero.codec_frame_size_ms = 0; splitRendBitsZero.isar_frame_size_ms = 20; if ( split_rend_write_bitstream_to_file( *splitRendWriter, splitRendBitsZero.bits_buf, &splitRendBitsZero.bits_read, &splitRendBitsZero.bits_written ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to write to bitstream file!\n" ); return error; } } #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( !isSplitCoded ) #else else #endif { if ( *pRemainingDelayNumSamples < *numOutSamples ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); return error; } *pRemainingDelayNumSamples = 0; } else { *pRemainingDelayNumSamples -= *numOutSamples; } } } free( zeroBuf ); } #else int16_t pcmFrameSize; if ( ( error = IVAS_DEC_GetOutputBufferSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1939,6 +2065,8 @@ static ivas_error initOnFirstGoodFrame( free( zeroBuf ); #endif /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL ) { Loading Loading @@ -2031,7 +2159,11 @@ static ivas_error initOnFirstGoodFrame( } } #ifdef IVAS_RTPDUMP if ( arg.rtpOutSR || *splitRendWriter != NULL ) #else if ( *splitRendWriter != NULL ) #endif { if ( numOutSamples == NULL || vec_pos_len == NULL ) { Loading Loading @@ -2575,7 +2707,11 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { #ifdef IVAS_RTPDUMP if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, NULL, &splitRendWriter ) ) != IVAS_ERR_OK ) #else if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, &vec_pos_len, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) #endif { goto cleanup; } Loading Loading @@ -2942,7 +3078,11 @@ static ivas_error printBitstreamInfoVoip( case IVAS_DEC_INPUT_FORMAT_RTPDUMP: case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: #ifdef IVAS_RTPDUMP if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename ) ) != IVAS_ERR_OK ) #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error ); goto cleanup; Loading Loading @@ -2984,7 +3124,11 @@ static ivas_error printBitstreamInfoVoip( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSizeBits, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSizeBits, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif #else rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSizeBits ); #endif Loading Loading @@ -3090,6 +3234,9 @@ static ivas_error decodeVoIP( int16_t i; #ifdef IVAS_RTPDUMP IVAS_RTP ivasRtp = { 0 }; IVAS_RTP srRtp = { 0 }; IVAS_RTP_SR_INFO srInfo = { true, false, 0, IVAS_SR_TRANSPORT_LCLD }; int32_t initialTsOffsetSystemAndRTP = 0; #else FILE *f_rtpstream = NULL; EVS_RTPDUMP_DEPACKER rtpdumpDepacker; Loading Loading @@ -3168,7 +3315,11 @@ static ivas_error decodeVoIP( case IVAS_DEC_INPUT_FORMAT_RTPDUMP: case IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF: #ifdef IVAS_RTPDUMP if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename ) ) != IVAS_ERR_OK ) #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, 0, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_READER_Init( &ivasRtp, arg.inputBitstreamFilename, arg.piOutputFilename, arg.outputConfig == IVAS_AUDIO_CONFIG_EXTERNAL, arg.outputWavFilename ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "error in IVAS_RTP_READER_Init(): %d\n", error ); goto cleanup; Loading Loading @@ -3231,7 +3382,12 @@ static ivas_error decodeVoIP( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, auPtr, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif initialTsOffsetSystemAndRTP = rtpTimeStamp - systemTime_ms * 16; /* For time mapping */ #else rtpdumpDepackerError = EVS_RTPDUMP_DEPACKER_readNextFrame( &rtpdumpDepacker, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms, &isAMRWB_IOmode, &frameTypeIndex, &qBit, &auPtr, (uint16_t *) &auSize ); #endif Loading Loading @@ -3414,7 +3570,11 @@ static ivas_error decodeVoIP( { auPtr = au; /* might have been set to RTP packet in prev call */ #ifdef IVAS_RTPDUMP #ifdef RTP_S4_251135_CR26253_0016_REV1 error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, NULL, &qBit ); #else error = IVAS_RTP_ReadNextFrame( &ivasRtp, au, &auSize, &rtpTimeStamp, &rtpSequenceNumber, &nextPacketRcvTime_ms, &qBit ); #endif /* IVAS RTP payload format has timescale 16000, JBM uses 1000 internally */ rtpTimeStamp = rtpTimeStamp / 16; Loading Loading @@ -3459,6 +3619,28 @@ static ivas_error decodeVoIP( /* decode and get samples */ while ( nSamplesRendered < nOutSamples ) { #ifdef IVAS_RTPDUMP if ( arg.applyPiData ) { /* Rudimentry Time Mapping to map system time to rtp timestamp */ uint32_t piTs = systemTime_ms * 16 + initialTsOffsetSystemAndRTP; uint32_t numPiData = 0; while ( ivasRtp.nProcPiData + numPiData < ivasRtp.nReadPiData && ivasRtp.piData[ivasRtp.nProcPiData + numPiData].timestamp <= piTs ) { numPiData++; } if ( ( error = IVAS_RTP_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; } ivasRtp.nProcPiData += numPiData; } #endif #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) { Loading Loading @@ -3575,7 +3757,11 @@ static ivas_error decodeVoIP( #else if ( ( error = initOnFirstGoodFrame( hIvasDec, arg, numInitialBadFrames, &nOutSamples, NULL, delayNumSamples_orig, &delayNumSamples, &delayTimeScale, #endif #ifdef IVAS_RTPDUMP &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &srRtp, &splitRendWriter ) ) != IVAS_ERR_OK ) #else &bsFormat, &afWriter, &masaWriter, ismWriters, &nOutChannels, &numObj, &splitRendWriter ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "Error in initOnFirstGoodFrame(): %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; Loading @@ -3588,7 +3774,11 @@ static ivas_error decodeVoIP( } /* Write current frame */ #ifdef IVAS_RTPDUMP if ( !srRtp.hPack && decodedGoodFrame ) #else if ( decodedGoodFrame ) #endif { #ifdef FIX_1119_SPLIT_RENDERING_VOIP if ( isSplitRend ) Loading Loading @@ -3673,8 +3863,25 @@ static ivas_error decodeVoIP( goto cleanup; } } IVAS_RTP_WriteExtPiData( ivasRtp.f_piExtOut, ivasRtp.piData, ivasRtp.nReadPiData, numObj ); } } #ifdef IVAS_RTPDUMP else if ( decodedGoodFrame ) { 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; 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 ) ); goto cleanup; } splitRendBits->bits_written = 0; splitRendBits->bits_read = 0; } #endif vec_pos_update = ( vec_pos_update + 1 ) % vec_pos_len; if ( vec_pos_update == 0 ) Loading Loading @@ -3773,6 +3980,8 @@ static ivas_error decodeVoIP( goto cleanup; } } IVAS_RTP_WriteExtPiData( ivasRtp.f_piExtOut, ivasRtp.piData, ivasRtp.nReadPiData, numObj ); } } Loading Loading @@ -3826,6 +4035,8 @@ static ivas_error decodeVoIP( { fprintf( stdout, "\nOutput MASA metadata file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); } fprintf( stdout, "\nOutput PI data file: %s\n", IVAS_RTP_GetExtPiFilePath( &ivasRtp ) ); } /*------------------------------------------------------------------------------------------* Loading @@ -3837,6 +4048,7 @@ static ivas_error decodeVoIP( cleanup: #ifdef IVAS_RTPDUMP IVAS_RTP_Term( &srRtp ); IVAS_RTP_Term( &ivasRtp ); #else EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); Loading
apps/encoder.c +4 −0 Original line number Diff line number Diff line Loading @@ -874,7 +874,11 @@ int main( goto cleanup; } #ifdef RTP_S4_251135_CR26253_0016_REV1 if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, NULL, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK ) #else if ( ( error = IVAS_RTP_WriteNextFrame( &ivasRtp, au, numBits, isMono, forcePacket ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError %s while pushing audio frame to RTP pack\n", IVAS_ENC_GetErrorMessage( error ) ); goto cleanup; Loading
apps/isar_post_rend.c +227 −0 File changed.Preview size limit exceeded, changes collapsed. Show changes