def METHOD_NAME(seq, patterns):
    f, h, w, c = seq.shape
    assert f == len(patterns)
    assert c == 3
    h = h // 2 * 2
    w = w // 2 * 2
    bayer_masks = {pattern: rgb_bayer_masks((h, w), pattern) for pattern in bayer_patterns}
    seq_masks = [bayer_masks[pattern] for pattern in patterns]
    reds, greens, blues = [np.stack(channel) for channel in zip(*seq_masks)]
    return seq[:, :h, :w, 0] * reds + seq[:, :h, :w, 1] * greens + seq[:, :h, :w, 2] * blues