Skip to content

types

Classes:

Attributes:

BotFieldLeftShift module-attribute

BotFieldLeftShift: TypeAlias = float

BotFieldTopShift module-attribute

BotFieldTopShift: TypeAlias = float

Center module-attribute

Center: TypeAlias = float

LeftShift module-attribute

LeftShift: TypeAlias = float

Slope module-attribute

Slope: TypeAlias = float

TopFieldLeftShift module-attribute

TopFieldLeftShift: TypeAlias = float

TopFieldTopShift module-attribute

TopFieldTopShift: TypeAlias = float

TopShift module-attribute

TopShift: TypeAlias = float

BorderHandling

Bases: CustomIntEnum

Methods:

Attributes:

MIRROR class-attribute instance-attribute

MIRROR = 0

REPEAT class-attribute instance-attribute

REPEAT = 2

ZERO class-attribute instance-attribute

ZERO = 1

pad_amount cached

pad_amount(size: int, min_amount: int = 2) -> int
Source code
40
41
42
43
44
45
@lru_cache
def pad_amount(self, size: int, min_amount: int = 2) -> int:
    if self is BorderHandling.MIRROR:
        return 0

    return (((size + min_amount) + 7) & -8) - size

prepare_clip

prepare_clip(clip: VideoNode, min_pad: int = 2) -> VideoNode
Source code
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def prepare_clip(self, clip: vs.VideoNode, min_pad: int = 2) -> vs.VideoNode:
    pad_w, pad_h = (
        self.pad_amount(size, min_pad) for size in (clip.width, clip.height)
    )

    if pad_w == pad_h == 0:
        return clip

    args = (clip, pad_w, pad_w, pad_h, pad_h)

    match self:
        case BorderHandling.MIRROR:
            return padder.MIRROR(*args)
        case BorderHandling.ZERO:
            return padder.COLOR(*args)
        case BorderHandling.REPEAT:
            return padder.REPEAT(*args)

SampleGridModel

Bases: CustomIntEnum

Methods:

Attributes:

MATCH_CENTERS class-attribute instance-attribute

MATCH_CENTERS = 1

MATCH_EDGES class-attribute instance-attribute

MATCH_EDGES = 0

__call__

__call__(
    width: int,
    height: int,
    src_width: float,
    src_height: float,
    shift: tuple[float, float],
    kwargs: KwargsT,
) -> tuple[KwargsT, tuple[float, float]]
Source code
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __call__(
    self, width: int, height: int, src_width: float, src_height: float, shift: tuple[float, float], kwargs: KwargsT
) -> tuple[KwargsT, tuple[float, float]]:
    if self is SampleGridModel.MATCH_CENTERS:
        src_width = src_width * (width - 1) / (src_width - 1)
        src_height = src_height * (height - 1) / (src_height - 1)

        kwargs |= dict(src_width=src_width, src_height=src_height)
        shift_x, shift_y, *_ = tuple(
            (x / 2 + y for x, y in zip(((height - src_height), (width - src_width)), shift))
        )
        shift = shift_x, shift_y

    return kwargs, shift

for_dst

for_dst(
    clip: VideoNode,
    width: int,
    height: int,
    shift: tuple[float, float],
    **kwargs: Any
) -> tuple[KwargsT, tuple[float, float]]
Source code
67
68
69
70
71
72
73
def for_dst(
    self, clip: vs.VideoNode, width: int, height: int, shift: tuple[float, float], **kwargs: Any
) -> tuple[KwargsT, tuple[float, float]]:
    src_width = kwargs.get('src_width', width)
    src_height = kwargs.get('src_height', height)

    return self(src_width, src_height, width, height, shift, kwargs)

for_src

for_src(
    clip: VideoNode,
    width: int,
    height: int,
    shift: tuple[float, float],
    **kwargs: Any
) -> tuple[KwargsT, tuple[float, float]]
Source code
75
76
77
78
79
80
81
def for_src(
    self, clip: vs.VideoNode, width: int, height: int, shift: tuple[float, float], **kwargs: Any
) -> tuple[KwargsT, tuple[float, float]]:
    src_width = kwargs.get('src_width', clip.width)
    src_height = kwargs.get('src_height', clip.height)

    return self(width, height, src_width, src_height, shift, kwargs)