Loading apps/isar_post_rend.c +21 −0 Original line number Diff line number Diff line Loading @@ -992,6 +992,9 @@ int main( while ( 1 ) { #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi = 0; #endif int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; Loading @@ -1000,7 +1003,11 @@ int main( { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi ); #else error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); #endif if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -1067,19 +1074,33 @@ int main( /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi; #endif if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } #endif } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } } #endif for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { Loading lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ #define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ #define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */ #define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ // object-editing feature porting Loading lib_dec/lib_dec_fx.c +71 −17 Original line number Diff line number Diff line Loading @@ -1226,12 +1226,18 @@ ivas_error IVAS_DEC_GetSamples( hIvasDec->hasBeenFedFrame = false; move16(); set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; move16(); #else hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked ); move16(); *nOutSamples = nSamplesAsked; move16(); #endif hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesAsked ); move16(); #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( hIvasDec->nSamplesAvailableNext == 0 ) { hIvasDec->needNewFrame = true; Loading @@ -1239,6 +1245,7 @@ ivas_error IVAS_DEC_GetSamples( move16(); move16(); } #endif } ELSE { Loading Loading @@ -1373,6 +1380,7 @@ ivas_error IVAS_DEC_GetSamples( } nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop ); #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop ); IF( hIvasDec->nSamplesAvailableNext == 0 ) { Loading @@ -1386,9 +1394,25 @@ ivas_error IVAS_DEC_GetSamples( *needNewFrame = false; move16(); } #endif } } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; move16(); hIvasDec->needNewFrame = true; move16(); } ELSE { *needNewFrame = false; move16(); } #endif *nOutSamples = nSamplesRendered; move16(); Loading Loading @@ -1525,6 +1549,13 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } #endif FOR( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { pOutput[i] = hSplitBinRend->hMultiBinCldfbData->output_fx[i]; Loading Loading @@ -3778,14 +3809,21 @@ ivas_error IVAS_DEC_GetSamplesDecoder( ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) { ivas_error error; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } #endif /* If TSM is generally enabled, we have to wait for the first good frame. Otherwise, we directly decode the first frame in any case. */ #ifdef FIX_HRTF_LOAD Loading Loading @@ -3964,7 +4002,7 @@ ivas_error IVAS_DEC_GetEditableParameters( test(); test(); test(); if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || IF( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ) { Loading @@ -3978,6 +4016,16 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasEditableParameters->num_obj = 0; move16(); return IVAS_ERR_OK; } #endif hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30; move32(); hIvasEditableParameters->num_obj = hIvasDec->st_ivas->nchan_ism; Loading Loading @@ -4090,9 +4138,7 @@ ivas_error IVAS_DEC_GetEditableParameters( } #endif error = IVAS_ERR_OK; return error; return IVAS_ERR_OK; } Loading Loading @@ -4126,8 +4172,12 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } error = IVAS_ERR_OK; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } #endif #ifdef DEBUGGING assert( hIvasEditableParameters.num_obj == hIvasDec->st_ivas->nchan_ism ); #endif Loading Loading @@ -4325,7 +4375,7 @@ ivas_error IVAS_DEC_SetEditableParameters( } #endif return error; return IVAS_ERR_OK; } Loading @@ -4338,18 +4388,22 @@ ivas_error IVAS_DEC_SetEditableParameters( ivas_error IVAS_DEC_PrepareRenderer( IVAS_DEC_HANDLE hIvasDec ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ #endif { ivas_jbm_dec_prepare_renderer( hIvasDec->st_ivas ); } hIvasDec->hasBeenPreparedRendering = true; return error; return IVAS_ERR_OK; } #endif Loading lib_isar/lib_isar_post_rend.c +14 −0 Original line number Diff line number Diff line Loading @@ -1574,6 +1574,20 @@ static ivas_error renderSplitBinauralWithPostRot( } ELSE { #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (Word16) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize; move16(); } ELSE { splitBinInput->numCachedSamples = sub( splitBinInput->numCachedSamples, outAudio.config.numSamplesPerChannel ); } #endif IF( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { FOR( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) Loading lib_util/split_render_file_read_write.c +16 −0 Original line number Diff line number Diff line Loading @@ -323,11 +323,20 @@ ivas_error split_rend_write_bitstream_to_file( * *-----------------------------------------------------------------------------------------*/ #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ) #else ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) #endif { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; Loading Loading @@ -390,6 +399,13 @@ ivas_error split_rend_read_bits_from_file( *bits_read = 0; *bits_written = bit_len; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST *bfi = 0; if ( bit_len == 0 ) { *bfi = 1; } #endif return IVAS_ERR_OK; } Loading Loading
apps/isar_post_rend.c +21 −0 Original line number Diff line number Diff line Loading @@ -992,6 +992,9 @@ int main( while ( 1 ) { #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi = 0; #endif int16_t num_in_channels; num_in_channels = inBuffer.config.numChannels; Loading @@ -1000,7 +1003,11 @@ int main( { ivas_error error_tmp; numSamplesRead = (int16_t) inBufferSize; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten, &bfi ); #else error_tmp = split_rend_read_bits_from_file( hSplitRendFileReadWrite, bitsBuffer.bits, &bitsBuffer.config.bitsRead, &bitsBuffer.config.bitsWritten ); #endif if ( error_tmp != IVAS_ERR_OK ) { if ( error_tmp == IVAS_ERR_END_OF_FILE ) Loading Loading @@ -1067,19 +1074,33 @@ int main( /* Read from split renderer bfi file if specified */ if ( splitRendBFIReader != NULL && splitBinNeedsNewFrame ) { #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST int16_t bfi; #endif if ( ( error = SplitRendBFIFileReading( splitRendBFIReader, &bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in SplitRendBFIFileReading(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } #endif } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST if ( splitBinNeedsNewFrame ) { if ( ( error = ISAR_POST_REND_SetSplitRendBFI( hIsarPostRend, bfi ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in ISAR_POST_REND_SetSplitRendBFI(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } } #endif for ( i = 0; i < args.inConfig.numBinBuses; ++i ) { Loading
lib_com/options.h +1 −0 Original line number Diff line number Diff line Loading @@ -156,6 +156,7 @@ #define NONBE_FIX_1180_HQMDCT_PHECU_LT_MUTING /* Ericsson: issue 1180, corrected long term mute loop attnuation after 200ms in PhECU-PLC */ #define FIX_1179_USAN_PHASEECU /* Eri: issue 1179: better handling of 16 bit wrap around for very long(>200ms) FER-bursts */ #define NONBE_1200_ISM_JBM_BRATE_SW_FLUSH /* VA: issue 1200: fix bug in renderer flush in ISM JBM bitrate switching */ #define NONBE_1293_CRASH_FIRST_FRAME_LOST /* VA: issue 1293: fix G.192 decoder crash when first frame is lost */ #define FIX_1384_MSAN_stereo_tcx_core_enc /* VA: issue 1384: fix use-of-uninitialized value in stereo_tcx_core_enc() */ // object-editing feature porting Loading
lib_dec/lib_dec_fx.c +71 −17 Original line number Diff line number Diff line Loading @@ -1226,12 +1226,18 @@ ivas_error IVAS_DEC_GetSamples( hIvasDec->hasBeenFedFrame = false; move16(); set16_fx( pcmBuf, 0, imult1616( hIvasDec->st_ivas->hDecoderConfig->nchan_out, nSamplesAsked ) ); #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesRendered = nSamplesAsked; move16(); #else hIvasDec->nSamplesRendered = add( hIvasDec->nSamplesRendered, nSamplesAsked ); move16(); *nOutSamples = nSamplesAsked; move16(); #endif hIvasDec->nSamplesAvailableNext = sub( hIvasDec->nSamplesAvailableNext, nSamplesAsked ); move16(); #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( hIvasDec->nSamplesAvailableNext == 0 ) { hIvasDec->needNewFrame = true; Loading @@ -1239,6 +1245,7 @@ ivas_error IVAS_DEC_GetSamples( move16(); move16(); } #endif } ELSE { Loading Loading @@ -1373,6 +1380,7 @@ ivas_error IVAS_DEC_GetSamples( } nSamplesRendered = add( nSamplesRendered, nSamplesRendered_loop ); #ifndef NONBE_1293_CRASH_FIRST_FRAME_LOST nSamplesToRender = sub( nSamplesToRender, nSamplesRendered_loop ); IF( hIvasDec->nSamplesAvailableNext == 0 ) { Loading @@ -1386,9 +1394,25 @@ ivas_error IVAS_DEC_GetSamples( *needNewFrame = false; move16(); } #endif } } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( hIvasDec->nSamplesAvailableNext == 0 ) { *needNewFrame = true; move16(); hIvasDec->needNewFrame = true; move16(); } ELSE { *needNewFrame = false; move16(); } #endif *nOutSamples = nSamplesRendered; move16(); Loading Loading @@ -1525,6 +1549,13 @@ ivas_error IVAS_DEC_GetSplitBinauralBitstream( return error; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } #endif FOR( i = 0; i < BINAURAL_CHANNELS * MAX_HEAD_ROT_POSES; ++i ) { pOutput[i] = hSplitBinRend->hMultiBinCldfbData->output_fx[i]; Loading Loading @@ -3778,14 +3809,21 @@ ivas_error IVAS_DEC_GetSamplesDecoder( ISAR_SPLIT_REND_BITS_DATA *splitRendBits /* o : output split rendering bits */ ) { ivas_error error; if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) IF( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( !hIvasDec->hasBeenFedFirstGoodFrame && !hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ { return IVAS_ERR_OK; } #endif /* If TSM is generally enabled, we have to wait for the first good frame. Otherwise, we directly decode the first frame in any case. */ #ifdef FIX_HRTF_LOAD Loading Loading @@ -3964,7 +4002,7 @@ ivas_error IVAS_DEC_GetEditableParameters( test(); test(); test(); if ( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || IF( !( hIvasDec->st_ivas->ivas_format == ISM_FORMAT || ( hIvasDec->st_ivas->ivas_format == SBA_ISM_FORMAT && hIvasDec->st_ivas->ism_mode == ISM_SBA_MODE_DISC ) || ( hIvasDec->st_ivas->ivas_format == MASA_ISM_FORMAT && ( hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || hIvasDec->st_ivas->ism_mode == ISM_MASA_MODE_DISC ) ) ) ) { Loading @@ -3978,6 +4016,16 @@ ivas_error IVAS_DEC_GetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { hIvasEditableParameters->num_obj = 0; move16(); return IVAS_ERR_OK; } #endif hIvasEditableParameters->gain_bed_fx = ONE_IN_Q30; move32(); hIvasEditableParameters->num_obj = hIvasDec->st_ivas->nchan_ism; Loading Loading @@ -4090,9 +4138,7 @@ ivas_error IVAS_DEC_GetEditableParameters( } #endif error = IVAS_ERR_OK; return error; return IVAS_ERR_OK; } Loading Loading @@ -4126,8 +4172,12 @@ ivas_error IVAS_DEC_SetEditableParameters( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } error = IVAS_ERR_OK; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( !hIvasDec->hasBeenFedFirstGoodFrame ) { return IVAS_ERR_OK; } #endif #ifdef DEBUGGING assert( hIvasEditableParameters.num_obj == hIvasDec->st_ivas->nchan_ism ); #endif Loading Loading @@ -4325,7 +4375,7 @@ ivas_error IVAS_DEC_SetEditableParameters( } #endif return error; return IVAS_ERR_OK; } Loading @@ -4338,18 +4388,22 @@ ivas_error IVAS_DEC_SetEditableParameters( ivas_error IVAS_DEC_PrepareRenderer( IVAS_DEC_HANDLE hIvasDec ) { ivas_error error; error = IVAS_ERR_OK; if ( hIvasDec == NULL ) { return IVAS_ERR_UNEXPECTED_NULL_POINTER; } #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST test(); IF( hIvasDec->hasBeenFedFirstGoodFrame || hIvasDec->isInitialized ) /* note: 'isInitialized' is related to EVS decoder */ #endif { ivas_jbm_dec_prepare_renderer( hIvasDec->st_ivas ); } hIvasDec->hasBeenPreparedRendering = true; return error; return IVAS_ERR_OK; } #endif Loading
lib_isar/lib_isar_post_rend.c +14 −0 Original line number Diff line number Diff line Loading @@ -1574,6 +1574,20 @@ static ivas_error renderSplitBinauralWithPostRot( } ELSE { #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST IF( splitBinInput->numCachedSamples == 0 ) { numSamplesPerChannelCacheSize = (Word16) ( *splitBinInput->base.ctx.pOutSampleRate * bits.isar_frame_size_ms / 1000 ) - outAudio.config.numSamplesPerChannel; splitBinInput->numCachedSamples = numSamplesPerChannelCacheSize; move16(); } ELSE { splitBinInput->numCachedSamples = sub( splitBinInput->numCachedSamples, outAudio.config.numSamplesPerChannel ); } #endif IF( splitBinInput->base.inConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED ) { FOR( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) Loading
lib_util/split_render_file_read_write.c +16 −0 Original line number Diff line number Diff line Loading @@ -323,11 +323,20 @@ ivas_error split_rend_write_bitstream_to_file( * *-----------------------------------------------------------------------------------------*/ #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written, int16_t *bfi ) #else ivas_error split_rend_read_bits_from_file( SplitFileReadWrite *hSplitRendFileReadWrite, uint8_t *bits, int32_t *bits_read, int32_t *bits_written ) #endif { char header[SPLIT_RENDERER_FRAME_HEADER_LEN] = "SPLIT_FRAME"; char header_read[SPLIT_RENDERER_FRAME_HEADER_LEN]; Loading Loading @@ -390,6 +399,13 @@ ivas_error split_rend_read_bits_from_file( *bits_read = 0; *bits_written = bit_len; #ifdef NONBE_1293_CRASH_FIRST_FRAME_LOST *bfi = 0; if ( bit_len == 0 ) { *bfi = 1; } #endif return IVAS_ERR_OK; } Loading