Skip to content

qtgmc

Classes:

  • QTempGaussMC

    Quasi Temporal Gaussian Motion Compensated (QTGMC)

QTempGaussMC

QTempGaussMC(
    clip: VideoNode,
    input_type: InputType = INTERLACE,
    tff: FieldBasedT | bool | None = None,
)

Bases: vs_object

Quasi 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(clip)
    .prefilter()
    .analyze()
    .denoise()
    .basic()
    .source_match()
    .lossless()
    .sharpen()
    .back_blend()
    .sharpen_limit()
    .final()
    .motion_blur()
    .deinterlace()
)

Parameters:

  • clip

    (VideoNode) –

    Clip to process.

  • input_type

    (InputType, default: INTERLACE ) –

    Indicates processing routine.

  • tff

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

    Field order of the clip.

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 artefacts.

  • 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.

  • SharpLimitMode

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

  • SharpMode

    How to re-sharpen the clip after temporally blurring.

  • 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.

  • deinterlace

    Start the deinterlacing process.

  • denoise

    Configure parameters for the denoise stage.

  • 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.

  • 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:

  • basic_output (ConstantFormatVideoNode) –

    Output of the basic stage.

  • bobbed (ConstantFormatVideoNode) –

    High quality bobbed clip, initial spatial interpolation.

  • clip (ConstantFormatVideoNode) –

    Clip to process.

  • denoise_output (ConstantFormatVideoNode) –

    Output of the denoise stage.

  • double_rate
  • draft (ConstantFormatVideoNode) –

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

  • final_output (ConstantFormatVideoNode) –

    Output of the final stage.

  • input_type
  • motion_blur_output (ConstantFormatVideoNode) –

    Output of the motion blur stage.

  • noise (ConstantFormatVideoNode) –

    Extracted noise when noise processing is enabled.

  • prefilter_output (ConstantFormatVideoNode) –

    Output of the prefilter stage.

  • tff
Source code
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
def __init__(
    self,
    clip: vs.VideoNode,
    input_type: InputType = InputType.INTERLACE,
    tff: FieldBasedT | bool | None = None,
) -> None:
    """
    Args:
        clip: Clip to process.
        input_type: Indicates processing routine.
        tff: Field order of the clip.
    """

    assert check_variable(clip, self.__class__)

    clip_fieldbased = FieldBased.from_param_or_video(tff, clip, True, self.__class__)

    self.clip = clip
    self.input_type = input_type
    self.tff = clip_fieldbased.is_tff
    self.double_rate = self.input_type != self.InputType.REPAIR

    if self.clip.format.sample_type is vs.FLOAT:
        raise CustomRuntimeError("FLOAT input is not supported!", self.__class__)

    if self.input_type == self.InputType.PROGRESSIVE and clip_fieldbased.is_inter:
        raise CustomRuntimeError(f"{self.input_type} incompatible with interlaced video!", self.__class__)

    if self.input_type in (self.InputType.INTERLACE, self.InputType.REPAIR) and not clip_fieldbased.is_inter:
        raise CustomRuntimeError(f"{self.input_type} incompatible with progressive video!", self.__class__)

basic_output instance-attribute

basic_output: ConstantFormatVideoNode

Output of the basic stage.

bobbed instance-attribute

bobbed: ConstantFormatVideoNode

High quality bobbed clip, initial spatial interpolation.

clip instance-attribute

clip: ConstantFormatVideoNode = clip

Clip to process.

denoise_output instance-attribute

denoise_output: ConstantFormatVideoNode

Output of the denoise stage.

double_rate instance-attribute

double_rate = input_type != REPAIR

draft instance-attribute

draft: ConstantFormatVideoNode

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

final_output instance-attribute

final_output: ConstantFormatVideoNode

Output of the final stage.

input_type instance-attribute

input_type = input_type

motion_blur_output instance-attribute

motion_blur_output: ConstantFormatVideoNode

Output of the motion blur stage.

noise instance-attribute

noise: ConstantFormatVideoNode

Extracted noise when noise processing is enabled.

prefilter_output instance-attribute

prefilter_output: ConstantFormatVideoNode

Output of the prefilter stage.

tff instance-attribute

tff = is_tff

BackBlendMode

Bases: CustomIntEnum

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

Attributes:

  • BOTH

    Perform back-blending both before and after sharpness limiting.

  • NONE

    No back-blending.

  • POSTLIMIT

    Perform back-blending after sharpness limiting.

  • PRELIMIT

    Perform back-blending prior to sharpness limiting.

