prefilters ¶
This module implements prefilters for denoisers.
Classes:
-
MultiPrefilter
–A wrapper to apply multiple prefilters in sequence.
-
Prefilter
–Enum representing available filters.
-
PrefilterPartial
–A partially-applied prefilter wrapper.
Functions:
-
prefilter_to_full_range
–Converts a clip to full range if necessary and amplifies dark areas.
Attributes:
AbstractPrefilter ¶
Methods:
-
__call__
–
__call__ ¶
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode | PrefilterPartial
Source code
129 130 131 132 |
|
MultiPrefilter ¶
MultiPrefilter(*prefilters: Prefilter)
Bases: AbstractPrefilter
A wrapper to apply multiple prefilters in sequence.
Stores a sequence of prefilter functions and applies them one after another to a given clip using the same parameters.
Parameters:
Methods:
-
__call__
–Apply a sequence of prefilters to the given clip.
Attributes:
Source code
506 507 508 509 510 511 512 513 |
|
__call__ ¶
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode
Apply a sequence of prefilters to the given clip.
Parameters:
-
clip
¶VideoNode
) –Clip to be preprocessed.
-
planes
¶PlanesT
, default:None
) –Planes to be preprocessed.
-
full_range
¶bool | float
, default:False
) –Whether to return a prefiltered clip in full range.
-
kwargs
¶Any
, default:{}
) –Additional keyword arguments passed to each prefilter.
Returns:
-
VideoNode
–Preprocessed clip.
Source code
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
|
Prefilter ¶
Bases: AbstractPrefilter
, CustomEnum
Enum representing available filters.
These are mainly thought of as prefilters for MVTools but can be used standalone as-is.
Methods:
-
__call__
–Run the selected prefilter.
Attributes:
-
BILATERAL
–Classic bilateral filtering or edge-preserving bilateral multi pass filtering.
-
BM3D
–Normal spatio-temporal denoising using BM3D.
-
DFTTEST
–Denoising in frequency domain with dfttest and an adaptive mask for retaining details.
-
FLUXSMOOTHST
–Perform smoothing using
zsmooth.FluxSmoothST
. -
GAUSS
–Gaussian blur.
-
MINBLUR
–Minimum difference of a gaussian/median blur.
-
NLMEANS
–Denoising with NLMeans.
-
NONE
–Don't do any prefiltering. Returns the clip as-is.
BILATERAL class-attribute
instance-attribute
¶
BILATERAL = auto()
Classic bilateral filtering or edge-preserving bilateral multi pass filtering.
BM3D class-attribute
instance-attribute
¶
BM3D = auto()
Normal spatio-temporal denoising using BM3D.
DFTTEST class-attribute
instance-attribute
¶
DFTTEST = auto()
Denoising in frequency domain with dfttest and an adaptive mask for retaining details.
FLUXSMOOTHST class-attribute
instance-attribute
¶
FLUXSMOOTHST = auto()
Perform smoothing using zsmooth.FluxSmoothST
.
MINBLUR class-attribute
instance-attribute
¶
MINBLUR = auto()
Minimum difference of a gaussian/median blur.
NONE class-attribute
instance-attribute
¶
NONE = auto()
Don't do any prefiltering. Returns the clip as-is.
__call__ ¶
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
*,
temp_thr: float | Sequence[float] = 2.0,
spat_thr: float | Sequence[float] | None = 2.0,
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
*,
sloc: SLocationT | MultiDim | None = {0.0: 4.0, 0.2: 9.0, 1.0: 15.0},
pref_mask: VideoNode | Literal[False] | tuple[int, int] = (16, 75),
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
*,
h: float | Sequence[float] = 7.0,
s: int | Sequence[int] = 2,
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
*,
sigma: float | Sequence[float] = 10,
radius: int | Sequence[int | None] | None = 1,
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
*,
sigmaS: float | list[float] | tuple[float | list[float], ...] = 3.0,
sigmaR: float | list[float] | tuple[float | list[float], ...] = 0.02,
**kwargs: Any,
) -> VideoNode
__call__(
*,
planes: PlanesT = None,
full_range: bool | float = False,
temp_thr: float | Sequence[float] = 2.0,
spat_thr: float | Sequence[float] | None = 2.0,
**kwargs: Any
) -> PrefilterPartial
__call__(
*,
planes: PlanesT = None,
full_range: bool | float = False,
sloc: SLocationT | MultiDim | None = {0.0: 4.0, 0.2: 9.0, 1.0: 15.0},
pref_mask: VideoNode | Literal[False] | tuple[int, int] = (16, 75),
**kwargs: Any
) -> PrefilterPartial
__call__(
*,
planes: PlanesT = None,
full_range: bool | float = False,
h: float | Sequence[float] = 7.0,
s: int | Sequence[int] = 2,
**kwargs: Any
) -> PrefilterPartial
__call__(
*,
planes: PlanesT = None,
full_range: bool | float = False,
sigma: float | Sequence[float] = 10,
radius: int | Sequence[int | None] | None = 1,
**kwargs: Any
) -> PrefilterPartial
__call__(
*,
planes: PlanesT = None,
full_range: bool | float = False,
sigmaS: float | list[float] | tuple[float | list[float], ...] = 3.0,
sigmaR: float | list[float] | tuple[float | list[float], ...] = 0.02,
**kwargs: Any
) -> PrefilterPartial
__call__(
clip: VideoNode,
/,
planes: PlanesT = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode
__call__(
*, planes: PlanesT = None, full_range: bool | float = False, **kwargs: Any
) -> PrefilterPartial
__call__(
clip: VideoNode | MissingT = MISSING,
/,
planes: PlanesT = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode | PrefilterPartial
Run the selected prefilter.
Parameters:
-
clip
¶VideoNode | MissingT
, default:MISSING
) –Clip to be preprocessed.
-
planes
¶PlanesT
, default:None
) –Planes to be preprocessed.
-
full_range
¶bool | float
, default:False
) –Whether to return a prefiltered clip in full range.
-
kwargs
¶Any
, default:{}
) –Additional arguments to pass to the specified prefilter.
Returns:
-
VideoNode | PrefilterPartial
–Preprocessed clip or Partial Prefilter.
Source code
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 |
|
PrefilterPartial ¶
Bases: AbstractPrefilter
A partially-applied prefilter wrapper.
Stores a prefilter function, allowing it to be reused with different clips.
Parameters:
-
prefilter
¶Prefilter
) –Prefilter enumeration.
-
planes
¶PlanesT
) –Planes to be preprocessed.
-
full_range
¶bool | float
) –Whether to return a prefiltered clip in full range.
-
kwargs
¶Any
, default:{}
) –Arguments for the specified prefilter.
Methods:
-
__call__
–Apply the prefilter to the given clip with optional argument overrides.
Attributes:
-
full_range
– -
kwargs
– -
planes
– -
prefilter
–
Source code
461 462 463 464 465 466 467 468 469 470 471 472 473 |
|
__call__ ¶
__call__(
clip: VideoNode,
/,
planes: PlanesT | MissingT = MISSING,
full_range: bool | float | MissingT = MISSING,
**kwargs: Any,
) -> VideoNode
Apply the prefilter to the given clip with optional argument overrides.
Parameters:
-
clip
¶VideoNode
) –Clip to be preprocessed.
-
planes
¶PlanesT | MissingT
, default:MISSING
) –Optional override for the planes to preprocess. If not provided, the default set in the constructor is used.
-
full_range
¶bool | float | MissingT
, default:MISSING
) –Optional override for full range setting. If not provided, the default set in the constructor is used.
-
kwargs
¶Any
, default:{}
) –Additional keyword arguments to override or extend the stored ones.
Returns:
-
VideoNode
–Preprocessed clip.
Source code
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
|
prefilter_to_full_range ¶
prefilter_to_full_range(
clip: VideoNode, slope: float = 2.0, smooth: float = 0.0625
) -> ConstantFormatVideoNode
Converts a clip to full range if necessary and amplifies dark areas. Essentially acts like a luma-based multiplier on the SAD when used as an mvtools prefilter.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
slope
¶float
, default:2.0
) –Slope to amplify the scale of the dark areas relative to bright areas.
-
smooth
¶float
, default:0.0625
) –Indicates the length of the transition between the amplified dark areas and normal range conversion.
Returns:
-
ConstantFormatVideoNode
–Range expanded clip.
Source code
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 568 569 |
|