From 172401200ad7c6c5c46a80d39b83059ba972a7a5 Mon Sep 17 00:00:00 2001 From: Archit Tamarapu Date: Mon, 1 Sep 2025 15:11:17 +0200 Subject: [PATCH] [fix] missing resampling before codec conditions if different fs was specified --- ivas_processing_scripts/processing/chains.py | 25 +++++++++++++++----- ivas_processing_scripts/processing/ivas.py | 2 +- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ivas_processing_scripts/processing/chains.py b/ivas_processing_scripts/processing/chains.py index 9c52bdc8..1a48834d 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 c2e728e6..01f8220f 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 ) -- GitLab