Skip to content

qtgmc

Classes:

  • QTempGaussMC

    Quick Temporal Gaussian Motion Compensated (QTGMC)

QTGMCArgs

Namespace containing helper TypedDict definitions for various argument groups.

Classes:

Blur

Bases: TypedDict

Arguments available when passing to MVTools.flow_blur.

Attributes:

prec instance-attribute

prec: int | None

Compensate

Bases: TypedDict

Arguments available when passing to MVTools.compensate.

Attributes:

scbehavior instance-attribute

scbehavior: bool | None

thsad instance-attribute

thsad: int | None

time instance-attribute

time: float | None

Degrain

Bases: TypedDict

Arguments available when passing to the internal binomial_degrain method, calling MVTools.degrain through QTempGaussMC.basic and QTempGaussMC.source_match or directly calling MVTools.degrain through QTempGaussMC.final

Attributes:

limit instance-attribute

limit: float | tuple[float | None, float | None] | None

planes instance-attribute

planes: Planes

Mask

Bases: TypedDict

Arguments available when passing to MVTools.mask.

Attributes:

delta instance-attribute

delta: int

gamma instance-attribute

gamma: float | None

ml instance-attribute

ml: float | None

time instance-attribute

time: float | None

ysc instance-attribute

ysc: int | None

MaskShimmer

Bases: TypedDict

Arguments available when passing to the internal _mask_shimmer method through QTempGaussMC.prefilter, QTempGaussMC.basic and QTempGaussMC.final.

Attributes:

erosion_distance instance-attribute

erosion_distance: int

How much to deflate then reflate to remove thin areas.

over_dilation instance-attribute

over_dilation: int

Extra inflation to ensure areas to restore back are fully caught.

PrefilterToFullRange

Bases: TypedDict

Arguments available when passing to prefilter_to_full_range.

Attributes:

slope instance-attribute

slope: float

smooth instance-attribute

smooth: float

QTempGaussMC

QTempGaussMC(*args: Any, **kwargs: Any)

Bases: VSObject

Quick Temporal Gaussian Motion Compensated (QTGMC)

A very high quality deinterlacer with a range of features for both quality and convenience. These include extensive noise processing capabilities, support for repair of progressive material, precision source matching, shutter speed simulation, etc.

Originally based on TempGaussMC by Didée.

Basic usage
deinterlace = QTempGaussMC().deinterlace(clip)

Refer to the AviSynth QTGMC documentation and the havsfunc implementation for detailed explanations of the underlying algorithm.

These resources remain relevant, as the core algorithm used here is largely similar.

Note that parameter names differ in this implementation due to a complete rewrite. A mapping between vsjetpack and havsfunc parameters is available here.

Examples:

  • ...
  • Passing a progressive input to reduce shimmering (equivalent to InputType=2, ProgSADMask=12):
    clip = QTempGaussMC().basic(mask_args={"ml": 12}).repair(clip)
    
    Or:
    clip = QTempGaussMC(basic_mask_args={"ml": 12}).repair(clip)
    

Parameters:

  • **kwargs

    (Any, default: {} ) –

    Additional arguments to be passed to the parameter stage methods. Use the method's name as prefix to pass an argument to the respective method.

    Example for passing tr=1 to the prefilter stage: prefilter_tr=1.

Classes:

  • BackBlendMode

    When to back blend (blurred) difference between pre & post sharpened clip.

  • InputType

    Processing routine to use for the input.

  • LosslessMode

    When to put exact source fields into result & clean any artifacts.

  • NoiseDeintMode

    When noise is taken from interlaced source, how to 'deinterlace' it before restoring.

  • NoiseProcessMode

    How to handle processing noise in the source.

  • SearchPostProcess

    Prefiltering to apply in order to assist with motion search.

  • SharpenLimitMode

    How to limit and when to apply re-sharpening of the clip.

  • SharpenMode

    How to re-sharpen the clip after temporal smoothing.

  • SourceMatchMode

    Creates higher fidelity output with extra processing.

Methods:

  • analyze

    Configure parameters for the motion analysis stage.

  • back_blend

    Configure parameters for the back_blend stage.

  • basic

    Configure parameters for the basic stage.

  • bob

    Bob interlaced input. Motion blur stage FPS divisor is ignored.

  • deinterlace

    Deinterlace interlaced input. Motion blur stage FPS divisor is respected.

  • denoise

    Configure parameters for the denoise stage.

  • deshimmer

    Deshimmer progressive input.

  • final

    Configure parameters for the final stage.

  • lossless

    Configure parameter for the lossless stage.

  • motion_blur

    Configure parameters for the motion blur stage.

  • prefilter

    Configure parameters for the prefilter stage.

  • repair

    Repair badly deinterlaced input.

  • sharpen

    Configure parameters for the sharpen stage.

  • sharpen_limit

    Configure parameters for the sharpen_limit stage.

  • source_match

    Configure parameters for the source_match stage.

Attributes:

