From 5fda509541969c0335fac80c0aac2d4ff9ed4a2a Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Feb 2024 17:02:07 +0100 Subject: [PATCH 1/2] issue 699: complement FileReader_getFilePath() logic for TSM and JBM; under FIX_699_FILE_READER_JBM_TSM --- apps/decoder.c | 65 +++++++++++++++++--------------- apps/encoder.c | 4 ++ lib_com/options.h | 2 +- lib_util/tsm_scale_file_reader.c | 6 +++ lib_util/tsm_scale_file_reader.h | 6 +++ 5 files changed, 51 insertions(+), 32 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 01e6b4f3d1..e8acfb67a2 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2334,7 +2334,11 @@ static ivas_error decodeG192( { if ( ( error = TsmScaleFileReader_readScale( tsmScaleFileReader, &scale ) ) != IVAS_ERR_OK ) { +#ifdef FIX_699_FILE_READER_JBM_TSM + fprintf( stderr, "\nError (%s) when reading TSM data from %s \n\n", arg.inputBitstreamFilename, TsmScaleFileReader_getFilePath( tsmScaleFileReader ) ); +#else fprintf( stderr, "\nError: input bitstream file couldn't be read: %s \n\n", arg.inputBitstreamFilename ); +#endif goto cleanup; } int16_t maxScaling; @@ -2426,7 +2430,6 @@ static ivas_error decodeG192( #endif } } - } while ( nSamplesRendered < nOutSamples && error == IVAS_ERR_OK ); if ( error == IVAS_ERR_END_OF_FILE ) @@ -2577,8 +2580,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Flush what is still left in the VoIP Buffers.... - *------------------------------------------------------------------------------------------*/ + * Flush what is still left in the VoIP Buffers.... + *------------------------------------------------------------------------------------------*/ while ( nSamplesAvailableNext > 0 ) { @@ -2733,8 +2736,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ if ( !arg.quietModeEnabled ) { @@ -2766,8 +2769,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2784,8 +2787,8 @@ static ivas_error decodeG192( #endif /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -2816,10 +2819,10 @@ cleanup: #ifdef DEBUGGING /*---------------------------------------------------------------------* - * printBitstreamInfoVoip() - * - * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. - *---------------------------------------------------------------------*/ + * printBitstreamInfoVoip() + * + * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. + *---------------------------------------------------------------------*/ static ivas_error printBitstreamInfoVoip( DecArguments arg, @@ -2897,8 +2900,8 @@ static ivas_error printBitstreamInfoVoip( IVAS_DEC_PrintConfigWithVoipBitstream( hIvasDec, arg.quietModeEnabled, au, auSizeBits ); /*------------------------------------------------------------------------------------------* - * Close fhandles and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close fhandles and deallocate resources + *------------------------------------------------------------------------------------------*/ previewFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -2924,10 +2927,10 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer /*---------------------------------------------------------------------* - * decodeVoIP() - * - * Read G.192 or RTPDUMP bitstream and decode in VOIP - *---------------------------------------------------------------------*/ + * decodeVoIP() + * + * Read G.192 or RTPDUMP bitstream and decode in VOIP + *---------------------------------------------------------------------*/ static ivas_error decodeVoIP( DecArguments arg, @@ -3093,8 +3096,8 @@ static ivas_error decodeVoIP( #endif /*------------------------------------------------------------------------------------------* - * Main receiving/decoding loop - *------------------------------------------------------------------------------------------*/ + * Main receiving/decoding loop + *------------------------------------------------------------------------------------------*/ while ( 1 ) { @@ -3431,8 +3434,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) @@ -3442,8 +3445,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ if ( !arg.quietModeEnabled ) { @@ -3475,8 +3478,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -3506,10 +3509,10 @@ cleanup: #ifdef DEBUGGING /*---------------------------------------------------------------------* - * parseForcedRendModeDec() - * - * - *---------------------------------------------------------------------*/ + * parseForcedRendModeDec() + * + * + *---------------------------------------------------------------------*/ static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ) diff --git a/apps/encoder.c b/apps/encoder.c index 882187601b..835c4d18f9 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -686,7 +686,11 @@ int main( { if ( ( error = JbmFileReader_readCAconfig( jbmReader, &caConfig ) ) != IVAS_ERR_OK ) { +#ifdef FIX_699_FILE_READER_JBM_TSM + fprintf( stderr, "\nError (%s) while reading Channel-Aware Config. from: %s\n\n", IVAS_ENC_GetErrorMessage( error ), JbmFileReader_getFilePath( jbmReader ) ); +#else fprintf( stderr, "JbmFileReader_readCAconfig() failed: %s\n\n", IVAS_ENC_GetErrorMessage( error ) ); +#endif goto cleanup; } diff --git a/lib_com/options.h b/lib_com/options.h index 48d7a6cb28..008f909ad1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,7 +154,7 @@ /*#define SPLIT_REND_WITH_HEAD_ROT */ /* Dlb,FhG: Split Rendering contributions 21 and 35 */ #define FIX_966_VAR_OVERFLOW_IN_HARM_MODEL_ARI /* FhG: fix and undef behaviour bug in the harmonic TCX model arithmetic coder */ - +#define FIX_699_FILE_READER_JBM_TSM /* VA: issue 699: complement FileReader_getFilePath() logic for TSM and JBM */ diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index 775462253b..147f077f66 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -36,6 +36,9 @@ #include #include +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + struct TsmScaleFileReader { FILE *file; @@ -146,3 +149,6 @@ const char *TsmScaleFileReader_getFilePath( return self->file_path; } + +#endif +#endif diff --git a/lib_util/tsm_scale_file_reader.h b/lib_util/tsm_scale_file_reader.h index 4fe560e39b..7666a3b594 100644 --- a/lib_util/tsm_scale_file_reader.h +++ b/lib_util/tsm_scale_file_reader.h @@ -37,6 +37,9 @@ /* clang-format off */ +#ifdef DEBUGGING +#ifdef VARIABLE_SPEED_DECODING + typedef struct TsmScaleFileReader TsmScaleFileReader; @@ -59,6 +62,9 @@ const char *TsmScaleFileReader_getFilePath( TsmScaleFileReader* self /* i/o: TsmScaleFileReader handle */ ); +#endif +#endif + /* clang-format on */ #endif /* IVAS_TSM_SCALE_FILE_READER_H */ -- GitLab From e00604ed8f918861d77fd8059265a4653748e520 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 15 Feb 2024 17:57:28 +0100 Subject: [PATCH 2/2] clang-format --- apps/decoder.c | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index e8acfb67a2..5b0193cb7c 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -2580,8 +2580,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Flush what is still left in the VoIP Buffers.... - *------------------------------------------------------------------------------------------*/ + * Flush what is still left in the VoIP Buffers.... + *------------------------------------------------------------------------------------------*/ while ( nSamplesAvailableNext > 0 ) { @@ -2736,8 +2736,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ if ( !arg.quietModeEnabled ) { @@ -2769,8 +2769,8 @@ static ivas_error decodeG192( } /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); #ifdef SPLIT_REND_WITH_HEAD_ROT @@ -2787,8 +2787,8 @@ static ivas_error decodeG192( #endif /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -2819,10 +2819,10 @@ cleanup: #ifdef DEBUGGING /*---------------------------------------------------------------------* - * printBitstreamInfoVoip() - * - * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. - *---------------------------------------------------------------------*/ + * printBitstreamInfoVoip() + * + * Print bitstream info of a VoIP G.192 or RTPDUMP bitstream. + *---------------------------------------------------------------------*/ static ivas_error printBitstreamInfoVoip( DecArguments arg, @@ -2900,8 +2900,8 @@ static ivas_error printBitstreamInfoVoip( IVAS_DEC_PrintConfigWithVoipBitstream( hIvasDec, arg.quietModeEnabled, au, auSizeBits ); /*------------------------------------------------------------------------------------------* - * Close fhandles and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close fhandles and deallocate resources + *------------------------------------------------------------------------------------------*/ previewFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -2927,10 +2927,10 @@ static ivas_error writeJbmTraceFileFrameWrapper( const void *data, void *writer /*---------------------------------------------------------------------* - * decodeVoIP() - * - * Read G.192 or RTPDUMP bitstream and decode in VOIP - *---------------------------------------------------------------------*/ + * decodeVoIP() + * + * Read G.192 or RTPDUMP bitstream and decode in VOIP + *---------------------------------------------------------------------*/ static ivas_error decodeVoIP( DecArguments arg, @@ -3096,8 +3096,8 @@ static ivas_error decodeVoIP( #endif /*------------------------------------------------------------------------------------------* - * Main receiving/decoding loop - *------------------------------------------------------------------------------------------*/ + * Main receiving/decoding loop + *------------------------------------------------------------------------------------------*/ while ( 1 ) { @@ -3434,8 +3434,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Add zeros at the end to have equal length of synthesized signals - *------------------------------------------------------------------------------------------*/ + * Add zeros at the end to have equal length of synthesized signals + *------------------------------------------------------------------------------------------*/ memset( pcmBuf, 0, delayNumSamples_orig[0] * nOutChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( afWriter, pcmBuf, delayNumSamples_orig[0] * nOutChannels ) ) != IVAS_ERR_OK ) @@ -3445,8 +3445,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Printouts after decoding has finished - *------------------------------------------------------------------------------------------*/ + * Printouts after decoding has finished + *------------------------------------------------------------------------------------------*/ if ( !arg.quietModeEnabled ) { @@ -3478,8 +3478,8 @@ static ivas_error decodeVoIP( } /*------------------------------------------------------------------------------------------* - * Close files and deallocate resources - *------------------------------------------------------------------------------------------*/ + * Close files and deallocate resources + *------------------------------------------------------------------------------------------*/ decodingFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ @@ -3509,10 +3509,10 @@ cleanup: #ifdef DEBUGGING /*---------------------------------------------------------------------* - * parseForcedRendModeDec() - * - * - *---------------------------------------------------------------------*/ + * parseForcedRendModeDec() + * + * + *---------------------------------------------------------------------*/ static IVAS_DEC_FORCED_REND_MODE parseForcedRendModeDec( char *forcedRendModeChar ) -- GitLab