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 ¶
Bases: ABC
Methods:
-
__call__–
__call__ abstractmethod ¶
__call__(
clip: VideoNode,
planes: Planes = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode | PrefilterPartial
Source code in vsdenoise/prefilters.py
138 139 140 141 | |
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 in vsdenoise/prefilters.py
554 555 556 557 558 559 560 561 562 | |
__call__ ¶
__call__(
clip: VideoNode,
planes: Planes = 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¶Planes, 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 in vsdenoise/prefilters.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
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.
-
from_param–Return the enum value from a parameter.
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: Planes = 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: Planes = None,
full_range: bool | float = False,
*,
sloc: SLocationLike | MultiDim | None = {0.0: 4.0, 0.2: 9.0, 1.0: 15.0},
pref_mask: VideoNode | Literal[False] | tuple[int, int] = (16, 75),
backend: Backend = AUTO,
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
planes: Planes = None,
full_range: bool | float = False,
*,
h: float | Sequence[float] = 7.0,
s: int | Sequence[int] = 2,
**kwargs: Any,
) -> VideoNode
__call__(
clip: VideoNode,
planes: Planes = 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: Planes = 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: Planes = 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: Planes = None,
full_range: bool | float = False,
sloc: SLocationLike | MultiDim | None = {0.0: 4.0, 0.2: 9.0, 1.0: 15.0},
pref_mask: VideoNode | Literal[False] | tuple[int, int] = (16, 75),
backend: Backend = AUTO,
**kwargs: Any,
) -> PrefilterPartial
__call__(
*,
planes: Planes = None,
full_range: bool | float = False,
h: float | Sequence[float] = 7.0,
s: int | Sequence[int] = 2,
**kwargs: Any,
) -> PrefilterPartial
__call__(
*,
planes: Planes = None,
full_range: bool | float = False,
sigma: float | Sequence[float] = 10,
radius: int | Sequence[int | None] | None = 1,
**kwargs: Any,
) -> PrefilterPartial
__call__(
*,
planes: Planes = 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: Planes = None,
full_range: bool | float = False,
**kwargs: Any,
) -> VideoNode
__call__(
*, planes: Planes = None, full_range: bool | float = False, **kwargs: Any
) -> PrefilterPartial
__call__(
clip: VideoNode | MissingT = MISSING,
planes: Planes = 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¶Planes, 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 in vsdenoise/prefilters.py
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 492 493 494 495 496 497 | |
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:
-
NotFoundEnumValue–Variable not found in the given enum.
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 | |
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¶Planes) –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 in vsdenoise/prefilters.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 | |
__call__ ¶
__call__(
clip: VideoNode,
planes: Planes | 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¶Planes | 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 in vsdenoise/prefilters.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
prefilter_to_full_range ¶
prefilter_to_full_range(
clip: VideoNode,
slope: float = 2.0,
smooth: float = 0.0625,
func: FuncExcept | None = None,
) -> VideoNode
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:
-
VideoNode–Range expanded clip.
Source code in vsdenoise/prefilters.py
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | |