Commit 31c1c37b authored by Anika Treffehn's avatar Anika Treffehn
Browse files

started jbm splitting support

parent 2526b201
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ class EVS(Processing):
        logger: Optional[logging.Logger] = None,
    ) -> Tuple[Union[Path, str], bool]:
        if self.tx is not None:
            # TODO: (treffehn) change this part -> delay error profile to FER profile and apply
            if self.tx["type"] == "JBM":
                bs, ext = os.path.splitext(bitstream)
                bitstream_processed = Path(f"{bs}_processed{ext}")
+1 −1
Original line number Diff line number Diff line
@@ -292,7 +292,7 @@ class IVAS(Processing):

        # add -voip cmdline option to the decoder
        if voip:
            cmd.extend(["-voip"])
            cmd.extend(["-voip", "-Tracefile", f"{str(out_file).split('.')[0]}.tracefile.csv"])
        if self.dec_opts:
            cmd.extend(self.dec_opts)

+38 −1
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ def concat_setup(cfg: TestConfig, chain, logger: logging.Logger):
    logger.info(f"Splits written to file {splits_info_file}")


def concat_teardown(x, splits, out_fmt, fs, in_fs, meta, logger: logging.Logger):
def concat_teardown(x, splits, out_fmt, fs, in_fs, meta, tracefile, logger: logging.Logger):
    if not splits:
        raise ValueError("Splitting not possible without split marker")

@@ -188,6 +188,42 @@ def concat_teardown(x, splits, out_fmt, fs, in_fs, meta, logger: logging.Logger)
    for split_i in splits:
        new_splits.append(int(float(split_i) * relative_fs_change))
    splits = new_splits
    # TODO: add jbmtrim compensation
#     rtpTsRelErr = (entry.rtpTs / rtpTimeScale - nextCutTime) / ((entry.rtpTs - lastRtpTs) / rtpTimeScale);
#     double
#     playTimeAbsErr = rtpTsRelErr * (entry.playTime - lastPlayTime) / playTimeScale;
#     if (currBeginPlayTime < 0) {
#     // found begin of item
#     currBeginPlayTime = entry.playTime / playTimeScale - playTimeAbsErr;
#     // now look for end of item
#     nextCutTime += itemLength;
#     }
#     else {
#     // found complete item
#     double currEndPlayTime = entry.playTime / playTimeScale - playTimeAbsErr;
#     mappedStart = currBeginPlayTime;
#     mappedLength = currEndPlayTime - currBeginPlayTime;
#     return true;
#     }
#     }
#     lastRtpTs = entry.rtpTs;
#     lastPlayTime = entry.playTime;
#     }
#     // check if item
#     begin
#     was
#     found
#     if (currBeginPlayTime < 0)
#     {
#         cerr << "Invalid item start position specified: " << itemStart << endl;
#
#
# return false;
# }
# // return item
# with missing end
# mappedStart = currBeginPlayTime;
# mappedLength = lastPlayTime / playTimeScale - currBeginPlayTime;

    # check if last split ending coincides with last sample of signal
    if splits[-1] > len(x):
@@ -214,6 +250,7 @@ def concat_teardown(x, splits, out_fmt, fs, in_fs, meta, logger: logging.Logger)

        # split ISM metadata
        if out_fmt.startswith("ISM"):
            # TODO: (treffehn) add error message if output is ism or masa and jbm was used
            split_meta_object = []
            for obj_meta in meta:
                # compute number of frames per split
+8 −1
Original line number Diff line number Diff line
@@ -210,10 +210,17 @@ class Processing_splitting_scaling(Processing):
                )
            )
            splits, split_names, split_fs = read_splits_file(splits_info_file)
            # TODO: (treffehn) if jbm and ivas instead of noerror
            if not noerror:
                # read out tracefile with jbm info
                tracefile_info_file = Path(f"{in_file.with_suffix('').with_suffix('')}.tracefile.csv")
                tracefile_info = np.genfromtxt(tracefile_info_file, delimiter=";")
            else:
                tracefile_info = None

            # split file
            file_splits, meta_splits = concat_teardown(
                x, splits, self.out_fmt, fs, split_fs, in_meta, logger
                x, splits, self.out_fmt, fs, split_fs, in_meta, tracefile_info, logger
            )

            # set new out_files