Skip to content

utils

Functions:

get_field_difference

get_field_difference(
    clip: VideoNode, tff: FieldBasedT | bool | None = None
) -> VideoNode
Source code
24
25
26
27
28
29
30
31
def get_field_difference(clip: vs.VideoNode, tff: FieldBasedT | bool | None = None) -> vs.VideoNode:
    tff = FieldBased.from_param_or_video(tff, clip, True, get_field_difference).is_tff

    stats = clip.std.SeparateFields(tff).std.PlaneStats()

    return core.akarin.PropExpr(
        [clip, stats[::2], stats[1::2]], lambda: {'FieldDifference': 'y.PlaneStatsAverage z.PlaneStatsAverage - abs'}
    )

reinterlace

reinterlace(
    clip: VideoNode, tff: FieldBasedT | bool | None = None
) -> VideoNode
Source code
34
35
36
37
def reinterlace(clip: vs.VideoNode, tff: FieldBasedT | bool | None = None) -> vs.VideoNode:
    tff = FieldBased.from_param_or_video(tff, clip, True, reinterlace).is_tff

    return clip.std.SeparateFields(tff).std.SelectEvery(4, (0, 3)).std.DoubleWeave(tff)[::2]

reweave

reweave(
    clipa: VideoNode, clipb: VideoNode, tff: FieldBasedT | bool | None = None
) -> VideoNode
Source code
40
41
42
43
def reweave(clipa: vs.VideoNode, clipb: vs.VideoNode, tff: FieldBasedT | bool | None = None) -> vs.VideoNode:
    tff = FieldBased.from_param_or_video(tff, clipa, True, reweave).is_tff

    return core.std.Interleave([clipa, clipb]).std.SelectEvery(4, (0, 1, 3, 2)).std.DoubleWeave(tff)[::2]

telecine_patterns

telecine_patterns(
    clipa: VideoNode, clipb: VideoNode, length: int = 5
) -> list[VideoNode]
Source code
13
14
15
16
17
18
19
20
21
def telecine_patterns(clipa: vs.VideoNode, clipb: vs.VideoNode, length: int = 5) -> list[vs.VideoNode]:
    a_select = [clipa.std.SelectEvery(length, i) for i in range(length)]
    b_select = [clipb.std.SelectEvery(length, i) for i in range(length)]

    return [
        core.std.Interleave([
            (b_select if i == j else a_select)[j] for j in range(length)
        ]) for i in range(length)
    ]