BOTH class-attribute instance-attribute

BOTH = 3

Perform back-blending both before and after sharpness limiting.

NONE class-attribute instance-attribute

NONE = 0

No back-blending.

POSTLIMIT class-attribute instance-attribute

POSTLIMIT = 2

Perform back-blending after sharpness limiting.

PRELIMIT class-attribute instance-attribute

PRELIMIT = 1

Perform back-blending prior to sharpness limiting.

InputType

Bases: CustomIntEnum

Processing routine to use for the input.

Attributes:

  • INTERLACE

    Deinterlace interlaced input.

  • PROGRESSIVE

    Deshimmer general progressive material that contains less severe problems.

  • REPAIR

    Repair badly deinterlaced material with considerable horizontal artefacts.

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 artefacts.

LosslessMode

Bases: CustomIntEnum

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

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.

NoiseDeintMode

Bases: CustomIntEnum

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

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.

NoiseProcessMode

Bases: CustomIntEnum

How to handle processing noise in the source.

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.

  • NONE

    No noise processing.

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 = 2

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

NONE class-attribute instance-attribute

NONE = 0

No noise processing.

SearchPostProcess

Bases: CustomIntEnum

Prefiltering to apply in order to assist with motion search.

Attributes:

GAUSSBLUR class-attribute instance-attribute

GAUSSBLUR = 1

Gaussian blur.

GAUSSBLUR_EDGESOFTEN class-attribute instance-attribute

GAUSSBLUR_EDGESOFTEN = 2

Gaussian blur & edge softening.

NONE class-attribute instance-attribute

NONE = 0

No post-processing.

SharpLimitMode

Bases: CustomIntEnum

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

Attributes:

NONE class-attribute instance-attribute

NONE = 0

No sharpness limiting.

SPATIAL_POSTSMOOTH class-attribute instance-attribute

SPATIAL_POSTSMOOTH = 3

Spatial sharpness limiting after the final stage.

SPATIAL_PRESMOOTH class-attribute instance-attribute

SPATIAL_PRESMOOTH = 1

Spatial sharpness limiting prior to final stage.

TEMPORAL_POSTSMOOTH class-attribute instance-attribute

TEMPORAL_POSTSMOOTH = 4

Temporal sharpness limiting after the final stage.

TEMPORAL_PRESMOOTH class-attribute instance-attribute

TEMPORAL_PRESMOOTH = 2

Temporal sharpness limiting prior to final stage.

SharpMode

Bases: CustomIntEnum

How to re-sharpen the clip after temporally blurring.

Attributes:

  • NONE

    No re-sharpening.

  • UNSHARP

    Re-sharpening using unsharpening.

  • UNSHARP_MINMAX

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

NONE class-attribute instance-attribute

NONE = 0

No re-sharpening.

UNSHARP class-attribute instance-attribute

UNSHARP = 1

Re-sharpening using unsharpening.

UNSHARP_MINMAX class-attribute instance-attribute

UNSHARP_MINMAX = 2

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

SourceMatchMode

Bases: CustomIntEnum

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

Attributes:

  • BASIC

    Conservative halfway stage that rarely introduces artefacts.

  • 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 artefacts.

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.

analyze

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

Configure parameters for the motion analysis stage.

