Commit 3284f2ae authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'fix-resampling-before-codecs' into 'main'

[fix] missing resampling before codec conditions if different fs was specified

See merge request !219
parents 99a7de20 17240120
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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
        )