Commit 5775172d authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

split off mono upmix into separate key in ivas_modes.json + format IvasModeRunner.py

parent bcf810c8
Loading
Loading
Loading
Loading
Loading
+61 −10
Original line number Diff line number Diff line
@@ -8,7 +8,66 @@
                "{bandwidth}"
            ],
            "dec": {
                "MONO": [],
                "MONO": []
            },
            "in_config": "MONO",
            "table_name": "Mono@{table_bitrate} kbps {bandwidth}",
            "nummetadata": 0,
            "metadatafilenames": [],
            "rs": false,
            "amr": false,
            "mono": true,
            "bitrates": {
                "nb": [
                    7200,
                    8000,
                    9600,
                    13200,
                    16400,
                    24400
                ],
                "wb": [
                    7200,
                    8000,
                    9600,
                    13200,
                    16400,
                    24400,
                    32000,
                    48000,
                    64000,
                    96000,
                    128000
                ],
                "swb": [
                    9600,
                    13200,
                    16400,
                    24400,
                    32000,
                    48000,
                    64000,
                    96000,
                    128000
                ],
                "fb": [
                    16400,
                    24400,
                    32000,
                    48000,
                    64000,
                    96000,
                    128000
                ]
            }
        },
        "mono_upmix_b{bitrate}_{bandwidth}_cbr": {
            "encmodeoption": [],
            "encoptions": [
                "-max_band",
                "{bandwidth}"
            ],
            "dec": {
                "STEREO": [],
                "5_1": [],
                "5_1_2": [],
@@ -24,21 +83,13 @@
                "HOA3": []
            },
            "in_config": "MONO",
            "table_name": "Mono@{table_bitrate} kbps {bandwidth}",
            "table_name": "Mono Upmix@{table_bitrate} kbps {bandwidth}",
            "nummetadata": 0,
            "metadatafilenames": [],
            "rs": false,
            "amr": false,
            "mono": true,
            "bitrates": {
                "nb": [
                    7200,
                    8000,
                    9600,
                    13200,
                    16400,
                    24400
                ],
                "wb": [
                    7200,
                    8000,
+42 −19
Original line number Diff line number Diff line
@@ -245,7 +245,10 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
        with self.lock:
            if self.stats:
                if not self.run_encoder:
                    if config["config"]["num_dec_remaining"] == config["config"]["num_dec"]:
                    if (
                        config["config"]["num_dec_remaining"]
                        == config["config"]["num_dec"]
                    ):
                        self.stats["num_modes_running"] += 1
                self.stats["num_decs_running"] += 1
                config["config"]["num_dec_remaining"] -= 1
@@ -297,16 +300,27 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                    self.logger.error("Exception in ivas_dec_thread(): " + str(e))
                    return

                if config["mono"]:
                if config["mono"] and output_config.lower() != "mono":
                    dec_options.extend(["-evs"])

                # additional output configs for mono only supported for WB and above
                if not config["mono"] or (
                    config["mono"] and config["config"]["cmd"]["bw"] != "nb"
                ):
                    dec_options.extend([output_config])
                dec_options = [
                    x.format(dec_file_name=dec_file_name) if "{dec_file_name}" in x else x
                    (
                        x.format(dec_file_name=dec_file_name)
                        if "{dec_file_name}" in x
                        else x
                    )
                    for x in dec_options
                    if x != []
                ]
                enc_file_name = config["enc_file_name"]
                self.logger.info("Decoding {} to {}".format(enc_file_name, dec_file_name))
                self.logger.info(
                    "Decoding {} to {}".format(enc_file_name, dec_file_name)
                )
                if self.test_tool != "":
                    dec_cmd = (
                        self.test_tool
@@ -454,7 +468,9 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
            if isinstance(in_file_name, list):
                metadata_file_names = in_file_name[1:]
                in_file_name = in_file_name[0]
            self.logger.info("Encoding Mode {} input file {}".format(mode, in_file_name))
            self.logger.info(
                "Encoding Mode {} input file {}".format(mode, in_file_name)
            )

        with self.lock:
            if self.stats:
@@ -539,12 +555,8 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                        )
                    )

                    pcm_log_name_tmp = "".join(
                        [pcm_base_name, constants.LOG_FILE_EXT]
                    )
                    pcm_log_name = os.path.join(
                        self.dir_name, "logs", pcm_log_name_tmp
                    )
                    pcm_log_name_tmp = "".join([pcm_base_name, constants.LOG_FILE_EXT])
                    pcm_log_name = os.path.join(self.dir_name, "logs", pcm_log_name_tmp)

                    with open(pcm_log_name, "w") as pcm_log:
                        pcm_name_res_tmp = pcm_name + ".res.wav"
@@ -768,7 +780,9 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):

                if error == 0 and "bitstream_processing" in enc_dec_cmd:
                    bs_in_file = enc_file_name
                    proc_chain = deepcopy(enc_dec_cmd["bitstream_processing"]["proc_chain"])
                    proc_chain = deepcopy(
                        enc_dec_cmd["bitstream_processing"]["proc_chain"]
                    )
                    for processing in proc_chain:
                        suffix = processing.pop()
                        bs_out_file = ".".join(
@@ -824,7 +838,9 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                        os.remove(pcm_name)

                self.logger.console(
                    "Exception when encoding item {}: {}".format(enc_file_name, str(exc)),
                    "Exception when encoding item {}: {}".format(
                        enc_file_name, str(exc)
                    ),
                    logging.ERROR,
                )
                self.logger.console(
@@ -842,7 +858,10 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                    if not self.run_decoder:
                        self.stats["num_modes_running"] -= 1
                        self.stats["num_modes_finished"] -= 1
                if self.enc_queue["num_modes_enc"] == self.enc_queue["num_modes_enc_done"]:
                if (
                    self.enc_queue["num_modes_enc"]
                    == self.enc_queue["num_modes_enc_done"]
                ):
                    self.dec_queue["all_encoded"] = True
                self.stats["num_encs_finished"] += 1
                self.stats["num_encs_running"] -= 1
@@ -1207,7 +1226,9 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                    ]

                    enc_log.write(" ".join(proc_cmd))
                    proc_result = subprocess.run(proc_cmd, capture_output=True, text=True)
                    proc_result = subprocess.run(
                        proc_cmd, capture_output=True, text=True
                    )
                    enc_log.write(proc_result.stderr)
                    enc_log.write(proc_result.stdout)
                    error = proc_result.returncode
@@ -1225,7 +1246,9 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector):
                    bs_in_file = bs_out_file
            except Exception as exc:
                self.logger.error(
                    "Exception processing bitstream {}: {}".format(enc_file_name, str(exc))
                    "Exception processing bitstream {}: {}".format(
                        enc_file_name, str(exc)
                    )
                )
                self.logger.error("failed command: {}".format(" ".join(proc_cmd)))
                self.logger.error(