Loading apps/decoder.c +0 −276 Original line number Diff line number Diff line Loading @@ -122,9 +122,7 @@ static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING #ifdef MC_JBM static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #endif static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif Loading Loading @@ -287,15 +285,11 @@ int main( if ( arg.voipMode ) { #ifdef MC_JBM if ( ( error = printBitstreamInfoVoip( arg, hBsReader, hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error while previewing VoIP bitstream: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else IVAS_DEC_PrintConfig( hIvasDec, arg.quietModeEnabled, arg.voipMode ); #endif } else { Loading Loading @@ -454,13 +448,6 @@ int main( if ( arg.voipMode ) { #ifndef MC_JBM if ( arg.decMode != IVAS_DEC_MODE_EVS ) { fprintf( stderr, "\nError: VoIP not yet supported for decMode: %d\n\n", arg.decMode ); goto cleanup; } #endif if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1087,7 +1074,6 @@ static int16_t app_own_random( int16_t *seed ) } #endif #ifdef MC_JBM static ivas_error initOnFirstGoodFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: */ const DecArguments arg, /* i : */ Loading Loading @@ -1242,7 +1228,6 @@ static ivas_error initOnFirstGoodFrame( return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * decodeG192() Loading @@ -1260,11 +1245,7 @@ static ivas_error decodeG192( { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; #ifdef MC_JBM int16_t i, num_bits; #else int16_t i, j, num_bits; #endif int16_t bfi = 0; #ifdef DEBUGGING int16_t fec_seed = 12558; /* FEC_SEED */ Loading @@ -1276,9 +1257,6 @@ static ivas_error decodeG192( int16_t nOutChannels = 0; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; #ifndef MC_JBM int16_t zeroPad = 0; #endif int16_t nOutSamples = 0; int32_t delayTimeScale = 0; ivas_error error = IVAS_ERR_UNKNOWN; Loading Loading @@ -1386,7 +1364,6 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { #ifdef MC_JBM error = initOnFirstGoodFrame( hIvasDec, arg, Loading @@ -1405,128 +1382,6 @@ static ivas_error decodeG192( { goto cleanup; } #else /* Now number of output channels and frame size are known */ if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, &nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); goto cleanup; } int32_t pcmFrameSize; if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error ); goto cleanup; } /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); goto cleanup; } int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( i = 0; i < numInitialBadFrames; ++i ) { if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, zeroBuf, nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); goto cleanup; } delayNumSamples = 0; } else { delayNumSamples -= nOutSamples; } } free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &bsFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */ if ( bsFormat == IVAS_DEC_BS_OBJ ) { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } for ( i = 0; i < numObj; ++i ) { if ( ( error = IsmFileWriter_open( arg.outputWavFilename, i, &ismWriters[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Error opening ISM decoded metadata file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); goto cleanup; } } for ( j = 0; j < numInitialBadFrames; ++j ) { /* write zero metadata */ for ( i = 0; i < numObj; ++i ) { IVAS_ISM_METADATA IsmMetadata; if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 1, i ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); goto cleanup; } } } } /* If outputting MASA, open output file and write metadata for initial bad frames */ else if ( bsFormat == IVAS_DEC_BS_MASA ) { if ( ( error = MasaFileWriter_open( arg.outputWavFilename, &masaWriter ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; } /* Duplicate good first frame metadata to fill the beginning of stream. */ IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } for ( j = 0; j < numInitialBadFrames; ++j ) { if ( ( MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; } } } } #endif } else { Loading @@ -1534,25 +1389,6 @@ static ivas_error decodeG192( } } #ifndef MC_JBM if ( delayNumSamples == -1 ) { if ( arg.delayCompensationEnabled ) { if ( ( error = IVAS_DEC_GetDelay( hIvasDec, &delayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } delayNumSamples_orig = delayNumSamples; } else { delayNumSamples = 0; } zeroPad = delayNumSamples; } #endif /* Write current frame */ if ( decodedGoodFrame ) Loading Loading @@ -1663,21 +1499,12 @@ static ivas_error decodeG192( } /* add zeros at the end to have equal length of synthesized signals */ #ifdef MC_JBM memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else memset( pcmBuf, 0, zeroPad * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); goto cleanup; } #endif /*------------------------------------------------------------------------------------------* * Close files and deallocate resources Loading @@ -1702,7 +1529,6 @@ cleanup: return error; } #ifdef MC_JBM #ifdef DEBUGGING /*---------------------------------------------------------------------* * printBitstreamInfoVoip() Loading Loading @@ -1804,16 +1630,13 @@ cleanup: return IVAS_ERR_OK; } #endif #endif #ifdef MC_JBM #ifdef SUPPORT_JBM_TRACEFILE static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer ) { return JbmTraceFileWriter_writeFrame( data, writer ); } #endif #endif /*---------------------------------------------------------------------* Loading @@ -1839,7 +1662,6 @@ static ivas_error decodeVoIP( uint16_t rtpSequenceNumber; uint32_t rtpTimeStamp; #ifdef MC_JBM bool decodedGoodFrame = false; int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ int16_t nOutChannels = 0; Loading @@ -1847,15 +1669,6 @@ static ivas_error decodeVoIP( uint16_t numObj = 0; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #else /* For now always assume output with one channel. When adding VoIP to IVAS, * initialization of the memory for jitter buffer etc. needs to happen after * first good frame has been decoded because for some configs (such as EXT * renderer) only then the number of output channels is known.*/ const int16_t nOutChannels = 1; const uint32_t pcmBufSizeWithSampleBasedTimeScaling = 3 * MAX_FRAME_SIZE; int16_t pcmBuf[3 * MAX_FRAME_SIZE]; #endif AudioFileWriter *afWriter = NULL; #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriter *jbmTraceWriter = NULL; Loading @@ -1865,9 +1678,6 @@ static ivas_error decodeVoIP( int16_t delayNumSamples_orig = -1; int16_t delayNumSamples = -1; int32_t delayTimeScale = -1; #ifndef MC_JBM int16_t zeroPad = 0; #endif FILE *f_rtpstream = NULL; EVS_RTPDUMP_DEPACKER rtpdumpDepacker; Loading @@ -1877,16 +1687,12 @@ static ivas_error decodeVoIP( uint16_t frameTypeIndex; bool qBit; #ifdef MC_JBM IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; } #else memset( pcmBuf, 0, pcmBufSizeWithSampleBasedTimeScaling ); #endif rtpdumpDepacker.rtpdump = NULL; Loading Loading @@ -1917,13 +1723,6 @@ static ivas_error decodeVoIP( goto cleanup; } #ifndef MC_JBM if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); goto cleanup; } #endif #ifdef SUPPORT_JBM_TRACEFILE if ( arg.jbmTraceFilename != NULL ) Loading Loading @@ -1951,12 +1750,6 @@ static ivas_error decodeVoIP( if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) { error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); #ifndef MC_JBM if ( !evsPayload_getFrameTypeFromSize( auSize, &isAMRWB_IOmode, &frameTypeIndex ) ) { error = IVAS_ERR_BITSTREAM_READER_INVALID_DATA; } #endif qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ } else Loading Loading @@ -2002,11 +1795,7 @@ static ivas_error decodeVoIP( while ( nextPacketRcvTime_ms <= systemTime_ms ) { /* feed the previous read packet into the receiver now */ #ifdef MC_JBM error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, qBit ); #else error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, isAMRWB_IOmode, frameTypeIndex, qBit ); #endif if ( error != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_FeedFrame: %s\n", IVAS_DEC_GetErrorMessage( error ) ); Loading @@ -2019,12 +1808,6 @@ static ivas_error decodeVoIP( { error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); #ifndef MC_JBM if ( !evsPayload_getFrameTypeFromSize( auSize, &isAMRWB_IOmode, &frameTypeIndex ) ) { error = IVAS_ERR_BITSTREAM_READER_INVALID_DATA; } #endif qBit = 1; /* good q_bit for VOIP_G192_RTP */ } else Loading Loading @@ -2056,7 +1839,6 @@ static ivas_error decodeVoIP( break; } #ifdef MC_JBM nOutSamples = (int16_t) ( arg.output_Fs / 50 ); /* decode and get samples */ Loading @@ -2067,36 +1849,11 @@ static ivas_error decodeVoIP( jbmTraceWriter #endif ) ) != IVAS_ERR_OK ) #else /* decode and get samples */ if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, &nOutSamples, pcmBuf, pcmBufSizeWithSampleBasedTimeScaling, systemTime_ms ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifndef MC_JBM #ifdef SUPPORT_JBM_TRACEFILE /* write JBM trace file entry - only done for EVS testing */ if ( jbmTraceWriter != NULL ) { IVAS_JBM_TRACE_DATA JbmTraceData; if ( ( error = IVAS_DEC_GetJbmData( hIvasDec, &JbmTraceData ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetJbmData: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( ( JbmTraceFileWriter_writeFrame( &JbmTraceData, jbmTraceWriter ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing JBM Trace data to file %s\n", arg.jbmTraceFilename ); goto cleanup; } } #endif #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading @@ -2116,7 +1873,6 @@ static ivas_error decodeVoIP( } } #ifdef MC_JBM /* Continue checking for first good frame until it is found */ if ( !decodedGoodFrame ) { Loading Loading @@ -2153,33 +1909,11 @@ static ivas_error decodeVoIP( ++numInitialBadFrames; } } #endif #ifndef MC_JBM if ( delayNumSamples == -1 ) { if ( arg.delayCompensationEnabled ) { if ( ( error = IVAS_DEC_GetDelay( hIvasDec, &delayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } delayNumSamples_orig = delayNumSamples; } else { delayNumSamples = 0; } zeroPad = delayNumSamples; } #endif /* Write current frame */ #ifdef MC_JBM if ( decodedGoodFrame ) { #endif if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) Loading @@ -2193,9 +1927,7 @@ static ivas_error decodeVoIP( { delayNumSamples -= nOutSamples; } #ifdef MC_JBM } #endif if ( !arg.quietModeEnabled ) { Loading @@ -2213,7 +1945,6 @@ static ivas_error decodeVoIP( #endif } #ifdef MC_JBM /* add zeros at the end to have equal length of synthesized signals */ memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) Loading @@ -2221,11 +1952,6 @@ static ivas_error decodeVoIP( fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else /* add zeros at the end to have equal length of synthesized signals */ memset( pcmBuf, 0, zeroPad * nOutChannels * sizeof( int16_t ) ); AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ); #endif /*------------------------------------------------------------------------------------------* * Printouts after decoding has finished Loading @@ -2244,9 +1970,7 @@ static ivas_error decodeVoIP( cleanup: #ifdef MC_JBM EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); #endif AudioFileWriter_close( &afWriter ); JbmOffsetFileWriter_close( &jbmOffsetWriter ); #ifdef SUPPORT_JBM_TRACEFILE Loading lib_com/bitstream.c +0 −120 Original line number Diff line number Diff line Loading @@ -2012,11 +2012,7 @@ ivas_error read_indices( file_read_FECpattern( &st_ivas->bfi ); st_ivas->bfi |= bfi; #ifdef MC_JBM if ( bfi == FRAMEMODE_MISSING ) /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #else if ( bfi ) #endif { for ( k = 0; k < num_bits; k++ ) { Loading Loading @@ -2182,9 +2178,7 @@ ivas_error read_indices( /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */ if ( ( #ifdef MC_JBM bfi != FRAMEMODE_FUTURE && /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #endif ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */ ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */ { Loading Loading @@ -2229,9 +2223,7 @@ ivas_error read_indices( /* GOOD frame */ if ( st_ivas->bfi == 0 #ifdef MC_JBM || st_ivas->bfi == FRAMEMODE_FUTURE /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #endif ) { /* GOOD frame - convert ITU-T G.192 words to short values */ Loading Loading @@ -2735,118 +2727,6 @@ void get_NextCoderType( return; } #ifndef MC_JBM /*-------------------------------------------------------------------* * read_indices_from_djb() * * Read indices from the de-jitter buffer payload (works also for AMR-WB IO mode) *-------------------------------------------------------------------*/ void read_indices_from_djb( Decoder_State *st, /* i/o: decoder state structure */ uint8_t *pt_stream, /* i : bitstream file */ int16_t *CNG, const int16_t num_bits, /* i : input frame length in bits */ const Word16 isAMRWB_IOmode, const Word16 core_mode, const Word16 qbit, const Word16 bitstreamformat, const Word16 amrwb_rfc4867_flag, const int16_t partialframe, /* i : partial frame information */ const int16_t next_coder_type /* i : next coder type information */ ) { int16_t k; UWord8 mask = 0x80; Word16 no_data = 0; Word16 sti = -1; uint16_t *bit_stream_ptr; int32_t total_brate; int16_t speech_lost = 0; st->bfi = 0; st->BER_detect = 0; st->mdct_sw_enable = 0; st->mdct_sw = 0; reset_indices_dec( st ); st->bfi = !qbit; total_brate = (Word32) (num_bits) *50; if ( num_bits == 0 ) /* guess type of missing frame for SP_LOST and NO_DATA */ { speech_lost = *CNG == 0; no_data = *CNG != 0; } if ( partialframe || st->prev_use_partial_copy ) { st->next_coder_type = next_coder_type; } else { st->next_coder_type = INACTIVE; } if ( partialframe == 1 ) { st->bfi = 2; } /* unpack speech data */ bit_stream_ptr = st->bit_stream; /* convert bitstream from compact bytes to short values and store it in decoder state */ for ( k = 0; k < num_bits; k++ ) { if ( bitstreamformat == VOIP_RTPDUMP && isAMRWB_IOmode ) { st->bit_stream[sort_ptr[core_mode][k]] = unpack_bit( &pt_stream, &mask ); bit_stream_ptr++; } else { *bit_stream_ptr++ = unpack_bit( &pt_stream, &mask ); } } /* unpack auxiliary bits */ if ( isAMRWB_IOmode && total_brate == SID_1k75 ) { if ( bitstreamformat == VOIP_RTPDUMP ) { /* A.2.2.1.3: AMR-WB SID_1k75 frame is followed by STI bit and CMI bits */ sti = unpack_bit( &pt_stream, &mask ); } else { /* VOIP_G192_RTP does not contain STI and CMI */ sti = 1; } read_indices_mime_handle_sti_and_all_zero_bits( st, &total_brate, sti ); } /* add two zero bytes for arithmetic coder flush */ for ( k = 0; k < 8 * 2; ++k ) { *bit_stream_ptr++ = 0; } total_brate = read_indices_mime_handle_dtx( st, CNG, isAMRWB_IOmode, core_mode, total_brate, sti, speech_lost, no_data, amrwb_rfc4867_flag ); /* st->CNG set inside */ if ( st->bfi != 1 ) { /* select Mode 1 or Mode 2 */ decoder_selectCodec( st, total_brate, *st->bit_stream ? 1 : 0 ); /* a change of the total bitrate should not be known to the decoder, if the received frame was truly lost */ st->total_brate = total_brate; mdct_switching_dec( st ); } return; } #endif /*-------------------------------------------------------------------* * get_indice_preview() Loading lib_com/common_api_types.h +0 −11 Original line number Diff line number Diff line Loading @@ -134,28 +134,17 @@ typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; typedef struct _IVAS_JBM_TRACE_DATA { #ifdef MC_JBM uint32_t systemTimestamp_ms; uint16_t extBufferedSamples; uint16_t lastDecodedWasActive; int32_t output_Fs; int16_t dataUnit_flag; #else double playTime; int16_t partialCopyOffset; #endif uint16_t sequenceNumber; uint32_t timeStamp; uint32_t rcvTime; #ifdef MC_JBM int16_t partial_frame; int16_t partialCopyOffset; #else int16_t lastDecodedWasActive; int16_t partial_frame_flag; int16_t dataUnit_flag; #endif } IVAS_JBM_TRACE_DATA; Loading lib_com/ivas_error.h +0 −2 Original line number Diff line number Diff line Loading @@ -81,9 +81,7 @@ typedef enum IVAS_ERR_INVALID_INDEX, IVAS_ERR_NOT_SUPPORTED_OPTION, IVAS_ERR_NOT_IMPLEMENTED, #ifdef MC_JBM IVAS_ERR_WAITING_FOR_BITSTREAM, #endif IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH, IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, Loading lib_com/options.h +0 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ #define MC_JBM /* FhG: extend JBM beyond mono for running IVAS in VoIP mode (contribution 19) */ #define FIX_265_MC_BRATE_SWITCHING /* Issue 265: fix use-of-uninitialized-value in MC bitrate switching */ #define FIX_ANGLE_WRAPPING /* Issue 244: Problems with angle wrapping*/ #define FIX_245_RANGE_CODER_VOIP_MSAN /* Issue 245: fix use-of-uninitialized-value in range coder in VoIP mode */ Loading Loading
apps/decoder.c +0 −276 Original line number Diff line number Diff line Loading @@ -122,9 +122,7 @@ static void usage_dec( void ); static ivas_error decodeG192( DecArguments arg, BS_READER_HANDLE hBsReader, HeadRotFileReader *headRotReader, IVAS_DEC_HANDLE hIvasDec, int16_t *pcmBuf ); static ivas_error decodeVoIP( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #ifdef DEBUGGING #ifdef MC_JBM static ivas_error printBitstreamInfoVoip( DecArguments arg, BS_READER_HANDLE hBsReader, IVAS_DEC_HANDLE hIvasDec ); #endif static int16_t app_own_random( int16_t *seed ); static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ); #endif Loading Loading @@ -287,15 +285,11 @@ int main( if ( arg.voipMode ) { #ifdef MC_JBM if ( ( error = printBitstreamInfoVoip( arg, hBsReader, hIvasDec ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Error while previewing VoIP bitstream: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else IVAS_DEC_PrintConfig( hIvasDec, arg.quietModeEnabled, arg.voipMode ); #endif } else { Loading Loading @@ -454,13 +448,6 @@ int main( if ( arg.voipMode ) { #ifndef MC_JBM if ( arg.decMode != IVAS_DEC_MODE_EVS ) { fprintf( stderr, "\nError: VoIP not yet supported for decMode: %d\n\n", arg.decMode ); goto cleanup; } #endif if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) { Loading Loading @@ -1087,7 +1074,6 @@ static int16_t app_own_random( int16_t *seed ) } #endif #ifdef MC_JBM static ivas_error initOnFirstGoodFrame( IVAS_DEC_HANDLE hIvasDec, /* i/o: */ const DecArguments arg, /* i : */ Loading Loading @@ -1242,7 +1228,6 @@ static ivas_error initOnFirstGoodFrame( return IVAS_ERR_OK; } #endif /*---------------------------------------------------------------------* * decodeG192() Loading @@ -1260,11 +1245,7 @@ static ivas_error decodeG192( { bool decodingFailed = true; /* Assume failure until cleanup is reached without errors */ uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; #ifdef MC_JBM int16_t i, num_bits; #else int16_t i, j, num_bits; #endif int16_t bfi = 0; #ifdef DEBUGGING int16_t fec_seed = 12558; /* FEC_SEED */ Loading @@ -1276,9 +1257,6 @@ static ivas_error decodeG192( int16_t nOutChannels = 0; int16_t delayNumSamples = -1; int16_t delayNumSamples_orig = 0; #ifndef MC_JBM int16_t zeroPad = 0; #endif int16_t nOutSamples = 0; int32_t delayTimeScale = 0; ivas_error error = IVAS_ERR_UNKNOWN; Loading Loading @@ -1386,7 +1364,6 @@ static ivas_error decodeG192( /* Once good frame decoded, catch up */ if ( decodedGoodFrame ) { #ifdef MC_JBM error = initOnFirstGoodFrame( hIvasDec, arg, Loading @@ -1405,128 +1382,6 @@ static ivas_error decodeG192( { goto cleanup; } #else /* Now number of output channels and frame size are known */ if ( ( error = IVAS_DEC_GetNumOutputChannels( hIvasDec, &nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumOutputChannels, code: %d\n", error ); goto cleanup; } int32_t pcmFrameSize; if ( ( error = IVAS_DEC_GetPcmFrameSize( hIvasDec, &pcmFrameSize ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetPcmFrameSize, error code: %d\n", error ); goto cleanup; } /* Open audio writer and write all previously skipped bad frames now that frame size is known */ if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); goto cleanup; } int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( i = 0; i < numInitialBadFrames; ++i ) { if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, zeroBuf, nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); goto cleanup; } delayNumSamples = 0; } else { delayNumSamples -= nOutSamples; } } free( zeroBuf ); /* Open other output files if EXT output config - now details about ISM or MASA are known */ if ( arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { if ( ( error = IVAS_DEC_GetFormat( hIvasDec, &bsFormat ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetFormat, code: %d\n", error ); goto cleanup; } /* If outputting ISM, get number of objects, open output files and write zero metadata for initial bad frames */ if ( bsFormat == IVAS_DEC_BS_OBJ ) { if ( ( error = IVAS_DEC_GetNumObjects( hIvasDec, &numObj ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetNumObjects: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } for ( i = 0; i < numObj; ++i ) { if ( ( error = IsmFileWriter_open( arg.outputWavFilename, i, &ismWriters[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Error opening ISM decoded metadata file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); goto cleanup; } } for ( j = 0; j < numInitialBadFrames; ++j ) { /* write zero metadata */ for ( i = 0; i < numObj; ++i ) { IVAS_ISM_METADATA IsmMetadata; if ( ( error = IVAS_DEC_GetObjectMetadata( hIvasDec, &IsmMetadata, 1, i ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetObjectMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( ( IsmFileWriter_writeFrame( IsmMetadata, ismWriters[i] ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing ISM metadata to file %s\n", IsmFileWriter_getFilePath( ismWriters[i] ) ); goto cleanup; } } } } /* If outputting MASA, open output file and write metadata for initial bad frames */ else if ( bsFormat == IVAS_DEC_BS_MASA ) { if ( ( error = MasaFileWriter_open( arg.outputWavFilename, &masaWriter ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError: Error opening MASA decoded metadata file %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; } /* Duplicate good first frame metadata to fill the beginning of stream. */ IVAS_MASA_QMETADATA_HANDLE qMetadata = NULL; if ( ( error = IVAS_DEC_GetMasaMetadata( hIvasDec, &qMetadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetMasaMetadata: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } for ( j = 0; j < numInitialBadFrames; ++j ) { if ( ( MasaFileWriter_writeFrame( masaWriter, qMetadata ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing MASA metadata to file: %s\n", MasaFileWriter_getFilePath( masaWriter ) ); goto cleanup; } } } } #endif } else { Loading @@ -1534,25 +1389,6 @@ static ivas_error decodeG192( } } #ifndef MC_JBM if ( delayNumSamples == -1 ) { if ( arg.delayCompensationEnabled ) { if ( ( error = IVAS_DEC_GetDelay( hIvasDec, &delayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } delayNumSamples_orig = delayNumSamples; } else { delayNumSamples = 0; } zeroPad = delayNumSamples; } #endif /* Write current frame */ if ( decodedGoodFrame ) Loading Loading @@ -1663,21 +1499,12 @@ static ivas_error decodeG192( } /* add zeros at the end to have equal length of synthesized signals */ #ifdef MC_JBM memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else memset( pcmBuf, 0, zeroPad * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); goto cleanup; } #endif /*------------------------------------------------------------------------------------------* * Close files and deallocate resources Loading @@ -1702,7 +1529,6 @@ cleanup: return error; } #ifdef MC_JBM #ifdef DEBUGGING /*---------------------------------------------------------------------* * printBitstreamInfoVoip() Loading Loading @@ -1804,16 +1630,13 @@ cleanup: return IVAS_ERR_OK; } #endif #endif #ifdef MC_JBM #ifdef SUPPORT_JBM_TRACEFILE static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer ) { return JbmTraceFileWriter_writeFrame( data, writer ); } #endif #endif /*---------------------------------------------------------------------* Loading @@ -1839,7 +1662,6 @@ static ivas_error decodeVoIP( uint16_t rtpSequenceNumber; uint32_t rtpTimeStamp; #ifdef MC_JBM bool decodedGoodFrame = false; int16_t numInitialBadFrames = 0; /* Number of bad frames received until first good frame is decoded */ int16_t nOutChannels = 0; Loading @@ -1847,15 +1669,6 @@ static ivas_error decodeVoIP( uint16_t numObj = 0; int16_t pcmBuf[MAX_OUTPUT_PCM_BUFFER_SIZE]; #else /* For now always assume output with one channel. When adding VoIP to IVAS, * initialization of the memory for jitter buffer etc. needs to happen after * first good frame has been decoded because for some configs (such as EXT * renderer) only then the number of output channels is known.*/ const int16_t nOutChannels = 1; const uint32_t pcmBufSizeWithSampleBasedTimeScaling = 3 * MAX_FRAME_SIZE; int16_t pcmBuf[3 * MAX_FRAME_SIZE]; #endif AudioFileWriter *afWriter = NULL; #ifdef SUPPORT_JBM_TRACEFILE JbmTraceFileWriter *jbmTraceWriter = NULL; Loading @@ -1865,9 +1678,6 @@ static ivas_error decodeVoIP( int16_t delayNumSamples_orig = -1; int16_t delayNumSamples = -1; int32_t delayTimeScale = -1; #ifndef MC_JBM int16_t zeroPad = 0; #endif FILE *f_rtpstream = NULL; EVS_RTPDUMP_DEPACKER rtpdumpDepacker; Loading @@ -1877,16 +1687,12 @@ static ivas_error decodeVoIP( uint16_t frameTypeIndex; bool qBit; #ifdef MC_JBM IVAS_DEC_BS_FORMAT bsFormat = IVAS_DEC_BS_UNKOWN; IsmFileWriter *ismWriters[IVAS_MAX_NUM_OBJECTS]; for ( int16_t i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) { ismWriters[i] = NULL; } #else memset( pcmBuf, 0, pcmBufSizeWithSampleBasedTimeScaling ); #endif rtpdumpDepacker.rtpdump = NULL; Loading Loading @@ -1917,13 +1723,6 @@ static ivas_error decodeVoIP( goto cleanup; } #ifndef MC_JBM if ( ( error = AudioFileWriter_open( &afWriter, arg.outputWavFilename, arg.output_Fs, nOutChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to open output file %s\n", arg.outputWavFilename ); goto cleanup; } #endif #ifdef SUPPORT_JBM_TRACEFILE if ( arg.jbmTraceFilename != NULL ) Loading Loading @@ -1951,12 +1750,6 @@ static ivas_error decodeVoIP( if ( arg.inputFormat == IVAS_DEC_INPUT_FORMAT_G192 ) { error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); #ifndef MC_JBM if ( !evsPayload_getFrameTypeFromSize( auSize, &isAMRWB_IOmode, &frameTypeIndex ) ) { error = IVAS_ERR_BITSTREAM_READER_INVALID_DATA; } #endif qBit = 1; /* good q_bit for INPUT_FORMAT_G192 */ } else Loading Loading @@ -2002,11 +1795,7 @@ static ivas_error decodeVoIP( while ( nextPacketRcvTime_ms <= systemTime_ms ) { /* feed the previous read packet into the receiver now */ #ifdef MC_JBM error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, qBit ); #else error = IVAS_DEC_VoIP_FeedFrame( hIvasDec, auPtr, auSize, rtpSequenceNumber, rtpTimeStamp, nextPacketRcvTime_ms, isAMRWB_IOmode, frameTypeIndex, qBit ); #endif if ( error != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_VoIP_FeedFrame: %s\n", IVAS_DEC_GetErrorMessage( error ) ); Loading @@ -2019,12 +1808,6 @@ static ivas_error decodeVoIP( { error = BS_Reader_ReadVoipFrame_compact( hBsReader, au, &auSize, &rtpSequenceNumber, &rtpTimeStamp, &nextPacketRcvTime_ms ); #ifndef MC_JBM if ( !evsPayload_getFrameTypeFromSize( auSize, &isAMRWB_IOmode, &frameTypeIndex ) ) { error = IVAS_ERR_BITSTREAM_READER_INVALID_DATA; } #endif qBit = 1; /* good q_bit for VOIP_G192_RTP */ } else Loading Loading @@ -2056,7 +1839,6 @@ static ivas_error decodeVoIP( break; } #ifdef MC_JBM nOutSamples = (int16_t) ( arg.output_Fs / 50 ); /* decode and get samples */ Loading @@ -2067,36 +1849,11 @@ static ivas_error decodeVoIP( jbmTraceWriter #endif ) ) != IVAS_ERR_OK ) #else /* decode and get samples */ if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, &nOutSamples, pcmBuf, pcmBufSizeWithSampleBasedTimeScaling, systemTime_ms ) ) != IVAS_ERR_OK ) #endif { fprintf( stderr, "\nError in IVAS_DEC_VoIP_GetSamples: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } #ifndef MC_JBM #ifdef SUPPORT_JBM_TRACEFILE /* write JBM trace file entry - only done for EVS testing */ if ( jbmTraceWriter != NULL ) { IVAS_JBM_TRACE_DATA JbmTraceData; if ( ( error = IVAS_DEC_GetJbmData( hIvasDec, &JbmTraceData ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_DEC_GetJbmData: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } if ( ( JbmTraceFileWriter_writeFrame( &JbmTraceData, jbmTraceWriter ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError writing JBM Trace data to file %s\n", arg.jbmTraceFilename ); goto cleanup; } } #endif #endif /* write JBM Offset file entry */ if ( jbmOffsetWriter != NULL ) Loading @@ -2116,7 +1873,6 @@ static ivas_error decodeVoIP( } } #ifdef MC_JBM /* Continue checking for first good frame until it is found */ if ( !decodedGoodFrame ) { Loading Loading @@ -2153,33 +1909,11 @@ static ivas_error decodeVoIP( ++numInitialBadFrames; } } #endif #ifndef MC_JBM if ( delayNumSamples == -1 ) { if ( arg.delayCompensationEnabled ) { if ( ( error = IVAS_DEC_GetDelay( hIvasDec, &delayNumSamples, &delayTimeScale ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nUnable to get delay of decoder: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } delayNumSamples_orig = delayNumSamples; } else { delayNumSamples = 0; } zeroPad = delayNumSamples; } #endif /* Write current frame */ #ifdef MC_JBM if ( decodedGoodFrame ) { #endif if ( delayNumSamples < nOutSamples ) { if ( ( error = AudioFileWriter_write( afWriter, &pcmBuf[delayNumSamples * nOutChannels], nOutSamples * nOutChannels - ( delayNumSamples * nOutChannels ) ) ) != IVAS_ERR_OK ) Loading @@ -2193,9 +1927,7 @@ static ivas_error decodeVoIP( { delayNumSamples -= nOutSamples; } #ifdef MC_JBM } #endif if ( !arg.quietModeEnabled ) { Loading @@ -2213,7 +1945,6 @@ static ivas_error decodeVoIP( #endif } #ifdef MC_JBM /* add zeros at the end to have equal length of synthesized signals */ memset( pcmBuf, 0, delayNumSamples_orig * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig * nOutChannels ) ) != IVAS_ERR_OK ) Loading @@ -2221,11 +1952,6 @@ static ivas_error decodeVoIP( fprintf( stderr, "\nError writing output file: %s\n", ivas_error_to_string( error ) ); goto cleanup; } #else /* add zeros at the end to have equal length of synthesized signals */ memset( pcmBuf, 0, zeroPad * nOutChannels * sizeof( int16_t ) ); AudioFileWriter_write( afWriter, pcmBuf, zeroPad * nOutChannels ); #endif /*------------------------------------------------------------------------------------------* * Printouts after decoding has finished Loading @@ -2244,9 +1970,7 @@ static ivas_error decodeVoIP( cleanup: #ifdef MC_JBM EVS_RTPDUMP_DEPACKER_close( &rtpdumpDepacker ); #endif AudioFileWriter_close( &afWriter ); JbmOffsetFileWriter_close( &jbmOffsetWriter ); #ifdef SUPPORT_JBM_TRACEFILE Loading
lib_com/bitstream.c +0 −120 Original line number Diff line number Diff line Loading @@ -2012,11 +2012,7 @@ ivas_error read_indices( file_read_FECpattern( &st_ivas->bfi ); st_ivas->bfi |= bfi; #ifdef MC_JBM if ( bfi == FRAMEMODE_MISSING ) /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #else if ( bfi ) #endif { for ( k = 0; k < num_bits; k++ ) { Loading Loading @@ -2182,9 +2178,7 @@ ivas_error read_indices( /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */ if ( ( #ifdef MC_JBM bfi != FRAMEMODE_FUTURE && /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #endif ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */ ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */ { Loading Loading @@ -2229,9 +2223,7 @@ ivas_error read_indices( /* GOOD frame */ if ( st_ivas->bfi == 0 #ifdef MC_JBM || st_ivas->bfi == FRAMEMODE_FUTURE /* TODO(mcjbm): This fixes channel-aware mode BE. Still requires review from a bitstream reading expert */ #endif ) { /* GOOD frame - convert ITU-T G.192 words to short values */ Loading Loading @@ -2735,118 +2727,6 @@ void get_NextCoderType( return; } #ifndef MC_JBM /*-------------------------------------------------------------------* * read_indices_from_djb() * * Read indices from the de-jitter buffer payload (works also for AMR-WB IO mode) *-------------------------------------------------------------------*/ void read_indices_from_djb( Decoder_State *st, /* i/o: decoder state structure */ uint8_t *pt_stream, /* i : bitstream file */ int16_t *CNG, const int16_t num_bits, /* i : input frame length in bits */ const Word16 isAMRWB_IOmode, const Word16 core_mode, const Word16 qbit, const Word16 bitstreamformat, const Word16 amrwb_rfc4867_flag, const int16_t partialframe, /* i : partial frame information */ const int16_t next_coder_type /* i : next coder type information */ ) { int16_t k; UWord8 mask = 0x80; Word16 no_data = 0; Word16 sti = -1; uint16_t *bit_stream_ptr; int32_t total_brate; int16_t speech_lost = 0; st->bfi = 0; st->BER_detect = 0; st->mdct_sw_enable = 0; st->mdct_sw = 0; reset_indices_dec( st ); st->bfi = !qbit; total_brate = (Word32) (num_bits) *50; if ( num_bits == 0 ) /* guess type of missing frame for SP_LOST and NO_DATA */ { speech_lost = *CNG == 0; no_data = *CNG != 0; } if ( partialframe || st->prev_use_partial_copy ) { st->next_coder_type = next_coder_type; } else { st->next_coder_type = INACTIVE; } if ( partialframe == 1 ) { st->bfi = 2; } /* unpack speech data */ bit_stream_ptr = st->bit_stream; /* convert bitstream from compact bytes to short values and store it in decoder state */ for ( k = 0; k < num_bits; k++ ) { if ( bitstreamformat == VOIP_RTPDUMP && isAMRWB_IOmode ) { st->bit_stream[sort_ptr[core_mode][k]] = unpack_bit( &pt_stream, &mask ); bit_stream_ptr++; } else { *bit_stream_ptr++ = unpack_bit( &pt_stream, &mask ); } } /* unpack auxiliary bits */ if ( isAMRWB_IOmode && total_brate == SID_1k75 ) { if ( bitstreamformat == VOIP_RTPDUMP ) { /* A.2.2.1.3: AMR-WB SID_1k75 frame is followed by STI bit and CMI bits */ sti = unpack_bit( &pt_stream, &mask ); } else { /* VOIP_G192_RTP does not contain STI and CMI */ sti = 1; } read_indices_mime_handle_sti_and_all_zero_bits( st, &total_brate, sti ); } /* add two zero bytes for arithmetic coder flush */ for ( k = 0; k < 8 * 2; ++k ) { *bit_stream_ptr++ = 0; } total_brate = read_indices_mime_handle_dtx( st, CNG, isAMRWB_IOmode, core_mode, total_brate, sti, speech_lost, no_data, amrwb_rfc4867_flag ); /* st->CNG set inside */ if ( st->bfi != 1 ) { /* select Mode 1 or Mode 2 */ decoder_selectCodec( st, total_brate, *st->bit_stream ? 1 : 0 ); /* a change of the total bitrate should not be known to the decoder, if the received frame was truly lost */ st->total_brate = total_brate; mdct_switching_dec( st ); } return; } #endif /*-------------------------------------------------------------------* * get_indice_preview() Loading
lib_com/common_api_types.h +0 −11 Original line number Diff line number Diff line Loading @@ -134,28 +134,17 @@ typedef struct ivas_LS_setup_custom IVAS_LSSETUP_CUSTOM_STRUCT; typedef struct _IVAS_JBM_TRACE_DATA { #ifdef MC_JBM uint32_t systemTimestamp_ms; uint16_t extBufferedSamples; uint16_t lastDecodedWasActive; int32_t output_Fs; int16_t dataUnit_flag; #else double playTime; int16_t partialCopyOffset; #endif uint16_t sequenceNumber; uint32_t timeStamp; uint32_t rcvTime; #ifdef MC_JBM int16_t partial_frame; int16_t partialCopyOffset; #else int16_t lastDecodedWasActive; int16_t partial_frame_flag; int16_t dataUnit_flag; #endif } IVAS_JBM_TRACE_DATA; Loading
lib_com/ivas_error.h +0 −2 Original line number Diff line number Diff line Loading @@ -81,9 +81,7 @@ typedef enum IVAS_ERR_INVALID_INDEX, IVAS_ERR_NOT_SUPPORTED_OPTION, IVAS_ERR_NOT_IMPLEMENTED, #ifdef MC_JBM IVAS_ERR_WAITING_FOR_BITSTREAM, #endif IVAS_ERR_FILE_READER_TIMESTAMP_MISMATCH, IVAS_ERR_ISM_FILE_READER_INVALID_METADATA_FORMAT, IVAS_ERR_ISM_INVALID_METADATA_VALUE, Loading
lib_com/options.h +0 −1 Original line number Diff line number Diff line Loading @@ -147,7 +147,6 @@ #endif #define FIX_I59_DELAY_ROUNDING /* Issue 59: rounding in sample domain instead of nanosec for IVAS_ENC_GetDelay() and IVAS_DEC_GetDelay() */ #define FIX_FIX_I59 /* Issue 59: small fix concerning LFE delay rounding */ #define MC_JBM /* FhG: extend JBM beyond mono for running IVAS in VoIP mode (contribution 19) */ #define FIX_265_MC_BRATE_SWITCHING /* Issue 265: fix use-of-uninitialized-value in MC bitrate switching */ #define FIX_ANGLE_WRAPPING /* Issue 244: Problems with angle wrapping*/ #define FIX_245_RANGE_CODER_VOIP_MSAN /* Issue 245: fix use-of-uninitialized-value in range coder in VoIP mode */ Loading