Loading ivas_processing_scripts/audiotools/wrappers/masaRenderer.py +4 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ from ivas_processing_scripts.audiotools import audio from ivas_processing_scripts.audiotools.audiofile import read, write from ivas_processing_scripts.audiotools.wrappers.filter import resample_itu from ivas_processing_scripts.constants import DEFAULT_CONFIG_BINARIES from ivas_processing_scripts.utils import find_binary, run from ivas_processing_scripts.utils import find_binary, get_binary_path, run def ivasRendMasa( Loading @@ -51,7 +51,7 @@ def ivasRendMasa( logger: Optional[logging.Logger] = None, ) -> np.ndarray: """ Wrapper for IVAS_Rend MASA Rendering Wrapper for IVAS_rend MASA Rendering Parameters ---------- Loading @@ -78,6 +78,8 @@ def ivasRendMasa( else: binary = find_binary("IVAS_rend") binary = get_binary_path(binary, False) rend = IVAS_rend( { "bin": binary, Loading ivas_processing_scripts/processing/evs.py +8 −23 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import logging import os.path import platform from itertools import repeat from pathlib import Path from shutil import copyfile Loading @@ -55,7 +54,12 @@ from ivas_processing_scripts.audiotools.wrappers.eid_xor import ( validate_error_pattern_application, ) from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import apply_func_parallel, run, use_wine from ivas_processing_scripts.utils import ( apply_func_parallel, get_binary_path, run, use_wine, ) class EVS(Processing): Loading @@ -69,27 +73,8 @@ class EVS(Processing): def _validate( self, ): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The EVS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The EVS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # configure per-channel bitrate if specified, otherwise simply repeat if not isinstance(self.bitrate, list): Loading ivas_processing_scripts/processing/ivas.py +4 −34 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.audiotools.wrappers.random_seed import random_seed from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import run, use_wine from ivas_processing_scripts.utils import get_binary_path, run, use_wine class IVAS(Processing): Loading @@ -68,27 +68,8 @@ class IVAS(Processing): self._validate() def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # existence of error pattern files (if given) already here if self.tx is not None: Loading Loading @@ -497,18 +478,7 @@ class IVAS_rend(Processing): ) def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not Path(self.bin).exists(): if need_exe_suffix and ( self.bin and Path(self.bin).with_suffix(".exe").exists() ): self.bin = Path(self.bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS renderer binary was not found! Please check the configuration." ) self.bin = get_binary_path(self.bin, self.use_windows_codec_binaries) def process( self, Loading ivas_processing_scripts/processing/ivas_combined.py +3 −23 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ # import logging import platform from pathlib import Path from warnings import warn Loading @@ -45,7 +44,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.processing.ivas import IVAS from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import use_wine from ivas_processing_scripts.utils import get_binary_path, use_wine class IVASCombined(Processing): Loading @@ -68,27 +67,8 @@ class IVASCombined(Processing): ) def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # existence of error pattern files (if given) already here if self.tx is not None: Loading ivas_processing_scripts/utils.py +16 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,22 @@ def use_wine(use_windows_codec_binaries: bool): return linux_system and not wsl and use_windows_codec_binaries def get_binary_path(binary: str, use_windows_codec_binaries: bool) -> Path: need_exe_suffix = platform.system() == "Windows" or use_windows_codec_binaries if need_exe_suffix and binary: binary = Path(binary).with_suffix(".exe") if not binary or not binary.exists(): raise FileNotFoundError( f"The binary {binary.name} was not found!" f"\nProvided path was '{binary}'." "\nPlease check the configuration." ) return binary def find_binary( binary: str, raise_error: Optional[bool] = True, Loading Loading
ivas_processing_scripts/audiotools/wrappers/masaRenderer.py +4 −2 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ from ivas_processing_scripts.audiotools import audio from ivas_processing_scripts.audiotools.audiofile import read, write from ivas_processing_scripts.audiotools.wrappers.filter import resample_itu from ivas_processing_scripts.constants import DEFAULT_CONFIG_BINARIES from ivas_processing_scripts.utils import find_binary, run from ivas_processing_scripts.utils import find_binary, get_binary_path, run def ivasRendMasa( Loading @@ -51,7 +51,7 @@ def ivasRendMasa( logger: Optional[logging.Logger] = None, ) -> np.ndarray: """ Wrapper for IVAS_Rend MASA Rendering Wrapper for IVAS_rend MASA Rendering Parameters ---------- Loading @@ -78,6 +78,8 @@ def ivasRendMasa( else: binary = find_binary("IVAS_rend") binary = get_binary_path(binary, False) rend = IVAS_rend( { "bin": binary, Loading
ivas_processing_scripts/processing/evs.py +8 −23 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import logging import os.path import platform from itertools import repeat from pathlib import Path from shutil import copyfile Loading @@ -55,7 +54,12 @@ from ivas_processing_scripts.audiotools.wrappers.eid_xor import ( validate_error_pattern_application, ) from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import apply_func_parallel, run, use_wine from ivas_processing_scripts.utils import ( apply_func_parallel, get_binary_path, run, use_wine, ) class EVS(Processing): Loading @@ -69,27 +73,8 @@ class EVS(Processing): def _validate( self, ): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The EVS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The EVS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # configure per-channel bitrate if specified, otherwise simply repeat if not isinstance(self.bitrate, list): Loading
ivas_processing_scripts/processing/ivas.py +4 −34 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.audiotools.wrappers.random_seed import random_seed from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import run, use_wine from ivas_processing_scripts.utils import get_binary_path, run, use_wine class IVAS(Processing): Loading @@ -68,27 +68,8 @@ class IVAS(Processing): self._validate() def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # existence of error pattern files (if given) already here if self.tx is not None: Loading Loading @@ -497,18 +478,7 @@ class IVAS_rend(Processing): ) def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not Path(self.bin).exists(): if need_exe_suffix and ( self.bin and Path(self.bin).with_suffix(".exe").exists() ): self.bin = Path(self.bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS renderer binary was not found! Please check the configuration." ) self.bin = get_binary_path(self.bin, self.use_windows_codec_binaries) def process( self, Loading
ivas_processing_scripts/processing/ivas_combined.py +3 −23 Original line number Diff line number Diff line Loading @@ -31,7 +31,6 @@ # import logging import platform from pathlib import Path from warnings import warn Loading @@ -45,7 +44,7 @@ from ivas_processing_scripts.audiotools.wrappers.networkSimulator import ( ) from ivas_processing_scripts.processing.ivas import IVAS from ivas_processing_scripts.processing.processing import Processing from ivas_processing_scripts.utils import use_wine from ivas_processing_scripts.utils import get_binary_path, use_wine class IVASCombined(Processing): Loading @@ -68,27 +67,8 @@ class IVASCombined(Processing): ) def _validate(self): need_exe_suffix = ( platform.system() == "Windows" or self.use_windows_codec_binaries ) if not self.cod_bin or not Path(self.cod_bin).exists(): if need_exe_suffix and ( self.cod_bin and Path(self.cod_bin).with_suffix(".exe").exists() ): self.cod_bin = Path(self.cod_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS encoder binary was not found! Please check the configuration." ) if not self.dec_bin or not Path(self.dec_bin).exists(): if need_exe_suffix and ( self.dec_bin and Path(self.dec_bin).with_suffix(".exe").exists() ): self.dec_bin = Path(self.dec_bin).with_suffix(".exe") else: raise FileNotFoundError( "The IVAS decoder binary was not found! Please check the configuration." ) self.cod_bin = get_binary_path(self.cod_bin, self.use_windows_codec_binaries) self.dec_bin = get_binary_path(self.dec_bin, self.use_windows_codec_binaries) # existence of error pattern files (if given) already here if self.tx is not None: Loading
ivas_processing_scripts/utils.py +16 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,22 @@ def use_wine(use_windows_codec_binaries: bool): return linux_system and not wsl and use_windows_codec_binaries def get_binary_path(binary: str, use_windows_codec_binaries: bool) -> Path: need_exe_suffix = platform.system() == "Windows" or use_windows_codec_binaries if need_exe_suffix and binary: binary = Path(binary).with_suffix(".exe") if not binary or not binary.exists(): raise FileNotFoundError( f"The binary {binary.name} was not found!" f"\nProvided path was '{binary}'." "\nPlease check the configuration." ) return binary def find_binary( binary: str, raise_error: Optional[bool] = True, Loading