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. will capture more source detail and reduce oversharpening / haloing.

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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
def __init__(
    self,
    clip: vs.VideoNode,
    input_type: InputType = InputType.INTERLACE,
    tff: FieldBasedT | bool | None = None,
) -> None:
    """
    :param clip:          Clip to process.
    :param input_type:    Indicates processing routine.
    :param 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 = False if self.input_type == self.InputType.REPAIR else True

    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 = False if input_type == REPAIR else True

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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
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.

    :param force_tr:        Always analyze motion to at least this, even if otherwise unnecessary.
    :param preset:          MVTools preset defining base values for the MVTools object.
    :param blksize:         Size of a block. Larger blocks are less sensitive to noise, are faster, but also less accurate.
    :param refine:          Number of times to recalculate motion vectors with halved block size.
    :param 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.
    :param 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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
def back_blend(
    self,
    *,
    mode: BackBlendMode = BackBlendMode.BOTH,
    sigma: float = 1.4,
) -> Self:
    """
    Configure parameters for the back_blend stage.

    :param mode:     Specifies at which stage to perform back-blending.
    :param 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 [_binomial_degrain][vsdeinterlace.qtgmc.QTempGaussMC._binomial_degrain].

  • 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 [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].

Source code
338
339
340
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
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.

    :param tr:                  Temporal radius of the motion compensated binomial smooth.
    :param thsad:               Thsad of the motion compensated binomial smooth.
    :param bobber:              Bobber to use for initial spatial interpolation.
    :param noise_restore:       How much noise to restore after this stage.
    :param degrain_args:        Arguments passed to [_binomial_degrain][vsdeinterlace.qtgmc.QTempGaussMC._binomial_degrain].
    :param mask_args:           Arguments passed to [MVTools.mask][vsdenoise.mvtools.mvtools.MVTools.mask]
                                for [InputType.REPAIR][vsdeinterlace.qtgmc.QTempGaussMC.InputType.REPAIR].
    :param mask_shimmer_args:   Arguments passed to [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].
    """

    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
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
def deinterlace(self) -> ConstantFormatVideoNode:
    """
    Start the deinterlacing process.

    :return:    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
305
306
307
308
309
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
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.

    :param tr:                     Temporal radius of the denoising function & it's motion compensation.
    :param func:                   Denoising function to use.
    :param mode:                   Noise handling method to use.
    :param deint:                  Noise deinterlacing method to use.
    :param stabilize:              Weights to use when blending source noise with compensated noise.
    :param func_comp_args:         Arguments passed to [MVTools.compensate][vsdenoise.mvtools.mvtools.MVTools.compensate] for denoising.
    :param 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 ) –

    Arguments passed to [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].

Source code
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
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.

    :param tr:                   Temporal radius of the motion compensated smooth.
    :param thsad:                Thsad of the motion compensated smooth.
    :param noise_restore:        How much noise to restore after this stage.
    :param degrain_args:         Arguments passed to [MVTools.degrain][vsdenoise.mvtools.mvtools.MVTools.degrain].
    :param mask_shimmer_args:    Arguments passed to [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].
    """

    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
402
403
404
405
406
407
408
409
410
411
412
413
414
415
def lossless(
    self,
    *,
    mode: LosslessMode = LosslessMode.NONE,
) -> Self:
    """
    Configure parameter for the lossless stage.

    :param 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
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
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.

    :param shutter_angle:    Tuple containing the source and output shutter angle. Will apply motion blur if they do not match.
    :param fps_divisor:      Factor by which to reduce framerate.
    :param blur_args:        Arguments passed to [MVTools.flow_blur][vsdenoise.mvtools.mvtools.MVTools.flow_blur].
    :param 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 ) –

    Arguments passed to [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].

Source code
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
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.

    :param tr:                      Radius of the initial temporal binomial smooth.
    :param sc_threshold:            Threshold for scene changes, disables sc detection if False.
    :param postprocess:             Post-processing routine to use.
    :param strength:                Tuple containing gaussian blur sigma & blend weight of the blur.
    :param limit:                   3-step limiting thresholds for the gaussian blur post-processing.
    :param range_expansion_args:    Arguments passed to [prefilter_to_full_range][vsdenoise.prefilters.prefilter_to_full_range].
    :param mask_shimmer_args:       Arguments passed to [_mask_shimmer][vsdeinterlace.qtgmc.QTempGaussMC._mask_shimmer].
    """

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

    :param mode:        Specifies the type of sharpening to use.
    :param strength:    Sharpening strength.
    :param clamp:       Clamp the sharpening strength of
                        [SharpMode.UNSHARP_MINMAX][vsdeinterlace.qtgmc.QTempGaussMC.SharpMode.UNSHARP_MINMAX]
                        to the min/max average plus/minus this.
    :param 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
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
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.

    :param mode:         Specifies type of limiting & at which stage to perform it.
    :param radius:       Radius of sharpness limiting.
    :param clamp:        How much undershoot/overshoot to allow.
    :param 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 [_binomial_degrain][vsdeinterlace.qtgmc.QTempGaussMC._binomial_degrain].

Source code
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
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.

    :param tr:              Temporal radius of the refinement motion compensated binomial smooth.
    :param bobber:          Bobber to use for refined spatial interpolation.
    :param mode:            Specifies number of refinement steps to perform.
    :param similarity:      Temporal similarity of the error created by smoothing.
    :param enhance:         Sharpening strength prior to source match refinement.
    :param degrain_args:    Arguments passed to [_binomial_degrain][vsdeinterlace.qtgmc.QTempGaussMC._binomial_degrain].
    """

    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