Source code in vsdeinterlace/qtgmc.py
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
def __init__(self, *args: Any, **kwargs: Any) -> None:
    """
    Args:
        **kwargs: Additional arguments to be passed to the parameter stage methods.
            Use the method's name as prefix to pass an argument to the respective method.

            Example for passing tr=1 to the prefilter stage: `prefilter_tr=1`.
    """
    args_it = iter(args)

    self.compat_clip = kwargs.pop("clip", next(args_it, None))
    self.compat_input_type = kwargs.pop("input_type", next(args_it, None))
    self.compat_tff = kwargs.pop("tff", next(args_it, None))

    if any((self.compat_clip, self.compat_input_type is not None, self.compat_tff is not None)):
        warn(
            "Passing a clip, input type, or field order to class initialization is deprecated"
            "and will be removed in a future version.",
            DeprecationWarning,
        )

    # Set default parameters for all the stages in this exact order
    self._settings_methods = (
        self.prefilter,
        self.analyze,
        self.denoise,
        self.basic,
        self.source_match,
        self.lossless,
        self.sharpen,
        self.back_blend,
        self.sharpen_limit,
        self.final,
        self.motion_blur,
    )

    for method in self._settings_methods:
        prefix = f"{method.__name__}_"

        method(**{k.removeprefix(prefix): kwargs.pop(k) for k in tuple(kwargs) if k.startswith(prefix)})

    if kwargs:
        raise CustomValueError("Unknown arguments were passed.", self.__class__, kwargs)

basic_output instance-attribute

basic_output: VideoNode

Output of the basic stage.

bobbed instance-attribute

bobbed: VideoNode

High quality bobbed clip, initial spatial interpolation.

clip instance-attribute

clip: VideoNode

Clip to process.

compat_clip instance-attribute

compat_clip = pop('clip', next(args_it, None))

compat_input_type instance-attribute

compat_input_type = pop('input_type', next(args_it, None))

compat_tff instance-attribute

compat_tff = pop('tff', next(args_it, None))

denoise_output instance-attribute

denoise_output: VideoNode

Output of the denoise stage.

draft instance-attribute

draft: VideoNode

Draft processed clip, used as a base for prefiltering & denoising.

final_output instance-attribute

final_output: VideoNode

Output of the final stage.

input instance-attribute

input: VideoNode

Prepared input clip for high quality interpolation.

motion_blur_output instance-attribute

motion_blur_output: VideoNode

Output of the motion blur stage.

mv instance-attribute

mv: MVTools

MVTools instance used during processing.

noise instance-attribute

noise: VideoNode

Extracted noise when noise processing is enabled.

prefilter_output instance-attribute

prefilter_output: VideoNode

Output of the prefilter stage.

sharpen_limit_radius property writable

sharpen_limit_radius: int

sharpen_strength property writable

sharpen_strength: float

source_match_bobber property writable

source_match_bobber: Bobber

BackBlendMode

Bases: CustomIntEnum

When to back blend (blurred) difference between pre & post sharpened clip.

Methods:

Attributes:

  • BOTH

    Perform back-blending both before and after sharpness limiting.

  • POSTLIMIT

    Perform back-blending after sharpness limiting.

  • PRELIMIT

    Perform back-blending prior to sharpness limiting.

BOTH class-attribute instance-attribute

BOTH = 2

Perform back-blending both before and after sharpness limiting.

POSTLIMIT class-attribute instance-attribute

POSTLIMIT = 1

Perform back-blending after sharpness limiting.

PRELIMIT class-attribute instance-attribute

PRELIMIT = 0

Perform back-blending prior to sharpness limiting.

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!s})" 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: ...

InputType

Bases: CustomIntEnum

Processing routine to use for the input.

Methods:

Attributes:

  • INTERLACE

    Deinterlace interlaced input.

  • PROGRESSIVE

    Deshimmer general progressive material that contains less severe problems.

  • REPAIR

    Repair badly deinterlaced material with considerable horizontal artifacts.

INTERLACE class-attribute instance-attribute

INTERLACE = 0

Deinterlace interlaced input.

PROGRESSIVE class-attribute instance-attribute

PROGRESSIVE = 1

Deshimmer general progressive material that contains less severe problems.

REPAIR class-attribute instance-attribute

REPAIR = 2

Repair badly deinterlaced material with considerable horizontal artifacts.

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!s})" 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: ...

LosslessMode

Bases: CustomIntEnum

When to put exact source fields into result & clean any artifacts.

Methods:

Attributes:

  • NONE

    Do not restore source fields.

  • POSTSMOOTH

    Restore source fields after final temporal smooth. True lossless but less stable.

  • PRESHARPEN

    Restore source fields prior to re-sharpening. Not exactly lossless.

NONE class-attribute instance-attribute

NONE = 0

Do not restore source fields.

POSTSMOOTH class-attribute instance-attribute

POSTSMOOTH = 2

Restore source fields after final temporal smooth. True lossless but less stable.

PRESHARPEN class-attribute instance-attribute

PRESHARPEN = 1

Restore source fields prior to re-sharpening. Not exactly lossless.

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!s})" 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: ...

NoiseDeintMode

Bases: CustomIntEnum

When noise is taken from interlaced source, how to 'deinterlace' it before restoring.

Methods:

Attributes:

  • BOB

    Bob source noise, results in coarse noise.

  • GENERATE

    Generates fresh noise lines.

  • WEAVE

    Double weave source noise, lags behind by one frame.

BOB class-attribute instance-attribute

BOB = 1

Bob source noise, results in coarse noise.

GENERATE class-attribute instance-attribute

GENERATE = 2

Generates fresh noise lines.

WEAVE class-attribute instance-attribute

WEAVE = 0

Double weave source noise, lags behind by one frame.

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!s})" 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: ...

NoiseProcessMode

Bases: CustomIntEnum

How to handle processing noise in the source.

Methods:

