Skip to content

enums

Classes:

  • IVTCycles

    Enum representing different decimation patterns for IVTC (Inverse Telecine) processes.

  • VFMMode

    Enum representing different matching modes for VFM.

IVTCycles

Bases: CustomEnum

Enum representing different decimation patterns for IVTC (Inverse Telecine) processes.

These patterns are used to remove duplicate frames after double weaving fields into frames. Each pattern defines a sequence of frame indices to keep during decimation.

Methods:

  • decimate

    Apply the decimation pattern to a video clip with the given pattern index.

  • from_param

    Return the enum value from a parameter.

Attributes:

  • CYCLE_05

    Pattern for standard frame-based 2:3 pulldown.

  • CYCLE_08

    Pattern for 2:3:3:2 pulldown.

  • CYCLE_10

    Pattern for standard field-based 2:3 pulldown.

  • cycle (int) –

    Get the total number of available pattern variations for this cycle.

  • pattern_length (int) –

    Get the length of the pattern cycle in frames.

CYCLE_05 class-attribute instance-attribute

CYCLE_05 = (
    (0, 1, 3, 4),
    (0, 1, 2, 4),
    (0, 1, 2, 3),
    (1, 2, 3, 4),
    (0, 2, 3, 4),
)

Pattern for standard frame-based 2:3 pulldown.

CYCLE_08 class-attribute instance-attribute

CYCLE_08 = (
    (0, 3, 4, 6),
    (0, 2, 5, 6),
    (0, 2, 4, 7),
    (0, 2, 4, 7),
    (1, 2, 4, 6),
)

Pattern for 2:3:3:2 pulldown.

CYCLE_10 class-attribute instance-attribute

CYCLE_10 = (
    (0, 3, 6, 8),
    (0, 2, 5, 8),
    (0, 2, 4, 7),
    (2, 4, 6, 9),
    (1, 4, 6, 8),
)

Pattern for standard field-based 2:3 pulldown.

cycle property

cycle: int

Get the total number of available pattern variations for this cycle.

pattern_length property

pattern_length: int

Get the length of the pattern cycle in frames.

decimate

decimate(clip: VideoNode, pattern: int = 0) -> VideoNode

Apply the decimation pattern to a video clip with the given pattern index.

Source code in vsdeinterlace/enums.py
89
90
91
92
93
94
95
def decimate(self, clip: vs.VideoNode, pattern: int = 0) -> vs.VideoNode:
    """
    Apply the decimation pattern to a video clip with the given pattern index.
    """
    assert 0 <= pattern < self.cycle

    return core.std.SelectEvery(clip, self.pattern_length, self.value[pattern])

from_param classmethod

from_param(value: Any, func_except: FuncExcept | None = None) -> Self

Return the enum value from a parameter.

Parameters:

  • value

    (Any) –

    Value to instantiate the enum class.

  • func_except

    (FuncExcept | None, default: None ) –

    Exception function.

Returns:

  • Self

    Enum value.

Raises:

Source code in jetpytools/enums/base.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@classmethod
def from_param(cls, value: Any, func_except: FuncExcept | None = None) -> Self:
    """
    Return the enum value from a parameter.

    Args:
        value: Value to instantiate the enum class.
        func_except: Exception function.

    Returns:
        Enum value.

    Raises:
        NotFoundEnumValue: Variable not found in the given enum.
    """
    func_except = func_except or cls.from_param

    try:
        return cls(value)
    except (ValueError, TypeError):
        pass

    if isinstance(func_except, tuple):
        func_name, var_name = func_except
    else:
        func_name, var_name = func_except, repr(cls)

    raise NotFoundEnumValueError(
        'The given value for "{var_name}" argument must be a valid {enum_name}, not "{value}"!\n'
        "Valid values are: [{readable_enum}].",
        func_name,
        var_name=var_name,
        enum_name=cls,
        value=value,
        readable_enum=(f"{name} ({value!r})" for name, value in cls.__members__.items()),
        reason=value,
    ) from None

VFMMode

Bases: CustomIntEnum

Enum representing different matching modes for VFM.

The mode determines the strategy used for matching fields and frames. Higher modes generally offer better matching in complex scenarios but may introduce more risk of jerkiness or duplicate frames.

Methods:

Attributes:

THREE_WAY_MATCH class-attribute instance-attribute

THREE_WAY_MATCH = 4

3-way match (p/c/n).

THREE_WAY_MATCH_FOURTH_FIFTH class-attribute instance-attribute

THREE_WAY_MATCH_FOURTH_FIFTH = 5

3-way match + 4th/5th matches on combed (p/c/n + u/b). Highest risk of jerkiness but best at finding good matches.

TWO_WAY_MATCH class-attribute instance-attribute

TWO_WAY_MATCH = 0

2-way match (p/c). Safest option, but may output combed frames in cases of bad edits or blended fields.

TWO_WAY_MATCH_THIRD_COMBED class-attribute instance-attribute

TWO_WAY_MATCH_THIRD_COMBED = 1

2-way match + 3rd match on combed (p/c + n). Default mode.

TWO_WAY_MATCH_THIRD_FOURTH_FIFTH class-attribute instance-attribute

TWO_WAY_MATCH_THIRD_FOURTH_FIFTH = 3

2-way match + 3rd match on combed + 4th/5th matches if still combed (p/c + n + u/b).

TWO_WAY_MATCH_THIRD_SAME_ORDER class-attribute instance-attribute

TWO_WAY_MATCH_THIRD_SAME_ORDER = 2

2-way match + 3rd match (same order) on combed (p/c + u).

from_param classmethod

from_param(value: Any, func_except: FuncExcept | None = None) -> Self

Return the enum value from a parameter.

Parameters:

  • value

    (Any) –

    Value to instantiate the enum class.

  • func_except

    (FuncExcept | None, default: None ) –

    Exception function.

Returns:

  • Self

    Enum value.

Raises:

Source code in jetpytools/enums/base.py
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@classmethod
def from_param(cls, value: Any, func_except: FuncExcept | None = None) -> Self:
    """
    Return the enum value from a parameter.

    Args:
        value: Value to instantiate the enum class.
        func_except: Exception function.

    Returns:
        Enum value.

    Raises:
        NotFoundEnumValue: Variable not found in the given enum.
    """
    func_except = func_except or cls.from_param

    try:
        return cls(value)
    except (ValueError, TypeError):
        pass

    if isinstance(func_except, tuple):
        func_name, var_name = func_except
    else:
        func_name, var_name = func_except, repr(cls)

    raise NotFoundEnumValueError(
        'The given value for "{var_name}" argument must be a valid {enum_name}, not "{value}"!\n'
        "Valid values are: [{readable_enum}].",
        func_name,
        var_name=var_name,
        enum_name=cls,
        value=value,
        readable_enum=(f"{name} ({value!r})" for name, value in cls.__members__.items()),
        reason=value,
    ) from None

value

value() -> int
Source code in jetpytools/enums/base.py
86
87
@enum_property
def value(self) -> int: ...