Commit 8223fb7c authored by Anika Treffehn's avatar Anika Treffehn
Browse files

fixed evs jbm processing

parent 54a89b56
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ input:
    # errpatt_delay: 200
    ### Seed for error pattern shift in EVS JBM
    # errpatt_seed: 0
    ### Index of one of the existing delay error profile files to use (1-11)
    ### Index of one of the existing delay error profile files to use (1-10)
    # error_profile: 5
    ## nFramesPerPacket parameter for the network simulator; default = 1
    # n_frames_per_packet: 2
+1 −3
Original line number Diff line number Diff line
@@ -167,7 +167,6 @@ def evs_jbm(bitstream, bitstream_processed, error_profile, error_pattern, errpat
            num_frames_packet = 1
            length = 8000
        else:
            # TODO: (treffehn) what to do?
            raise ValueError("JBM error profile number not an integer between 1 and 10")
        shift = 0  # TODO: (treffehn) compute offset with random and master seed (also for ivas jbm)
        if error_profile in LIST_JBM_PROFILES:
@@ -193,8 +192,7 @@ def evs_jbm(bitstream, bitstream_processed, error_profile, error_pattern, errpat
    )

    # apply FER pattern with eid-xor
    # TODO (treffehn)
    # eid_xor()
    eid_xor(fer_pattern, bitstream, bitstream_processed)


def validate_evs_jbm(
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ from typing import Optional, Union
from ivas_processing_scripts.constants import DEFAULT_CONFIG_BINARIES
from ivas_processing_scripts.utils import find_binary, run

LIST_JBM_PROFILES = range(12)
LIST_JBM_PROFILES = range(11)
ERROR_PATTERNS_DIR = Path(__file__).parent.parent.parent.joinpath("dly_error_profiles")


+5 −16
Original line number Diff line number Diff line
@@ -228,14 +228,12 @@ class EVS(Processing):
            None,
            show_progress=False,
        )
        voip = [scb[1] for scb in split_chan_bs]
        split_chan_bs = [scb[0] for scb in split_chan_bs]

        # run all decoders twice with and without bitstream errors
        logger.debug(f"Running EVS decoders for {out_file.stem.split('.')[0]}")
        apply_func_parallel(
            self.dec,
            zip(split_chan_bs, split_chan_out, voip, repeat(logger)),
            zip(split_chan_bs, split_chan_out, repeat(logger)),
            None,
            "mt" if self.multiprocessing else None,
            show_progress=False,
@@ -246,7 +244,6 @@ class EVS(Processing):
                zip(
                    split_chan_bs_unprocessed,
                    split_chan_out_noerror,
                    repeat(False),
                    repeat(logger),
                ),
                None,
@@ -376,7 +373,7 @@ class EVS(Processing):
        in_file: Union[Path, str],
        bitstream: Path,
        logger: Optional[logging.Logger] = None,
    ) -> Tuple[Union[Path, str], bool]:
    ) -> Union[Path, str]:
        if self.tx is not None:
            if self.tx["type"] == "JBM":
                bs, ext = os.path.splitext(bitstream)
@@ -392,8 +389,7 @@ class EVS(Processing):
                    self.tx["errpatt_seed"],
                    self.tx["n_frames_per_packet"],
                )
                voip = True
                return bitstream_processed, voip
                return bitstream_processed

            elif self.tx["type"] == "FER":
                bs, ext = os.path.splitext(bitstream)
@@ -417,27 +413,20 @@ class EVS(Processing):
                    master_seed=self.tx["master_seed"],
                    prerun_seed=self.tx["prerun_seed"],
                )
                voip = False
                return bitstream_processed, voip
                return bitstream_processed
        else:
            voip = False
            return bitstream, voip
            return bitstream

    def dec(
        self,
        bitstream: Path,
        out_pcm_file: Path,
        voip: bool = False,
        logger: Optional[logging.Logger] = None,
    ) -> None:
        cmd = [self.dec_bin]
        if self._use_wine:
            cmd.insert(0, "wine")

        # add -voip cmdline option to the decoder
        if voip:
            cmd.extend(["-voip"])

        if self.dec_opts:
            cmd.extend(self.dec_opts)