Loading examples/TEMPLATE.yml +13 −9 Original line number Diff line number Diff line Loading @@ -94,15 +94,19 @@ input: ################################################# ### Bistream processing (transport simulation) done after encoding and before decoding ### e.g. frame error insertion or transport simulation for JBM testing # tx_jbm: ### REQUIRED: Path to network simulation binary # bs_proc_bin: ".../ivas_python_testscripts/networkSimulator_g192.exe" ### Path to delay error profile (mandatory if no information for generating the error pattern is given) # delay_error_profile: ".../dly_error_profile.dat" ### options for the binary, possible placeholders are {delay_error_profile} for the error pattern, ### {bitstream} for the bitstream to process and {bitstream_processed} for the processed bitstream # bs_proc_opts: [ "{delay_error_profile}", "{bitstream}", "{processed_bitstream}", "{processed_bitstream}_tracefile_sim", "2", "0" ] # tx_fer: # tx: ### REQUIRED: Type of bitsream processing; possible types: "jbm" or "fer" #type: "jbm" ### JBM ### Path to delay error pattern (mandatory if no information for generating the error pattern is given) # error_pattern: ".../dly_error_profile.dat" ## # error_profile: ## ; defalt = 1 # n_frames_per_paket: 2 ### FER ### REQUIRED: either error_pattern or error_rate ### Frame error pattern file # error_pattern: "path/pattern.192" Loading ivas_processing_scripts/audiotools/wrappers/eid_xor.py +3 −6 Original line number Diff line number Diff line Loading @@ -91,7 +91,6 @@ def create_and_apply_error_pattern( error_pattern: Optional[Union[Path, str]] = None, error_rate: Optional[float] = None, preamble: Optional[int] = 0, fs: Optional[int] = 48000, ) -> None: """ Function to create (or use existing) frame error pattern for bitstream processing Loading @@ -103,15 +102,13 @@ def create_and_apply_error_pattern( out_bitstream: Union[Path, str] Path of output bitstream len_sig: int Length of signal in samples Length of signal in frames error_pattern: Optional[Union[Path, str]] Path to existing error pattern error_rate: float Error rate in percent preamble: Optional[int] Length of preamble fs: Optional[int] Sampling rate Length of preamble in frames """ if error_pattern is None: Loading @@ -120,7 +117,7 @@ def create_and_apply_error_pattern( error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix( ".192" ) create_error_pattern(len_sig, error_pattern, error_rate, preamble, fs) create_error_pattern(len_sig, error_pattern, error_rate, preamble) else: raise ValueError( "Either error pattern or error rate has to be specified for bitstream processing" Loading ivas_processing_scripts/audiotools/wrappers/gen_patt.py +6 −23 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ def gen_patt( path_pattern: Union[Path, str], error_rate: float, start: Optional[int] = 0, fs: Optional[int] = 48000, working_dir: Optional[Union[Path, str]] = None, ) -> None: """ Loading @@ -58,29 +57,17 @@ def gen_patt( Parameters ---------- len_sig: int Length of signal in samples Length of signal in frames path_pattern: Union[Path, str] Path of output pattern error_rate: float Error rate in percent start: Optional[int] Start sample of error pattern (length preamble) fs: Optional[int] Sampling rate Start frame of error pattern (length preamble) working_dir: Optional[Union[Path, str]] Directory where binary should be called (sta file has to be in this dir if desired) """ # check if multiple of frame length if len_sig % int(IVAS_FRAME_LEN_MS * fs // 1000): raise ValueError( "Signal length has to be integer multiple of frame length for bitstream processing" ) if start % int(IVAS_FRAME_LEN_MS * fs // 1000): raise ValueError( "Preamble length has to be integer multiple of frame length for bitstream processing" ) # find binary binary = find_binary("gen-patt") Loading @@ -101,9 +88,9 @@ def gen_patt( str(0.001), "-reset", # Reset EID state in between iteractions "-n", str(int(len_sig / int(IVAS_FRAME_LEN_MS * fs // 1000))), str(int(len_sig)), "-start", str(int(start / int(IVAS_FRAME_LEN_MS * fs // 1000)) + 1), str(int(start) + 1), path_pattern, ] Loading @@ -118,7 +105,6 @@ def create_error_pattern( path_pattern: Union[Path, str], frame_error_rate: float, preamble: Optional[int] = 0, fs: Optional[int] = 48000, ) -> None: """ Creates error pattern with desired frame error rate for bitstream processing Loading @@ -127,15 +113,13 @@ def create_error_pattern( Parameters ---------- len_sig: int Length of signal in samples Length of signal in frames path_pattern: Union[Path, str] Path of output pattern frame_error_rate: float Error rate in percent preamble: Optional[int] Length of preamble fs: Optional[int] Sampling rate Length of preamble in frames """ with TemporaryDirectory() as tmp_dir: Loading @@ -156,7 +140,6 @@ def create_error_pattern( error_rate=frame_error_rate, path_pattern=path_pattern, start=preamble, fs=fs, working_dir=tmp_dir, ) Loading ivas_processing_scripts/audiotools/wrappers/networkSimulator.py +11 −11 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ def validate_network_simulator( error_profile: Optional[int] = None, n_frames_per_paket: Optional[int] = None, ) -> None: """Validate settings for the network simulator """ Validate settings for the network simulator Parameters ---------- Loading @@ -55,8 +56,9 @@ def validate_network_simulator( error_profile: Optional[int] Index of existing error pattern n_frames_per_paket: Optional[int] number of frames per paket Number of frames per paket """ if find_binary("networkSimulator_g192") is None: raise FileNotFoundError( "The network simulator binary was not found! Please check the configuration." Loading Loading @@ -90,7 +92,7 @@ def network_simulator( n_frames_per_paket: int, ) -> None: """ Wrapper for eid-xor binary to apply error patterns for the bitstream processing Wrapper for networkSimulator_g192 binary to apply error patterns for the bitstream processing Parameters ---------- Loading @@ -101,7 +103,7 @@ def network_simulator( out_bitstream: Union[str, Path] Output path for modified bitstream n_frames_per_paket: int, number of frames per paket [1,2] Number of frames per paket [1,2] """ # find binary Loading Loading @@ -155,9 +157,7 @@ def apply_network_simulator( error_profile: Optional[int] Index of existing error pattern n_frames_per_paket: Optional[int] number of frames per paket fs: Optional[int] Sampling rate Number of frames per paket """ if error_pattern is None: Loading ivas_processing_scripts/processing/chains.py +20 −27 Original line number Diff line number Diff line Loading @@ -212,32 +212,26 @@ def get_processing_chain( dec_cfg = cond_cfg["dec"] # Frame error pattern bitstream modification if "tx_fer" in cond_cfg.keys(): tx_fer_cfg = cond_cfg["tx_fer"] elif hasattr(cfg, "tx_fer"): tx_fer_cfg = { "error_pattern": cfg.tx_fer.get("error_pattern", None), "error_rate": cfg.tx_fer.get("error_rate", None), if "tx" in cond_cfg.keys(): tx_cfg = cond_cfg["tx"] elif hasattr(cfg, "tx"): if cfg.tx.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), } else: tx_fer_cfg = None # JBM delay error profile bitstream modification if "tx_jmb" in cond_cfg.keys(): tx_jbm_cfg = cond_cfg["tx_jbm"] elif hasattr(cfg, "tx_jbm"): tx_jbm_cfg = { "error_pattern": cfg.tx_jbm.get("error_pattern", None), "error_profile": cfg.tx_jbm.get("error_profile", None), "n_frames_per_paket": cfg.tx_jbm.get("n_frames_per_paket", 1), elif cfg.tx.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_paket": cfg.tx.get("n_frames_per_paket", 1), } else: tx_jbm_cfg = None if tx_fer_cfg is not None and tx_jbm_cfg is not None: raise ValueError( "Application of error pattern and delay error profile simultaneously is not possible" ) raise ValueError("Type of bitstream procesing either missing or not valid") else: tx_cfg = None chain["processes"].append( IVAS( Loading @@ -252,8 +246,7 @@ def get_processing_chain( "dec_bin": dec_cfg.get("bin"), "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx_jbm": tx_jbm_cfg, "tx_fer": tx_fer_cfg, "tx": tx_cfg, } ) ) Loading Loading
examples/TEMPLATE.yml +13 −9 Original line number Diff line number Diff line Loading @@ -94,15 +94,19 @@ input: ################################################# ### Bistream processing (transport simulation) done after encoding and before decoding ### e.g. frame error insertion or transport simulation for JBM testing # tx_jbm: ### REQUIRED: Path to network simulation binary # bs_proc_bin: ".../ivas_python_testscripts/networkSimulator_g192.exe" ### Path to delay error profile (mandatory if no information for generating the error pattern is given) # delay_error_profile: ".../dly_error_profile.dat" ### options for the binary, possible placeholders are {delay_error_profile} for the error pattern, ### {bitstream} for the bitstream to process and {bitstream_processed} for the processed bitstream # bs_proc_opts: [ "{delay_error_profile}", "{bitstream}", "{processed_bitstream}", "{processed_bitstream}_tracefile_sim", "2", "0" ] # tx_fer: # tx: ### REQUIRED: Type of bitsream processing; possible types: "jbm" or "fer" #type: "jbm" ### JBM ### Path to delay error pattern (mandatory if no information for generating the error pattern is given) # error_pattern: ".../dly_error_profile.dat" ## # error_profile: ## ; defalt = 1 # n_frames_per_paket: 2 ### FER ### REQUIRED: either error_pattern or error_rate ### Frame error pattern file # error_pattern: "path/pattern.192" Loading
ivas_processing_scripts/audiotools/wrappers/eid_xor.py +3 −6 Original line number Diff line number Diff line Loading @@ -91,7 +91,6 @@ def create_and_apply_error_pattern( error_pattern: Optional[Union[Path, str]] = None, error_rate: Optional[float] = None, preamble: Optional[int] = 0, fs: Optional[int] = 48000, ) -> None: """ Function to create (or use existing) frame error pattern for bitstream processing Loading @@ -103,15 +102,13 @@ def create_and_apply_error_pattern( out_bitstream: Union[Path, str] Path of output bitstream len_sig: int Length of signal in samples Length of signal in frames error_pattern: Optional[Union[Path, str]] Path to existing error pattern error_rate: float Error rate in percent preamble: Optional[int] Length of preamble fs: Optional[int] Sampling rate Length of preamble in frames """ if error_pattern is None: Loading @@ -120,7 +117,7 @@ def create_and_apply_error_pattern( error_pattern = in_bitstream.parent.joinpath("error_pattern").with_suffix( ".192" ) create_error_pattern(len_sig, error_pattern, error_rate, preamble, fs) create_error_pattern(len_sig, error_pattern, error_rate, preamble) else: raise ValueError( "Either error pattern or error rate has to be specified for bitstream processing" Loading
ivas_processing_scripts/audiotools/wrappers/gen_patt.py +6 −23 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ def gen_patt( path_pattern: Union[Path, str], error_rate: float, start: Optional[int] = 0, fs: Optional[int] = 48000, working_dir: Optional[Union[Path, str]] = None, ) -> None: """ Loading @@ -58,29 +57,17 @@ def gen_patt( Parameters ---------- len_sig: int Length of signal in samples Length of signal in frames path_pattern: Union[Path, str] Path of output pattern error_rate: float Error rate in percent start: Optional[int] Start sample of error pattern (length preamble) fs: Optional[int] Sampling rate Start frame of error pattern (length preamble) working_dir: Optional[Union[Path, str]] Directory where binary should be called (sta file has to be in this dir if desired) """ # check if multiple of frame length if len_sig % int(IVAS_FRAME_LEN_MS * fs // 1000): raise ValueError( "Signal length has to be integer multiple of frame length for bitstream processing" ) if start % int(IVAS_FRAME_LEN_MS * fs // 1000): raise ValueError( "Preamble length has to be integer multiple of frame length for bitstream processing" ) # find binary binary = find_binary("gen-patt") Loading @@ -101,9 +88,9 @@ def gen_patt( str(0.001), "-reset", # Reset EID state in between iteractions "-n", str(int(len_sig / int(IVAS_FRAME_LEN_MS * fs // 1000))), str(int(len_sig)), "-start", str(int(start / int(IVAS_FRAME_LEN_MS * fs // 1000)) + 1), str(int(start) + 1), path_pattern, ] Loading @@ -118,7 +105,6 @@ def create_error_pattern( path_pattern: Union[Path, str], frame_error_rate: float, preamble: Optional[int] = 0, fs: Optional[int] = 48000, ) -> None: """ Creates error pattern with desired frame error rate for bitstream processing Loading @@ -127,15 +113,13 @@ def create_error_pattern( Parameters ---------- len_sig: int Length of signal in samples Length of signal in frames path_pattern: Union[Path, str] Path of output pattern frame_error_rate: float Error rate in percent preamble: Optional[int] Length of preamble fs: Optional[int] Sampling rate Length of preamble in frames """ with TemporaryDirectory() as tmp_dir: Loading @@ -156,7 +140,6 @@ def create_error_pattern( error_rate=frame_error_rate, path_pattern=path_pattern, start=preamble, fs=fs, working_dir=tmp_dir, ) Loading
ivas_processing_scripts/audiotools/wrappers/networkSimulator.py +11 −11 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ def validate_network_simulator( error_profile: Optional[int] = None, n_frames_per_paket: Optional[int] = None, ) -> None: """Validate settings for the network simulator """ Validate settings for the network simulator Parameters ---------- Loading @@ -55,8 +56,9 @@ def validate_network_simulator( error_profile: Optional[int] Index of existing error pattern n_frames_per_paket: Optional[int] number of frames per paket Number of frames per paket """ if find_binary("networkSimulator_g192") is None: raise FileNotFoundError( "The network simulator binary was not found! Please check the configuration." Loading Loading @@ -90,7 +92,7 @@ def network_simulator( n_frames_per_paket: int, ) -> None: """ Wrapper for eid-xor binary to apply error patterns for the bitstream processing Wrapper for networkSimulator_g192 binary to apply error patterns for the bitstream processing Parameters ---------- Loading @@ -101,7 +103,7 @@ def network_simulator( out_bitstream: Union[str, Path] Output path for modified bitstream n_frames_per_paket: int, number of frames per paket [1,2] Number of frames per paket [1,2] """ # find binary Loading Loading @@ -155,9 +157,7 @@ def apply_network_simulator( error_profile: Optional[int] Index of existing error pattern n_frames_per_paket: Optional[int] number of frames per paket fs: Optional[int] Sampling rate Number of frames per paket """ if error_pattern is None: Loading
ivas_processing_scripts/processing/chains.py +20 −27 Original line number Diff line number Diff line Loading @@ -212,32 +212,26 @@ def get_processing_chain( dec_cfg = cond_cfg["dec"] # Frame error pattern bitstream modification if "tx_fer" in cond_cfg.keys(): tx_fer_cfg = cond_cfg["tx_fer"] elif hasattr(cfg, "tx_fer"): tx_fer_cfg = { "error_pattern": cfg.tx_fer.get("error_pattern", None), "error_rate": cfg.tx_fer.get("error_rate", None), if "tx" in cond_cfg.keys(): tx_cfg = cond_cfg["tx"] elif hasattr(cfg, "tx"): if cfg.tx.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), } else: tx_fer_cfg = None # JBM delay error profile bitstream modification if "tx_jmb" in cond_cfg.keys(): tx_jbm_cfg = cond_cfg["tx_jbm"] elif hasattr(cfg, "tx_jbm"): tx_jbm_cfg = { "error_pattern": cfg.tx_jbm.get("error_pattern", None), "error_profile": cfg.tx_jbm.get("error_profile", None), "n_frames_per_paket": cfg.tx_jbm.get("n_frames_per_paket", 1), elif cfg.tx.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_paket": cfg.tx.get("n_frames_per_paket", 1), } else: tx_jbm_cfg = None if tx_fer_cfg is not None and tx_jbm_cfg is not None: raise ValueError( "Application of error pattern and delay error profile simultaneously is not possible" ) raise ValueError("Type of bitstream procesing either missing or not valid") else: tx_cfg = None chain["processes"].append( IVAS( Loading @@ -252,8 +246,7 @@ def get_processing_chain( "dec_bin": dec_cfg.get("bin"), "dec_opts": dec_cfg.get("opts"), "multiprocessing": cfg.multiprocessing, "tx_jbm": tx_jbm_cfg, "tx_fer": tx_fer_cfg, "tx": tx_cfg, } ) ) Loading