Commit 1d16f57e authored by Jan Kiene's avatar Jan Kiene
Browse files

cleanup

parent 8a82f3c9
Loading
Loading
Loading
Loading
+12 −14
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ def create_br_switching_pattern(
    random.seed(seed)

    if strategy == "exhaustive":
        # TODO: review, probably needs more work to be really exhaustive...
        n = len(brs) - 1
        permuts = list(permutations(bitrates, 2))
        split_permuts = [permuts[i * n : (i + 1) * n] for i in range(len(brs))]
@@ -118,22 +117,21 @@ def create_br_switching_pattern(
        split_permuts = np.asarray(split_permuts)
        brs = np.concatenate([split_permuts[:, i] for i in range(n)])
    elif strategy == "random":
        rand_brs = list()
        brs = list()

        # if starting bitrate is given, put it at first place and sample one br less
        if starting_br is not None:
            rand_brs = [starting_br]
            brs = [starting_br]
            length_frames -= 1

        rand_brs += [
            x
            for x in random_choice(
        rand_gen = random_choice(
            bitrates,
            length_frames,
            allow_repetitions=False,
            last_init=starting_br,
            seed=seed,
        )
        ]
        brs = np.asarray(rand_brs)
        brs += [x for x in rand_gen]

    brs = np.repeat(brs, switch_time).astype(np.int32)
    return brs