From 4b0a741051f1637f612c64d623e8eb2e4a9cdfe9 Mon Sep 17 00:00:00 2001 From: Treffehn Date: Tue, 25 Apr 2023 14:00:28 +0200 Subject: [PATCH] fixed bitstream procesing for individual conditions --- examples/TEMPLATE.yml | 9 +++ ivas_processing_scripts/processing/chains.py | 60 +++++++++++--------- 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/examples/TEMPLATE.yml b/examples/TEMPLATE.yml index 8c5fdd8e..e34d627c 100755 --- a/examples/TEMPLATE.yml +++ b/examples/TEMPLATE.yml @@ -201,6 +201,9 @@ conditions_to_generate: # fs: 48000 ### Additional commandline options; default = null # opts: ["-q", "-no_delay_cmp"] + ### Bitstream options + # tx: + ### For possible arguments see overall bitstream modification ### IVAS condition ############################### c07: @@ -228,6 +231,9 @@ conditions_to_generate: # fs: 48000 ### Additional commandline options; default = null # opts: ["-q", "-no_delay_cmp"] + ### Bitstream options + # tx: + ### For possible arguments see overall bitstream modification ### EVS condition ################################ c08: @@ -249,6 +255,9 @@ conditions_to_generate: bin: ~/git/ivas-codec/IVAS_dec ### Decoder output sampling rate; default = null (same as input) # fs: 48000 + ### Bitstream options + # tx: + ### For possible arguments see overall bitstream modification ################################################ ### Post-processing diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index f830a18b..db5df6ab 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -239,23 +239,27 @@ def get_processing_chain( dec_cfg = cond_cfg["dec"] # Frame error pattern bitstream modification - if "tx" in cond_cfg.keys(): - tx_cfg = cond_cfg["tx"] - elif hasattr(cfg, "tx"): - if cfg.tx.get("type", None) == "FER": + if "tx" in cond_cfg.keys() or hasattr(cfg, "tx"): + # local specification overwrites global one + if "tx" in cond_cfg.keys(): + tx_cfg_tmp = cond_cfg["tx"] + else: + tx_cfg_tmp = cfg.tx + + if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { - "type": cfg.tx.get("type", None), - "error_pattern": cfg.tx.get("error_pattern", None), - "error_rate": cfg.tx.get("error_rate", None), + "type": tx_cfg_tmp.get("type", None), + "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, - "prerun_seed": cfg.tx.get("prerun_seed", 0), + "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), } - elif cfg.tx.get("type", None) == "JBM": + elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { - "type": cfg.tx.get("type", None), - "error_pattern": cfg.tx.get("error_pattern", None), - "error_profile": cfg.tx.get("error_profile", None), - "n_frames_per_packet": cfg.tx.get("n_frames_per_packet", 1), + "type": tx_cfg_tmp.get("type", None), + "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_profile": tx_cfg_tmp.get("error_profile", None), + "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } else: raise ValueError( @@ -294,23 +298,27 @@ def get_processing_chain( dec_cfg = cond_cfg["dec"] # Frame error pattern bitstream modification - if "tx" in cond_cfg.keys(): - tx_cfg = cond_cfg["tx"] - elif hasattr(cfg, "tx"): - if cfg.tx.get("type", None) == "FER": + if "tx" in cond_cfg.keys() or hasattr(cfg, "tx"): + # local specification overwrites global one + if "tx" in cond_cfg.keys(): + tx_cfg_tmp = cond_cfg["tx"] + else: + tx_cfg_tmp = cfg.tx + + if tx_cfg_tmp.get("type", None) == "FER": tx_cfg = { - "type": cfg.tx.get("type", None), - "error_pattern": cfg.tx.get("error_pattern", None), - "error_rate": cfg.tx.get("error_rate", None), + "type": tx_cfg_tmp.get("type", None), + "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_rate": tx_cfg_tmp.get("error_rate", None), "master_seed": cfg.master_seed, - "prerun_seed": cfg.tx.get("prerun_seed", 0), + "prerun_seed": tx_cfg_tmp.get("prerun_seed", 0), } - elif cfg.tx.get("type", None) == "JBM": + elif tx_cfg_tmp.get("type", None) == "JBM": tx_cfg = { - "type": cfg.tx.get("type", None), - "error_pattern": cfg.tx.get("error_pattern", None), - "error_profile": cfg.tx.get("error_profile", None), - "n_frames_per_packet": cfg.tx.get("n_frames_per_packet", None), + "type": tx_cfg_tmp.get("type", None), + "error_pattern": tx_cfg_tmp.get("error_pattern", None), + "error_profile": tx_cfg_tmp.get("error_profile", None), + "n_frames_per_packet": tx_cfg_tmp.get("n_frames_per_packet", None), } else: raise ValueError( -- GitLab