Skip to content

util

Functions:

norm_rmode_planes

norm_rmode_planes(
    clip: VideoNode, mode: int | Sequence[int], planes: PlanesT = None
) -> list[int]
Source code
18
19
20
21
22
23
24
25
26
27
28
@deprecated(
    "`norm_rmode_planes` is deprecated and will be removed in a future version. "
    "Use `vstools.normalize_param_planes` instead",
    category=DeprecationWarning
)
def norm_rmode_planes(
    clip: vs.VideoNode, mode: int | Sequence[int], planes: PlanesT = None
) -> list[int]:
    from vstools import normalize_param_planes

    return normalize_param_planes(clip, mode, planes, 0)

normalize_radius

normalize_radius(
    clip: VideoNode,
    func: GenericVSFunction[ConstantFormatVideoNode],
    radius: Sequence[float | int] | dict[str, Sequence[float | int]],
    planes: PlanesT,
    **kwargs: Any
) -> ConstantFormatVideoNode
Source code
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
def normalize_radius(
    clip: vs.VideoNode,
    func: GenericVSFunction[ConstantFormatVideoNode],
    radius: Sequence[float | int] | dict[str, Sequence[float | int]],
    planes: PlanesT,
    **kwargs: Any
) -> ConstantFormatVideoNode:
    assert check_variable_format(clip, normalize_radius)

    if isinstance(radius, dict):
        name, radius = radius.popitem()
    else:
        name, radius = "radius", radius

    radius = normalize_seq(radius, clip.format.num_planes)
    planes = normalize_planes(clip, planes)

    if len(set(radius)) > 1:
        pplanes = [
            func(p, **kwargs | {name: rad, 'planes': 0})
            if i in planes else p
            for i, (rad, p) in enumerate(zip(radius, split(clip)))
        ]
        return join(pplanes)

    return func(clip, **kwargs | {name: radius[0], 'planes': planes})