Attributes:

  • DENOISE

    Denoise source & optionally restore some noise back at the end of basic or final stages.

  • IDENTIFY

    Identify noise only & optionally restore some noise back at the end of basic or final stages.

DENOISE class-attribute instance-attribute

DENOISE = 1

Denoise source & optionally restore some noise back at the end of basic or final stages.

IDENTIFY class-attribute instance-attribute

IDENTIFY = 0

Identify noise only & optionally restore some noise back at the end of basic or final stages.

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!s})" 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: ...

SearchPostProcess

Bases: CustomIntEnum

Prefiltering to apply in order to assist with motion search.

Methods:

Attributes:

GAUSSBLUR class-attribute instance-attribute

GAUSSBLUR = 0

Gaussian blur.

GAUSSBLUR_EDGESOFTEN class-attribute instance-attribute

GAUSSBLUR_EDGESOFTEN = 1

Gaussian blur & edge softening.

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!s})" 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: ...

SharpenLimitMode

Bases: CustomIntEnum

How to limit and when to apply re-sharpening of the clip.

Methods:

Attributes:

SPATIAL_POSTSMOOTH class-attribute instance-attribute

SPATIAL_POSTSMOOTH = 2

Spatial sharpness limiting after the final stage.

SPATIAL_PRESMOOTH class-attribute instance-attribute

SPATIAL_PRESMOOTH = 0

Spatial sharpness limiting prior to final stage.

TEMPORAL_POSTSMOOTH class-attribute instance-attribute

TEMPORAL_POSTSMOOTH = 3

Temporal sharpness limiting after the final stage.

TEMPORAL_PRESMOOTH class-attribute instance-attribute

TEMPORAL_PRESMOOTH = 1

Temporal sharpness limiting prior to final stage.

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!s})" 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: ...

SharpenMode

Bases: CustomIntEnum

How to re-sharpen the clip after temporal smoothing.

Methods:

Attributes:

  • UNSHARP

    Re-sharpening using unsharpening.

  • UNSHARP_MINMAX

    Re-sharpening using unsharpening clamped to the local 3x3 min/max average.

UNSHARP class-attribute instance-attribute

UNSHARP = 0

Re-sharpening using unsharpening.

UNSHARP_MINMAX class-attribute instance-attribute

UNSHARP_MINMAX = 1

Re-sharpening using unsharpening clamped to the local 3x3 min/max average.

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!s})" 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: ...

SourceMatchMode

Bases: CustomIntEnum

Creates higher fidelity output with extra processing. Will capture more source detail and reduce oversharpening / haloing.

Methods:

Attributes:

  • BASIC

    Conservative halfway stage that rarely introduces artifacts.

  • NONE

    No source match processing.

  • REFINED

    Restores almost exact source detail but is sensitive to noise & can introduce occasional aliasing.

  • TWICE_REFINED

    Restores almost exact source detail.

BASIC class-attribute instance-attribute

BASIC = 1

Conservative halfway stage that rarely introduces artifacts.

NONE class-attribute instance-attribute

NONE = 0

No source match processing.

REFINED class-attribute instance-attribute

REFINED = 2

Restores almost exact source detail but is sensitive to noise & can introduce occasional aliasing.

TWICE_REFINED class-attribute instance-attribute

TWICE_REFINED = 3

Restores almost exact source detail.

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!s})" 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: ...

analyze

analyze(
    *,
    force_tr: int = 0,
    preset: Mapping[str, Any] = HQ_SAD,
    blksize: int | tuple[int, int] = 16,
    overlap: int | tuple[int, int] = 2,
    refine: int = 1,
    thsad_recalc: int | None = None,
    thscd: int | tuple[int | None, float | None] | None = (180, 38.5)
) -> Self

Configure parameters for the motion analysis stage.

Parameters:

  • force_tr

    (int, default: 0 ) –

    Always analyze motion to at least this, even if otherwise unnecessary.

  • preset

    (Mapping[str, Any], default: HQ_SAD ) –

    MVTools preset defining base values for the MVTools object.

  • blksize

    (int | tuple[int, int], default: 16 ) –

    Size of a block. Larger blocks are less sensitive to noise, are faster, but also less accurate.

  • overlap

    (int | tuple[int, int], default: 2 ) –

    The blksize divisor for block overlap. Larger overlapping reduces blocking artifacts.

  • refine

    (int, default: 1 ) –

    Number of times to recalculate motion vectors with halved block size.

  • thsad_recalc

    (int | None, default: None ) –

    Only bad quality new vectors with a SAD above this will be re-estimated by search. thsad value is scaled to 8x8 block size.

  • thscd

    (int | tuple[int | None, float | None] | None, default: (180, 38.5) ) –

    Scene change detection thresholds:

    • First value: SAD threshold for considering a block changed between frames.
    • Second value: Percentage of changed blocks needed to trigger a scene change.
