From 1fc5e1482ca9477e3cd90b0d26dc04a96a0073d8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 8 Nov 2024 16:03:40 +0100 Subject: [PATCH 01/85] add FIX_1209_SID_SIGNALING when DEBUGGING is activated --- lib_com/bitstream.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index babb9f3e0e..9dd2819283 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -2624,9 +2624,11 @@ ivas_error preview_indices( case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; break; +#ifndef FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; break; +#endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; st_ivas->element_mode_init = IVAS_SCE; @@ -2651,7 +2653,9 @@ ivas_error preview_indices( } break; default: +#ifndef FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ +#endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } } -- GitLab From b4860acf561554ea7e715df52441d4f702df298e Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 8 Nov 2024 16:06:09 +0100 Subject: [PATCH 02/85] revert --- lib_com/bitstream.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 9dd2819283..babb9f3e0e 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -2624,11 +2624,9 @@ ivas_error preview_indices( case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; break; -#ifndef FIX_1209_SID_SIGNALING case SID_MULTICHANNEL: st_ivas->ivas_format = MC_FORMAT; break; -#endif case SID_SBA_1TC: st_ivas->ivas_format = SBA_FORMAT; st_ivas->element_mode_init = IVAS_SCE; @@ -2653,9 +2651,7 @@ ivas_error preview_indices( } break; default: -#ifndef FIX_1209_SID_SIGNALING /* This should actually be impossible, since only 3 bits are read, so if this happens something is broken */ -#endif return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } } -- GitLab From dfea7efef077b7029827f4ab58f2ccbcfb1022a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 23 May 2025 15:27:29 +0200 Subject: [PATCH 03/85] Fix fread size/count argument order --- lib_util/mime_io.c | 2 +- lib_util/rtpdump.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 9bdd20e453..9ca8ba1b83 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -317,7 +317,7 @@ static bool readByte( FILE *file, uint8_t *value ) static bool readLong( FILE *file, uint16_t *value ) { char buffer[4] = { 0 }; - if ( fread( buffer, 4, 1, file ) != 1U ) + if ( fread( buffer, 1, 4, file ) != 1U ) { return false; } diff --git a/lib_util/rtpdump.c b/lib_util/rtpdump.c index e3eb4c1f4a..9b25633a93 100644 --- a/lib_util/rtpdump.c +++ b/lib_util/rtpdump.c @@ -80,7 +80,7 @@ static unsigned char *parseByte( unsigned char *buffer, unsigned char *value ) static int readLong( FILE *file, unsigned int *value ) { char buffer[4] = { 0 }; - if ( fread( buffer, 4, 1, file ) != 1U ) + if ( fread( buffer, 1, 4, file ) != 1U ) { return -1; } @@ -96,7 +96,7 @@ static int readLong( FILE *file, unsigned int *value ) static int readShort( FILE *file, unsigned short *value ) { char buffer[2] = { 0 }; - if ( fread( buffer, 2, 1, file ) != 1U ) + if ( fread( buffer, 1, 2, file ) != 1U ) { return -1; } -- GitLab From 5bc8fff681bda08d06c5dbd615dff9cd9a499159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 23 May 2025 15:31:11 +0200 Subject: [PATCH 04/85] Avoid the use of reserved names https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html --- lib_util/g192.c | 8 ++++---- lib_util/g192.h | 4 ++-- lib_util/tinywavein_c.h | 4 ++-- lib_util/tinywaveout_c.h | 22 +++++++++++----------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib_util/g192.c b/lib_util/g192.c index f61971ef14..a45c673270 100644 --- a/lib_util/g192.c +++ b/lib_util/g192.c @@ -62,7 +62,7 @@ *-----------------------------------------------------------------------*/ /* main handle */ -struct __G192 +struct G192_STRUCT { FILE *file; int16_t ownFileHandle; /* flag whether FILE handle created by instance or externally */ @@ -79,12 +79,12 @@ G192_ERROR G192_Reader_Open_filename( const char *filename ) { /* create handle */ - *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct __G192 ) ); + *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct G192_STRUCT ) ); if ( !phG192 ) { return G192_MEMORY_ERROR; } - memset( *phG192, 0, sizeof( struct __G192 ) ); + memset( *phG192, 0, sizeof( struct G192_STRUCT ) ); /* open file stream */ ( *phG192 )->file = fopen( filename, "rb" ); @@ -422,7 +422,7 @@ G192_ERROR G192_Writer_Open_filename( const char *filename ) { /* create handle */ - *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct __G192 ) ); + *phG192 = (G192_HANDLE) calloc( 1, sizeof( struct G192_STRUCT ) ); if ( !phG192 ) { return G192_MEMORY_ERROR; diff --git a/lib_util/g192.h b/lib_util/g192.h index 8014f52368..751f1324fb 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -67,8 +67,8 @@ typedef enum _G192_ERROR *-----------------------------------------------------------------------*/ /* main handle */ -struct __G192; -typedef struct __G192 *G192_HANDLE; +struct G192_STRUCT; +typedef struct G192_STRUCT *G192_HANDLE; /*-----------------------------------------------------------------------* diff --git a/lib_util/tinywavein_c.h b/lib_util/tinywavein_c.h index b86d97c964..1ff6f26bb7 100644 --- a/lib_util/tinywavein_c.h +++ b/lib_util/tinywavein_c.h @@ -54,14 +54,14 @@ #define __TWI_SUCCESS ( 0 ) #define __TWI_ERROR ( -1 ) -typedef struct __tinyWaveInHandle +typedef struct tinyWaveInHandle { FILE *theFile; fpos_t dataChunkPos; uint32_t position; uint32_t length; uint32_t bps; -} __tinyWaveInHandle, WAVEFILEIN; +} tinyWaveInHandle, WAVEFILEIN; typedef struct { diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index 693beccf95..a3982ba19c 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -70,15 +70,15 @@ #endif #endif -typedef struct __tinyWaveOutHeader +typedef struct tinyWaveOutHeader { uint32_t riffType; /* 'RIFF' */ uint32_t riffSize; /* file size */ uint32_t waveType; /* 'WAVE' */ -} __tinyWaveOutHeader; +} tinyWaveOutHeader; -typedef struct __tinyWaveOutFmtChunk +typedef struct tinyWaveOutFmtChunk { uint32_t formatType; uint32_t formatSize; @@ -91,16 +91,16 @@ typedef struct __tinyWaveOutFmtChunk uint16_t bitsPerSample; /* wav fmt ext hdr here */ -} __tinyWaveOutFmtChunk; +} tinyWaveOutFmtChunk; -typedef struct __tinyWaveOutDataChunk +typedef struct tinyWaveOutDataChunk { uint32_t dataType; uint32_t dataSize; -} __tinyWaveOutDataChunk; +} tinyWaveOutDataChunk; -typedef struct __tinyWaveOutHandle +typedef struct tinyWaveOutHandle { FILE *theFile; uint32_t dataSize; @@ -109,7 +109,7 @@ typedef struct __tinyWaveOutHandle uint32_t dataChunkOffset; uint32_t bps; uint32_t clipCount; -} __tinyWaveOutHandle, WAVEFILEOUT; +} tinyWaveOutHandle, WAVEFILEOUT; /*--- local protos --------------------------------------------------*/ static __inline uint32_t BigEndian32( char, char, char, char ); @@ -132,9 +132,9 @@ static WAVEFILEOUT *CreateBWF( /* ,const uint32_t writeWaveExt */ ) { WAVEFILEOUT *self; - __tinyWaveOutHeader whdr; - __tinyWaveOutFmtChunk wfch; - __tinyWaveOutDataChunk wdch; + tinyWaveOutHeader whdr; + tinyWaveOutFmtChunk wfch; + tinyWaveOutDataChunk wdch; uint32_t blockAlignment = 0; uint32_t ByteCnt = 0; /* Byte counter for fwrite */ -- GitLab From bcc1edc030a958a98b6cbbf8e9ad029f128c3e53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 23 May 2025 15:37:29 +0200 Subject: [PATCH 05/85] Improve readability of is_numeric_float Also fixes an implicit narrowing. --- lib_com/tools.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib_com/tools.c b/lib_com/tools.c index 024fe71c7a..0d770111f4 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -1742,19 +1742,9 @@ double anint( int16_t is_numeric_float( float x ) { -#ifndef BASOP_NOGLOB - union float_int -#else /* BASOP_NOGLOB */ - union float_int -#endif /* BASOP_NOGLOB */ - { - float float_val; - int32_t int_val; - } float_int; - - float_int.float_val = x; - - return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 ); +#define WMC_TOOL_SKIP + return (int16_t) ( !isnan( x ) && !isinf( x ) ); +#undef WMC_TOOL_SKIP } /*-------------------------------------------------------------------* -- GitLab From fbfb6355bff78b580c64d3838a05c96e45d1fb31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Fri, 23 May 2025 15:40:12 +0200 Subject: [PATCH 06/85] Remove redundant indexing and deref operator --- lib_rend/ivas_rom_rend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index bf6776ab04..87a9197f93 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -163,9 +163,9 @@ const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3*DIRAC_MAX_NUM_DECORR_F const float * const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS] = { - &ap_lattice_coeffs_1[0], - &ap_lattice_coeffs_2[0], - &ap_lattice_coeffs_3[0], + ap_lattice_coeffs_1, + ap_lattice_coeffs_2, + ap_lattice_coeffs_3, }; const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = -- GitLab From 8625b3d0903ee5391ecd0ac9ceeb746134979352 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 23 May 2025 17:19:58 +0200 Subject: [PATCH 07/85] Fix memory alignment warning in lib_rend --- lib_rend/lib_rend.c | 66 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 98b3177a15..f1d0a89dfe 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3291,31 +3291,72 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } +static void *getInputByIndex( void *inputsArray, const size_t index, const IVAS_REND_AudioConfigType inputType ) +{ + switch ( inputType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + return (input_mc *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + return (input_sba *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + return (input_ism *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + return (input_masa *) inputsArray + index; + default: + break; + } + + /* this should be unreachable */ + assert( 0 ); + return NULL; +} + +/* Const variant of getInputByIndex. Unfortunately, this duplication is required to keep const-correctness. */ +static const void *getConstInputByIndex( const void *inputsArray, const size_t index, const IVAS_REND_AudioConfigType inputType ) +{ + switch ( inputType ) + { + case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: + return (const input_mc *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: + return (const input_sba *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: + return (const input_ism *) inputsArray + index; + case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: + return (const input_masa *) inputsArray + index; + default: + break; + } + + /* this should be unreachable */ + assert( 0 ); + return NULL; +} static ivas_error findFreeInputSlot( const void *inputs, - const int32_t inputStructSize, + const IVAS_REND_AudioConfigType inputType, const int32_t maxInputs, int32_t *inputIndex ) { - /* Using a void pointer and a separately provided size is a hack for this function + /* Using a void pointer and a separately provided type is a hack for this function to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). Assumptions: - input_base is always the first member in the input struct - - provided size is correct + - memory alignments of original input type and input_base are the same */ int32_t i; bool canAddInput; - const uint8_t *pByte; const input_base *pInputBase; canAddInput = false; /* Find first unused input in array */ - for ( i = 0, pByte = inputs; i < maxInputs; ++i, pByte += inputStructSize ) + for ( i = 0; i < maxInputs; ++i ) { - pInputBase = (const input_base *) pByte; + pInputBase = (const input_base *) getConstInputByIndex( inputs, i, inputType ); if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { @@ -3457,7 +3498,7 @@ ivas_error IVAS_REND_AddInput( ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; - int32_t inputStructSize; + IVAS_REND_AudioConfigType inputType; ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); int32_t inputIndex; @@ -3478,30 +3519,27 @@ ivas_error IVAS_REND_AddInput( } } - switch ( getAudioConfigType( inConfig ) ) + inputType = getAudioConfigType( inConfig ); + switch ( inputType ) { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; inputsArray = hIvasRend->inputsIsm; - inputStructSize = sizeof( *hIvasRend->inputsIsm ); activateInput = setRendInputActiveIsm; break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; inputsArray = hIvasRend->inputsMc; - inputStructSize = sizeof( *hIvasRend->inputsMc ); activateInput = setRendInputActiveMc; break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; inputsArray = hIvasRend->inputsSba; - inputStructSize = sizeof( *hIvasRend->inputsSba ); activateInput = setRendInputActiveSba; break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; inputsArray = hIvasRend->inputsMasa; - inputStructSize = sizeof( *hIvasRend->inputsMasa ); activateInput = setRendInputActiveMasa; break; default: @@ -3509,13 +3547,13 @@ ivas_error IVAS_REND_AddInput( } /* Find first free input in array corresponding to input type */ - if ( ( error = findFreeInputSlot( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) + if ( ( error = findFreeInputSlot( inputsArray, inputType, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) { return error; } *inputId = makeInputId( inConfig, inputIndex ); - if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) + if ( ( error = activateInput( getInputByIndex( inputsArray, inputIndex, inputType ), inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) { return error; } -- GitLab From ef695613bb82ae743f2be51d0241d241090b4822 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 27 May 2025 11:54:45 +0200 Subject: [PATCH 08/85] Move unreachable code into switch-case --- lib_rend/lib_rend.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index f1d0a89dfe..978744a1c4 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3304,12 +3304,10 @@ static void *getInputByIndex( void *inputsArray, const size_t index, const IVAS_ case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: return (input_masa *) inputsArray + index; default: - break; + /* this should be unreachable */ + assert( 0 ); + return NULL; } - - /* this should be unreachable */ - assert( 0 ); - return NULL; } /* Const variant of getInputByIndex. Unfortunately, this duplication is required to keep const-correctness. */ @@ -3326,12 +3324,10 @@ static const void *getConstInputByIndex( const void *inputsArray, const size_t i case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: return (const input_masa *) inputsArray + index; default: - break; + /* this should be unreachable */ + assert( 0 ); + return NULL; } - - /* this should be unreachable */ - assert( 0 ); - return NULL; } static ivas_error findFreeInputSlot( -- GitLab From 01e9e91c1faf926f34c86a13da2dcb5a62fbb0d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 27 May 2025 16:54:46 +0200 Subject: [PATCH 09/85] Remove getConstInputByIndex again --- lib_rend/lib_rend.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 978744a1c4..4d8cc35d56 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3310,28 +3310,8 @@ static void *getInputByIndex( void *inputsArray, const size_t index, const IVAS_ } } -/* Const variant of getInputByIndex. Unfortunately, this duplication is required to keep const-correctness. */ -static const void *getConstInputByIndex( const void *inputsArray, const size_t index, const IVAS_REND_AudioConfigType inputType ) -{ - switch ( inputType ) - { - case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: - return (const input_mc *) inputsArray + index; - case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: - return (const input_sba *) inputsArray + index; - case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: - return (const input_ism *) inputsArray + index; - case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: - return (const input_masa *) inputsArray + index; - default: - /* this should be unreachable */ - assert( 0 ); - return NULL; - } -} - static ivas_error findFreeInputSlot( - const void *inputs, + void *inputs, const IVAS_REND_AudioConfigType inputType, const int32_t maxInputs, int32_t *inputIndex ) @@ -3352,7 +3332,7 @@ static ivas_error findFreeInputSlot( /* Find first unused input in array */ for ( i = 0; i < maxInputs; ++i ) { - pInputBase = (const input_base *) getConstInputByIndex( inputs, i, inputType ); + pInputBase = (const input_base *) getInputByIndex( inputs, i, inputType ); if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { -- GitLab From 5dc8c9a80db014dc98193a9fadcaa1776c2ff908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 2 Jun 2025 09:09:08 +0200 Subject: [PATCH 10/85] Fix code style --- lib_rend/lib_rend.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 4d8cc35d56..2ac0cad5ee 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3291,7 +3291,10 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } -static void *getInputByIndex( void *inputsArray, const size_t index, const IVAS_REND_AudioConfigType inputType ) +static void *getInputByIndex( + void *inputsArray, + const size_t index, + const IVAS_REND_AudioConfigType inputType ) { switch ( inputType ) { -- GitLab From d248032cf684e79cb43500da7f1f7eb15d41b5d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 3 Jun 2025 21:57:29 +0200 Subject: [PATCH 11/85] Add CODE_IMPROVEMENTS define --- lib_com/options.h | 1 + lib_com/tools.c | 16 +++++++++++ lib_rend/ivas_rom_rend.c | 6 +++++ lib_rend/lib_rend.c | 57 +++++++++++++++++++++++++++++++++++++++- lib_util/g192.h | 5 ++++ lib_util/mime_io.c | 4 +++ lib_util/rtpdump.c | 4 +++ lib_util/tinywavein_c.h | 8 ++++++ lib_util/tinywaveout_c.h | 39 ++++++++++++++++++++++++++- 9 files changed, 138 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index aec5a9e672..2caa691dc5 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,6 +154,7 @@ /* ################## Start DEVELOPMENT switches ######################### */ +#define CODE_IMPROVEMENTS /* Small code improvements that do not change the functionality */ /* ################### Start BE switches ################################# */ /* only BE switches wrt selection floating point code */ diff --git a/lib_com/tools.c b/lib_com/tools.c index 0d770111f4..cb1d121629 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -1742,9 +1742,25 @@ double anint( int16_t is_numeric_float( float x ) { +#ifdef CODE_IMPROVEMENTS #define WMC_TOOL_SKIP return (int16_t) ( !isnan( x ) && !isinf( x ) ); #undef WMC_TOOL_SKIP +#else +#ifndef BASOP_NOGLOB + union float_int +#else /* BASOP_NOGLOB */ + union float_int +#endif /* BASOP_NOGLOB */ + { + float float_val; + int32_t int_val; + } float_int; + + float_int.float_val = x; + + return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 ); +#endif } /*-------------------------------------------------------------------* diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index 87a9197f93..b14a5303a0 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -163,9 +163,15 @@ const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3*DIRAC_MAX_NUM_DECORR_F const float * const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS] = { +#ifdef CODE_IMPROVEMENTS ap_lattice_coeffs_1, ap_lattice_coeffs_2, ap_lattice_coeffs_3, +#else + &ap_lattice_coeffs_1[0], + &ap_lattice_coeffs_2[0], + &ap_lattice_coeffs_3[0], +#endif }; const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 2ac0cad5ee..0bcde62a65 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3291,6 +3291,7 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } +#ifdef CODE_IMPROVEMENTS static void *getInputByIndex( void *inputsArray, const size_t index, @@ -3312,30 +3313,56 @@ static void *getInputByIndex( return NULL; } } +#endif static ivas_error findFreeInputSlot( +#ifdef CODE_IMPROVEMENTS void *inputs, const IVAS_REND_AudioConfigType inputType, +#else + const void *inputs, + const int32_t inputStructSize, +#endif const int32_t maxInputs, int32_t *inputIndex ) { +#ifdef CODE_IMPROVEMENTS /* Using a void pointer and a separately provided type is a hack for this function to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). Assumptions: - input_base is always the first member in the input struct - memory alignments of original input type and input_base are the same */ +#else + /* Using a void pointer and a separately provided size is a hack for this function + to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). + Assumptions: + - input_base is always the first member in the input struct + - provided size is correct + */ +#endif int32_t i; bool canAddInput; +#ifndef CODE_IMPROVEMENTS + const uint8_t *pByte; +#endif const input_base *pInputBase; canAddInput = false; /* Find first unused input in array */ +#ifdef CODE_IMPROVEMENTS for ( i = 0; i < maxInputs; ++i ) +#else + for ( i = 0, pByte = inputs; i < maxInputs; ++i, pByte += inputStructSize ) +#endif { +#ifdef CODE_IMPROVEMENTS pInputBase = (const input_base *) getInputByIndex( inputs, i, inputType ); +#else + pInputBase = (const input_base *) pByte; +#endif if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { @@ -3477,7 +3504,11 @@ ivas_error IVAS_REND_AddInput( ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; +#ifdef CODE_IMPROVEMENTS IVAS_REND_AudioConfigType inputType; +#else + int32_t inputStructSize; +#endif ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); int32_t inputIndex; @@ -3498,41 +3529,65 @@ ivas_error IVAS_REND_AddInput( } } +#ifdef CODE_IMPROVEMENTS inputType = getAudioConfigType( inConfig ); switch ( inputType ) +#else + switch ( getAudioConfigType( inConfig ) ) +#endif { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; inputsArray = hIvasRend->inputsIsm; +#ifndef CODE_IMPROVEMENTS + inputStructSize = sizeof( *hIvasRend->inputsIsm ); +#endif activateInput = setRendInputActiveIsm; break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; inputsArray = hIvasRend->inputsMc; +#ifndef CODE_IMPROVEMENTS + inputStructSize = sizeof( *hIvasRend->inputsMc ); +#endif activateInput = setRendInputActiveMc; break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; inputsArray = hIvasRend->inputsSba; +#ifndef CODE_IMPROVEMENTS + inputStructSize = sizeof( *hIvasRend->inputsSba ); +#endif activateInput = setRendInputActiveSba; break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; inputsArray = hIvasRend->inputsMasa; +#ifndef CODE_IMPROVEMENTS + inputStructSize = sizeof( *hIvasRend->inputsMasa ); +#endif activateInput = setRendInputActiveMasa; break; default: return IVAS_ERR_INVALID_INPUT_FORMAT; } - /* Find first free input in array corresponding to input type */ + /* Find first free input in array corresponding to input type */ +#ifdef CODE_IMPROVEMENTS if ( ( error = findFreeInputSlot( inputsArray, inputType, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) +#else + if ( ( error = findFreeInputSlot( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) +#endif { return error; } *inputId = makeInputId( inConfig, inputIndex ); +#ifdef CODE_IMPROVEMENTS if ( ( error = activateInput( getInputByIndex( inputsArray, inputIndex, inputType ), inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) +#else + if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) +#endif { return error; } diff --git a/lib_util/g192.h b/lib_util/g192.h index 751f1324fb..f94c69f0da 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -67,8 +67,13 @@ typedef enum _G192_ERROR *-----------------------------------------------------------------------*/ /* main handle */ +#ifdef CODE_IMPROVEMENTS struct G192_STRUCT; typedef struct G192_STRUCT *G192_HANDLE; +#else +struct __G192; +typedef struct __G192 *G192_HANDLE; +#endif /*-----------------------------------------------------------------------* diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index 9ca8ba1b83..ee2a9c12a5 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -317,7 +317,11 @@ static bool readByte( FILE *file, uint8_t *value ) static bool readLong( FILE *file, uint16_t *value ) { char buffer[4] = { 0 }; +#ifdef CODE_IMPROVEMENTS if ( fread( buffer, 1, 4, file ) != 1U ) +#else + if ( fread( buffer, 4, 1, file ) != 1U ) +#endif { return false; } diff --git a/lib_util/rtpdump.c b/lib_util/rtpdump.c index 9b25633a93..ac143bb8f6 100644 --- a/lib_util/rtpdump.c +++ b/lib_util/rtpdump.c @@ -80,7 +80,11 @@ static unsigned char *parseByte( unsigned char *buffer, unsigned char *value ) static int readLong( FILE *file, unsigned int *value ) { char buffer[4] = { 0 }; +#ifdef CODE_IMPROVEMENTS if ( fread( buffer, 1, 4, file ) != 1U ) +#else + if ( fread( buffer, 4, 1, file ) != 1U ) +#endif { return -1; } diff --git a/lib_util/tinywavein_c.h b/lib_util/tinywavein_c.h index 1ff6f26bb7..179c676a81 100644 --- a/lib_util/tinywavein_c.h +++ b/lib_util/tinywavein_c.h @@ -54,14 +54,22 @@ #define __TWI_SUCCESS ( 0 ) #define __TWI_ERROR ( -1 ) +#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveInHandle +#else +typedef struct __tinyWaveInHandle +#endif { FILE *theFile; fpos_t dataChunkPos; uint32_t position; uint32_t length; uint32_t bps; +#ifdef CODE_IMPROVEMENTS } tinyWaveInHandle, WAVEFILEIN; +#else +} __tinyWaveInHandle, WAVEFILEIN; +#endif typedef struct { diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index a3982ba19c..a511b932dd 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -70,15 +70,27 @@ #endif #endif +#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutHeader +#else +typedef struct __tinyWaveOutHeader +#endif { uint32_t riffType; /* 'RIFF' */ uint32_t riffSize; /* file size */ uint32_t waveType; /* 'WAVE' */ +#ifdef CODE_IMPROVEMENTS } tinyWaveOutHeader; +#else +} __tinyWaveOutHeader; +#endif +#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutFmtChunk +#else +typedef struct __tinyWaveOutFmtChunk +#endif { uint32_t formatType; uint32_t formatSize; @@ -91,16 +103,31 @@ typedef struct tinyWaveOutFmtChunk uint16_t bitsPerSample; /* wav fmt ext hdr here */ +#ifdef CODE_IMPROVEMENTS } tinyWaveOutFmtChunk; +#else +} tinyWaveOutFmtChunk; +#endif +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutDataChunk +#else typedef struct tinyWaveOutDataChunk +#endif { uint32_t dataType; uint32_t dataSize; - +#ifdef CODE_IMPROVEMENTS } tinyWaveOutDataChunk; +#else +} __tinyWaveOutDataChunk; +#endif +#ifdef CODE_IMPROVEMENTS +typedef struct tinyWaveOutHandle +#else typedef struct tinyWaveOutHandle +#endif { FILE *theFile; uint32_t dataSize; @@ -109,7 +136,11 @@ typedef struct tinyWaveOutHandle uint32_t dataChunkOffset; uint32_t bps; uint32_t clipCount; +#ifdef CODE_IMPROVEMENTS } tinyWaveOutHandle, WAVEFILEOUT; +#else +} __tinyWaveOutHandle, WAVEFILEOUT; +#endif /*--- local protos --------------------------------------------------*/ static __inline uint32_t BigEndian32( char, char, char, char ); @@ -132,9 +163,15 @@ static WAVEFILEOUT *CreateBWF( /* ,const uint32_t writeWaveExt */ ) { WAVEFILEOUT *self; +#ifdef CODE_IMPROVEMENTS tinyWaveOutHeader whdr; tinyWaveOutFmtChunk wfch; tinyWaveOutDataChunk wdch; +#else + __tinyWaveOutHeader whdr; + __tinyWaveOutFmtChunk wfch; + __tinyWaveOutDataChunk wdch; +#endif uint32_t blockAlignment = 0; uint32_t ByteCnt = 0; /* Byte counter for fwrite */ -- GitLab From e01c21c621abf3e4c87910a175e396258895c7a1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 11 Jun 2025 15:43:38 +0200 Subject: [PATCH 12/85] fix build with the switch CODE_IMPROVEMENTS deactivated --- lib_com/options.h | 4 ++-- lib_util/g192.h | 5 ----- lib_util/tinywaveout_c.h | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2caa691dc5..dc9793ef16 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -154,8 +154,6 @@ /* ################## Start DEVELOPMENT switches ######################### */ -#define CODE_IMPROVEMENTS /* Small code improvements that do not change the functionality */ - /* ################### Start BE switches ################################# */ /* only BE switches wrt selection floating point code */ @@ -167,6 +165,8 @@ #define FIX_RENDERER_STACK /* VA: issue 1322: reduction of renderers' buffers size */ #define FIX_1319_STACK_SBA_DECODER /* VA: issue 1319: Optimize the definition of buffer lengths in the SBA decoder */ #define JBM_MEMORY_OPT /* VA: issue 916: optimization of RAM in the JBM decoder */ +#define CODE_IMPROVEMENTS /* FhG: Small code improvements that do not change the functionality */ + /* #################### End BE switches ################################## */ diff --git a/lib_util/g192.h b/lib_util/g192.h index f94c69f0da..751f1324fb 100644 --- a/lib_util/g192.h +++ b/lib_util/g192.h @@ -67,13 +67,8 @@ typedef enum _G192_ERROR *-----------------------------------------------------------------------*/ /* main handle */ -#ifdef CODE_IMPROVEMENTS struct G192_STRUCT; typedef struct G192_STRUCT *G192_HANDLE; -#else -struct __G192; -typedef struct __G192 *G192_HANDLE; -#endif /*-----------------------------------------------------------------------* diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index a511b932dd..e7d568dc83 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -106,7 +106,7 @@ typedef struct __tinyWaveOutFmtChunk #ifdef CODE_IMPROVEMENTS } tinyWaveOutFmtChunk; #else -} tinyWaveOutFmtChunk; +} __tinyWaveOutFmtChunk; #endif #ifdef CODE_IMPROVEMENTS @@ -126,7 +126,7 @@ typedef struct tinyWaveOutDataChunk #ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutHandle #else -typedef struct tinyWaveOutHandle +typedef struct __tinyWaveOutHandle #endif { FILE *theFile; -- GitLab From d54146405f21698695c91e19633f37ab73854514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Wed, 11 Jun 2025 17:19:02 +0200 Subject: [PATCH 13/85] Fix calloc argument order --- lib_debug/debug.c | 2 +- lib_lc3plus/dct4.c | 4 ++-- lib_lc3plus/mdct.c | 2 +- lib_util/aeid_file_reader.c | 4 ++-- lib_util/audio_file_reader.c | 2 +- lib_util/audio_file_writer.c | 2 +- lib_util/hrtf_file_reader.c | 4 ++-- lib_util/ism_file_reader.c | 4 ++-- lib_util/ism_file_writer.c | 4 ++-- lib_util/jbm_file_reader.c | 4 ++-- lib_util/jbm_file_writer.c | 8 ++++---- lib_util/ls_custom_file_reader.c | 4 ++-- lib_util/masa_file_reader.c | 2 +- lib_util/masa_file_writer.c | 6 +++--- lib_util/obj_edit_file_reader.c | 6 +++--- lib_util/render_config_reader.c | 2 +- lib_util/rotation_file_reader.c | 4 ++-- lib_util/split_rend_bfi_file_reader.c | 4 ++-- lib_util/tsm_scale_file_reader.c | 4 ++-- lib_util/vector3_pair_file_reader.c | 4 ++-- 20 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 6336e911fc..012183c5ac 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -820,7 +820,7 @@ int16_t make_dirs( const char *const pathname ) if ( sep != 0 ) { - temp = calloc( 1, strlen( pathname ) + 1 ); + temp = calloc( strlen( pathname ) + 1, sizeof( char ) ); p = pathname; while ( ( p = strchr( p, sep ) ) != NULL ) { diff --git a/lib_lc3plus/dct4.c b/lib_lc3plus/dct4.c index 4b4a3f6a0f..d45687ffa7 100644 --- a/lib_lc3plus/dct4.c +++ b/lib_lc3plus/dct4.c @@ -52,8 +52,8 @@ void dct4_init(Dct4* dct, int length) int i; assert(length <= MAX_LEN); dct->length = length; - dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); - dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); + dct->twid1 = calloc(length / 2, sizeof(*dct->twid1)); + dct->twid2 = calloc(length / 2, sizeof(*dct->twid2)); for (i = 0; i < length / 2; i++) { dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * (i + (LC3_FLOAT)0.25) / length); dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * i / length); diff --git a/lib_lc3plus/mdct.c b/lib_lc3plus/mdct.c index 4698afd4bf..0e41b4f745 100644 --- a/lib_lc3plus/mdct.c +++ b/lib_lc3plus/mdct.c @@ -109,7 +109,7 @@ void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC mdct->length = length; mdct->mem_length = length - mdct->leading_zeros; mdct->window = mdct_window(length, frame_dms, hrmode); - mdct->mem = calloc(sizeof(*mdct->mem), mdct->mem_length); + mdct->mem = calloc(mdct->mem_length, sizeof(*mdct->mem)); dct4_init(&mdct->dct, length); } diff --git a/lib_util/aeid_file_reader.c b/lib_util/aeid_file_reader.c index e569dbdc7c..6f877452e5 100644 --- a/lib_util/aeid_file_reader.c +++ b/lib_util/aeid_file_reader.c @@ -69,9 +69,9 @@ ivas_error aeidFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( aeidFileReader ), 1 ); + self = calloc( 1, sizeof( aeidFileReader ) ); self->aeidFile = aeidFile; - self->file_path = calloc( sizeof( char ), strlen( aeidFilePath ) + 1 ); + self->file_path = calloc( strlen( aeidFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, aeidFilePath ); *aeidReader = self; diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index 1b52daaa77..92bfe89789 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -94,7 +94,7 @@ ivas_error AudioFileReader_open( { return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileReader ), 1 ); + self = calloc( 1, sizeof( AudioFileReader ) ); self->samplingRate = 0; self->numChannels = 0; diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index 3210631019..eb93018341 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -89,7 +89,7 @@ ivas_error AudioFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileWriter ), 1 ); + self = calloc( 1, sizeof( AudioFileWriter ) ); if ( self == NULL ) { return IVAS_ERR_FAILED_ALLOC; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 53a5d340e1..3347a0c9ab 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -83,9 +83,9 @@ ivas_error hrtfFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( hrtfFileReader ), 1 ); + self = calloc( 1, sizeof( hrtfFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *hrtfReader = self; diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 088a4134f9..83a32b7a01 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -72,9 +72,9 @@ IsmFileReader *IsmFileReader_open( return NULL; } - self = calloc( sizeof( IsmFileReader ), 1 ); + self = calloc( 1, sizeof( IsmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index fff4cc4ff0..10efc1ea3d 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -81,9 +81,9 @@ ivas_error IsmFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( IsmFileWriter ), 1 ); + self = calloc( 1, sizeof( IsmFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *ismWriter = self; diff --git a/lib_util/jbm_file_reader.c b/lib_util/jbm_file_reader.c index b657ab7892..68caf5ae73 100644 --- a/lib_util/jbm_file_reader.c +++ b/lib_util/jbm_file_reader.c @@ -68,9 +68,9 @@ JbmFileReader *JbmFileReader_open( return NULL; } - self = calloc( sizeof( JbmFileReader ), 1 ); + self = calloc( 1, sizeof( JbmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/jbm_file_writer.c b/lib_util/jbm_file_writer.c index 76a5a67d25..9d11dad904 100644 --- a/lib_util/jbm_file_writer.c +++ b/lib_util/jbm_file_writer.c @@ -77,9 +77,9 @@ ivas_error JbmOffsetFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( JbmOffsetFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmOffsetFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmOffsetFilename ) + 1 ); + self->file_path = calloc( strlen( jbmOffsetFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmOffsetFilename ); *jbmOffsetWriter = self; @@ -204,9 +204,9 @@ ivas_error JbmTraceFileWriter_open( fprintf( file, "#rtpSeqNo;rtpTs;rcvTime;playTime;active\n" ); - self = calloc( sizeof( JbmTraceFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmTraceFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmTraceFilename ) + 1 ); + self->file_path = calloc( strlen( jbmTraceFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmTraceFilename ); *jbmTraceWriter = self; diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 48c87a88ea..43c9959e68 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -70,9 +70,9 @@ ivas_error CustomLsReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( LsCustomFileReader ), 1 ); + self = calloc( 1, sizeof( LsCustomFileReader ) ); self->file = lsFile; - self->file_path = calloc( sizeof( char ), strlen( LsFilePath ) + 1 ); + self->file_path = calloc( strlen( LsFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, LsFilePath ); *hLsCustomReader = self; diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 2cb76f96e6..1122878f8a 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -70,7 +70,7 @@ MasaFileReader *MasaFileReader_open( return NULL; } - self = calloc( sizeof( MasaFileReader ), 1 ); + self = calloc( 1, sizeof( MasaFileReader ) ); self->file = file; generate_gridEq( &self->sph_grid16 ); diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 8cac01ff5a..3f269a6871 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -212,14 +212,14 @@ ivas_error MasaFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( MasaFileWriter ), 1 ); + self = calloc( 1, sizeof( MasaFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); if ( !delayCompensationEnabled ) { - self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); + self->delayStorage = calloc( 1, sizeof( MASA_META_DELAY_STORAGE ) ); self->delayStorage->prevDelay = DELAY_MASA_PARAM_DEC_SFR; } diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 9963e722ba..2dde08ecc3 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -76,13 +76,13 @@ ivas_error ObjectEditFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = (ObjectEditFileReader *) calloc( sizeof( ObjectEditFileReader ), 1 ); + self = (ObjectEditFileReader *) calloc( 1, sizeof( ObjectEditFileReader ) ); self->maxLineLen = 256; self->editFileHandle = fileHandle; - self->inLine = (char *) calloc( sizeof( char ), self->maxLineLen ); + self->inLine = (char *) calloc( self->maxLineLen, sizeof( char ) ); - self->readInfo = (ReadObjectEditInfo *) calloc( sizeof( ReadObjectEditInfo ), 1 ); + self->readInfo = (ReadObjectEditInfo *) calloc( 1, sizeof( ReadObjectEditInfo ) ); self->readInfo->bg_gain = 0.0f; self->readInfo->bg_gain_edited = false; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index dd3e84ac87..7729efbc7c 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1398,7 +1398,7 @@ ivas_error RenderConfigReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - pSelf = calloc( sizeof( RenderConfigReader ), 1 ); + pSelf = calloc( 1, sizeof( RenderConfigReader ) ); pSelf->pConfigFile = pConfigFile; pSelf->nFG = 0; pSelf->pFG = NULL; diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index f659fbb9fa..024b083737 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -72,10 +72,10 @@ ivas_error RotationFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( RotFileReader ), 1 ); + self = calloc( 1, sizeof( RotFileReader ) ); self->trajFile = trajFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); self->fileRewind = false; diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 70e695048e..07b71e2219 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -76,10 +76,10 @@ ivas_error SplitRendBFIFileReader_open( txtfile = ( strcmp( bfiFilePath + strlen( bfiFilePath ) - 4, ".txt" ) ? false : true ); - self = calloc( sizeof( SplitRendBFIFileReader ), 1 ); + self = calloc( 1, sizeof( SplitRendBFIFileReader ) ); self->bfiFile = bfiFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( bfiFilePath ) + 1 ); + self->file_path = calloc( strlen( bfiFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, bfiFilePath ); self->fileRewind = false; self->txtfile = txtfile; diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index 653fc0f2f6..65182061e2 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -73,9 +73,9 @@ TsmScaleFileReader *TsmScaleFileReader_open( return NULL; } - self = calloc( sizeof( TsmScaleFileReader ), 1 ); + self = calloc( 1, sizeof( TsmScaleFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index 8a46a97d1d..5f6116c747 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -68,9 +68,9 @@ ivas_error Vector3PairFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( Vector3PairFileReader ), 1 ); + self = calloc( 1, sizeof( Vector3PairFileReader ) ); self->trajFile = trajFile; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); *vector3PairReader = self; -- GitLab From 083de2781953d7c072ba517540de632b805ba334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Wed, 11 Jun 2025 17:27:38 +0200 Subject: [PATCH 14/85] Replace malloc/memset(0) with calloc --- apps/decoder.c | 3 +-- lib_util/bitstream_reader.c | 7 +++---- lib_util/bitstream_writer.c | 7 +++---- lib_util/g192.c | 1 - 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 6a1d823f76..d4f5989373 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1858,13 +1858,12 @@ static ivas_error initOnFirstGoodFrame( return error; } - int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); + int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } - memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { diff --git a/lib_util/bitstream_reader.c b/lib_util/bitstream_reader.c index a250a34a70..c6fe784fbd 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -203,16 +203,15 @@ static void init_for_mime( BS_READER_HANDLE hBsReader ) static ivas_error init_for_format( BS_READER_HANDLE *phBsReader, BS_READER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsReader ) = (BS_READER_HANDLE) malloc( sizeof( struct BS_Reader ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsReader ) = (BS_READER_HANDLE) calloc( 1, sizeof( struct BS_Reader ) ); if ( *phBsReader == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream reader" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_READER_HANDLE hBsReader = *phBsReader; - memset( hBsReader, 0, sizeof( struct BS_Reader ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/bitstream_writer.c b/lib_util/bitstream_writer.c index 8c4b64cd48..bff9f461b1 100644 --- a/lib_util/bitstream_writer.c +++ b/lib_util/bitstream_writer.c @@ -156,16 +156,15 @@ static void init_for_mime( BS_WRITER_HANDLE hBsWriter ) static ivas_error init_for_format( BS_WRITER_HANDLE *phBsWriter, BS_WRITER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsWriter ) = (BS_WRITER_HANDLE) malloc( sizeof( struct BS_Writer ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsWriter ) = (BS_WRITER_HANDLE) calloc( 1, sizeof( struct BS_Writer ) ); if ( *phBsWriter == NULL ) { IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream writer" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_WRITER_HANDLE hBsWriter = *phBsWriter; - memset( hBsWriter, 0, sizeof( struct BS_Writer ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/g192.c b/lib_util/g192.c index a45c673270..a96a8ee56d 100644 --- a/lib_util/g192.c +++ b/lib_util/g192.c @@ -84,7 +84,6 @@ G192_ERROR G192_Reader_Open_filename( { return G192_MEMORY_ERROR; } - memset( *phG192, 0, sizeof( struct G192_STRUCT ) ); /* open file stream */ ( *phG192 )->file = fopen( filename, "rb" ); -- GitLab From defd7af6ddf789abf1ae57288200544bf004c605 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 26 Jun 2025 17:33:14 +0200 Subject: [PATCH 15/85] scale EXT output by 0.5 in OSBA high-BR mode --- lib_com/options.h | 2 +- lib_dec/ivas_jbm_dec.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 8dd815456f..0208e83858 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,7 +176,7 @@ #define NONBE_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ -#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ +#define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2c6a571c75..1d0e63df3a 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,6 +1110,12 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } +#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + } +#endif } else { -- GitLab From 121988a44eaf8522bdd6cb45cae44ed0a0425c4e Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 27 Jun 2025 19:27:59 +0200 Subject: [PATCH 16/85] fix for issue 1329 --- lib_com/options.h | 9 +++++---- lib_enc/ivas_stereo_mdct_stereo_enc.c | 24 ++++++++++++++++++------ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 9473a7cc22..a1488d8662 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -/*#define DEBUGGING*/ /* Activate debugging part of the code */ +#define DEBUGGING /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ @@ -58,14 +58,14 @@ #ifdef DEBUGGING /*#define DBG_BITSTREAM_ANALYSIS*/ /* Write bitstream with annotations to a text file */ -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ -/*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ +#define DEBUG_MODE_MDCT /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC*/ /* output Parametric MC paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ @@ -77,7 +77,7 @@ #endif #ifdef DEBUG_MODE_MDCT -/*#define DEBUG_PLOT_BITS*/ +#define DEBUG_PLOT_BITS #endif #ifdef DEBUG_MODE_DFT @@ -176,6 +176,7 @@ #define NONBE_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ +#define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index fa97984539..455ac54a85 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -411,17 +411,29 @@ void stereo_coder_tcx( nAvailBitsMS[k] = ( ( mct_on ? 2 * sts[0]->bits_frame_channel : sts[0]->bits_frame_nominal ) - sts[0]->side_bits_frame_channel - sts[1]->side_bits_frame_channel - ( nSubframes == 2 ? OFFSET_BITS_TCX10 : OFFSET_BITS_TCX20 ) ) / nSubframes; - MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); - - if ( sts[0]->igf ) +#ifdef NONBE_1329_FIX_OSBA_CRASH + if ( mct_on && nAvailBitsMS[k] < 0 ) /*Force M/S when bit-budget is low for MCT*/ { - IGFEncStereoEncoder( sfbConf, sts[0]->hIGFEnc, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], &ms_mask[k][0], - &hStereoMdct->IGFStereoMode[k], hStereoMdct->mdct_stereo_mode[k], sts[0]->core == TCX_20_CORE, sts[0]->last_core == ACELP_CORE ); + hStereoMdct->mdct_stereo_mode[k] = 1; + hStereoMdct->IGFStereoMode[k] = 1; } else { - hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; +#endif + MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); + + if ( sts[0]->igf ) + { + IGFEncStereoEncoder( sfbConf, sts[0]->hIGFEnc, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], &ms_mask[k][0], + &hStereoMdct->IGFStereoMode[k], hStereoMdct->mdct_stereo_mode[k], sts[0]->core == TCX_20_CORE, sts[0]->last_core == ACELP_CORE ); + } + else + { + hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; + } +#ifdef NONBE_1329_FIX_OSBA_CRASH } +#endif if ( hStereoMdct->mdct_stereo_mode[k] != SMDCT_DUAL_MONO || hStereoMdct->IGFStereoMode[k] != SMDCT_DUAL_MONO ) { -- GitLab From 2d7d6c17210e0a51eb7372225400d0245daeceb7 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Fri, 27 Jun 2025 20:29:26 +0200 Subject: [PATCH 17/85] disable debugging --- lib_com/options.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 6f2d9ecfea..9709db8833 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -48,7 +48,7 @@ /* ################### Start DEBUGGING switches ########################### */ #ifndef RELEASE -#define DEBUGGING /* Activate debugging part of the code */ +/*#define DEBUGGING*/ /* Activate debugging part of the code */ #endif /*#define WMOPS*/ /* Activate complexity and memory counters */ /*#define WMOPS_PER_FRAME*/ /* Output per-frame complexity (writes one float value per frame to the file "wmops_analysis") */ @@ -58,14 +58,14 @@ #ifdef DEBUGGING /*#define DBG_BITSTREAM_ANALYSIS*/ /* Write bitstream with annotations to a text file */ -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ -#define DEBUG_MODE_MDCT /* output most important MDCT parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC*/ /* output Parametric MC paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ -- GitLab From 407b1fe4af2bb3fdc6deb5c9e70190c60070adc0 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 30 Jun 2025 16:33:28 +0200 Subject: [PATCH 18/85] add missing define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND again --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 0208e83858..5f9184a30a 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,7 @@ #define NONBE_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ +#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ #define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ /* ##################### End NON-BE switches ########################### */ -- GitLab From cee4a2ad25fcb3225e46af9e68d42e9904c8d20c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 1 Jul 2025 11:23:31 +0200 Subject: [PATCH 19/85] Fix calloc argument order --- lib_debug/debug.c | 2 +- lib_util/aeid_file_reader.c | 4 ++-- lib_util/audio_file_reader.c | 2 +- lib_util/audio_file_writer.c | 2 +- lib_util/hrtf_file_reader.c | 4 ++-- lib_util/ism_file_reader.c | 4 ++-- lib_util/ism_file_writer.c | 4 ++-- lib_util/jbm_file_reader.c | 4 ++-- lib_util/jbm_file_writer.c | 8 ++++---- lib_util/ls_custom_file_reader.c | 4 ++-- lib_util/masa_file_reader.c | 2 +- lib_util/masa_file_writer.c | 6 +++--- lib_util/obj_edit_file_reader.c | 6 +++--- lib_util/render_config_reader.c | 2 +- lib_util/rotation_file_reader.c | 4 ++-- lib_util/split_rend_bfi_file_reader.c | 4 ++-- lib_util/tsm_scale_file_reader.c | 4 ++-- lib_util/vector3_pair_file_reader.c | 4 ++-- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lib_debug/debug.c b/lib_debug/debug.c index 6336e911fc..012183c5ac 100644 --- a/lib_debug/debug.c +++ b/lib_debug/debug.c @@ -820,7 +820,7 @@ int16_t make_dirs( const char *const pathname ) if ( sep != 0 ) { - temp = calloc( 1, strlen( pathname ) + 1 ); + temp = calloc( strlen( pathname ) + 1, sizeof( char ) ); p = pathname; while ( ( p = strchr( p, sep ) ) != NULL ) { diff --git a/lib_util/aeid_file_reader.c b/lib_util/aeid_file_reader.c index e569dbdc7c..6f877452e5 100644 --- a/lib_util/aeid_file_reader.c +++ b/lib_util/aeid_file_reader.c @@ -69,9 +69,9 @@ ivas_error aeidFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( aeidFileReader ), 1 ); + self = calloc( 1, sizeof( aeidFileReader ) ); self->aeidFile = aeidFile; - self->file_path = calloc( sizeof( char ), strlen( aeidFilePath ) + 1 ); + self->file_path = calloc( strlen( aeidFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, aeidFilePath ); *aeidReader = self; diff --git a/lib_util/audio_file_reader.c b/lib_util/audio_file_reader.c index 1b52daaa77..92bfe89789 100644 --- a/lib_util/audio_file_reader.c +++ b/lib_util/audio_file_reader.c @@ -94,7 +94,7 @@ ivas_error AudioFileReader_open( { return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileReader ), 1 ); + self = calloc( 1, sizeof( AudioFileReader ) ); self->samplingRate = 0; self->numChannels = 0; diff --git a/lib_util/audio_file_writer.c b/lib_util/audio_file_writer.c index 3210631019..eb93018341 100644 --- a/lib_util/audio_file_writer.c +++ b/lib_util/audio_file_writer.c @@ -89,7 +89,7 @@ ivas_error AudioFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( AudioFileWriter ), 1 ); + self = calloc( 1, sizeof( AudioFileWriter ) ); if ( self == NULL ) { return IVAS_ERR_FAILED_ALLOC; diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index 53a5d340e1..3347a0c9ab 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -83,9 +83,9 @@ ivas_error hrtfFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( hrtfFileReader ), 1 ); + self = calloc( 1, sizeof( hrtfFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *hrtfReader = self; diff --git a/lib_util/ism_file_reader.c b/lib_util/ism_file_reader.c index 088a4134f9..83a32b7a01 100644 --- a/lib_util/ism_file_reader.c +++ b/lib_util/ism_file_reader.c @@ -72,9 +72,9 @@ IsmFileReader *IsmFileReader_open( return NULL; } - self = calloc( sizeof( IsmFileReader ), 1 ); + self = calloc( 1, sizeof( IsmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/ism_file_writer.c b/lib_util/ism_file_writer.c index fff4cc4ff0..10efc1ea3d 100644 --- a/lib_util/ism_file_writer.c +++ b/lib_util/ism_file_writer.c @@ -81,9 +81,9 @@ ivas_error IsmFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( IsmFileWriter ), 1 ); + self = calloc( 1, sizeof( IsmFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); *ismWriter = self; diff --git a/lib_util/jbm_file_reader.c b/lib_util/jbm_file_reader.c index b657ab7892..68caf5ae73 100644 --- a/lib_util/jbm_file_reader.c +++ b/lib_util/jbm_file_reader.c @@ -68,9 +68,9 @@ JbmFileReader *JbmFileReader_open( return NULL; } - self = calloc( sizeof( JbmFileReader ), 1 ); + self = calloc( 1, sizeof( JbmFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/jbm_file_writer.c b/lib_util/jbm_file_writer.c index 76a5a67d25..9d11dad904 100644 --- a/lib_util/jbm_file_writer.c +++ b/lib_util/jbm_file_writer.c @@ -77,9 +77,9 @@ ivas_error JbmOffsetFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( JbmOffsetFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmOffsetFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmOffsetFilename ) + 1 ); + self->file_path = calloc( strlen( jbmOffsetFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmOffsetFilename ); *jbmOffsetWriter = self; @@ -204,9 +204,9 @@ ivas_error JbmTraceFileWriter_open( fprintf( file, "#rtpSeqNo;rtpTs;rcvTime;playTime;active\n" ); - self = calloc( sizeof( JbmTraceFileWriter ), 1 ); + self = calloc( 1, sizeof( JbmTraceFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( jbmTraceFilename ) + 1 ); + self->file_path = calloc( strlen( jbmTraceFilename ) + 1, sizeof( char ) ); strcpy( self->file_path, jbmTraceFilename ); *jbmTraceWriter = self; diff --git a/lib_util/ls_custom_file_reader.c b/lib_util/ls_custom_file_reader.c index 1629a6d59e..d874342c11 100644 --- a/lib_util/ls_custom_file_reader.c +++ b/lib_util/ls_custom_file_reader.c @@ -70,9 +70,9 @@ ivas_error CustomLsReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( LsCustomFileReader ), 1 ); + self = calloc( 1, sizeof( LsCustomFileReader ) ); self->file = lsFile; - self->file_path = calloc( sizeof( char ), strlen( LsFilePath ) + 1 ); + self->file_path = calloc( strlen( LsFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, LsFilePath ); *hLsCustomReader = self; diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 2cb76f96e6..1122878f8a 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -70,7 +70,7 @@ MasaFileReader *MasaFileReader_open( return NULL; } - self = calloc( sizeof( MasaFileReader ), 1 ); + self = calloc( 1, sizeof( MasaFileReader ) ); self->file = file; generate_gridEq( &self->sph_grid16 ); diff --git a/lib_util/masa_file_writer.c b/lib_util/masa_file_writer.c index 8cac01ff5a..3f269a6871 100644 --- a/lib_util/masa_file_writer.c +++ b/lib_util/masa_file_writer.c @@ -212,14 +212,14 @@ ivas_error MasaFileWriter_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( MasaFileWriter ), 1 ); + self = calloc( 1, sizeof( MasaFileWriter ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); if ( !delayCompensationEnabled ) { - self->delayStorage = calloc( sizeof( MASA_META_DELAY_STORAGE ), 1 ); + self->delayStorage = calloc( 1, sizeof( MASA_META_DELAY_STORAGE ) ); self->delayStorage->prevDelay = DELAY_MASA_PARAM_DEC_SFR; } diff --git a/lib_util/obj_edit_file_reader.c b/lib_util/obj_edit_file_reader.c index 9963e722ba..2dde08ecc3 100644 --- a/lib_util/obj_edit_file_reader.c +++ b/lib_util/obj_edit_file_reader.c @@ -76,13 +76,13 @@ ivas_error ObjectEditFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = (ObjectEditFileReader *) calloc( sizeof( ObjectEditFileReader ), 1 ); + self = (ObjectEditFileReader *) calloc( 1, sizeof( ObjectEditFileReader ) ); self->maxLineLen = 256; self->editFileHandle = fileHandle; - self->inLine = (char *) calloc( sizeof( char ), self->maxLineLen ); + self->inLine = (char *) calloc( self->maxLineLen, sizeof( char ) ); - self->readInfo = (ReadObjectEditInfo *) calloc( sizeof( ReadObjectEditInfo ), 1 ); + self->readInfo = (ReadObjectEditInfo *) calloc( 1, sizeof( ReadObjectEditInfo ) ); self->readInfo->bg_gain = 0.0f; self->readInfo->bg_gain_edited = false; diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c index dd3e84ac87..7729efbc7c 100644 --- a/lib_util/render_config_reader.c +++ b/lib_util/render_config_reader.c @@ -1398,7 +1398,7 @@ ivas_error RenderConfigReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - pSelf = calloc( sizeof( RenderConfigReader ), 1 ); + pSelf = calloc( 1, sizeof( RenderConfigReader ) ); pSelf->pConfigFile = pConfigFile; pSelf->nFG = 0; pSelf->pFG = NULL; diff --git a/lib_util/rotation_file_reader.c b/lib_util/rotation_file_reader.c index f659fbb9fa..024b083737 100644 --- a/lib_util/rotation_file_reader.c +++ b/lib_util/rotation_file_reader.c @@ -72,10 +72,10 @@ ivas_error RotationFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( RotFileReader ), 1 ); + self = calloc( 1, sizeof( RotFileReader ) ); self->trajFile = trajFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); self->fileRewind = false; diff --git a/lib_util/split_rend_bfi_file_reader.c b/lib_util/split_rend_bfi_file_reader.c index 70e695048e..07b71e2219 100644 --- a/lib_util/split_rend_bfi_file_reader.c +++ b/lib_util/split_rend_bfi_file_reader.c @@ -76,10 +76,10 @@ ivas_error SplitRendBFIFileReader_open( txtfile = ( strcmp( bfiFilePath + strlen( bfiFilePath ) - 4, ".txt" ) ? false : true ); - self = calloc( sizeof( SplitRendBFIFileReader ), 1 ); + self = calloc( 1, sizeof( SplitRendBFIFileReader ) ); self->bfiFile = bfiFile; self->frameCounter = 0; - self->file_path = calloc( sizeof( char ), strlen( bfiFilePath ) + 1 ); + self->file_path = calloc( strlen( bfiFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, bfiFilePath ); self->fileRewind = false; self->txtfile = txtfile; diff --git a/lib_util/tsm_scale_file_reader.c b/lib_util/tsm_scale_file_reader.c index 653fc0f2f6..65182061e2 100644 --- a/lib_util/tsm_scale_file_reader.c +++ b/lib_util/tsm_scale_file_reader.c @@ -73,9 +73,9 @@ TsmScaleFileReader *TsmScaleFileReader_open( return NULL; } - self = calloc( sizeof( TsmScaleFileReader ), 1 ); + self = calloc( 1, sizeof( TsmScaleFileReader ) ); self->file = file; - self->file_path = calloc( sizeof( char ), strlen( filePath ) + 1 ); + self->file_path = calloc( strlen( filePath ) + 1, sizeof( char ) ); strcpy( self->file_path, filePath ); return self; diff --git a/lib_util/vector3_pair_file_reader.c b/lib_util/vector3_pair_file_reader.c index 8a46a97d1d..5f6116c747 100644 --- a/lib_util/vector3_pair_file_reader.c +++ b/lib_util/vector3_pair_file_reader.c @@ -68,9 +68,9 @@ ivas_error Vector3PairFileReader_open( return IVAS_ERR_FAILED_FILE_OPEN; } - self = calloc( sizeof( Vector3PairFileReader ), 1 ); + self = calloc( 1, sizeof( Vector3PairFileReader ) ); self->trajFile = trajFile; - self->file_path = calloc( sizeof( char ), strlen( trajFilePath ) + 1 ); + self->file_path = calloc( strlen( trajFilePath ) + 1, sizeof( char ) ); strcpy( self->file_path, trajFilePath ); *vector3PairReader = self; -- GitLab From 2ef8b7cb3e6f3b9904e798dc4be3cc3c9d426612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Wed, 11 Jun 2025 17:27:38 +0200 Subject: [PATCH 20/85] Replace malloc/memset(0) with calloc --- apps/decoder.c | 3 +-- lib_util/bitstream_reader.c | 7 +++---- lib_util/bitstream_writer.c | 7 +++---- lib_util/g192.c | 1 - 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/apps/decoder.c b/apps/decoder.c index 6a1d823f76..d4f5989373 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1858,13 +1858,12 @@ static ivas_error initOnFirstGoodFrame( return error; } - int16_t *zeroBuf = malloc( pcmFrameSize * sizeof( int16_t ) ); + int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { fprintf( stdout, "Error: Unable to allocate memory for output buffer.\n" ); return IVAS_ERR_FAILED_ALLOC; } - memset( zeroBuf, 0, pcmFrameSize * sizeof( int16_t ) ); for ( int16_t i = 0; i < numInitialBadFrames; ++i ) { diff --git a/lib_util/bitstream_reader.c b/lib_util/bitstream_reader.c index a250a34a70..c6fe784fbd 100644 --- a/lib_util/bitstream_reader.c +++ b/lib_util/bitstream_reader.c @@ -203,16 +203,15 @@ static void init_for_mime( BS_READER_HANDLE hBsReader ) static ivas_error init_for_format( BS_READER_HANDLE *phBsReader, BS_READER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsReader ) = (BS_READER_HANDLE) malloc( sizeof( struct BS_Reader ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsReader ) = (BS_READER_HANDLE) calloc( 1, sizeof( struct BS_Reader ) ); if ( *phBsReader == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream reader" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_READER_HANDLE hBsReader = *phBsReader; - memset( hBsReader, 0, sizeof( struct BS_Reader ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/bitstream_writer.c b/lib_util/bitstream_writer.c index 8c4b64cd48..bff9f461b1 100644 --- a/lib_util/bitstream_writer.c +++ b/lib_util/bitstream_writer.c @@ -156,16 +156,15 @@ static void init_for_mime( BS_WRITER_HANDLE hBsWriter ) static ivas_error init_for_format( BS_WRITER_HANDLE *phBsWriter, BS_WRITER_FORMAT format ) { /* Allocate memory under handle and check if allocation successful */ - ( *phBsWriter ) = (BS_WRITER_HANDLE) malloc( sizeof( struct BS_Writer ) ); + /* Initialize all struct members to NULL - supported functions + * will be overwritten below in init_for_ */ + ( *phBsWriter ) = (BS_WRITER_HANDLE) calloc( 1, sizeof( struct BS_Writer ) ); if ( *phBsWriter == NULL ) { IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "could not allocate bitstream writer" ); } - /* Initialize all struct members to NULL - supported functions - * will be overwritten below in init_for_ */ BS_WRITER_HANDLE hBsWriter = *phBsWriter; - memset( hBsWriter, 0, sizeof( struct BS_Writer ) ); /* Set function pointers to selected format */ switch ( format ) diff --git a/lib_util/g192.c b/lib_util/g192.c index f61971ef14..f7eeaf6f6d 100644 --- a/lib_util/g192.c +++ b/lib_util/g192.c @@ -84,7 +84,6 @@ G192_ERROR G192_Reader_Open_filename( { return G192_MEMORY_ERROR; } - memset( *phG192, 0, sizeof( struct __G192 ) ); /* open file stream */ ( *phG192 )->file = fopen( filename, "rb" ); -- GitLab From ee9e951d74af8810fb5b382c3bdf53342243b602 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 12:55:16 +0200 Subject: [PATCH 21/85] make renderer sanitizer tests run full stv files --- .gitlab-ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e3e1cba90..59b82fcf63 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -554,8 +554,9 @@ renderer-asan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" @@ -578,8 +579,9 @@ renderer-msan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" @@ -602,8 +604,9 @@ renderer-usan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout - grep_exit_code=0 - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? -- GitLab From 6adb0a25e3452dd2bdd84a494250e1bcf086ef9a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 12:57:21 +0200 Subject: [PATCH 22/85] add split rendering tests to MR pipeline renderer sanitizer jobs --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 59b82fcf63..2425132ee0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -556,7 +556,7 @@ renderer-asan: - cmake --build cmake-build -- -j - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" @@ -581,7 +581,7 @@ renderer-msan: - cmake --build cmake-build -- -j - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" @@ -606,7 +606,7 @@ renderer-usan: - cmake --build cmake-build -- -j - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py --create_ref --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout - grep_exit_code=0 - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? -- GitLab From ecab5348a9d6eeb0c49c67310c80a93dfaecff14 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 13:47:39 +0200 Subject: [PATCH 23/85] also rename _cod and _dec binaries --- .gitlab-ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2425132ee0..166e33d6a3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -554,6 +554,10 @@ renderer-asan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + # rename files to fit naming convention + # en- and decoder needed because of split rendering testcases + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout @@ -579,6 +583,10 @@ renderer-msan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + # rename files to fit naming convention + # en- and decoder needed because of split rendering testcases + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout @@ -604,6 +612,10 @@ renderer-usan: script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j + # rename files to fit naming convention + # en- and decoder needed because of split rendering testcases + - mv IVAS_cod IVAS_cod_ref + - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout -- GitLab From f064eb3a531f8f370103fb1248579b5571048c53 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 14:09:15 +0200 Subject: [PATCH 24/85] add missing --create_ref in renderer-usn job --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 166e33d6a3..de3898fa68 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -618,7 +618,7 @@ renderer-usan: - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout - grep_exit_code=0 - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? -- GitLab From 60ec82e788a89bc5467aba5186026acae018d12a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 15:17:12 +0200 Subject: [PATCH 25/85] change command execution handling, integrate USAN capture --- .gitlab-ci.yml | 6 +--- tests/renderer/utils.py | 61 +++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de3898fa68..c3bd9f97d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -618,11 +618,7 @@ renderer-usan: - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1,log_path=usan_log_catchall python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout - - grep_exit_code=0 - - touch usan_log_empty # Creates an empty file, this is to avoid "grep: usan_log_*: No such file or directory" in case no USAN failures are reported from pytest - - grep UndefinedBehaviorSanitizer usan_log_* || grep_exit_code=$? - - if [ $grep_exit_code != 1 ] ; then echo "Run errors in test_renderer.py with Clang undefined-behavior-sanitizer"; exit 1; fi + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 9176feaa1f..1e66afd606 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -67,53 +67,54 @@ from ..cmp_pcm import cmp_pcm from ..conftest import parse_properties, get_split_idx -def run_cmd(cmd, test_info, env=None): - logging.info(f"\nRunning command\n{' '.join(cmd)}\n") +def _run_cmd(cmd, env, test_info=None): + """ + Helper function for running some command. + Raises a SystemError if either the return code is non-zero or a USAN printout is detected + """ + proc = sp.run(cmd, capture_output=True, text=True, env=env) + stdout = proc.stdout + proc.stderr + + # check for USAN error first + if "UndefinedBehaviorSanitizer" in stdout: + error = f"USAN error detected in stdout of command: {' '.join(cmd)}\n{stdout}" + if test_info is not None: + test_info.error = error + raise SystemError(error) + + # then handle possible crash try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) + proc.check_returncode() except sp.CalledProcessError as e: - test_info.error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - raise SystemError(test_info.error) + error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" + if test_info is not None: + test_info.error = error + raise SystemError(error) + + +def run_cmd(cmd, test_info, env=None): + logging.info(f"\nRunning command\n{' '.join(cmd)}\n") + _run_cmd(cmd, env, test_info) def run_isar_ext_rend_cmd(cmd, env=None): logging.info(f"\nRunning ISAR EXT REND command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_ivas_isar_enc_cmd(cmd, env=None): logging.info(f"\nRunning IVAS ISAR encoder command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_ivas_isar_dec_cmd(cmd, env=None): logging.info(f"\nDUT decoder command:\n\t{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def run_isar_post_rend_cmd(cmd, env=None): logging.info(f"\nRunning ISAR post renderer command\n{' '.join(cmd)}\n") - try: - sp.run(cmd, check=True, capture_output=True, text=True, env=env) - except sp.CalledProcessError as e: - raise SystemError( - f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}" - ) + _run_cmd(cmd, env) def check_BE( @@ -251,7 +252,7 @@ def run_renderer( for k, v in FORMAT_TO_METADATA_FILES_LTV.items(): format_to_file[k] = str(v).replace( str(LTV_DIR), str(test_info.config.option.ltv_dir) - ) + ) else: format_to_file = FORMAT_TO_FILE_LTV format_to_metadata_files = FORMAT_TO_METADATA_FILES_LTV -- GitLab From 4e58e4cdf44f51926c17c4504689433bc278579c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 16:25:14 +0200 Subject: [PATCH 26/85] refactor jobs --- .gitlab-ci.yml | 87 +++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 58 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c3bd9f97d1..de2cfb6949 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -544,44 +544,26 @@ renderer-smoke-test: junit: - report-junit.xml -# test renderer executable with cmake + asan -renderer-asan: +.renderer-sanitizer-job: extends: - .test-job-linux - .rules-merge-request-to-main needs: ["build-codec-linux-cmake"] stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=asan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - # rename files to fit naming convention - # en- and decoder needed because of split rendering testcases - - mv IVAS_cod IVAS_cod_ref - - mv IVAS_dec IVAS_dec_ref - - mv IVAS_rend IVAS_rend_ref - - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout - + timeout: "12 minutes" artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" expire_in: 1 week when: always paths: - report-junit.xml - expose_as: "renderer asan pytest results" + expose_as: "$CI_JOB_NAME pytest results" reports: junit: - report-junit.xml - -# test renderer executable with cmake + msan -renderer-msan: - extends: - - .test-job-linux - - .rules-merge-request-to-main - needs: ["build-codec-linux-cmake"] - stage: test - script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=msan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true + - report.html + before_script: + - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=$SANITIZER_BUILD_STRING -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j # rename files to fit naming convention # en- and decoder needed because of split rendering testcases @@ -589,47 +571,36 @@ renderer-msan: - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref - testcase_timeout=180 - - python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer msan pytest results" - reports: - junit: - - report-junit.xml +# test renderer executable with cmake + asan +renderer-asan: + extends: + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "asan" + script: + - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + + +# test renderer executable with cmake + msan +renderer-msan: + extends: + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "msan" + script: + - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + # test renderer executable with cmake + usan renderer-usan: extends: - - .test-job-linux - - .rules-merge-request-to-main - needs: ["build-codec-linux-cmake"] - stage: test + - .renderer-sanitizer-job + variables: + SANITIZER_BUILD_STRING: "usan" script: - - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=usan -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - - cmake --build cmake-build -- -j - # rename files to fit naming convention - # en- and decoder needed because of split rendering testcases - - mv IVAS_cod IVAS_cod_ref - - mv IVAS_dec IVAS_dec_ref - - mv IVAS_rend IVAS_rend_ref - - testcase_timeout=180 - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto -rA --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout - artifacts: - name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" - expire_in: 1 week - when: always - paths: - - report-junit.xml - expose_as: "renderer usan pytest results" - reports: - junit: - - report-junit.xml # compare renderer bitexactness between target and source branch renderer-pytest-on-merge-request: -- GitLab From 610a12eed2e1f844aeec26511f7144d4dcc520fb Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 16:28:39 +0200 Subject: [PATCH 27/85] move artifacts: expose_as back into individual jobs --- .gitlab-ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index de2cfb6949..b45138e199 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -557,7 +557,6 @@ renderer-smoke-test: when: always paths: - report-junit.xml - expose_as: "$CI_JOB_NAME pytest results" reports: junit: - report-junit.xml @@ -580,6 +579,8 @@ renderer-asan: SANITIZER_BUILD_STRING: "asan" script: - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + artifacts: + expose_as: "renderer asan result" # test renderer executable with cmake + msan @@ -590,6 +591,8 @@ renderer-msan: SANITIZER_BUILD_STRING: "msan" script: - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + artifacts: + expose_as: "renderer msan result" # test renderer executable with cmake + usan @@ -600,6 +603,8 @@ renderer-usan: SANITIZER_BUILD_STRING: "usan" script: - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + artifacts: + expose_as: "renderer usan result" # compare renderer bitexactness between target and source branch -- GitLab From 087e87ec2c249d70c1a03f065cbc523e5df289fb Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 16:39:15 +0200 Subject: [PATCH 28/85] add missing html output for usan test --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b45138e199..a6f696b814 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -602,7 +602,7 @@ renderer-usan: variables: SANITIZER_BUILD_STRING: "usan" script: - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: expose_as: "renderer usan result" -- GitLab From 7e291a83a423a44f88c79da99b6f5889811ed8a9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Tue, 1 Jul 2025 16:55:10 +0200 Subject: [PATCH 29/85] add new delay Eeror profile I1 from S4-250217 --- scripts/dly_error_profiles/dly_error_profile_I1.dat | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 scripts/dly_error_profiles/dly_error_profile_I1.dat diff --git a/scripts/dly_error_profiles/dly_error_profile_I1.dat b/scripts/dly_error_profiles/dly_error_profile_I1.dat new file mode 100644 index 0000000000..ecf898b34b --- /dev/null +++ b/scripts/dly_error_profiles/dly_error_profile_I1.dat @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:854e83b31b5aa6f120e793336e8732281681fc242c86819496901a8c2a65558f +size 25512 -- GitLab From 17ccd81d2ca0bd00b0365223f331039f89c4573f Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 17:13:42 +0200 Subject: [PATCH 30/85] increase timeout --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a6f696b814..b581e54b16 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -550,7 +550,7 @@ renderer-smoke-test: - .rules-merge-request-to-main needs: ["build-codec-linux-cmake"] stage: test - timeout: "12 minutes" + timeout: "30 minutes" artifacts: name: "mr-$CI_MERGE_REQUEST_IID--sha-$CI_COMMIT_SHORT_SHA--job-$CI_JOB_NAME--results" expire_in: 1 week -- GitLab From 02f74d8f64575ea1051c909d0444b9d377b0aff3 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 17:15:09 +0200 Subject: [PATCH 31/85] suppress traceback to not overflow logs --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b581e54b16..96d6f87c81 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -578,7 +578,7 @@ renderer-asan: variables: SANITIZER_BUILD_STRING: "asan" script: - - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest -q -n --tb=no auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: expose_as: "renderer asan result" @@ -590,7 +590,7 @@ renderer-msan: variables: SANITIZER_BUILD_STRING: "msan" script: - - python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: expose_as: "renderer msan result" @@ -602,7 +602,7 @@ renderer-usan: variables: SANITIZER_BUILD_STRING: "usan" script: - - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - UBSAN_OPTIONS=suppressions=scripts/ubsan.supp,report_error_type=1 python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: expose_as: "renderer usan result" -- GitLab From 2a4051d7f7ba6de33aa5ec75edd2d72a4075dac0 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 17:31:05 +0200 Subject: [PATCH 32/85] fix pytest call --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 96d6f87c81..61864fe614 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -578,7 +578,7 @@ renderer-asan: variables: SANITIZER_BUILD_STRING: "asan" script: - - python3 -m pytest -q -n --tb=no auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout + - python3 -m pytest -q --tb=no -n auto --html=report.html --self-contained-html --junit-xml=report-junit.xml tests/renderer/test_renderer.py tests/split_rendering/test_split_rendering.py --create_ref --testcase_timeout=$testcase_timeout artifacts: expose_as: "renderer asan result" -- GitLab From 3887abc8a2781bef9672afa94319f6b5102fb38c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 1 Jul 2025 17:40:28 +0200 Subject: [PATCH 33/85] fix artifacts --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61864fe614..07ae03094e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -557,10 +557,10 @@ renderer-smoke-test: when: always paths: - report-junit.xml + - report.html reports: junit: - report-junit.xml - - report.html before_script: - cmake -B cmake-build -G "Unix Makefiles" -DCLANG=$SANITIZER_BUILD_STRING -DCOPY_EXECUTABLES_FROM_BUILD_DIR=true - cmake --build cmake-build -- -j -- GitLab From caad186bb406d43f85a3dac747974f2514f0ed4a Mon Sep 17 00:00:00 2001 From: rtyag Date: Wed, 2 Jul 2025 15:56:18 +1000 Subject: [PATCH 34/85] split rendering asan fixes --- lib_com/options.h | 2 +- lib_dec/ivas_init_dec.c | 5 ++++- lib_dec/ivas_ism_dec.c | 4 ++++ lib_dec/ivas_mct_dec.c | 4 ++++ lib_rend/ivas_crend.c | 17 ++++++++++++++++- lib_rend/ivas_prot_rend.h | 5 +++++ lib_rend/lib_rend.c | 28 ++++++++++++++++++++++++++++ 7 files changed, 62 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 05773f3307..c09cbb3e3f 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,7 @@ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1335_EXTREND_RETCODE /* FhG: Add modification of returncode for external renderer when an error occurs */ #define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */ - +#define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ /* #################### End BE switches ################################## */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 7b4b631f40..b3d7e62e92 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2782,8 +2782,11 @@ void ivas_destroy_dec( ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); /* Crend handle */ +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); - +#else + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); +#endif /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 7472690650..e18a28281a 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -253,7 +253,11 @@ static ivas_error ivas_ism_bitrate_switching_dec( } /* close the crend binaural renderer */ +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); +#else + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); +#endif } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 6d406fccc1..e15b9c437f 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1169,7 +1169,11 @@ static ivas_error ivas_mc_dec_reconfig( if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); +#else + ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); +#endif } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 8455901f4d..322d6b7e22 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1076,6 +1076,13 @@ ivas_error ivas_rend_initCrendWrapper( ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; +#ifdef FIX_1288_SPLIT_REND_XSAN + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) + { + ( *pCrend )->hCrend[pos_idx] = NULL; + } +#endif + for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { hCrend = NULL; @@ -1338,10 +1345,14 @@ ivas_error ivas_rend_openCrend( * * Deallocate Crend renderer handle *------------------------------------------------------------------------*/ - +#ifndef FIX_1288_SPLIT_REND_XSAN void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses ) +#else +void ivas_rend_closeCrend( + CREND_WRAPPER_HANDLE *pCrend ) +#endif { int16_t i; int16_t pos_idx; @@ -1357,7 +1368,11 @@ void ivas_rend_closeCrend( ivas_hrtf_close( &( *pCrend )->hHrtfCrend ); } +#ifndef FIX_1288_SPLIT_REND_XSAN for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) +#else + for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) +#endif { hCrend = ( *pCrend )->hCrend[pos_idx]; if ( hCrend != NULL ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 121d912881..0e17d68ed0 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -903,10 +903,15 @@ ivas_error ivas_rend_openCrend( const int16_t num_poses ); +#ifndef FIX_1288_SPLIT_REND_XSAN void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend, const int16_t num_poses ); +#else +void ivas_rend_closeCrend( + CREND_WRAPPER_HANDLE *pCrend ); +#endif ivas_error ivas_Crend_hrtf_init( HRTFS_CREND_DATA *hHrtf /* i/o: Crend HRTF handle */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 08f6c7fbbc..bea0c4aa34 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1263,7 +1263,11 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputIsm->crendWrapper ); +#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -1390,7 +1394,11 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputIsm->crendWrapper ); +#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -2088,7 +2096,11 @@ static ivas_error initMcBinauralRendering( /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputMc->crendWrapper ); +#endif } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2180,7 +2192,11 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputMc->crendWrapper ); +#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2365,7 +2381,11 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputMc->crendWrapper ); +#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2582,7 +2602,11 @@ static ivas_error initSbaMasaRendering( { ivas_error error; +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputSba->crendWrapper ); +#endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { @@ -2660,7 +2684,11 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ +#ifndef FIX_1288_SPLIT_REND_XSAN ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); +#else + ivas_rend_closeCrend( &inputSba->crendWrapper ); +#endif if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { -- GitLab From 70ac9fcdd4982e5a6a54e96bfc46948a3ea3f7a5 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Wed, 2 Jul 2025 10:41:17 +0200 Subject: [PATCH 35/85] add some debugging info for bit consumption --- lib_com/options.h | 1 + lib_enc/enc_prm.c | 15 +++++++++++++++ lib_enc/ivas_enc.c | 5 +++++ lib_enc/ivas_mct_core_enc.c | 8 ++++++++ lib_enc/ivas_mdct_core_enc.c | 8 ++++++++ 5 files changed, 37 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index 9709db8833..cbed29f488 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -78,6 +78,7 @@ #ifdef DEBUG_MODE_MDCT #define DEBUG_PLOT_BITS +#define DEBUG_OSBA_MD_BITS #endif #ifdef DEBUG_MODE_DFT diff --git a/lib_enc/enc_prm.c b/lib_enc/enc_prm.c index fb1a338ee6..951ae35b70 100644 --- a/lib_enc/enc_prm.c +++ b/lib_enc/enc_prm.c @@ -565,6 +565,12 @@ void writeTCXparam( nbits_tcx, NPRM_RESQ * st->hTcxCfg->resq, flag_ctx_hm ? &hm_cfg[k] : NULL ); } } +#ifdef DEBUG_PLOT_BITS + if ( core == TCX_10_CORE ) + { + dbgwrite( &nbits_tcx, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + } +#endif } } #ifdef DEBUG_PLOT_BITS @@ -576,6 +582,15 @@ void writeTCXparam( dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_TNS" ); } } + else + { + if ( nSubframes == 1 ) + { + tmp = 0; + dbgwrite( &nbits_tcx, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_RC" ); + } + } #endif return; diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index db2e60fada..8f6eb68b96 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -412,6 +412,11 @@ ivas_error ivas_enc( /* get SBA TCs */ ivas_sba_getTCs( &data_f[n], st_ivas, input_frame ); } +#ifdef DEBUG_OSBA_MD_BITS + { + dbgwrite( &nb_bits_metadata[0], sizeof( int16_t ), hEncoderConfig->nchan_ism + 1, 1, "./res/osba_md_bits" ); + } +#endif /* core-coding of transport channels */ if ( st_ivas->nSCE == 1 ) diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 27f1a0ad3c..4a46bd7b2f 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -471,6 +471,10 @@ void ivas_mct_core_enc( /*write IGF data to bitstream*/ for ( ch = 0; ch < nChannels; ch++ ) { +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif + st = sts[ch]; if ( sts[ch]->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) @@ -478,6 +482,10 @@ void ivas_mct_core_enc( continue; } enc_prm_igf_mdct( st, hBstr ); +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_IGF" ); +#endif } } diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 8085fea231..0c669b581a 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -1146,6 +1146,9 @@ void ivas_mdct_core_whitening_enc( skipped_first_channel = 0; for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { +#ifdef DEBUG_PLOT_BITS + int16_t tmp = hBstr->nb_bits_tot; +#endif st = sts[ch]; if ( st->mct_chan_mode == MCT_CHAN_MODE_IGNORE ) @@ -1170,6 +1173,11 @@ void ivas_mdct_core_whitening_enc( } encode_lpc_avq( hBstr, num_sns, param_lpc[ch], st->core, st->element_mode ); +#ifdef DEBUG_PLOT_BITS + tmp = hBstr->nb_bits_tot - tmp; + dbgwrite( &tmp, sizeof( int16_t ), 1, 1, "./res/bits_SNS" ); +#endif + st->side_bits_frame_channel += hBstr->nb_bits_tot - nbits_start_sns; } } -- GitLab From 6fcf59bace4a1e0ab9deefcf882b736f092f1292 Mon Sep 17 00:00:00 2001 From: Eleni Fotopoulou Date: Wed, 2 Jul 2025 10:57:02 +0200 Subject: [PATCH 36/85] add correct ms mask --- lib_enc/ivas_stereo_mdct_stereo_enc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 455ac54a85..d7cdd4786a 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -412,10 +412,11 @@ void stereo_coder_tcx( nAvailBitsMS[k] = ( ( mct_on ? 2 * sts[0]->bits_frame_channel : sts[0]->bits_frame_nominal ) - sts[0]->side_bits_frame_channel - sts[1]->side_bits_frame_channel - ( nSubframes == 2 ? OFFSET_BITS_TCX10 : OFFSET_BITS_TCX20 ) ) / nSubframes; #ifdef NONBE_1329_FIX_OSBA_CRASH - if ( mct_on && nAvailBitsMS[k] < 0 ) /*Force M/S when bit-budget is low for MCT*/ + if ( mct_on && nAvailBitsMS[k] <= 0 ) /*Force M/S when bit-budget is low for MCT*/ { hStereoMdct->mdct_stereo_mode[k] = 1; hStereoMdct->IGFStereoMode[k] = 1; + set_s( ms_mask[k], 1, sfbConf->sfbCnt ); } else { -- GitLab From 48f1ca8382da0d1c65ecf86fe3aa51bc3ae8127e Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 2 Jul 2025 12:43:29 +0200 Subject: [PATCH 37/85] [cleanup] accept FIX_1335_EXTREND_RETCODE --- apps/isar_post_rend.c | 8 -------- apps/renderer.c | 8 -------- lib_com/options.h | 1 - 3 files changed, 17 deletions(-) diff --git a/apps/isar_post_rend.c b/apps/isar_post_rend.c index a901a294c1..2744c3bbe5 100644 --- a/apps/isar_post_rend.c +++ b/apps/isar_post_rend.c @@ -681,9 +681,7 @@ int main( int argc, char **argv ) { -#ifdef FIX_1335_EXTREND_RETCODE bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ -#endif ISAR_POST_REND_HANDLE hIsarPostRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; @@ -1225,10 +1223,8 @@ int main( * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ -#ifdef FIX_1335_EXTREND_RETCODE mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ -#endif cleanup: free( inpInt16Buffer ); @@ -1259,11 +1255,7 @@ cleanup: print_mem( NULL ); #endif -#ifdef FIX_1335_EXTREND_RETCODE return mainFailed ? -1 : 0; -#else - return 0; -#endif } diff --git a/apps/renderer.c b/apps/renderer.c index b90244b3ad..5242242f7f 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -659,9 +659,7 @@ int main( int argc, char **argv ) { -#ifdef FIX_1335_EXTREND_RETCODE bool mainFailed = true; /* Assume main failed until cleanup is reached without errors */ -#endif IVAS_REND_HANDLE hIvasRend = NULL; RotFileReader *headRotReader = NULL; RotFileReader *externalOrientationFileReader = NULL; @@ -1979,10 +1977,8 @@ int main( * Close files and deallocate resources *------------------------------------------------------------------------------------------*/ -#ifdef FIX_1335_EXTREND_RETCODE mainFailed = false; /* This will stay set to true if cleanup is reached via a goto due to an error */ -#endif cleanup: free( inpInt16Buffer ); @@ -2039,11 +2035,7 @@ cleanup: print_mem( NULL ); #endif -#ifdef FIX_1335_EXTREND_RETCODE return mainFailed ? -1 : 0; -#else - return 0; -#endif } diff --git a/lib_com/options.h b/lib_com/options.h index 05773f3307..81bacee6ea 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,7 +161,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define FIX_1335_EXTREND_RETCODE /* FhG: Add modification of returncode for external renderer when an error occurs */ #define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */ -- GitLab From b5e8702f5b9b3d95d4a602e1a9285837d8e712b9 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 2 Jul 2025 12:43:32 +0200 Subject: [PATCH 38/85] [cleanup] accept NONBE_1250_MCMASA_LS_OUTPUT --- lib_com/options.h | 1 - lib_dec/ivas_dirac_dec.c | 4 ---- 2 files changed, 5 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 81bacee6ea..c6974e925e 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1250_MCMASA_LS_OUTPUT /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */ #define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index cc27fec5f9..88141656c8 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -2453,14 +2453,10 @@ void ivas_dirac_dec_render_sf( /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); -#ifdef NONBE_1250_MCMASA_LS_OUTPUT if ( hDirACRend->hOutSetup.num_lfe > 0 ) { mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); } -#else - mvr2r( &( output_f[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe, num_samples_subframe ); -#endif for ( ch = 0; ch < outchannels; ch++ ) { -- GitLab From 6f6bafda2b04a23e20b57a3c7f810238734ad8da Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 2 Jul 2025 12:43:35 +0200 Subject: [PATCH 39/85] [cleanup] accept NONBE_1302_FIX_OMASA_JBM_FLUSH --- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 9 --------- 2 files changed, 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c6974e925e..d845d456e1 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1302_FIX_OMASA_JBM_FLUSH /* VA: issue 1302: fix OMASA JBM bitrate switching flush in binaural output */ #define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 2c6a571c75..80297cc6ca 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1504,13 +1504,11 @@ ivas_error ivas_jbm_dec_flush_renderer( if ( ism_mode_old == ISM_MASA_MODE_DISC ) { float *tc_local[MAX_NUM_OBJECTS]; -#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH int16_t last_dirac_md_idx; uint16_t nSamplesAvailableNext; ISM_MODE ism_mode_orig; RENDERER_TYPE renderer_type_orig; int32_t ivas_total_brate; -#endif /* copy from ISM delay buffer to the correct place in TCs */ for ( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ ) @@ -1519,7 +1517,6 @@ ivas_error ivas_jbm_dec_flush_renderer( mvr2r( st_ivas->hMasaIsmData->delayBuffer[ch_idx], tc_local[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); } -#ifdef NONBE_1302_FIX_OMASA_JBM_FLUSH /* to render flushed samples, use configuration from the last received frame */ ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; renderer_type_orig = st_ivas->renderer_type; @@ -1546,12 +1543,6 @@ ivas_error ivas_jbm_dec_flush_renderer( st_ivas->ism_mode = ism_mode_orig; st_ivas->renderer_type = renderer_type_orig; st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; -#else - if ( ( error = ivas_td_binaural_renderer_sf( st_ivas, p_output, hTcBuffer->n_samples_granularity ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } } else if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) -- GitLab From 7987fa593c49dd435fa774b1a719e94217755b0b Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 2 Jul 2025 12:43:37 +0200 Subject: [PATCH 40/85] [cleanup] accept NONBE_1324_TC_BUFFER_MEMOERY_KEEP --- lib_com/options.h | 1 - lib_dec/ivas_jbm_dec.c | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d845d456e1..2fb4ac04b2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -173,7 +173,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 80297cc6ca..147f900af6 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -2253,16 +2253,13 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( const int16_t n_samples_granularity /* i : new granularity of the renderer/buffer */ ) { -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available; float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1]; -#endif ivas_error error; DECODER_TC_BUFFER_HANDLE hTcBuffer; hTcBuffer = st_ivas->hTcBuffer; -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP num_tc_buffer_mem = 0; n_samples_still_available = 0; @@ -2281,7 +2278,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( } } -#endif /* if granularity changes, adapt subframe_nb_slots */ if ( n_samples_granularity != hTcBuffer->n_samples_granularity ) { @@ -2321,12 +2317,6 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( hTcBuffer->nchan_buffer_full = nchan_full; hTcBuffer->n_samples_granularity = n_samples_granularity; -#ifndef NONBE_1324_TC_BUFFER_MEMOERY_KEEP -#ifdef DEBUGGING - /* what is remaining from last frames needs always be smaller than n_samples_granularity */ - assert( ( hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered ) < n_samples_granularity ); -#endif -#endif /* reallocate TC audio buffers */ ivas_jbm_dec_tc_audio_deallocate( hTcBuffer ); @@ -2336,14 +2326,12 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure( return error; } -#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP /* propagate samples of the TC buffer from the previous frame */ for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ ) { mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available ); } -#endif return IVAS_ERR_OK; } -- GitLab From e244173daadbdb14866cb94d03de535a8632696d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Fri, 4 Jul 2025 10:44:12 +0200 Subject: [PATCH 41/85] set gain to 0 when rendering from OSBA in the exernal renderer --- apps/renderer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index b90244b3ad..510b8e201d 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -54,6 +54,7 @@ #endif #include "wmc_auto.h" +#define NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER #define WMC_TOOL_SKIP @@ -3498,13 +3499,21 @@ static void parseCombinedFormatInput( inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects; +#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER + inConfig->ambisonicsBuses[0].gain_dB = 0.0f; +#else inConfig->ambisonicsBuses[0].gain_dB = -6.f; +#endif *configString += 4; /* Modify input gain for objects too */ for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) { +#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER + inConfig->audioObjects[i].gain_dB = 0.0f; +#else inConfig->audioObjects[i].gain_dB = -6.f; +#endif } } else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) -- GitLab From 242fc72d8369280545b8e660413bcd8e23a360d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Mon, 7 Jul 2025 14:42:32 +0200 Subject: [PATCH 42/85] Automatically use latest CI scripts --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e3e1cba90..9003f5042b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: # note: GitLab cannot reference variables defined by users in the include ref:, we need to use a YAML anchor for this # see https://docs.gitlab.com/ci/yaml/includes/#use-variables-with-include for more information - IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF a31272de16bd1b556269a50bc179321a60f2a500 + IVAS_CODEC_CI_REF: &IVAS_CODEC_CI_REF main include: - local: .gitlab-ci/variables.yml -- GitLab From 6d9be4367a41d520e6c1ab65e0796ffa715a0fa0 Mon Sep 17 00:00:00 2001 From: rtyag Date: Tue, 8 Jul 2025 14:56:47 +1000 Subject: [PATCH 43/85] usan fixes in lc3plus --- lib_lc3plus/ari_codec.c | 4 ++++ lib_lc3plus/lc3.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib_lc3plus/ari_codec.c b/lib_lc3plus/ari_codec.c index 5ba87a32bc..1695cf562d 100644 --- a/lib_lc3plus/ari_codec.c +++ b/lib_lc3plus/ari_codec.c @@ -705,7 +705,11 @@ void ac_shift_fl(Encoder_State_fl* st) st->carry_count = st->carry_count + 1; } +#ifdef FIX_1288_SPLIT_REND_XSAN + st->low = (LC3_INT)((LC3_UINT32)st->low << 8); +#else st->low = st->low << 8; +#endif st->low = (st->low) & (16777215); /* 2^24 - 1 */ } diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3.c index 56a39286f8..816d680edd 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3.c @@ -88,9 +88,17 @@ static int null_in_list(void **list, int n) /* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ void *balloc(void *base, size_t *base_size, size_t size) { +#ifdef FIX_1288_SPLIT_REND_XSAN + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & (uintptr_t)(~3); +#else uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; +#endif assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ +#ifdef FIX_1288_SPLIT_REND_XSAN + *base_size = (*base_size + size + 3) & (uintptr_t)(~3); +#else *base_size = (*base_size + size + 3) & ~3; +#endif return (void *)ptr; } -- GitLab From 1c434d82ac98c9f965744a742a7f1ee625199099 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Wed, 9 Jul 2025 11:27:04 +0200 Subject: [PATCH 44/85] remove define from LC3plus changes and update integration script --- lib_lc3plus/ari_codec.c | 6 +----- lib_lc3plus/lc3.c | 12 ++---------- scripts/lc3plus_lib_setup/get_lc3plus.sh | 4 ++++ 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/lib_lc3plus/ari_codec.c b/lib_lc3plus/ari_codec.c index 1695cf562d..2a76ecac83 100644 --- a/lib_lc3plus/ari_codec.c +++ b/lib_lc3plus/ari_codec.c @@ -705,11 +705,7 @@ void ac_shift_fl(Encoder_State_fl* st) st->carry_count = st->carry_count + 1; } -#ifdef FIX_1288_SPLIT_REND_XSAN - st->low = (LC3_INT)((LC3_UINT32)st->low << 8); -#else - st->low = st->low << 8; -#endif + st->low = (LC3_INT)((LC3_UINT32)st->low << 8); st->low = (st->low) & (16777215); /* 2^24 - 1 */ } diff --git a/lib_lc3plus/lc3.c b/lib_lc3plus/lc3.c index 816d680edd..b275ed8084 100644 --- a/lib_lc3plus/lc3.c +++ b/lib_lc3plus/lc3.c @@ -88,17 +88,9 @@ static int null_in_list(void **list, int n) /* return pointer to aligned base + base_size, *base_size += size + 4 bytes align */ void *balloc(void *base, size_t *base_size, size_t size) { -#ifdef FIX_1288_SPLIT_REND_XSAN - uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & (uintptr_t)(~3); -#else - uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & ~3; -#endif + uintptr_t ptr = ((uintptr_t)base + *base_size + 3) & (uintptr_t)(~3); assert((uintptr_t)base % 4 == 0); /* base must be 4-byte aligned */ -#ifdef FIX_1288_SPLIT_REND_XSAN - *base_size = (*base_size + size + 3) & (uintptr_t)(~3); -#else - *base_size = (*base_size + size + 3) & ~3; -#endif + *base_size = (*base_size + size + 3) & (uintptr_t)(~3); return (void *)ptr; } diff --git a/scripts/lc3plus_lib_setup/get_lc3plus.sh b/scripts/lc3plus_lib_setup/get_lc3plus.sh index ea2a893d19..d44aff0699 100755 --- a/scripts/lc3plus_lib_setup/get_lc3plus.sh +++ b/scripts/lc3plus_lib_setup/get_lc3plus.sh @@ -57,6 +57,10 @@ find lib_lc3plus -name '*.[ch]' -type f -print0 | \ xargs -0 -I {} \ sed -i 's/^#[[:space:]]\+/#/' {} +# fix for sanitizer issues +sed -i 's/st->low << 8/(LC3_INT)((LC3_UINT32)st->low << 8)/' lib_lc3plus/ari_codec.c +sed -i 's/~3/(uintptr_t)(~3)/' lib_lc3plus/lc3.c + # Add .clang-format file to lib_lc3plus to disable formatting there printf "Disabling clang-format in lib_lc3plus directory\n" printf ' -- GitLab From b927c9d33913ec4c6591349c43460078c30fdf42 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Thu, 10 Jul 2025 10:15:38 +0200 Subject: [PATCH 45/85] revert changes to apps/renderer.c --- apps/renderer.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 206a82704b..5242242f7f 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -54,7 +54,6 @@ #endif #include "wmc_auto.h" -#define NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER #define WMC_TOOL_SKIP @@ -3491,21 +3490,13 @@ static void parseCombinedFormatInput( inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects; -#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER - inConfig->ambisonicsBuses[0].gain_dB = 0.0f; -#else inConfig->ambisonicsBuses[0].gain_dB = -6.f; -#endif *configString += 4; /* Modify input gain for objects too */ for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) { -#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS_RENDERER - inConfig->audioObjects[i].gain_dB = 0.0f; -#else inConfig->audioObjects[i].gain_dB = -6.f; -#endif } } else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) -- GitLab From 202c215ebb318efabb6f6df6d2cd7897cd9b7e74 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 10 Jul 2025 17:20:21 +0200 Subject: [PATCH 46/85] fix for TCX5 ungrouping/interleaving when in_fs < out_fs --- lib_com/options.h | 1 + lib_dec/dec_tcx.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index a9f49183cf..3021ad01a2 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -176,6 +176,7 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ #define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ +#define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index c371d0c9f9..0fb28ddb2d 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -1506,7 +1506,11 @@ void decoder_tcx_tns( hTcxCfg->tcx_last_overlap_mode = hTcxCfg->tcx_curr_overlap_mode; } +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 && whitenedDomain ) || ( L_spec > L_frameTCX ) ) +#else if ( ( hTcxCfg->fIsTNSAllowed && fUseTns != 0 && bfi != 1 ) || ( L_spec > L_frameTCX ) ) +#endif { L = L_spec; } @@ -1548,7 +1552,11 @@ void decoder_tcx_tns( if ( ( L_frame == st->L_frame >> 1 ) && st->tcxonly && isTCX5 ) { +#ifdef NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT + if ( st->element_mode == EVS_MONO || ( L_spec < L_frameTCX && !whitenedDomain ) ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#else if ( st->element_mode == EVS_MONO || L_spec < L_frameTCX ) /* todo: this is temporary to maintain EVS BE, this is a bug and should be fixed also for EVS (see issue 13) */ +#endif { tcx5TnsUngrouping( L_frameTCX >> 1, hTcxCfg->tnsConfig[0][0].iFilterBorders[0] >> 1, x, DEC ); } -- GitLab From 1aceaaa69a74b16ca39ecf793586bda716d69367 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 15 Jul 2025 08:53:44 +0200 Subject: [PATCH 47/85] accept switches FIX_938_COMPILER_WARNING, FIX_1288_SPLIT_REND_XSAN, NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND, and NONBE_1329_FIX_OSBA_CRASH --- apps/renderer.c | 5 +++-- lib_com/options.h | 6 +----- lib_dec/ivas_init_dec.c | 5 +---- lib_dec/ivas_ism_dec.c | 4 ---- lib_dec/ivas_mct_dec.c | 5 +---- lib_dec/ivas_mdct_core_dec.c | 10 +-------- lib_enc/ivas_stereo_mdct_stereo_enc.c | 4 ---- lib_rend/ivas_crend.c | 13 +----------- lib_rend/ivas_prot_rend.h | 10 ++------- lib_rend/lib_rend.c | 30 +-------------------------- 10 files changed, 11 insertions(+), 81 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 5242242f7f..f43fde32d2 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -1081,18 +1081,19 @@ int main( fprintf( stderr, "\nFailed to read renderer configuration from file %s\n", args.renderConfigFilePath ); goto cleanup; } -#ifdef NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND + if ( ( error = RenderConfigReader_getDirectivity( renderConfigReader, args.directivityPatternId, renderConfig.directivity ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get directivity patterns for one or more of IDs: %d %d %d %d\n\n", args.directivityPatternId[0], args.directivityPatternId[1], args.directivityPatternId[2], args.directivityPatternId[3] ); goto cleanup; } + if ( ( error = RenderConfigReader_getDistanceAttenuation( renderConfigReader, renderConfig.distAtt ) ) != IVAS_ERR_OK ) { fprintf( stderr, "Failed to get Distance Attenuation \n\n" ); goto cleanup; } -#endif + if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) { aeID = args.aeSequence.count > 0 ? args.aeSequence.pID[0] : 65535; diff --git a/lib_com/options.h b/lib_com/options.h index 9089edfddc..d3b2b9c417 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING /*#define DBG_BITSTREAM_ANALYSIS*/ /* Write bitstream with annotations to a text file */ -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -162,8 +162,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define FIX_938_COMPILER_WARNING /* FhG: Fix compiler warning in ivas_mdct_core_reconstruct() */ -#define FIX_1288_SPLIT_REND_XSAN /* Dlb: Fix asan, msan and usan issues in split rendering mode*/ /* #################### End BE switches ################################## */ @@ -174,8 +172,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */ -#define NONBE_1329_FIX_OSBA_CRASH /* FhG: issue 1329: prevent assert when bit budget is low*/ #define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index b3d7e62e92..a303c6d65b 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2782,11 +2782,8 @@ void ivas_destroy_dec( ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin ); /* Crend handle */ -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif + /* Reverb handle */ ivas_reverb_close( &st_ivas->hReverb ); diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e18a28281a..a76db36306 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -253,11 +253,7 @@ static ivas_error ivas_ism_bitrate_switching_dec( } /* close the crend binaural renderer */ -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index e15b9c437f..8fb966c365 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1161,6 +1161,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( st_ivas->hBinRenderer != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV && st_ivas->renderer_type != RENDERER_BINAURAL_FASTCONV_ROOM ) ) { ivas_binRenderer_close( &st_ivas->hBinRenderer ); + if ( ( st_ivas->hDecoderConfig->Opt_Headrotation || st_ivas->hDecoderConfig->Opt_ExternalOrientation ) ) { efap_free_data( &st_ivas->hEFAPdata ); @@ -1169,11 +1170,7 @@ static ivas_error ivas_mc_dec_reconfig( if ( ( st_ivas->hCrendWrapper != NULL ) && ( st_ivas->hCrendWrapper->hCrend[0] != NULL ) && ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD || st_ivas->hIntSetup.output_config != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) ) { -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ), ( st_ivas->hSplitBinRend == NULL ) ? 1 : st_ivas->hSplitBinRend->splitrend.multiBinPoseData.num_poses ); -#else ivas_rend_closeCrend( &( st_ivas->hCrendWrapper ) ); -#endif } if ( st_ivas->hBinRendererTd != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) ) diff --git a/lib_dec/ivas_mdct_core_dec.c b/lib_dec/ivas_mdct_core_dec.c index 7bb81b4aff..7ba536809c 100644 --- a/lib_dec/ivas_mdct_core_dec.c +++ b/lib_dec/ivas_mdct_core_dec.c @@ -943,15 +943,7 @@ void ivas_mdct_core_reconstruct( /* Postfiltering */ post_decoder( st, synth_buf, pit_gain[ch], pitch[ch], x[ch][0], st->p_bpf_noise_buf ); -#ifndef FIX_938_COMPILER_WARNING - if ( signal_outFB[ch] ) - { -#endif - mvr2r( synthFB, signal_outFB[ch], st->hTcxDec->L_frameTCX ); -#ifndef FIX_938_COMPILER_WARNING - } -#endif - + mvr2r( synthFB, signal_outFB[ch], st->hTcxDec->L_frameTCX ); #ifdef DEBUG_PLC_INFO { int16_t i; diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index d7cdd4786a..d97697434d 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -411,7 +411,6 @@ void stereo_coder_tcx( nAvailBitsMS[k] = ( ( mct_on ? 2 * sts[0]->bits_frame_channel : sts[0]->bits_frame_nominal ) - sts[0]->side_bits_frame_channel - sts[1]->side_bits_frame_channel - ( nSubframes == 2 ? OFFSET_BITS_TCX10 : OFFSET_BITS_TCX20 ) ) / nSubframes; -#ifdef NONBE_1329_FIX_OSBA_CRASH if ( mct_on && nAvailBitsMS[k] <= 0 ) /*Force M/S when bit-budget is low for MCT*/ { hStereoMdct->mdct_stereo_mode[k] = 1; @@ -420,7 +419,6 @@ void stereo_coder_tcx( } else { -#endif MsStereoDecision( sfbConf, sts[0]->hTcxEnc->spectrum[k], sts[1]->hTcxEnc->spectrum[k], inv_spectrum[0][k], inv_spectrum[1][k], &hStereoMdct->mdct_stereo_mode[k], &ms_mask[k][0], nAvailBitsMS[k] ); if ( sts[0]->igf ) @@ -432,9 +430,7 @@ void stereo_coder_tcx( { hStereoMdct->IGFStereoMode[k] = hStereoMdct->mdct_stereo_mode[k]; } -#ifdef NONBE_1329_FIX_OSBA_CRASH } -#endif if ( hStereoMdct->mdct_stereo_mode[k] != SMDCT_DUAL_MONO || hStereoMdct->IGFStereoMode[k] != SMDCT_DUAL_MONO ) { diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index 322d6b7e22..b120fd6c6a 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1076,12 +1076,10 @@ ivas_error ivas_rend_initCrendWrapper( ( *pCrend )->binaural_latency_ns = 0; ( *pCrend )->hHrtfCrend = NULL; -#ifdef FIX_1288_SPLIT_REND_XSAN for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) { ( *pCrend )->hCrend[pos_idx] = NULL; } -#endif for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) { @@ -1345,14 +1343,9 @@ ivas_error ivas_rend_openCrend( * * Deallocate Crend renderer handle *------------------------------------------------------------------------*/ -#ifndef FIX_1288_SPLIT_REND_XSAN -void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses ) -#else + void ivas_rend_closeCrend( CREND_WRAPPER_HANDLE *pCrend ) -#endif { int16_t i; int16_t pos_idx; @@ -1368,11 +1361,7 @@ void ivas_rend_closeCrend( ivas_hrtf_close( &( *pCrend )->hHrtfCrend ); } -#ifndef FIX_1288_SPLIT_REND_XSAN - for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ ) -#else for ( pos_idx = 0; pos_idx < MAX_HEAD_ROT_POSES; pos_idx++ ) -#endif { hCrend = ( *pCrend )->hCrend[pos_idx]; if ( hCrend != NULL ) diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 0e17d68ed0..bb936d4b14 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -903,15 +903,9 @@ ivas_error ivas_rend_openCrend( const int16_t num_poses ); -#ifndef FIX_1288_SPLIT_REND_XSAN -void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend, - const int16_t num_poses -); -#else void ivas_rend_closeCrend( - CREND_WRAPPER_HANDLE *pCrend ); -#endif + CREND_WRAPPER_HANDLE *pCrend +); ivas_error ivas_Crend_hrtf_init( HRTFS_CREND_DATA *hHrtf /* i/o: Crend HRTF handle */ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index bea0c4aa34..24eafd2e7f 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -1263,11 +1263,7 @@ static ivas_error initIsmMasaRendering( ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd ); } -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputIsm->crendWrapper ); -#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -1394,11 +1390,7 @@ static void clearInputIsm( initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputIsm->crendWrapper ); -#endif ivas_reverb_close( &inputIsm->hReverb ); @@ -2096,11 +2088,7 @@ static ivas_error initMcBinauralRendering( /* if we need to use TD renderer and CREND was open, close it */ if ( useTDRend ) { -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif } if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) ) @@ -2192,11 +2180,7 @@ static ivas_error initMcMasaRendering( ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd ); } -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2381,11 +2365,7 @@ static void clearInputMc( efap_free_data( &inputMc->efapInWrapper.hEfap ); } -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputMc->crendWrapper ); -#endif ivas_reverb_close( &inputMc->hReverb ); @@ -2602,11 +2582,7 @@ static ivas_error initSbaMasaRendering( { ivas_error error; -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputSba->crendWrapper ); -#endif if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK ) { @@ -2684,11 +2660,7 @@ static void clearInputSba( initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 ); /* Free input's internal handles */ -#ifndef FIX_1288_SPLIT_REND_XSAN - ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ); -#else ivas_rend_closeCrend( &inputSba->crendWrapper ); -#endif if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL ) { @@ -7529,7 +7501,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From 3d0ab448b6463301e3ebad0c14b8aa0fdd2ed729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 15 Jul 2025 10:53:47 +0200 Subject: [PATCH 48/85] Revert changes on lc3plus The fixes will be introduced by a future lc3plus update MR. --- lib_lc3plus/dct4.c | 4 ++-- lib_lc3plus/mdct.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib_lc3plus/dct4.c b/lib_lc3plus/dct4.c index d45687ffa7..4b4a3f6a0f 100644 --- a/lib_lc3plus/dct4.c +++ b/lib_lc3plus/dct4.c @@ -52,8 +52,8 @@ void dct4_init(Dct4* dct, int length) int i; assert(length <= MAX_LEN); dct->length = length; - dct->twid1 = calloc(length / 2, sizeof(*dct->twid1)); - dct->twid2 = calloc(length / 2, sizeof(*dct->twid2)); + dct->twid1 = calloc(sizeof(*dct->twid1), length / 2); + dct->twid2 = calloc(sizeof(*dct->twid2), length / 2); for (i = 0; i < length / 2; i++) { dct->twid1[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * (i + (LC3_FLOAT)0.25) / length); dct->twid2[i] = cexpi(-(LC3_FLOAT)M_PI_LC3PLUS * i / length); diff --git a/lib_lc3plus/mdct.c b/lib_lc3plus/mdct.c index 0e41b4f745..ebea9a2c83 100644 --- a/lib_lc3plus/mdct.c +++ b/lib_lc3plus/mdct.c @@ -108,8 +108,7 @@ void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC mdct->length = length; mdct->mem_length = length - mdct->leading_zeros; - mdct->window = mdct_window(length, frame_dms, hrmode); - mdct->mem = calloc(mdct->mem_length, sizeof(*mdct->mem)); + mdct->mem = calloc(sizeof(*mdct->mem), mdct->mem_length); dct4_init(&mdct->dct, length); } -- GitLab From 6a3f1700677b16f9bca7de7e0b741eca2cfc76ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20M=C3=BCller?= Date: Tue, 15 Jul 2025 11:04:34 +0200 Subject: [PATCH 49/85] Restore accidentally deleted line --- lib_lc3plus/mdct.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_lc3plus/mdct.c b/lib_lc3plus/mdct.c index ebea9a2c83..4698afd4bf 100644 --- a/lib_lc3plus/mdct.c +++ b/lib_lc3plus/mdct.c @@ -108,6 +108,7 @@ void mdct_init(Mdct* mdct, LC3_INT length, LC3_INT frame_dms, LC3_INT fs_idx, LC mdct->length = length; mdct->mem_length = length - mdct->leading_zeros; + mdct->window = mdct_window(length, frame_dms, hrmode); mdct->mem = calloc(sizeof(*mdct->mem), mdct->mem_length); dct4_init(&mdct->dct, length); } -- GitLab From 06ac088c4e05eb64e617355042673a2865daf3a2 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 15 Jul 2025 12:13:49 +0200 Subject: [PATCH 50/85] clang-format --- lib_rend/lib_rend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 24eafd2e7f..142215e675 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -7501,7 +7501,7 @@ static ivas_error getSamplesInternal( &bits, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, - (const int16_t) ( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), + ( const int16_t )( ( BINAURAL_MAXBANDS * hIvasRend->sampleRateOut ) / 48000 ), tmpBinaural, 1, cldfb_in_flag, -- GitLab From 65b2c8a3fa821416503b8b90b83ef8c9651ee004 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 15 Jul 2025 12:27:59 +0200 Subject: [PATCH 51/85] add comment --- apps/decoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/decoder.c b/apps/decoder.c index d4f5989373..71379c6575 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -1858,6 +1858,7 @@ static ivas_error initOnFirstGoodFrame( return error; } + /* Write zeros to the output audio buffer */ int16_t *zeroBuf = calloc( pcmFrameSize, sizeof( int16_t ) ); if ( zeroBuf == NULL ) { @@ -1887,7 +1888,6 @@ static ivas_error initOnFirstGoodFrame( } else { - if ( *pRemainingDelayNumSamples < *numOutSamples ) { if ( ( error = AudioFileWriter_write( *ppAfWriter, zeroBuf, *numOutSamples * *pNumOutChannels - ( *pRemainingDelayNumSamples * *pNumOutChannels ) ) ) != IVAS_ERR_OK ) -- GitLab From f4c1affb5df3e665c5389bd31b019e5952e34fb9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 17 Jul 2025 12:29:23 +0200 Subject: [PATCH 52/85] re-enable suffix for ref comparison --- tests/split_rendering/utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index f9a1e86fc7..4fe7de3ae0 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -270,8 +270,8 @@ def run_full_chain_split_rendering( # run split renderer cmd = SPLIT_POST_REND_CMD[:] - # if test_info.config.option.create_ref: - # cmd[0] += BIN_SUFFIX_MERGETARGET + if test_info.config.option.create_ref: + cmd[0] += BIN_SUFFIX_MERGETARGET cmd[0] += binary_suffix cmd[4] = str(split_bitstream) cmd[6] = renderer_fmt @@ -416,8 +416,8 @@ def run_external_split_rendering( # run split renderer cmd = SPLIT_POST_REND_CMD[:] - # if test_info.config.option.create_ref: - # cmd[0] += BIN_SUFFIX_MERGETARGET + if test_info.config.option.create_ref: + cmd[0] += BIN_SUFFIX_MERGETARGET cmd[0] += binary_suffix cmd[4] = str(split_bitstream) cmd[6] = renderer_fmt -- GitLab From fe52905c98eb20bed4a09562fd05c783cbda26f7 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 17 Jul 2025 12:34:31 +0200 Subject: [PATCH 53/85] add renaming of post renderer executable --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3cc6086351..cb921d351f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -724,6 +724,7 @@ split-rendering-pytest-on-merge-request: - mv IVAS_cod IVAS_cod_ref - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref + - mv ISAR_post_rend ISAR_post_rend_ref ### If ref_using_main is not set, checkout the source branch to use scripts and input from there - if [ $ref_using_main == 0 ]; then git restore lib_com/options.h; fi # Revert changes back before checking out another branch to avoid conflicts -- GitLab From 2c09078cd6c1ba7c6f83bc500792edea0c9a81de Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 15:49:35 +0200 Subject: [PATCH 54/85] remove factor of 0.5 in the OSBA encoder and decoder --- lib_dec/ivas_jbm_dec.c | 10 +++++----- lib_dec/ivas_osba_dec.c | 25 +++++++++++++++---------- lib_enc/ivas_osba_enc.c | 4 ++++ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 173d031628..4133283729 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,11 +1110,11 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } -#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS - for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) - { - v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); - } +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + } #endif } else diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index afa273fdbb..deda07dc04 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -183,12 +183,16 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = - ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + - ( 0.5f * Cldfb_RealBuffer[b] ); + // ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + + // ( 0.5f * Cldfb_RealBuffer[b] ); + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] + + Cldfb_RealBuffer[b]; st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = - ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + - ( 0.5f * Cldfb_ImagBuffer[b] ); + // ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + + // ( 0.5f * Cldfb_ImagBuffer[b] ); + st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] + + Cldfb_ImagBuffer[b]; } } } @@ -205,7 +209,8 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { - output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; + // output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; + output_f[n][i] = output_f[channel_offset + n][i] + p_sepobj[n][i]; } } } @@ -295,7 +300,7 @@ ivas_error ivas_osba_render_sf( v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } - v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + // v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); } return IVAS_ERR_OK; @@ -338,10 +343,10 @@ void ivas_osba_stereo_add_channels( } } - for ( n = 0; n < nchan_out; n++ ) - { - v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); - } + // for ( n = 0; n < nchan_out; n++ ) + // { + // v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); + // } return; } diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 9939545607..5eaee1331c 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -72,7 +72,11 @@ static void ivas_merge_sba_transports( { for ( j = 0; j < input_frame; j++ ) { +#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS + data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; +#else data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); +#endif } } -- GitLab From e57cc89fa918745c16b0ab1bcd0facf976b13357 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 16:56:43 +0200 Subject: [PATCH 55/85] fix formatting --- lib_dec/ivas_jbm_dec.c | 8 ++++---- lib_enc/ivas_osba_enc.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 4133283729..55c95b452d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1111,10 +1111,10 @@ ivas_error ivas_jbm_dec_render( mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } #ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS - for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) - { - v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); - } + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + } #endif } else diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 5eaee1331c..809177a3f8 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -73,7 +73,7 @@ static void ivas_merge_sba_transports( for ( j = 0; j < input_frame; j++ ) { #ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS - data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; + data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; #else data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); #endif -- GitLab From d204583b6afa920afbfeff83144f71645265563a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 17:00:18 +0200 Subject: [PATCH 56/85] enable NONBE_13552_HARMONIZE_OSBA_LOUDNESS --- lib_com/options.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_com/options.h b/lib_com/options.h index 88467e1090..4d7e724045 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,6 +174,7 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ #define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ +#define NONBE_13552_HARMONIZE_OSBA_LOUDNESS /* FhG: do not scale OSBA inputs by 0.5 any more */ /* ##################### End NON-BE switches ########################### */ -- GitLab From bd8ffd96c74f1092cdc2825c7ec0a1067f220906 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 17:03:34 +0200 Subject: [PATCH 57/85] fix ifdefs in lib_dec/ivas_jbm_dec.c --- lib_dec/ivas_jbm_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 55c95b452d..f8bf5f73b3 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,7 +1110,7 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#if defined(NONBE_1339_FIXOSBA_EXT_LOUDNESS) && !defined(NONBE_13552_HARMONIZE_OSBA_LOUDNESS) for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); -- GitLab From 10372a21f7759b0cd52cc83e097e0b760cdf6325 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 17:09:39 +0200 Subject: [PATCH 58/85] fix formatting --- lib_dec/ivas_jbm_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index f8bf5f73b3..7d8fff6387 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,7 +1110,7 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } -#if defined(NONBE_1339_FIXOSBA_EXT_LOUDNESS) && !defined(NONBE_13552_HARMONIZE_OSBA_LOUDNESS) +#if defined( NONBE_1339_FIXOSBA_EXT_LOUDNESS ) && !defined( NONBE_13552_HARMONIZE_OSBA_LOUDNESS ) for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); -- GitLab From 85168bcabff14359717043a294d73adfa33bc8dc Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 18:02:37 +0200 Subject: [PATCH 59/85] fix encapdulation of the changes in lib_dec/ivas_osba_dec.c and lib_enc/ivas_osba_enc.c --- lib_dec/ivas_osba_dec.c | 19 +++++++++++++------ lib_enc/ivas_osba_enc.c | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index deda07dc04..85ca8d5356 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -183,16 +183,21 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = - // ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + - // ( 0.5f * Cldfb_RealBuffer[b] ); +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + + ( 0.5f * Cldfb_RealBuffer[b] ); +#else st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] + Cldfb_RealBuffer[b]; - +#endif st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = - // ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + - // ( 0.5f * Cldfb_ImagBuffer[b] ); +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + + ( 0.5f * Cldfb_ImagBuffer[b] ); +#else st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] + Cldfb_ImagBuffer[b]; +#endif } } } @@ -300,7 +305,9 @@ ivas_error ivas_osba_render_sf( v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } - // v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); +#endif } return IVAS_ERR_OK; diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 809177a3f8..6215f884eb 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -72,7 +72,7 @@ static void ivas_merge_sba_transports( { for ( j = 0; j < input_frame; j++ ) { -#ifdef NONBE_1339_FIXOSBA_EXT_LOUDNESS +#ifdef NONBE_13552_HARMONIZE_OSBA_LOUDNESS data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; #else data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); -- GitLab From dac05343aa0c1228fc792d7c256599f9bcca77c4 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 18:05:06 +0200 Subject: [PATCH 60/85] fix formatting --- lib_dec/ivas_osba_dec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 85ca8d5356..20d1ef425b 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -191,7 +191,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( Cldfb_RealBuffer[b]; #endif st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); #else @@ -306,7 +306,7 @@ ivas_error ivas_osba_render_sf( } #ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS - v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); + v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); #endif } -- GitLab From 4488b5a76fbba9fe3c0ac44642570aab7d313dc0 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 18:10:30 +0200 Subject: [PATCH 61/85] fix encapdulation of more changes in lib_dec/ivas_osba_dec.c --- lib_dec/ivas_osba_dec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 20d1ef425b..918f4c45fe 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -214,8 +214,11 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { - // output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; +#else output_f[n][i] = output_f[channel_offset + n][i] + p_sepobj[n][i]; +#endif } } } @@ -350,10 +353,12 @@ void ivas_osba_stereo_add_channels( } } - // for ( n = 0; n < nchan_out; n++ ) - // { - // v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); - // } + #ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < nchan_out; n++ ) + { + v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); + } +#endif return; } -- GitLab From 469622e461f4c22f906f2ae7fa306e3b0d28d60b Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 18:29:02 +0200 Subject: [PATCH 62/85] amplify pre-rendered OSBA by in the decoder --- lib_dec/ivas_sba_dec.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 8ddc7f0406..ebd65a7b4f 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -747,20 +747,37 @@ ivas_error ivas_sba_dec_render( ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); - if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) + if ( st_ivas->ivas_format == SBA_ISM_FORMAT) { - float gain = st_ivas->hSbaIsmData->gain_bed; - if ( gain != 1.0f && gain >= 0.0f ) + if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - for ( ch = 0; ch < nchan_out; ch++ ) + float gain = st_ivas->hSbaIsmData->gain_bed; + if ( gain != 1.0f && gain >= 0.0f ) { - int16_t i; - for ( i = 0; i < n_samples_sf; i++ ) + for ( ch = 0; ch < nchan_out; ch++ ) { - output_f_local[ch][i] *= gain; + int16_t i; + for ( i = 0; i < n_samples_sf; i++ ) + { + output_f_local[ch][i] *= gain; + } } } } +#ifdef NONBE_13552_HARMONIZE_OSBA_LOUDNESS + else + { + for ( ch = 0; ch < nchan_out; ch++ ) + { + int16_t i; + for ( i = 0; i < n_samples_sf; i++ ) + { + output_f_local[ch][i] *= 2.0f; + } + } + + } +#endif } for ( ch = 0; ch < nchan_out; ch++ ) -- GitLab From 6ad1847317c0f4ed02f6f5b1918898632d4cd0a9 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 18:39:54 +0200 Subject: [PATCH 63/85] fix formatting --- lib_dec/ivas_sba_dec.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index ebd65a7b4f..2a41280554 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -747,7 +747,7 @@ ivas_error ivas_sba_dec_render( ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); - if ( st_ivas->ivas_format == SBA_ISM_FORMAT) + if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) { if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { @@ -767,15 +767,14 @@ ivas_error ivas_sba_dec_render( #ifdef NONBE_13552_HARMONIZE_OSBA_LOUDNESS else { - for ( ch = 0; ch < nchan_out; ch++ ) + for ( ch = 0; ch < nchan_out; ch++ ) + { + int16_t i; + for ( i = 0; i < n_samples_sf; i++ ) { - int16_t i; - for ( i = 0; i < n_samples_sf; i++ ) - { - output_f_local[ch][i] *= 2.0f; - } + output_f_local[ch][i] *= 2.0f; } - + } } #endif } -- GitLab From 209f67715f83504225a8b93c4ccfe0858a866b75 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Mon, 21 Jul 2025 19:03:51 +0200 Subject: [PATCH 64/85] fix formatting --- lib_dec/ivas_osba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 918f4c45fe..e1173b94fa 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -353,7 +353,7 @@ void ivas_osba_stereo_add_channels( } } - #ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS for ( n = 0; n < nchan_out; n++ ) { v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); -- GitLab From a05d2d90d69a6b3f437900ed83ba25647ddb580c Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 22 Jul 2025 09:34:39 +0200 Subject: [PATCH 65/85] fix a typo in a define --- lib_com/options.h | 2 +- lib_dec/ivas_sba_dec.c | 2 +- lib_enc/ivas_osba_enc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 4d7e724045..9b2e62b011 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,7 +174,7 @@ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ #define NONBE_FIX_TCX5_INTERLEAVING_FOR_FS_IN_UNEQUAL_FS_OUT /* FhG: apply correct TCX5 grouping/interleaving when input_fs != output_fs */ #define NONBE_1339_FIXOSBA_EXT_LOUDNESS /* FhG: issue 1339: apply scaling with EXT output in OSBA high-BR mode */ -#define NONBE_13552_HARMONIZE_OSBA_LOUDNESS /* FhG: do not scale OSBA inputs by 0.5 any more */ +#define NONBE_1352_HARMONIZE_OSBA_LOUDNESS /* FhG: do not scale OSBA inputs by 0.5 any more */ /* ##################### End NON-BE switches ########################### */ diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 2a41280554..4f0ef256e2 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -764,7 +764,7 @@ ivas_error ivas_sba_dec_render( } } } -#ifdef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS else { for ( ch = 0; ch < nchan_out; ch++ ) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 6215f884eb..4b73873b7d 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -72,7 +72,7 @@ static void ivas_merge_sba_transports( { for ( j = 0; j < input_frame; j++ ) { -#ifdef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; #else data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); -- GitLab From 400db3f9f01d629a047e4792fd435516a3c1d702 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 22 Jul 2025 10:18:57 +0200 Subject: [PATCH 66/85] move the scaling factor behind the rendering --- lib_dec/ivas_jbm_dec.c | 12 ++++++++++++ lib_dec/ivas_sba_dec.c | 24 ++++-------------------- lib_enc/ivas_osba_enc.c | 4 ---- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 7d8fff6387..eb3fec751d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1128,6 +1128,12 @@ ivas_error ivas_jbm_dec_render( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } else { @@ -1150,6 +1156,12 @@ ivas_error ivas_jbm_dec_render( set_zero( p_output[n], *nSamplesRendered ); } } +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) + { + v_multc( p_output[n], 2.0f, p_output[n], *nSamplesRendered ); + } +#endif } } else if ( st_ivas->ivas_format == MC_FORMAT ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 4f0ef256e2..8ddc7f0406 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -747,36 +747,20 @@ ivas_error ivas_sba_dec_render( ivas_spar_dec_upmixer_sf( st_ivas, output_f_local, nchan_internal ); - if ( st_ivas->ivas_format == SBA_ISM_FORMAT ) + if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) { - if ( st_ivas->ism_mode == ISM_SBA_MODE_DISC ) - { - float gain = st_ivas->hSbaIsmData->gain_bed; - if ( gain != 1.0f && gain >= 0.0f ) - { - for ( ch = 0; ch < nchan_out; ch++ ) - { - int16_t i; - for ( i = 0; i < n_samples_sf; i++ ) - { - output_f_local[ch][i] *= gain; - } - } - } - } -#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS - else + float gain = st_ivas->hSbaIsmData->gain_bed; + if ( gain != 1.0f && gain >= 0.0f ) { for ( ch = 0; ch < nchan_out; ch++ ) { int16_t i; for ( i = 0; i < n_samples_sf; i++ ) { - output_f_local[ch][i] *= 2.0f; + output_f_local[ch][i] *= gain; } } } -#endif } for ( ch = 0; ch < nchan_out; ch++ ) diff --git a/lib_enc/ivas_osba_enc.c b/lib_enc/ivas_osba_enc.c index 4b73873b7d..9939545607 100644 --- a/lib_enc/ivas_osba_enc.c +++ b/lib_enc/ivas_osba_enc.c @@ -72,11 +72,7 @@ static void ivas_merge_sba_transports( { for ( j = 0; j < input_frame; j++ ) { -#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS - data_out_f[i][j] = data_in_f1[i][j] + data_in_f2[i][j]; -#else data_out_f[i][j] = 0.5f * ( data_in_f1[i][j] + data_in_f2[i][j] ); -#endif } } -- GitLab From 0b5486f028f999f50e8e3392d86cb54c69b4941d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 22 Jul 2025 10:34:10 +0200 Subject: [PATCH 67/85] fix more instances of the typo in the define --- lib_dec/ivas_jbm_dec.c | 2 +- lib_dec/ivas_osba_dec.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index eb3fec751d..317bb0057d 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -1110,7 +1110,7 @@ ivas_error ivas_jbm_dec_render( { mvr2r( p_tc[n], p_output[n], *nSamplesRendered ); } -#if defined( NONBE_1339_FIXOSBA_EXT_LOUDNESS ) && !defined( NONBE_13552_HARMONIZE_OSBA_LOUDNESS ) +#if defined( NONBE_1339_FIXOSBA_EXT_LOUDNESS ) && !defined( NONBE_1352_HARMONIZE_OSBA_LOUDNESS ) for ( n = 0; n < st_ivas->hDecoderConfig->nchan_out; n++ ) { v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index e1173b94fa..25e9eecd6d 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -183,7 +183,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( for ( b = 0; b < num_cldfb_bands; b++ ) { st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_RealBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_RealBuffer[b] ); #else @@ -191,7 +191,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( Cldfb_RealBuffer[b]; #endif st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] = -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS ( 0.5f * st_ivas->hSplitBinRend->hMultiBinCldfbData->Cldfb_ImagBuffer_Binaural[n][slot_idx_start + slot_idx][b] ) + ( 0.5f * Cldfb_ImagBuffer[b] ); #else @@ -214,7 +214,7 @@ ivas_error ivas_osba_dirac_td_binaural_jbm( int16_t i; for ( i = 0; i < nSamplesAsked; i++ ) { -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS output_f[n][i] = 0.5f * output_f[channel_offset + n][i] + 0.5f * p_sepobj[n][i]; #else output_f[n][i] = output_f[channel_offset + n][i] + p_sepobj[n][i]; @@ -353,7 +353,7 @@ void ivas_osba_stereo_add_channels( } } -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS for ( n = 0; n < nchan_out; n++ ) { v_multc( output_f[n], 0.5f, output_f[n], n_samples_to_render ); -- GitLab From 67970d3d7f6bca7608865424671617989b0e055d Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 22 Jul 2025 11:33:44 +0200 Subject: [PATCH 68/85] do not scale OSBA inputs down in the external renderer --- apps/renderer.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index f43fde32d2..bd15b471c0 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3491,14 +3491,8 @@ static void parseCombinedFormatInput( inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects; - inConfig->ambisonicsBuses[0].gain_dB = -6.f; + inConfig->ambisonicsBuses[0].gain_dB = 0.f; *configString += 4; - - /* Modify input gain for objects too */ - for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) - { - inConfig->audioObjects[i].gain_dB = -6.f; - } } else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) { -- GitLab From 033fbca50d0862fcd33c5613afdc580c72b0c449 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 23 Jul 2025 12:58:52 +0200 Subject: [PATCH 69/85] fix naming for renderer sanitizer jobs --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cb921d351f..a3376dc113 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -569,6 +569,7 @@ renderer-smoke-test: - mv IVAS_cod IVAS_cod_ref - mv IVAS_dec IVAS_dec_ref - mv IVAS_rend IVAS_rend_ref + - mv ISAR_post_rend ISAR_post_rend_ref - testcase_timeout=180 # test renderer executable with cmake + asan -- GitLab From 27e55bcdb2b50bbc6fc459df5b5ffa3cadb9843a Mon Sep 17 00:00:00 2001 From: norvell Date: Wed, 23 Jul 2025 14:21:02 +0200 Subject: [PATCH 70/85] Add 6 DoF format to readme.txt --- readme.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/readme.txt b/readme.txt index 1741f84191..bc03403f67 100644 --- a/readme.txt +++ b/readme.txt @@ -571,6 +571,17 @@ columns are the Euler angles yaw, pitch, and roll. The rotations are applied in The yaw angle rotates around the z axis, the pitch angle rotates aroud the new y axis, and the roll angle rotates around the new x axis. +In case of 6 DoF support in the renderer, the head rotation trajectory file may also include a listener +position in absolute Cartesian coordinates on the x-, y- and z-axis. Note that the listener position is +expressed in absolute coordinates, while the listener orientation is expressed as scene displacement. +An example line from a headtracking file of a listener facing forward, positioned at x=3.0, y=4.0 and z=0, +could be: + +-3.0,0.0,0.0,0.0,3.0,4.0,0.0 + +Note that the listener position applies for listener orientation expressed both in Quaternions and Euler angles. + + For the Head rotation operation modes, external trajectory files are available: headrot.csv -- GitLab From cd6816b6b95d9eb4fd9a69aff00aa3e74ebaad8a Mon Sep 17 00:00:00 2001 From: norvell Date: Wed, 23 Jul 2025 14:34:27 +0200 Subject: [PATCH 71/85] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Archit Tamarapu --- readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index bc03403f67..608ebe56c0 100644 --- a/readme.txt +++ b/readme.txt @@ -571,7 +571,7 @@ columns are the Euler angles yaw, pitch, and roll. The rotations are applied in The yaw angle rotates around the z axis, the pitch angle rotates aroud the new y axis, and the roll angle rotates around the new x axis. -In case of 6 DoF support in the renderer, the head rotation trajectory file may also include a listener +In case of 6 DoF support for rendering, the head rotation trajectory file may also include a listener position in absolute Cartesian coordinates on the x-, y- and z-axis. Note that the listener position is expressed in absolute coordinates, while the listener orientation is expressed as scene displacement. An example line from a headtracking file of a listener facing forward, positioned at x=3.0, y=4.0 and z=0, -- GitLab From 187317fa86438768e913897b6b827fce076a8163 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 09:25:40 +0200 Subject: [PATCH 72/85] shorten filenames in split rendering tests --- tests/split_rendering/utils.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 4fe7de3ae0..b13195bdd0 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -192,14 +192,17 @@ def run_full_chain_split_rendering( tmp_dir = Path(tmp_dir) cut_in_file = tmp_dir.joinpath("cut_input.wav") # ivas_bitstream = tmp_dir.joinpath("ivas.192") - ivas_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_ivas.192" + + filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt.replace("BINAURAL_", "")}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" + + ivas_bitstream_stem = f"{filename_base}_ivas.192" # split_bitstream = tmp_dir.joinpath("split.bit") - split_bitstream_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split.bit" + split_bitstream_stem = f"{filename_base}_split.bit" if renderer_fmt == "BINAURAL_SPLIT_PCM": # split_md_file = tmp_dir.joinpath("split_md.bin") - split_md_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_split_md.bit" + split_md_file_stem = f"{filename_base}_split_md.bit" - out_file_stem = f"{in_fmt}_{bitrate}bps_{renderer_fmt}_split_full_config_{render_config.stem}_prerfr_{pre_rend_fr}_postrfr_{post_rend_fr}_.wav" + out_file_stem = f"{filename_base}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF @@ -365,7 +368,8 @@ def run_external_split_rendering( split_bitstream = tmp_dir.joinpath("split.bit") if renderer_fmt == "BINAURAL_SPLIT_PCM": split_md_file = tmp_dir.joinpath("split_md.bin") - out_file_stem = f"{in_fmt}_{renderer_fmt}_split_ext_config_{render_config.stem}_postrfr_{pre_rend_fr}_prerfr_{post_rend_fr}.wav" + + out_file_stem = f"{in_fmt}_{renderer_fmt.replace("BINAURAL_", "")}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF @@ -450,7 +454,7 @@ def run_external_split_rendering( cut, cut_fs = readfile(out_file) - if get_mld == False: + if not get_mld: [diff_found, snr, gain_b, max_diff] = check_BE( test_info, ref, ref_fs, cut, cut_fs ) -- GitLab From da95aa54e2c7110ee4686ef75e2feb9b5ff80035 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 09:36:14 +0200 Subject: [PATCH 73/85] workaround for qoutes in f-string in old python version --- tests/split_rendering/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index b13195bdd0..199f4d673a 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -193,7 +193,8 @@ def run_full_chain_split_rendering( cut_in_file = tmp_dir.joinpath("cut_input.wav") # ivas_bitstream = tmp_dir.joinpath("ivas.192") - filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt.replace("BINAURAL_", "")}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" + renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") + filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" ivas_bitstream_stem = f"{filename_base}_ivas.192" # split_bitstream = tmp_dir.joinpath("split.bit") -- GitLab From 525bb5035d090e2618b563cac4bb30126460b4cd Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 09:45:05 +0200 Subject: [PATCH 74/85] fix f-string issue in other place as well... --- tests/split_rendering/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 199f4d673a..7a4db525af 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -370,7 +370,8 @@ def run_external_split_rendering( if renderer_fmt == "BINAURAL_SPLIT_PCM": split_md_file = tmp_dir.joinpath("split_md.bin") - out_file_stem = f"{in_fmt}_{renderer_fmt.replace("BINAURAL_", "")}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" + renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") + out_file_stem = f"{in_fmt}_{renderer_fmt_for_filename}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF -- GitLab From 76650794d9f46302f74d734489045f9d4baae327 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 10:24:01 +0200 Subject: [PATCH 75/85] add missing renaming of post renderer executable --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a3376dc113..ba303836f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1251,6 +1251,7 @@ ivas-conformance: - cp -force IVAS_cod.exe IVAS_cod_ref.exe - cp -force IVAS_dec.exe IVAS_dec_ref.exe - cp -force IVAS_rend.exe IVAS_rend_ref.exe + - cp -force ISAR_post_rend.exe ISAR_post_rend_ref.exe # Reference creation - python scripts/prepare_combined_format_inputs.py @@ -1344,6 +1345,7 @@ ivas-conformance-linux: - cp IVAS_cod IVAS_cod_ref - cp IVAS_dec IVAS_dec_ref - cp IVAS_rend IVAS_rend_ref + - cp ISAR_post_rend ISAR_post_rend_ref # Reference creation - python3 scripts/prepare_combined_format_inputs.py -- GitLab From d7f37610400153a1d33baae48dbe8ffe4a71b7e4 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 10:58:53 +0200 Subject: [PATCH 76/85] keep "ext" and "full" to better match files to testcases --- tests/split_rendering/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 7a4db525af..1099d98fe1 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -194,14 +194,14 @@ def run_full_chain_split_rendering( # ivas_bitstream = tmp_dir.joinpath("ivas.192") renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") - filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" + filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_full_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" - ivas_bitstream_stem = f"{filename_base}_ivas.192" + ivas_bitstream_stem = f"{filename_base}.192" # split_bitstream = tmp_dir.joinpath("split.bit") - split_bitstream_stem = f"{filename_base}_split.bit" + split_bitstream_stem = f"{filename_base}.splt" if renderer_fmt == "BINAURAL_SPLIT_PCM": # split_md_file = tmp_dir.joinpath("split_md.bin") - split_md_file_stem = f"{filename_base}_split_md.bit" + split_md_file_stem = f"{filename_base}.spltmd" out_file_stem = f"{filename_base}.wav" @@ -371,7 +371,7 @@ def run_external_split_rendering( split_md_file = tmp_dir.joinpath("split_md.bin") renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") - out_file_stem = f"{in_fmt}_{renderer_fmt_for_filename}_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" + out_file_stem = f"{in_fmt}_{renderer_fmt_for_filename}_ext_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}.wav" if test_info.config.option.create_ref: output_path_base = OUTPUT_PATH_REF -- GitLab From c9269c6a4016ece75d122fca98070c97e2c294fb Mon Sep 17 00:00:00 2001 From: Erik Norvell Date: Thu, 24 Jul 2025 13:59:45 +0200 Subject: [PATCH 77/85] Add report_cmd.html for easier debugging of ivas-conformance --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ba303836f5..a3a9e4706a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1317,6 +1317,7 @@ ivas-conformance: expire_in: 1 week when: always paths: + - report_cmd.html - report-junit.xml - report.html - Readme_IVAS_dec.txt -- GitLab From 3aa5bd732d2dcbe448cf9aca2f164e8d2e63d7b5 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Thu, 24 Jul 2025 18:19:03 +0200 Subject: [PATCH 78/85] use .bit ext for split rend bitstream files conformance test depends on it --- tests/split_rendering/utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/split_rendering/utils.py b/tests/split_rendering/utils.py index 1099d98fe1..ccc6a9b5c8 100644 --- a/tests/split_rendering/utils.py +++ b/tests/split_rendering/utils.py @@ -191,17 +191,15 @@ def run_full_chain_split_rendering( with TemporaryDirectory() as tmp_dir: tmp_dir = Path(tmp_dir) cut_in_file = tmp_dir.joinpath("cut_input.wav") - # ivas_bitstream = tmp_dir.joinpath("ivas.192") renderer_fmt_for_filename = renderer_fmt.replace("BINAURAL_", "") filename_base = f"{in_fmt}_{bitrate}_{renderer_fmt_for_filename}_full_cfg_{render_config.stem}_fr_pre_{pre_rend_fr}_post_{post_rend_fr}" ivas_bitstream_stem = f"{filename_base}.192" - # split_bitstream = tmp_dir.joinpath("split.bit") - split_bitstream_stem = f"{filename_base}.splt" + # NOTE: the split bitstream files need to have ".bit" extension otherwise the conformance test breaks + split_bitstream_stem = f"{filename_base}.splt.bit" if renderer_fmt == "BINAURAL_SPLIT_PCM": - # split_md_file = tmp_dir.joinpath("split_md.bin") - split_md_file_stem = f"{filename_base}.spltmd" + split_md_file_stem = f"{filename_base}.spltmd.bit" out_file_stem = f"{filename_base}.wav" -- GitLab From 289e28aab6bc4b4ffa9a289bf81b43a8e789514a Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 29 Jul 2025 14:33:32 +0200 Subject: [PATCH 79/85] wrap changes in renderer.c into ifdefs --- apps/renderer.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index bd15b471c0..da7bea9c42 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3491,8 +3491,20 @@ static void parseCombinedFormatInput( inConfig->numAmbisonicsBuses = 1; inConfig->ambisonicsBuses[0].audioConfig = audioConfig; inConfig->ambisonicsBuses[0].inputChannelIndex = inConfig->numAudioObjects; +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS inConfig->ambisonicsBuses[0].gain_dB = 0.f; +#else + inConfig->ambisonicsBuses[0].gain_dB = -6.f; +#endif *configString += 4; + +#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS + /* Modify input gain for objects too */ + for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) + { + inConfig->audioObjects[i].gain_dB = -6.f; + } +#endif } else if ( audioConfig == IVAS_AUDIO_CONFIG_MASA1 || audioConfig == IVAS_AUDIO_CONFIG_MASA2 ) { -- GitLab From 6008c67efbeb053f3ca13c305bc86272446acb0f Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Tue, 29 Jul 2025 14:41:43 +0200 Subject: [PATCH 80/85] replace an ifdef by an ifndef in renderer.c --- apps/renderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/renderer.c b/apps/renderer.c index da7bea9c42..8e44fd6cc1 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -3498,7 +3498,7 @@ static void parseCombinedFormatInput( #endif *configString += 4; -#ifdef NONBE_1352_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS /* Modify input gain for objects too */ for ( int16_t i = 0; i < inConfig->numAudioObjects; ++i ) { -- GitLab From 1b9816b06aacd8a1adc0a97a3a7abf93d30bb1b3 Mon Sep 17 00:00:00 2001 From: Dominik Weckbecker Date: Wed, 30 Jul 2025 12:36:39 +0200 Subject: [PATCH 81/85] fix typo in ivas_osba_dec.c that caused a loudness decrease at higher bitrates --- lib_dec/ivas_osba_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_osba_dec.c b/lib_dec/ivas_osba_dec.c index 25e9eecd6d..ab1b378ab6 100644 --- a/lib_dec/ivas_osba_dec.c +++ b/lib_dec/ivas_osba_dec.c @@ -308,7 +308,7 @@ ivas_error ivas_osba_render_sf( v_add( p_output[n], p_output_ism[n], p_output[n], *nSamplesRendered ); } -#ifndef NONBE_13552_HARMONIZE_OSBA_LOUDNESS +#ifndef NONBE_1352_HARMONIZE_OSBA_LOUDNESS v_multc( p_output[n], 0.5f, p_output[n], *nSamplesRendered ); #endif } -- GitLab From 22dcb7d636a99ae8a2d5e5a85e827f27f807d4d6 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Wed, 30 Jul 2025 14:23:12 +0200 Subject: [PATCH 82/85] disable switch CODE_IMPROVEMENTS --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5f24053d93..903c44acd3 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -162,7 +162,7 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define CODE_IMPROVEMENTS /* FhG: Small code improvements that do not change the functionality */ +/*#define CODE_IMPROVEMENTS*/ /* FhG: Small code improvements that do not change the functionality */ /* #################### End BE switches ################################## */ -- GitLab From 7eda9ea2a33d0c97a7b6914524c176154295dff9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 4 Aug 2025 18:18:42 +0200 Subject: [PATCH 83/85] remove custom ac env with sequence testcases from exclusion list --- ci/remove_unsupported_testcases.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/ci/remove_unsupported_testcases.py b/ci/remove_unsupported_testcases.py index 28dc94c18b..66b62b04ef 100644 --- a/ci/remove_unsupported_testcases.py +++ b/ci/remove_unsupported_testcases.py @@ -35,12 +35,9 @@ import argparse TESTCASES = [ # self_test.prm "stereo bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, DTX on, EXT out", - "Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND)", "Multi-channel 5_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 32kHz out, EXT out", - "Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv)", "Multi-channel 7_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 16kHz out, EXT out", "Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, EXT out", - "Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin)", "Multi-channel 7_1_4 bitrate switching, 48kHz in, 48kHz out, BINAURAL out, HR, JBM Prof 5", "Multi-channel 5_1_2 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, EXT out", "Multi-channel 7_1 bitrate switching, 48kHz in, 32kHz out, BINAURAL_ROOM_REVERB out, HR, JBM Prof 5", -- GitLab From f5f71bc13f2eeb30db95046a36ed019a6eaf145a Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 5 Aug 2025 08:02:58 +0200 Subject: [PATCH 84/85] dummy commit to trigger CI -- GitLab From 6c7e785dc75e3ade980ba5db4e264908bb1b626c Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Tue, 5 Aug 2025 10:06:06 +0200 Subject: [PATCH 85/85] pass IDs for -aeid instead of files file reading is not yet supported in BASOP float ref --- scripts/config/self_test.prm | 6 +++--- scripts/config/self_test_ltv.prm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index 8074cbfda1..91f8c5e88d 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -1437,15 +1437,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 // Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) ../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid1.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:200,0:100,2:500 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_512000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) ../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid2.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:100,0:300 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_64000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid3.txt BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:100,2:500,1:200 BINAURAL_ROOM_REVERB 48 bit testv/stv51MC48c.wav_MC51_32000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/stv51MC48c.wav bit diff --git a/scripts/config/self_test_ltv.prm b/scripts/config/self_test_ltv.prm index 8c1897f0e1..7cd4b5a8bb 100644 --- a/scripts/config/self_test_ltv.prm +++ b/scripts/config/self_test_ltv.prm @@ -1437,15 +1437,15 @@ eid-xor -fer -vbr -bs g192 -ep g192 bit ../scripts/dly_error_profiles/ep_5pct.g1 // Multi-channel 5_1 at 512 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (CREND) ../IVAS_cod -mc 5_1 512000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid1.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51wav_MC51_512000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,0:1000,2:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51wav_MC51_512000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 64 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (FastConv) ../IVAS_cod -mc 5_1 64000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid2.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_64000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 1:500,2:500,0:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_64000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in 48kHz out, BINAURAL_ROOM_REVERB out custom acoustic environment with a sequence (ParamBin) ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit -../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid testv/aeid3.txt BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_32000_48-48_MC_reverb_sequence.tst +../IVAS_dec -render_config testv/rend_config_combined.cfg -aeid 0:1000,2:500,1:500 BINAURAL_ROOM_REVERB 48 bit testv/ltv48_MC51.wav_MC51_32000_48-48_MC_reverb_sequence.tst // Multi-channel 5_1 at 32 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM_REVERB out Config hospital_patientroom ../IVAS_cod -mc 5_1 32000 48 testv/ltv48_MC51.wav bit -- GitLab