From 08124d95343d2c49980360f7c9d36b90a8ae5106 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 22 Aug 2025 10:49:19 +0200 Subject: [PATCH 1/3] IVAS_rend: Do not allow empty strings as valid ISM metadata file paths --- apps/renderer.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/renderer.c b/apps/renderer.c index 8ef8a988bd..06ee8087aa 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -564,12 +564,19 @@ static void setupWithSingleFormatInput( positionProvider->numObjects = args.inConfig.numAudioObjects; for ( int16_t i = 0; i < positionProvider->numObjects; ++i ) { - /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ + /* Check if path to metadata file was given */ + if ( isEmptyString( args.inMetadataFilePaths[i] ) ) + { + fprintf( stderr, "No metadata file was given for ISM input %d\n", i ); + exit( -1 ); + } + + /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string contains "NULL" */ char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; to_upper( charBuf ); - if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) + if ( strncmp( charBuf, "NULL", 4 ) == 0 ) { continue; } @@ -2595,7 +2602,7 @@ static CmdlnArgs defaultArgs( args.outConfig.outSetupCustom.num_lfe = 0; args.inConfig.ambisonicsBuses->audioConfig = IVAS_AUDIO_CONFIG_INVALID; - for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) + for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS; ++i ) { clearString( args.inMetadataFilePaths[i] ); } -- GitLab From 0e880a070258979d80691fa90527ae61cbdcdc3c Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 22 Aug 2025 13:35:42 +0200 Subject: [PATCH 2/3] Wrap changes in preprocessor switch --- apps/renderer.c | 12 ++++++++++++ lib_com/options.h | 1 + 2 files changed, 13 insertions(+) diff --git a/apps/renderer.c b/apps/renderer.c index 06ee8087aa..deda26e8ae 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -564,6 +564,7 @@ static void setupWithSingleFormatInput( positionProvider->numObjects = args.inConfig.numAudioObjects; for ( int16_t i = 0; i < positionProvider->numObjects; ++i ) { +#ifdef FIX_1376_MISSING_ISM_METADATA /* Check if path to metadata file was given */ if ( isEmptyString( args.inMetadataFilePaths[i] ) ) { @@ -572,11 +573,18 @@ static void setupWithSingleFormatInput( } /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string contains "NULL" */ +#else + /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ +#endif char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; to_upper( charBuf ); +#ifdef FIX_1376_MISSING_ISM_METADATA if ( strncmp( charBuf, "NULL", 4 ) == 0 ) +#else + if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) +#endif { continue; } @@ -2602,7 +2610,11 @@ static CmdlnArgs defaultArgs( args.outConfig.outSetupCustom.num_lfe = 0; args.inConfig.ambisonicsBuses->audioConfig = IVAS_AUDIO_CONFIG_INVALID; +#ifdef FIX_1376_MISSING_ISM_METADATA for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS + RENDERER_MAX_MASA_INPUTS; ++i ) +#else + for ( int32_t i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i ) +#endif { clearString( args.inMetadataFilePaths[i] ); } diff --git a/lib_com/options.h b/lib_com/options.h index e6081dee4f..32c2722e32 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -165,6 +165,7 @@ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ #define FIX_1348_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_dec(), brings floating-point code inline with FX */ #define FIX_1369_HQ_LR_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_enc(), brings floating-point code inline with FX */ +#define FIX_1376_MISSING_ISM_METADATA /* FhG: IVAS_rend: throw error if there exists an ISM input without a corresponding metadata file path */ /* #################### End BE switches ################################## */ -- GitLab From b712e08bf08167611441e67c7c4d4beabea8fd63 Mon Sep 17 00:00:00 2001 From: Kacper Sagnowski Date: Fri, 22 Aug 2025 14:07:15 +0200 Subject: [PATCH 3/3] Fix renderer tests that relied on default ISM metadata when no -im was given --- tests/renderer/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index 29ee307fad..657b1aa616 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -273,6 +273,13 @@ def run_renderer( if in_meta_files is None and in_fmt in format_to_metadata_files: in_meta_files = format_to_metadata_files[in_fmt] + # If metadata not given with ISM input, use default NULL + if in_meta_files is None and isinstance(in_fmt, str) and "ism" in in_fmt.lower(): + match = re.search(r"ism(\d)", in_fmt.lower()) + assert match is not None + num_obj = int(match[1]) + in_meta_files = ["NULL"] * num_obj + if out_file is None: out_file_stem = f"{in_name}_to_{out_name}{trj_name}{non_diegetic_pan}{refrot_name}{refvec_name}{refveclev_name}{config_name}{framing_name}{hrtf_file_name}{name_extension}{aeid_name}_{sr}.wav" out_file = str(output_path_base.joinpath(out_file_stem)) -- GitLab