Source code in vsdeinterlace/qtgmc.py
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
def analyze(
    self,
    *,
    force_tr: int = 0,
    preset: Mapping[str, Any] = MVToolsPreset.HQ_SAD,
    blksize: int | tuple[int, int] = 16,
    overlap: int | tuple[int, int] = 2,
    refine: int = 1,
    thsad_recalc: int | None = None,
    thscd: int | tuple[int | None, float | None] | None = (180, 38.5),
) -> Self:
    """
    Configure parameters for the motion analysis stage.

    Args:
        force_tr: Always analyze motion to at least this, even if otherwise unnecessary.
        preset: MVTools preset defining base values for the MVTools object.
        blksize: Size of a block. Larger blocks are less sensitive to noise, are faster, but also less accurate.
        overlap: The blksize divisor for block overlap. Larger overlapping reduces blocking artifacts.
        refine: Number of times to recalculate motion vectors with halved block size.
        thsad_recalc: Only bad quality new vectors with a SAD above this will be re-estimated by search. thsad value
            is scaled to 8x8 block size.
        thscd: Scene change detection thresholds:

               - First value: SAD threshold for considering a block changed between frames.
               - Second value: Percentage of changed blocks needed to trigger a scene change.
    """

    self.analyze_force_tr = force_tr
    self.analyze_preset = preset
    self.analyze_blksize = blksize
    self.analyze_overlap = overlap
    self.analyze_refine = refine
    self.analyze_thsad_recalc = thsad_recalc
    self.analyze_thscd = thscd

    return self

back_blend

back_blend(*, mode: BackBlendMode = PRELIMIT, sigma: float = 1.4) -> Self

Configure parameters for the back_blend stage.

Parameters:

  • mode

    (BackBlendMode, default: PRELIMIT ) –

    Specifies at which stage to perform back-blending.

  • sigma

    (float, default: 1.4 ) –

    Gaussian blur sigma.

Source code in vsdeinterlace/qtgmc.py
666
667
668
669
670
671
672
673
674
675
676
677
678
def back_blend(self, *, mode: BackBlendMode = BackBlendMode.PRELIMIT, sigma: float = 1.4) -> Self:
    """
    Configure parameters for the back_blend stage.

    Args:
        mode: Specifies at which stage to perform back-blending.
        sigma: Gaussian blur sigma.
    """

    self.backblend_mode = mode
    self.backblend_sigma = sigma

    return self

basic

basic(
    *,
    tr: int = 2,
    thsad: int | tuple[int, int] = 640,
    bobber: BobberLike = NNEDI3(nsize=1),
    noise_restore: float = 0,
    degrain_args: Degrain | None = None,
    mask_args: Mask | None = {"ml": 10},
    mask_shimmer_args: MaskShimmer | None = {"erosion_distance": 0}
) -> Self

Configure parameters for the basic stage.

Parameters:

  • tr

    (int, default: 2 ) –

    Temporal radius of the motion compensated binomial smooth.

  • thsad

    (int | tuple[int, int], default: 640 ) –

    Thsad of the motion compensated binomial smooth.

  • bobber

    (BobberLike, default: NNEDI3(nsize=1) ) –

    Bobber to use for initial spatial interpolation.

  • noise_restore

    (float, default: 0 ) –

    How much noise to restore after this stage.

  • degrain_args

    (Degrain | None, default: None ) –

    Arguments passed to the binomial_degrain call.

  • mask_args

    (Mask | None, default: {'ml': 10} ) –

    Arguments passed to MVTools.mask for repair.

  • mask_shimmer_args

    (MaskShimmer | None, default: {'erosion_distance': 0} ) –

    Arguments passed to the mask_shimmer call:

    • erosion_distance: How much to deflate then reflate to remove thin areas. Default is 0 for this stage.
    • over_dilation: Extra inflation to ensure areas to restore back are fully caught. Default is 0.
Source code in vsdeinterlace/qtgmc.py
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
def basic(
    self,
    *,
    tr: int = 2,
    thsad: int | tuple[int, int] = 640,
    bobber: BobberLike = NNEDI3(nsize=1),
    noise_restore: float = 0,
    degrain_args: QTGMCArgs.Degrain | None = None,
    mask_args: QTGMCArgs.Mask | None = {"ml": 10},
    mask_shimmer_args: QTGMCArgs.MaskShimmer | None = {"erosion_distance": 0},
) -> Self:
    """
    Configure parameters for the basic stage.

    Args:
        tr: Temporal radius of the motion compensated binomial smooth.
        thsad: Thsad of the motion compensated binomial smooth.
        bobber: Bobber to use for initial spatial interpolation.
        noise_restore: How much noise to restore after this stage.
        degrain_args: Arguments passed to the binomial_degrain call.
        mask_args: Arguments passed to [MVTools.mask][vsdenoise.mvtools.mvtools.MVTools.mask] for
            [repair][vsdeinterlace.qtgmc.QTempGaussMC.repair].
        mask_shimmer_args: Arguments passed to the mask_shimmer call:

               - erosion_distance: How much to deflate then reflate to remove thin areas.
                 Default is 0 for this stage.
               - over_dilation: Extra inflation to ensure areas to restore back are fully caught.
                 Default is 0.
    """

    self.basic_tr = tr
    self.basic_thsad = thsad
    self.basic_bobber = (
        deepcopy(bobber) if isinstance(bobber, Bobber) else Bobber.ensure_obj(bobber, self.__class__)
    )
    self.basic_noise_restore = noise_restore
    self.basic_degrain_args = fallback(degrain_args, QTGMCArgs.Degrain())
    self.basic_mask_args = fallback(mask_args, QTGMCArgs.Mask())
    self.basic_mask_shimmer_args = fallback(mask_shimmer_args, QTGMCArgs.MaskShimmer())

    return self

bob

bob(clip: VideoNode, tff: FieldBasedLike | bool | None = None) -> VideoNode

Bob interlaced input. Motion blur stage FPS divisor is ignored.