Parameters:

  • force_tr

    (int, default: 1 ) –

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

  • preset

    (MVToolsPreset, 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.

  • 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, int | 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
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
404
405
406
407
408
409
def analyze(
    self,
    *,
    force_tr: int = 1,
    preset: MVToolsPreset = MVToolsPreset.HQ_SAD,
    blksize: int | tuple[int, int] = 16,
    refine: int = 1,
    thsad_recalc: int | None = None,
    thscd: int | tuple[int | None, int | 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.
        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.
    """

    preset.pop("search_clip", None)

    self.analyze_tr = force_tr
    self.analyze_preset = preset
    self.analyze_blksize = blksize if isinstance(blksize, tuple) else (blksize, blksize)
    self.analyze_refine = refine
    self.analyze_thsad_recalc = thsad_recalc
    self.analyze_thscd = thscd

    return self

back_blend

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

Configure parameters for the back_blend stage.

Parameters:

  • mode

    (BackBlendMode, default: BOTH ) –

    Specifies at which stage to perform back-blending.

  • sigma

    (float, default: 1.4 ) –

    Gaussian blur sigma.

Source code
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
def back_blend(
    self,
    *,
    mode: BackBlendMode = BackBlendMode.BOTH,
    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: Deinterlacer = NNEDI3(nsize=1),
    noise_restore: float = 0.0,
    degrain_args: KwargsT | None = None,
    mask_args: KwargsT | None | Literal[False] = None,
    mask_shimmer_args: KwargsT | None = KwargsT(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

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

    Bobber to use for initial spatial interpolation.

  • noise_restore

    (float, default: 0.0 ) –

    How much noise to restore after this stage.

  • degrain_args

    (KwargsT | None, default: None ) –

    Arguments passed to the binomial_degrain call.

  • mask_args

    (KwargsT | None | Literal[False], default: None ) –

    Arguments passed to MVTools.mask for InputType.REPAIR.

  • mask_shimmer_args

    (KwargsT | None, default: KwargsT(erosion_distance=0) ) –

    Arguments passed to the mask_shimmer call.

Source code
447
448
449
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
def basic(
    self,
    *,
    tr: int = 2,
    thsad: int | tuple[int, int] = 640,
    bobber: Deinterlacer = NNEDI3(nsize=1),
    noise_restore: float = 0.0,
    degrain_args: KwargsT | None = None,
    mask_args: KwargsT | None | Literal[False] = None,
    mask_shimmer_args: KwargsT | None = KwargsT(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
            [InputType.REPAIR][vsdeinterlace.qtgmc.QTempGaussMC.InputType.REPAIR].
        mask_shimmer_args: Arguments passed to the mask_shimmer call.
    """

    self.basic_tr = tr
    self.basic_thsad = thsad
    self.basic_bobber = bobber.copy(tff=self.tff, double_rate=self.double_rate)
    self.basic_noise_restore = noise_restore
    self.basic_degrain_args = fallback(degrain_args, KwargsT())
    self.basic_mask_shimmer_args = fallback(mask_shimmer_args, KwargsT())
    self.basic_mask_args: KwargsT | Literal[False] = fallback(mask_args, KwargsT())

    return self

deinterlace

deinterlace() -> ConstantFormatVideoNode

Start the deinterlacing process.

Returns:

  • ConstantFormatVideoNode

    Deinterlaced clip.

Source code
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
def deinterlace(self) -> ConstantFormatVideoNode:
    """
    Start the deinterlacing process.

    Returns:
        Deinterlaced clip.
    """

    self._apply_prefilter()
    self._apply_analyze()
    self._apply_denoise()
    self._apply_basic()
    self._apply_final()
    self._apply_motion_blur()

    return self.motion_blur_output

denoise

denoise(
    *,
    tr: int = 2,
    func: _DenoiseFuncTr | VSFunctionKwArgs[VideoNode, VideoNode] = partial(
        denoise, sigma=8
    ),
    mode: NoiseProcessMode = IDENTIFY,
    deint: NoiseDeintMode = GENERATE,
    stabilize: tuple[float, float] | Literal[False] = (0.6, 0.2),
    func_comp_args: KwargsT | None = None,
    stabilize_comp_args: KwargsT | None = None
) -> Self

Configure parameters for the denoise stage.

Parameters:

  • tr

    (int, default: 2 ) –

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

  • func

    (_DenoiseFuncTr | VSFunctionKwArgs[VideoNode, VideoNode], default: partial(denoise, sigma=8) ) –

    Denoising function to use.

  • mode

    (NoiseProcessMode, default: IDENTIFY ) –

    Noise handling method to use.

  • deint

    (NoiseDeintMode, default: GENERATE ) –

    Noise deinterlacing method to use.

  • stabilize

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

    Weights to use when blending source noise with compensated noise.

  • func_comp_args

    (KwargsT | None, default: None ) –

    Arguments passed to MVTools.compensate for denoising.

  • stabilize_comp_args

    (KwargsT | None, default: None ) –

    Arguments passed to MVTools.compensate for stabilization.

Source code
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
def denoise(
    self,
    *,
    tr: int = 2,
    func: _DenoiseFuncTr | VSFunctionKwArgs[vs.VideoNode, vs.VideoNode] = partial(DFTTest().denoise, sigma=8),
    mode: NoiseProcessMode = NoiseProcessMode.IDENTIFY,
    deint: NoiseDeintMode = NoiseDeintMode.GENERATE,
    stabilize: tuple[float, float] | Literal[False] = (0.6, 0.2),
    func_comp_args: KwargsT | None = None,
    stabilize_comp_args: KwargsT | 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.
        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
    self.denoise_mode = mode
    self.denoise_deint = deint
    self.denoise_stabilize: tuple[float, float] | Literal[False] = stabilize
    self.denoise_func_comp_args = fallback(func_comp_args, KwargsT())
    self.denoise_stabilize_comp_args = fallback(stabilize_comp_args, KwargsT())

    return self

final

final(
    *,
    tr: int = 3,
    thsad: int | tuple[int, int] = 256,
    noise_restore: float = 0.0,
    degrain_args: KwargsT | None = None,
    mask_shimmer_args: KwargsT | None = None
) -> Self

Configure parameters for the final stage.

Parameters:

  • tr

    (int, default: 3 ) –

    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.0 ) –

    How much noise to restore after this stage.

  • degrain_args

    (KwargsT | None, default: None ) –

    Arguments passed to MVTools.degrain.

  • mask_shimmer_args

    (KwargsT | None, default: None ) –

    mask_shimmer_args: Arguments passed to the mask_shimmer call.

Source code
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
def final(
    self,
    *,
    tr: int = 3,
    thsad: int | tuple[int, int] = 256,
    noise_restore: float = 0.0,
    degrain_args: KwargsT | None = None,
    mask_shimmer_args: KwargsT | None = None,
) -> 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: mask_shimmer_args: Arguments passed to the mask_shimmer call.
    """

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

    return self

lossless

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

Configure parameter for the lossless stage.

Parameters:

  • mode

    (LosslessMode, default: NONE ) –

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

Source code
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
def lossless(
    self,
    *,
    mode: LosslessMode = LosslessMode.NONE,
) -> Self:
    """
    Configure parameter for the lossless stage.

    Args:
        mode: Specifies at which stage to re-weave the original fields.
    """

    self.lossless_mode = mode

    return self

motion_blur

motion_blur(
    *,
    shutter_angle: tuple[int | float, int | float] = (180, 180),
    fps_divisor: int = 1,
    blur_args: KwargsT | None = None,
    mask_args: KwargsT | None | Literal[False] = KwargsT(ml=4)
) -> Self

Configure parameters for the motion blur stage.

Parameters:

  • shutter_angle

    (tuple[int | float, int | 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

    (KwargsT | None, default: None ) –

    Arguments passed to MVTools.flow_blur.

  • mask_args

    (KwargsT | None | Literal[False], default: KwargsT(ml=4) ) –

    Arguments passed to MVTools.mask.

Source code
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
def motion_blur(
    self,
    *,
    shutter_angle: tuple[int | float, int | float] = (180, 180),
    fps_divisor: int = 1,
    blur_args: KwargsT | None = None,
    mask_args: KwargsT | None | Literal[False] = KwargsT(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_args = fallback(blur_args, KwargsT())
    self.motion_blur_mask_args: KwargsT | Literal[False] = fallback(mask_args, KwargsT())

    return self

prefilter

prefilter(
    *,
    tr: int = 2,
    sc_threshold: float | Literal[False] = 0.1,
    postprocess: SearchPostProcess = GAUSSBLUR_EDGESOFTEN,
    strength: tuple[float, float] = (1.9, 0.1),
    limit: tuple[int | float, int | float, int | float] = (3, 7, 2),
    range_expansion_args: KwargsT | None | Literal[False] = None,
    mask_shimmer_args: KwargsT | None = None
) -> Self

Configure parameters for the prefilter stage.

Parameters:

  • tr

    (int, default: 2 ) –

    Radius of the initial temporal binomial smooth.

  • sc_threshold

    (float | Literal[False], 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], default: (1.9, 0.1) ) –

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

  • limit

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

    3-step limiting thresholds for the gaussian blur post-processing.

  • range_expansion_args

    (KwargsT | None | Literal[False], default: None ) –

    Arguments passed to prefilter_to_full_range.

  • mask_shimmer_args

    (KwargsT | None, default: None ) –

    mask_shimmer_args: Arguments passed to the mask_shimmer call.

Source code
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
def prefilter(
    self,
    *,
    tr: int = 2,
    sc_threshold: float | Literal[False] = 0.1,
    postprocess: SearchPostProcess = SearchPostProcess.GAUSSBLUR_EDGESOFTEN,
    strength: tuple[float, float] = (1.9, 0.1),
    limit: tuple[int | float, int | float, int | float] = (3, 7, 2),
    range_expansion_args: KwargsT | None | Literal[False] = None,
    mask_shimmer_args: KwargsT | None = None,
) -> 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 thresholds for the gaussian blur post-processing.
        range_expansion_args: Arguments passed to
            [prefilter_to_full_range][vsdenoise.prefilters.prefilter_to_full_range].
        mask_shimmer_args: mask_shimmer_args: Arguments passed to the mask_shimmer call.
    """

    self.prefilter_tr = tr
    self.prefilter_sc_threshold = sc_threshold
    self.prefilter_postprocess = postprocess
    self.prefilter_blur_strength = strength
    self.prefilter_soften_limit = limit
    self.prefilter_range_expansion_args: KwargsT | Literal[False] = fallback(range_expansion_args, KwargsT())
    self.prefilter_mask_shimmer_args = fallback(mask_shimmer_args, KwargsT())

    return self

sharpen

sharpen(
    *,
    mode: SharpMode | None = None,
    strength: float = 1.0,
    clamp: int | float | tuple[int | float, int | float] = 1,
    thin: float = 0.0
) -> Self

Configure parameters for the sharpen stage.

Parameters:

Source code
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
def sharpen(
    self,
    *,
    mode: SharpMode | None = None,
    strength: float = 1.0,
    clamp: int | float | tuple[int | float, int | float] = 1,
    thin: float = 0.0,
) -> Self:
    """
    Configure parameters for the sharpen stage.

    Args:
        mode: Specifies the type of sharpening to use.
        strength: Sharpening strength.
        clamp: Clamp the sharpening strength of
            [SharpMode.UNSHARP_MINMAX][vsdeinterlace.qtgmc.QTempGaussMC.SharpMode.UNSHARP_MINMAX] to the min/max
            average plus/minus this.
        thin: How much to vertically thin edges.
    """

    if mode is None:
        self.sharp_mode = self.SharpMode.NONE if self.match_mode else self.SharpMode.UNSHARP_MINMAX
    else:
        self.sharp_mode = mode

    self.sharp_strength = strength
    self.sharp_clamp = normalize_seq(clamp, 2)
    self.sharp_thin = thin

    return self

sharpen_limit

sharpen_limit(
    *,
    mode: SharpLimitMode | None = None,
    radius: int = 3,
    clamp: int | float | tuple[int | float, int | float] = 0,
    comp_args: KwargsT | None = None
) -> Self

Configure parameters for the sharpen_limit stage.

Parameters:

  • mode

    (SharpLimitMode | None, default: None ) –

    Specifies type of limiting & at which stage to perform it.

  • radius

    (int, default: 3 ) –

    Radius of sharpness limiting.

  • clamp

    (int | float | tuple[int | float, int | float], default: 0 ) –

    How much undershoot/overshoot to allow.

  • comp_args

    (KwargsT | None, default: None ) –

    Arguments passed to MVTools.compensate for temporal limiting.

Source code
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
def sharpen_limit(
    self,
    *,
    mode: SharpLimitMode | None = None,
    radius: int = 3,
    clamp: int | float | tuple[int | float, int | float] = 0,
    comp_args: KwargsT | 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.
        clamp: How much undershoot/overshoot to allow.
        comp_args: Arguments passed to [MVTools.compensate][vsdenoise.mvtools.mvtools.MVTools.compensate] for
            temporal limiting.
    """

    if mode is None:
        self.limit_mode = self.SharpLimitMode.NONE if self.match_mode else self.SharpLimitMode.TEMPORAL_PRESMOOTH
    else:
        self.limit_mode = mode

    self.limit_radius = radius
    self.limit_clamp = clamp
    self.limit_comp_args = fallback(comp_args, KwargsT())

    return self

source_match

source_match(
    *,
    tr: int = 1,
    bobber: Deinterlacer | None = None,
    mode: SourceMatchMode = NONE,
    similarity: float = 0.5,
    enhance: float = 0.5,
    degrain_args: KwargsT | 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

    (Deinterlacer | None, default: None ) –

    Bobber to use for refined spatial interpolation.

  • 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

    (KwargsT | None, default: None ) –

    Arguments passed to the binomial_degrain call.

Source code
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
def source_match(
    self,
    *,
    tr: int = 1,
    bobber: Deinterlacer | None = None,
    mode: SourceMatchMode = SourceMatchMode.NONE,
    similarity: float = 0.5,
    enhance: float = 0.5,
    degrain_args: KwargsT | 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.
        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.match_tr = tr
    self.match_bobber = fallback(bobber, self.basic_bobber).copy(tff=self.tff, double_rate=self.double_rate)
    self.match_mode = mode
    self.match_similarity = similarity
    self.match_enhance = enhance
    self.match_degrain_args = fallback(degrain_args, KwargsT())

    return self