diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 9c52bdc8af1c93af291c71cf0871fa31cea3f857..1a48834d6c1c421767457f3f6c5407152532341c 100755 --- a/ivas_processing_scripts/processing/chains.py +++ b/ivas_processing_scripts/processing/chains.py @@ -243,6 +243,11 @@ def get_prerend( attrs.setdefault("bin", get_abs_path(rend_cfg.get("bin"))) attrs.setdefault("opts", rend_cfg.get("opts")) attrs.setdefault("use_windows_codec_binaries", use_windows_codec_binaries) + if attrs.get("in_fs") != attrs.get("out_fs"): + raise NotImplementedError( + f"IVAS rend does not support resampling. Prerendering specified with resampling from {attrs.get('in_fs')} to {attrs.get('out_fs')}." + f"\nPlease update your configuration or disable IVAS rend prerendering." + ) return IVAS_rend( attrs, ) @@ -366,8 +371,11 @@ def get_processing_chain( if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) - # if the encoding format differs from the format after the preprocessing, add format conversion stuff - if (cod_fmt := cod_cfg.get("fmt", tmp_in_fmt)) != tmp_in_fmt: + # if the encoding format or fs differs from the values after preprocessing, add format conversion + cod_fmt = cod_cfg.get("fmt", tmp_in_fmt) + cod_fs = cod_cfg.get("fs", tmp_in_fs) + needs_preproc = (tmp_in_fmt != cod_fmt) or (tmp_in_fs != cod_fs) + if needs_preproc: chain["processes"].append( get_prerend( cod_cfg.get("ivas_prerend"), @@ -376,7 +384,7 @@ def get_processing_chain( attrs={ "in_fs": tmp_in_fs, "in_fmt": tmp_in_fmt, - "out_fs": tmp_in_fs, + "out_fs": cod_fs, "out_fmt": cod_fmt, "multiprocessing": cfg.multiprocessing, "tx_condition": False, @@ -384,6 +392,7 @@ def get_processing_chain( ) ) tmp_in_fmt = cod_fmt + tmp_in_fs = cod_fs chain["processes"].append( EVS( @@ -445,8 +454,11 @@ def get_processing_chain( if hasattr(cfg, "preprocessing_2"): preamble = cfg.preprocessing_2.get("preamble", 0) - # if the encoding format differs from the format after the preprocessing, add format conversion - if (cod_fmt := cod_cfg.get("fmt", tmp_in_fmt)) != tmp_in_fmt: + # if the encoding format or fs differs from the values after preprocessing, add format conversion + cod_fmt = cod_cfg.get("fmt", tmp_in_fmt) + cod_fs = cod_cfg.get("fs", tmp_in_fs) + needs_preproc = (tmp_in_fmt != cod_fmt) or (tmp_in_fs != cod_fs) + if needs_preproc: chain["processes"].append( get_prerend( cod_cfg.get("ivas_prerend"), @@ -455,7 +467,7 @@ def get_processing_chain( attrs={ "in_fs": tmp_in_fs, "in_fmt": tmp_in_fmt, - "out_fs": tmp_in_fs, + "out_fs": cod_fs, "out_fmt": cod_fmt, "multiprocessing": cfg.multiprocessing, "tx_condition": False, @@ -463,6 +475,7 @@ def get_processing_chain( ) ) tmp_in_fmt = cod_fmt + tmp_in_fs = cod_fs # allow list of output values for IVAS tmp_out_fmt = dec_cfg.get("fmt", tmp_out_fmt) diff --git a/ivas_processing_scripts/processing/ivas.py b/ivas_processing_scripts/processing/ivas.py index c2e728e6e2379c05d7b0e29827578602adf9375e..01f8220f2b721c35c2cd3071397633b9e95cad9e 100755 --- a/ivas_processing_scripts/processing/ivas.py +++ b/ivas_processing_scripts/processing/ivas.py @@ -485,7 +485,7 @@ class IVAS_rend(Processing): self.in_fmt = audio.fromtype(self.in_fmt) self.out_fmt = audio.fromtype(self.out_fmt) if not hasattr(self, "opts"): - self.dec_opts = None + self.opts = None self._use_wine = ( platform.system() == "Linux" and self.use_windows_codec_binaries )