From c2aeea67da0eb85bc7daf1809e0bc2e1ed14ae5d Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 4 May 2026 14:33:52 +0200 Subject: [PATCH 1/3] Wrong render framesize printout --- apps/decoder.c | 141 +++++++++++++++++++++++++++++++++++----------- lib_com/options.h | 1 + 2 files changed, 110 insertions(+), 32 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index e226ba245..9488bf724 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -498,6 +498,7 @@ int main( } } +#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT #ifdef DEBUGGING /*-----------------------------------------------------------------* * Preview bitstream and print config information @@ -587,6 +588,7 @@ int main( fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } +#endif #endif /*-------------------------------------------------------------------* @@ -621,14 +623,6 @@ int main( goto cleanup; } -#ifdef FIX_2500_RENDCONF_REFACTOR - if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); - goto cleanup; - } -#endif - aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) { @@ -708,13 +702,6 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { -#ifdef FIX_2500_RENDCONF_REFACTOR - if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); - goto cleanup; - } -#else if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) @@ -728,7 +715,6 @@ int main( fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); goto cleanup; } -#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -777,6 +763,99 @@ int main( hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; } +#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT +#ifdef DEBUGGING + /*-----------------------------------------------------------------* + * Preview bitstream and print config information + *-----------------------------------------------------------------*/ + + if ( arg.voipMode ) + { + 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 + { + uint16_t bit_stream[IVAS_MAX_BITS_PER_FRAME + 4 * 8]; + int16_t num_bits; + int16_t bfi = 0; + do + { + if ( BS_Reader_ReadFrame_short( hBsReader, bit_stream, &num_bits, &bfi ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nError: input bitstream file %s couldn't be read\n\n", arg.inputBitstreamFilename ); + goto cleanup; + } + } while ( bfi || num_bits < MIN_NUM_BITS_ACTIVE_FRAME || num_bits == NUM_BITS_SID_IVAS_5K2 ); + + BS_Reader_Rewind( hBsReader ); + + IVAS_DEC_PrintConfigWithBitstream( hIvasDec, arg.quietModeEnabled, bit_stream, num_bits ); + +#ifdef VARIABLE_SPEED_DECODING + if ( arg.tsmEnabled ) + { + if ( arg.tsmScaleFileEnabled ) + { + fprintf( stdout, "Variable speed file: %s\n", arg.tsmScaleFileName ); + } + else + { + fprintf( stdout, "Variable speed factor: %i\n", arg.tsmScale ); + } + } +#endif + } + + /*-----------------------------------------------------------------* + * Open Error pattern file for simulation + *-----------------------------------------------------------------*/ + + if ( arg.FEPatternFileName != NULL ) + { + if ( ( FEC_pattern = fopen( arg.FEPatternFileName, "rb" ) ) == NULL ) + { + fprintf( stderr, "Error: Missing or incorrect FEC filename specification\n\n" ); + usage_dec(); + goto cleanup; + } + } + +#ifdef DEBUG_SBA_AUDIO_DUMP + ivas_open_sba_decoder_debug_files( arg.output_Fs, 1, 1 ); +#endif + + /*-----------------------------------------------------------------* + * Print information about FEC + *-----------------------------------------------------------------*/ + + if ( !arg.voipMode && ( arg.FEPatternFileName != NULL || arg.FER > 0 ) ) + { + if ( arg.FEPatternFileName != NULL ) + { + fprintf( stdout, "FEC: %s\n", arg.FEPatternFileName ); + } + else + { + fprintf( stdout, "FEC: %.2f %%\n", arg.FER ); + } + } +#else + /*-----------------------------------------------------------------* + * Print config information + *-----------------------------------------------------------------*/ + + if ( ( error = IVAS_DEC_PrintConfig( hIvasDec, 1, arg.voipMode ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "\nIVAS_DEC_PrintConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); + goto cleanup; + } +#endif +#endif + /*------------------------------------------------------------------------------------------* * Allocate output data buffer *------------------------------------------------------------------------------------------*/ @@ -1991,7 +2070,9 @@ static ivas_error initOnFirstGoodFrame( uint16_t rtpDecSeed = RANDOM_INITSEED_DEC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed ); +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ +#endif if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { @@ -2028,7 +2109,11 @@ static ivas_error initOnFirstGoodFrame( /* Split Rendering RTPDump Output file */ +#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#else + if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) +#endif { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; @@ -2360,14 +2445,6 @@ static ivas_error decodeG192( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } - -#ifdef FIX_2500_RENDCONF_REFACTOR - if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); - goto cleanup; - } -#endif } for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -2567,13 +2644,6 @@ static ivas_error decodeG192( arg.aeSequence.selected = 0; } arg.aeSequence.frameCounter = 0; -#ifdef FIX_2500_RENDCONF_REFACTOR - if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) - { - fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); - goto cleanup; - } -#else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) @@ -2587,7 +2657,6 @@ static ivas_error decodeG192( fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); goto cleanup; } -#endif if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -3923,9 +3992,17 @@ static ivas_error decodeVoIP( } else if ( decodedGoodFrame ) { +#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP + srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->isar_frame_size_ms; +#else srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms; +#endif srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD; +#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP + srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->isar_frame_size_ms; +#else srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms; +#endif if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK ) { diff --git a/lib_com/options.h b/lib_com/options.h index c096f383c..56db7581c 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,6 +165,7 @@ #define FIX_2095_REMOVE_UNUSED_ISAR_TABLES /* Dolby: remove unused ISAR */ #define FIX_FLOAT_1582_STEREO_DFT_QUANTIZE_ITD /* FhG: float issue 1582: Remove unncessary statement from stereo_dft_quantize_itd() */ #define FIX_1585_ASAN_FORMAT_SW_ALT /* VA: float issue 1585: alternative fix memory leaks with format switching */ +#define FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT /* Dolby: float issue 1550: Wrong render framesize printout */ /* #################### End BE switches ################################## */ -- GitLab From 6a64cf9f9da4bfd2af4904566057272af3a16b07 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 4 May 2026 14:50:36 +0200 Subject: [PATCH 2/3] fix merge artifacts --- apps/decoder.c | 50 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 9488bf724..07e4e97f4 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -498,7 +498,7 @@ int main( } } -#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT +#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT #ifdef DEBUGGING /*-----------------------------------------------------------------* * Preview bitstream and print config information @@ -623,6 +623,14 @@ int main( goto cleanup; } +#ifdef FIX_2500_RENDCONF_REFACTOR + if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); + goto cleanup; + } +#endif + aeCount = RenderConfigReader_getAcousticEnvironmentCount( renderConfigReader ); if ( aeCount > 0 ) { @@ -702,6 +710,13 @@ int main( if ( arg.outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { +#ifdef FIX_2500_RENDCONF_REFACTOR + if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); + goto cleanup; + } +#else if ( ( error = IVAS_DEC_GetAcousticEnvironment( hIvasDec, aeID, &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) @@ -715,6 +730,7 @@ int main( fprintf( stderr, "Failed to get acoustic environment with ID: %d\n\n", aeID ); goto cleanup; } +#endif } /* ISAR frame size is set from command line, not renderer config file. @@ -763,7 +779,7 @@ int main( hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; } -#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT +#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT #ifdef DEBUGGING /*-----------------------------------------------------------------* * Preview bitstream and print config information @@ -2070,9 +2086,7 @@ static ivas_error initOnFirstGoodFrame( uint16_t rtpDecSeed = RANDOM_INITSEED_DEC; uint32_t ssrc = ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) & 0x0000FFFF ) | ( (uint32_t) IVAS_RTP_OwnRandom( &rtpDecSeed ) << 16 ); uint16_t seqNumInitVal = IVAS_RTP_OwnRandom( &rtpDecSeed ); -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API uint8_t payloadType = DEFAULT_IVAS_PAYLOAD_TYPE; /* Dynamic PT are in range [96, 127] */ -#endif if ( ( error = IVAS_DEC_GetDelay( hIvasDec, delayNumSamples_temp, &delayTimeScale_temp ) ) != IVAS_ERR_OK ) { @@ -2109,11 +2123,7 @@ static ivas_error initOnFirstGoodFrame( /* Split Rendering RTPDump Output file */ -#ifdef FIX_1540_EXPOSE_PT_IN_RTP_HEADER_API if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), payloadType, ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_RTP_WRITER_Init( srRtp, arg.outputWavFilename, 1000 / ( IVAS_NUM_FRAMES_PER_SEC * splitRendCodecFrameSizeMs ), ssrc, seqNumInitVal ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "\nError: Can't open SR output bitstream file for RTP output %s \n\n", arg.outputWavFilename ); return error; @@ -2445,6 +2455,14 @@ static ivas_error decodeG192( fprintf( stderr, "Failed to read renderer configuration from file %s\n\n", arg.renderConfigFilename ); goto cleanup; } + +#ifdef FIX_2500_RENDCONF_REFACTOR + if ( RenderConfigReader_checkValues( renderConfigReader ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Invalid renderer configuration parameters\n\n" ); + goto cleanup; + } +#endif } for ( i = 0; i < IVAS_MAX_NUM_OBJECTS; ++i ) @@ -2644,6 +2662,13 @@ static ivas_error decodeG192( arg.aeSequence.selected = 0; } arg.aeSequence.frameCounter = 0; +#ifdef FIX_2500_RENDCONF_REFACTOR + if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) != IVAS_ERR_OK ) + { + fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); + goto cleanup; + } +#else if ( ( error = RenderConfigReader_getAcousticEnvironment( renderConfigReader, arg.aeSequence.pID[arg.aeSequence.selected], &renderConfig.roomAcoustics ) ) == IVAS_ERR_OK ) { if ( RenderConfigReader_checkValues( &renderConfig ) != IVAS_ERR_OK ) @@ -2657,6 +2682,7 @@ static ivas_error decodeG192( fprintf( stderr, "Failed to get acoustic environment with ID %d\n\n", arg.aeSequence.pID[arg.aeSequence.selected] ); goto cleanup; } +#endif if ( ( error = IVAS_DEC_FeedRenderConfig( hIvasDec, renderConfig ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nIVAS_DEC_FeedRenderConfig failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); @@ -3992,17 +4018,9 @@ static ivas_error decodeVoIP( } else if ( decodedGoodFrame ) { -#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP - srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->isar_frame_size_ms; -#else srInfo.bitrateKbps = splitRendBits->bits_written * 1000 / splitRendBits->codec_frame_size_ms; -#endif srInfo.codec = ( splitRendBits->codec == ISAR_SPLIT_REND_CODEC_LC3PLUS ) ? IVAS_SR_TRANSPORT_LC3PLUS : IVAS_SR_TRANSPORT_LCLD; -#ifdef FIX_1515_ISAR_FRAME_SIZES_IN_RTP - srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->isar_frame_size_ms; -#else srInfo.codecFrameSizeMs = (uint32_t) splitRendBits->codec_frame_size_ms; -#endif if ( ( error = IVAS_RTP_WriteNextFrame( &srRtp, splitRendBits->bits_buf, &srInfo, (int16_t) splitRendBits->bits_written, false, false ) ) != IVAS_ERR_OK ) { -- GitLab From 8f7a0864908add0ee4e3fe69c7ecbd1e03492dd3 Mon Sep 17 00:00:00 2001 From: Vladimir Malenovsky Date: Mon, 4 May 2026 14:52:49 +0200 Subject: [PATCH 3/3] clang format --- apps/decoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 07e4e97f4..e63a80e89 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -498,7 +498,7 @@ int main( } } -#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT +#ifndef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT #ifdef DEBUGGING /*-----------------------------------------------------------------* * Preview bitstream and print config information @@ -779,7 +779,7 @@ int main( hHrtfBinary.hrtf_set_audio_cfg = IVAS_AUDIO_CONFIG_INVALID; } -#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT +#ifdef FIX_1550_WRONG_RENDER_FRAMESIZE_PRINTOUT #ifdef DEBUGGING /*-----------------------------------------------------------------* * Preview bitstream and print config information -- GitLab