Parameters:

  • clip

    (VideoNode) –

    Input clip.

  • tff

    (FieldBasedLike | bool | None, default: None ) –

    Field order (top-field-first). If None, inferred from the clip. Defaults to None.

Returns:

  • VideoNode

    Bobbed clip.

Source code in vsdeinterlace/qtgmc.py
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
def bob(self, clip: vs.VideoNode, tff: FieldBasedLike | bool | None = None) -> vs.VideoNode:
    """
    Bob interlaced input. Motion blur stage FPS divisor is ignored.

    Args:
        clip: Input clip.
        tff: Field order (top-field-first). If None, inferred from the clip. Defaults to None.

    Returns:
        Bobbed clip.
    """
    with self._disable_fps_divisor():
        return self._run_process(clip, tff, self.bob)

deinterlace

deinterlace(
    clip: VideoNode | None = None, tff: FieldBasedLike | bool | None = None
) -> VideoNode

Deinterlace interlaced input. Motion blur stage FPS divisor is respected.

Parameters:

  • clip

    (VideoNode | None, default: None ) –

    Input clip.

  • tff

    (FieldBasedLike | bool | None, default: None ) –

    Field order (top-field-first). If None, inferred from the clip. Defaults to None.

Returns:

  • VideoNode

    Deinterlaced clip.

Source code in vsdeinterlace/qtgmc.py
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
def deinterlace(self, clip: vs.VideoNode | None = None, tff: FieldBasedLike | bool | None = None) -> vs.VideoNode:
    """
    Deinterlace interlaced input. Motion blur stage FPS divisor is respected.

    Args:
        clip: Input clip.
        tff: Field order (top-field-first). If None, inferred from the clip. Defaults to None.

    Returns:
        Deinterlaced clip.
    """
    func = self.deinterlace

    if self.compat_clip:
        clip = self.compat_clip

    if self.compat_tff is not None:
        tff = self.compat_tff

    if self.compat_input_type == self.InputType.REPAIR:
        func = self.repair
    elif self.compat_input_type == self.InputType.PROGRESSIVE:
        func = self.deshimmer
        tff = FieldBased.PROGRESSIVE

    if not clip:
        raise CustomValueError("No input clip was passed.", self.deinterlace)

    return self._run_process(clip, tff, func)

denoise

denoise(
    *,
    tr: int = 1,
    func: DFTTest | _DenoiseFuncTr = DFTTest(sigma=8),
    mode: NoiseProcessMode = IDENTIFY,
    deint: NoiseDeintMode = GENERATE,
    mc_denoise: bool = True,
    stabilize: tuple[float, float] | Literal[False] = (0.6, 0.2),
    func_comp_args: Compensate | None = None,
    stabilize_comp_args: Compensate | None = None
) -> Self

Configure parameters for the denoise stage.

Parameters:

  • tr

    (int, default: 1 ) –

    Temporal radius of the denoising function & it's motion compensation.

  • func

    (DFTTest | _DenoiseFuncTr, default: DFTTest(sigma=8) ) –

    Denoising function to use.

  • mode

    (NoiseProcessMode, default: IDENTIFY ) –

    Noise handling method to use.

  • deint

    (NoiseDeintMode, default: GENERATE ) –

    Noise deinterlacing method to use.

  • mc_denoise

    (bool, default: True ) –

    Whether to perform motion-compensated denoising.

  • stabilize

    (tuple[float, float] | Literal[False], default: (0.6, 0.2) ) –

    Weights to use when blending source noise with compensated noise.

  • func_comp_args

    (Compensate | None, default: None ) –

    Arguments passed to MVTools.compensate for denoising.

  • stabilize_comp_args

    (Compensate | None, default: None ) –

    Arguments passed to MVTools.compensate for stabilization.

Source code in vsdeinterlace/qtgmc.py
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
def denoise(
    self,
    *,
    tr: int = 1,
    func: DFTTest | _DenoiseFuncTr = DFTTest(sigma=8),
    mode: NoiseProcessMode = NoiseProcessMode.IDENTIFY,
    deint: NoiseDeintMode = NoiseDeintMode.GENERATE,
    mc_denoise: bool = True,
    stabilize: tuple[float, float] | Literal[False] = (0.6, 0.2),
    func_comp_args: QTGMCArgs.Compensate | None = None,
    stabilize_comp_args: QTGMCArgs.Compensate | None = None,
) -> Self:
    """
    Configure parameters for the denoise stage.

    Args:
        tr: Temporal radius of the denoising function & it's motion compensation.
        func: Denoising function to use.
        mode: Noise handling method to use.
        deint: Noise deinterlacing method to use.
        mc_denoise: Whether to perform motion-compensated denoising.
        stabilize: Weights to use when blending source noise with compensated noise.
        func_comp_args: Arguments passed to [MVTools.compensate][vsdenoise.mvtools.mvtools.MVTools.compensate] for
            denoising.
        stabilize_comp_args: Arguments passed to [MVTools.compensate][vsdenoise.mvtools.mvtools.MVTools.compensate]
            for stabilization.
    """

    self.denoise_tr = tr
    self.denoise_func = func.denoise if isinstance(func, DFTTest) else func
    self.denoise_mode = mode
    self.denoise_deint = deint
    self.denoise_mc_denoise = mc_denoise
    self.denoise_stabilize: tuple[float, float] | Literal[False] = stabilize
    self.denoise_func_comp_args = fallback(func_comp_args, QTGMCArgs.Compensate())
    self.denoise_stabilize_comp_args = fallback(stabilize_comp_args, QTGMCArgs.Compensate())

    return self

deshimmer

deshimmer(clip: VideoNode) -> VideoNode

Deshimmer progressive input.

Parameters:

  • clip

    (VideoNode) –

    Input clip.

Returns:

  • VideoNode

    Deshimmered clip.

Source code in vsdeinterlace/qtgmc.py
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
def deshimmer(self, clip: vs.VideoNode) -> vs.VideoNode:
    """
    Deshimmer progressive input.

    Args:
        clip: Input clip.

    Returns:
        Deshimmered clip.
    """
    return self._run_process(clip, FieldBased.PROGRESSIVE, self.deshimmer)

final

final(
    *,
    tr: int = 1,
    thsad: int | tuple[int, int] = 256,
    noise_restore: float = 0,
    degrain_args: Degrain | None = None,
    mask_shimmer_args: MaskShimmer | None = {"erosion_distance": 4}
) -> Self

Configure parameters for the final stage.

Parameters:

  • tr

    (int, default: 1 ) –

    Temporal radius of the motion compensated smooth.

  • thsad

    (int | tuple[int, int], default: 256 ) –

    Thsad of the motion compensated smooth.

  • noise_restore

    (float, default: 0 ) –

    How much noise to restore after this stage.

  • degrain_args

    (Degrain | None, default: None ) –

    Arguments passed to MVTools.degrain.

  • mask_shimmer_args

    (MaskShimmer | None, default: {'erosion_distance': 4} ) –

    Arguments passed to the mask_shimmer call:

    • erosion_distance: How much to deflate then reflate to remove thin areas. Default is 4 for this stage.
    • over_dilation: Extra inflation to ensure areas to restore back are fully caught. Default is 0.
Source code in vsdeinterlace/qtgmc.py
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
def final(
    self,
    *,
    tr: int = 1,
    thsad: int | tuple[int, int] = 256,
    noise_restore: float = 0,
    degrain_args: QTGMCArgs.Degrain | None = None,
    mask_shimmer_args: QTGMCArgs.MaskShimmer | None = {"erosion_distance": 4},
) -> Self:
    """
    Configure parameters for the final stage.

    Args:
        tr: Temporal radius of the motion compensated smooth.
        thsad: Thsad of the motion compensated smooth.
        noise_restore: How much noise to restore after this stage.
        degrain_args: Arguments passed to [MVTools.degrain][vsdenoise.mvtools.mvtools.MVTools.degrain].
        mask_shimmer_args: Arguments passed to the mask_shimmer call:

               - erosion_distance: How much to deflate then reflate to remove thin areas.
                 Default is 4 for this stage.
               - over_dilation: Extra inflation to ensure areas to restore back are fully caught.
                 Default is 0.
    """

    self.final_tr = tr
    self.final_thsad = thsad
    self.final_noise_restore = noise_restore
    self.final_degrain_args = fallback(degrain_args, QTGMCArgs.Degrain())
    self.final_mask_shimmer_args = fallback(mask_shimmer_args, QTGMCArgs.MaskShimmer())

    return self

lossless

lossless(*, mode: LosslessMode = NONE, anti_comb: bool = True) -> Self

Configure parameter for the lossless stage.

Parameters:

  • mode

    (LosslessMode, default: NONE ) –

    Specifies at which stage to re-weave the original fields.

  • anti_comb

    (bool, default: True ) –

    Whether to apply combing reduction post-processing.

Source code in vsdeinterlace/qtgmc.py
615
616
617
618
619
620
621
622
623
624
625
626
627
def lossless(self, *, mode: LosslessMode = LosslessMode.NONE, anti_comb: bool = True) -> Self:
    """
    Configure parameter for the lossless stage.

    Args:
        mode: Specifies at which stage to re-weave the original fields.
        anti_comb: Whether to apply combing reduction post-processing.
    """

    self.lossless_mode = mode
    self.lossless_anti_comb = anti_comb

    return self

motion_blur

motion_blur(
    *,
    shutter_angle: tuple[float, float] = (180, 180),
    fps_divisor: int = 1,
    blur_args: Blur | None = None,
    mask_args: Mask | None = {"ml": 4}
) -> Self

Configure parameters for the motion blur stage.

Parameters:

  • shutter_angle

    (tuple[float, float], default: (180, 180) ) –

    Tuple containing the source and output shutter angle. Will apply motion blur if they do not match.

  • fps_divisor

    (int, default: 1 ) –

    Factor by which to reduce framerate.

  • blur_args

    (Blur | None, default: None ) –

    Arguments passed to MVTools.flow_blur.

  • mask_args

    (Mask | None, default: {'ml': 4} ) –

    Arguments passed to MVTools.mask.

Source code in vsdeinterlace/qtgmc.py
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
def motion_blur(
    self,
    *,
    shutter_angle: tuple[float, float] = (180, 180),
    fps_divisor: int = 1,
    blur_args: QTGMCArgs.Blur | None = None,
    mask_args: QTGMCArgs.Mask | None = {"ml": 4},
) -> Self:
    """
    Configure parameters for the motion blur stage.

    Args:
        shutter_angle: Tuple containing the source and output shutter angle. Will apply motion blur if they do not
            match.
        fps_divisor: Factor by which to reduce framerate.
        blur_args: Arguments passed to [MVTools.flow_blur][vsdenoise.mvtools.mvtools.MVTools.flow_blur].
        mask_args: Arguments passed to [MVTools.mask][vsdenoise.mvtools.mvtools.MVTools.mask].
    """

    self.motion_blur_shutter_angle = shutter_angle
    self.motion_blur_fps_divisor = fps_divisor
    self.motion_blur_blur_args = fallback(blur_args, QTGMCArgs.Blur())
    self.motion_blur_mask_args = fallback(mask_args, QTGMCArgs.Mask())

    return self

prefilter

prefilter(
    *,
    tr: int = 2,
    sc_threshold: float = 0.1,
    postprocess: SearchPostProcess = GAUSSBLUR_EDGESOFTEN,
    strength: tuple[float, float] | Literal[False] = (1.9, 0.1),
    limit: tuple[float, float, float] = (3, 7, 2),
    bias: float = 0.51,
    range_expansion_args: PrefilterToFullRange | None = None,
    mask_shimmer_args: MaskShimmer | None = {"erosion_distance": 4}
) -> Self

Configure parameters for the prefilter stage.

Parameters:

  • tr

    (int, default: 2 ) –

    Radius of the initial temporal binomial smooth.

  • sc_threshold

    (float, default: 0.1 ) –

    Threshold for scene changes, disables sc detection if False.

  • postprocess

    (SearchPostProcess, default: GAUSSBLUR_EDGESOFTEN ) –

    Post-processing routine to use.

  • strength

    (tuple[float, float] | Literal[False], default: (1.9, 0.1) ) –

    Tuple containing gaussian blur sigma & blend weight of the blur.

  • limit

    (tuple[float, float, float], default: (3, 7, 2) ) –

    3-step limiting (8-bit) thresholds for the gaussian blur post-processing. Only for SearchPostProcess.GAUSSBLUR_EDGESOFTEN.

  • bias

    (float, default: 0.51 ) –

    Bias for blending the gaussian blurred clip with the limited output. Only for SearchPostProcess.GAUSSBLUR_EDGESOFTEN.

  • range_expansion_args

    (PrefilterToFullRange | None, default: None ) –

    Arguments passed to prefilter_to_full_range.

  • mask_shimmer_args

    (MaskShimmer | None, default: {'erosion_distance': 4} ) –

    Arguments passed to the mask_shimmer call:

    • erosion_distance: How much to deflate then reflate to remove thin areas. Default is 4 for this stage.
    • over_dilation: Extra inflation to ensure areas to restore back are fully caught. Default is 0.
Source code in vsdeinterlace/qtgmc.py
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
def prefilter(
    self,
    *,
    tr: int = 2,
    sc_threshold: float = 0.1,
    postprocess: SearchPostProcess = SearchPostProcess.GAUSSBLUR_EDGESOFTEN,
    strength: tuple[float, float] | Literal[False] = (1.9, 0.1),
    limit: tuple[float, float, float] = (3, 7, 2),
    bias: float = 0.51,
    range_expansion_args: QTGMCArgs.PrefilterToFullRange | None = None,
    mask_shimmer_args: QTGMCArgs.MaskShimmer | None = {"erosion_distance": 4},
) -> Self:
    """
    Configure parameters for the prefilter stage.

    Args:
        tr: Radius of the initial temporal binomial smooth.
        sc_threshold: Threshold for scene changes, disables sc detection if False.
        postprocess: Post-processing routine to use.
        strength: Tuple containing gaussian blur sigma & blend weight of the blur.
        limit: 3-step limiting (8-bit) thresholds for the gaussian blur post-processing. Only for
            [SearchPostProcess.GAUSSBLUR_EDGESOFTEN][vsdeinterlace.qtgmc.QTempGaussMC.SearchPostProcess.GAUSSBLUR_EDGESOFTEN].
        bias: Bias for blending the gaussian blurred clip with the limited output. Only for
            [SearchPostProcess.GAUSSBLUR_EDGESOFTEN][vsdeinterlace.qtgmc.QTempGaussMC.SearchPostProcess.GAUSSBLUR_EDGESOFTEN].
        range_expansion_args: Arguments passed to
            [prefilter_to_full_range][vsdenoise.prefilters.prefilter_to_full_range].
        mask_shimmer_args: Arguments passed to the mask_shimmer call:

               - erosion_distance: How much to deflate then reflate to remove thin areas.
                 Default is 4 for this stage.
               - over_dilation: Extra inflation to ensure areas to restore back are fully caught.
                 Default is 0.
    """

    self.prefilter_tr = tr
    self.prefilter_sc_threshold = sc_threshold
    self.prefilter_postprocess = postprocess
    self.prefilter_strength: tuple[float, float] | Literal[False] = strength
    self.prefilter_limit = limit
    self.prefilter_bias = bias
    self.prefilter_range_expansion_args = fallback(range_expansion_args, QTGMCArgs.PrefilterToFullRange())
    self.prefilter_mask_shimmer_args = fallback(mask_shimmer_args, QTGMCArgs.MaskShimmer())

    return self

repair

repair(clip: VideoNode, tff: FieldBasedLike | bool | None = None) -> VideoNode

Repair badly deinterlaced input.

Parameters:

  • clip

    (VideoNode) –

    Input clip.

  • tff

    (FieldBasedLike | bool | None, default: None ) –

    Field order (top-field-first). If None, inferred from the clip. Defaults to None.

Returns:

  • VideoNode

    Repaired clip.

