From f3dd4025b0bc8f7303ddbbbe12f578661b311b2a Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Thu, 6 Feb 2025 17:14:38 +0100 Subject: [PATCH] add `in_loudness` key for setting the input loudness on a per-condition level --- examples/TEMPLATE.yml | 19 ++++++++++++------- ivas_processing_scripts/processing/chains.py | 15 ++++++++++++++- ivas_processing_scripts/processing/config.py | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/examples/TEMPLATE.yml b/examples/TEMPLATE.yml index b09e327d..a4a681da 100755 --- a/examples/TEMPLATE.yml +++ b/examples/TEMPLATE.yml @@ -1,3 +1,4 @@ +# !yamlfmt!:ignore --- ################################################ # General configuration @@ -11,7 +12,7 @@ ### Whether to use multiprocessing; default = true # multiprocessing: false -### Deletion of temporary directories containing +### Deletion of temporary directories containing ### intermediate processing files, bitstreams etc.; default = false # delete_tmp: true ### Master seed for random processes like bitstream error pattern generation; default = 0 @@ -137,7 +138,7 @@ input: # tx: ### REQUIRED: Type of bitstream processing; possible types: "JBM" or "FER" # type: "JBM" - + ### JBM ### REQUIRED: either error_pattern (and errpatt_late_loss_rate or errpatt_delay) or error_profile ### delay error profile file @@ -152,14 +153,14 @@ input: # n_frames_per_packet: 2 ### Seed for error pattern shift in JBM; default = 0 or determined by profile number # errpatt_seed: 0 - + ### FER ### REQUIRED: either error_pattern or error_rate ### Frame error pattern file # error_pattern: "path/pattern.192" ### Error rate in percent # error_rate: 5 - + ################################################ ### Configuration for conditions under test ################################################ @@ -179,6 +180,10 @@ conditions_to_generate: c01: ### REQUIRED: type of condition type: ref + ### applied BEFORE condition processing: + ### optional per-condition input loudness with bs1770demo (can be used in all conditions) + # in_loudness: -16 + ### applied AFTER condition processing: ### optional low-pass cut-off frequency in Hz; default = null # out_fc: 22500 ### optional use of IVAS_rend (can be used in all conditions) @@ -205,7 +210,7 @@ conditions_to_generate: c05: ### REQUIRED: type of condition type: mono_dmx - + ### IVAS condition ############################### c06: ### REQUIRED: type of condition @@ -273,7 +278,7 @@ conditions_to_generate: ### Bitstream options # tx: ### For possible arguments see overall bitstream modification - + ### EVS condition ################################ c08: ### REQUIRED: type of condition @@ -309,7 +314,7 @@ conditions_to_generate: ### Post-processing is required and can not be omitted postprocessing: ### REQUIRED: Target format for output, this can be a string as below, or a list, e.g. ["FOA", "BINAURAL"]. - ### Conversion will be applied in order and the last format is the final output forma. This was introduced to + ### Conversion will be applied in order and the last format is the final output forma. This was introduced to ### accomodate for the MASA tests where masaRenderer is used as binaural renderer for all conditions. fmt: "BINAURAL" ### REQUIRED: Target sampling rate in Hz for resampling diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 3c0bbaf4..60894c3f 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -246,6 +246,19 @@ def get_processing_chain( # override / add values based on specific conditions cond_cfg = cfg.conditions_to_generate[condition] + # global input gain per condition + if cond_cfg.get("in_loudness"): + chain["processes"].append( + Preprocessing( + { + "in_fs": tmp_in_fs, + "in_fmt": tmp_in_fmt, + "in_loudness": cond_cfg.get("in_loudness"), + "multiprocessing": cfg.multiprocessing, + } + ) + ) + if cond_cfg["type"] == "ref": # allow list of output formats if (ref_fmt := cond_cfg.get("fmt", None)) is not None: @@ -497,7 +510,7 @@ def get_processing_chain( raise SystemExit(f"Unknown condition {condition}!") # add optional IVAS_rend rendering step after each condition - if cond_cfg.get("ivas_rend", -1) != -1: + if cond_cfg.get("ivas_rend"): rend_cfg = cond_cfg["ivas_rend"] chain["processes"].append( IVAS_rend( diff --git a/ivas_processing_scripts/processing/config.py b/ivas_processing_scripts/processing/config.py index 315ddae9..015d5248 100755 --- a/ivas_processing_scripts/processing/config.py +++ b/ivas_processing_scripts/processing/config.py @@ -255,7 +255,7 @@ class TestConfig: f"The following key must be specified for ESDRU: {REQUIRED_KEYS_ESDRU}" ) - if cfg["conditions_to_generate"][cond_name].get("ivas_rend", -1) != -1: + if cfg["conditions_to_generate"][cond_name].get("ivas_rend"): merged_cfg = get_default_config_for_renderer( "IVAS", codec_bin_extension ) -- GitLab