Source code in vsdeinterlace/qtgmc.py
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
def repair(self, clip: vs.VideoNode, tff: FieldBasedLike | bool | None = None) -> vs.VideoNode:
    """
    Repair badly deinterlaced input.

    Args:
        clip: Input clip.
        tff: Field order (top-field-first). If None, inferred from the clip. Defaults to None.

    Returns:
        Repaired clip.
    """
    return self._run_process(clip, tff, self.repair)

sharpen

sharpen(
    *,
    mode: SharpenMode = UNSHARP_MINMAX,
    strength: float | None = None,
    clamp: float | tuple[float, float] = 1,
    thin: float = 0
) -> Self

Configure parameters for the sharpen stage.

Parameters:

Source code in vsdeinterlace/qtgmc.py
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
def sharpen(
    self,
    *,
    mode: SharpenMode = SharpenMode.UNSHARP_MINMAX,
    strength: float | None = None,
    clamp: float | tuple[float, float] = 1,
    thin: float = 0,
) -> Self:
    """
    Configure parameters for the sharpen stage.

    Args:
        mode: Specifies the type of sharpening to use.
            Defaults to [SharpenMode.UNSHARP_MINMAX][vsdeinterlace.qtgmc.QTempGaussMC.SharpenMode.UNSHARP_MINMAX].
        strength: Sharpening strength. Defaults to 1 for
            [SourceMatchMode.NONE][vsdeinterlace.qtgmc.QTempGaussMC.SourceMatchMode.NONE] or 0 otherwise.
        clamp: Clamp the sharpening strength of
            [SharpenMode.UNSHARP_MINMAX][vsdeinterlace.qtgmc.QTempGaussMC.SharpenMode.UNSHARP_MINMAX] to the min/max
            average plus/minus this.
        thin: How much to vertically thin edges.
    """

    self.sharpen_mode = mode
    self.sharpen_strength = strength
    self.sharpen_clamp = normalize_seq(clamp, 2)
    self.sharpen_thin = thin

    return self

sharpen_limit

sharpen_limit(
    *,
    mode: SharpenLimitMode = TEMPORAL_PRESMOOTH,
    radius: int | None = None,
    clamp: float | tuple[float, float] = 0,
    comp_args: Compensate | None = None
) -> Self

Configure parameters for the sharpen_limit stage.

Parameters:

Source code in vsdeinterlace/qtgmc.py
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
def sharpen_limit(
    self,
    *,
    mode: SharpenLimitMode = SharpenLimitMode.TEMPORAL_PRESMOOTH,
    radius: int | None = None,
    clamp: float | tuple[float, float] = 0,
    comp_args: QTGMCArgs.Compensate | None = None,
) -> Self:
    """
    Configure parameters for the sharpen_limit stage.

    Args:
        mode: Specifies type of limiting & at which stage to perform it.
        radius: Radius of sharpness limiting. Defaults to 1 for
            [SourceMatchMode.NONE][vsdeinterlace.qtgmc.QTempGaussMC.SourceMatchMode.NONE] or 0 otherwise.
        clamp: How much undershoot/overshoot to allow.
        comp_args: Arguments passed to [MVTools.compensate][vsdenoise.mvtools.mvtools.MVTools.compensate] for
            temporal limiting.
    """

    self.sharpen_limit_mode = mode
    self.sharpen_limit_radius = radius
    self.sharpen_limit_clamp = clamp
    self.sharpen_limit_comp_args = fallback(comp_args, QTGMCArgs.Compensate())

    return self

source_match

source_match(
    *,
    tr: int = 1,
    bobber: BobberLike | None = None,
    mode: SourceMatchMode = NONE,
    similarity: float = 0.5,
    enhance: float = 0.5,
    degrain_args: Degrain | None = None
) -> Self

Configure parameters for the source_match stage.

Parameters:

  • tr

    (int, default: 1 ) –

    Temporal radius of the refinement motion compensated binomial smooth.

  • bobber

    (BobberLike | None, default: None ) –

    Bobber to use for refined spatial interpolation. Defaults to the basic bobber.

  • mode

    (SourceMatchMode, default: NONE ) –

    Specifies number of refinement steps to perform.

  • similarity

    (float, default: 0.5 ) –

    Temporal similarity of the error created by smoothing.

  • enhance

    (float, default: 0.5 ) –

    Sharpening strength prior to source match refinement.

  • degrain_args

    (Degrain | None, default: None ) –

    Arguments passed to the binomial_degrain call.

Source code in vsdeinterlace/qtgmc.py
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
def source_match(
    self,
    *,
    tr: int = 1,
    bobber: BobberLike | None = None,
    mode: SourceMatchMode = SourceMatchMode.NONE,
    similarity: float = 0.5,
    enhance: float = 0.5,
    degrain_args: QTGMCArgs.Degrain | None = None,
) -> Self:
    """
    Configure parameters for the source_match stage.

    Args:
        tr: Temporal radius of the refinement motion compensated binomial smooth.
        bobber: Bobber to use for refined spatial interpolation. Defaults to the basic bobber.
        mode: Specifies number of refinement steps to perform.
        similarity: Temporal similarity of the error created by smoothing.
        enhance: Sharpening strength prior to source match refinement.
        degrain_args: Arguments passed to the binomial_degrain call.
    """

    self.source_match_tr = tr
    self.source_match_bobber = bobber
    self.source_match_mode = mode
    self.source_match_similarity = similarity
    self.source_match_enhance = enhance
    self.source_match_degrain_args = fallback(degrain_args, QTGMCArgs.Degrain())

    return self