fft ¶
This module implements wrappers for FFT (Fast Fourier Transform) based plugins.
Classes:
-
DFTTest
–2D/3D frequency domain denoiser using Discrete Fourier transform.
Functions:
-
fft3d
–Applies FFT3DFilter, a 3D frequency-domain filter used for strong denoising and mild sharpening.
Attributes:
-
SLocationT
–A type that represents various ways to specify a location in the frequency domain for denoising operations.
Frequency module-attribute
¶
Represents the frequency value in the frequency domain.
The value is a float
that represents the magnitude or position in the frequency spectrum.
SLocationT module-attribute
¶
SLocationT = Union[
int,
float,
SLocation,
Sequence[Frequency | Sigma],
Sequence[tuple[Frequency, Sigma]],
Mapping[Frequency, Sigma],
]
A type that represents various ways to specify a location in the frequency domain for denoising operations.
The SLocationT
type can be one of the following:
int
orfloat
: A single frequency value (for 1D frequency location).DFTTest.SLocation
: A structured class for defining frequency locations in a more complex manner.Sequence[Frequency, Sigma]
: A sequence (e.g., list or tuple) that alternates betweenFrequency
andSigma
values. The sequence must have an even number of items, where each frequency is followed by its corresponding sigma. For example:[0.0, 8.0, 0.5, 16.0]
where0.0
is the frequency and8.0
is its corresponding sigma, and so on.Sequence[tuple[Frequency, Sigma]]
: A sequence of tuples, where each tuple contains aFrequency
and aSigma
.Mapping[Frequency, Sigma]
: A dictionary (Mapping) where eachFrequency
key maps to a correspondingSigma
value.
The sequence or mapping must represent a pairing of frequency and sigma values for denoising operations. In the case of a sequence like Sequence[Frequency, Sigma]
, it is essential that the number of items is even, ensuring every frequency has an associated sigma.
Sigma module-attribute
¶
Represents the sigma value, which is typically associated with noise standard deviation.
Used to indicate the level of noise or variance in the signal, and it is represented as a float
value. A higher sigma means more noise in the signal.
DFTTest ¶
DFTTest(
clip: VideoNode | None = None,
backend: Backend = AUTO,
sloc: SLocationT | MultiDim | None = None,
**kwargs: Any
)
2D/3D frequency domain denoiser using Discrete Fourier transform.
Initializes the DFTTest
class with the provided clip, backend, and frequency location.
Example:
dfttest = DFTTest(clip, DFTTest.Backend.OLD)
denoised_low_frequencies = dfttest.denoise({0: 16, 0.25: 8, 0.5:0, 1.0: 0})
denoised_high_frequencies = dfttest.denoise([(0, 0), (0.5, 0), (0.75, 16), (1.0, 32)])
Parameters:
-
clip
¶VideoNode | None
, default:None
) –Source clip.
-
backend
¶Backend
, default:AUTO
) –The backend to use processing.
-
sloc
¶SLocationT | MultiDim | None
, default:None
) –The frequency location for denoising.
-
kwargs
¶Any
, default:{}
) –Additional parameters to configure the denoising process.
Classes:
-
Backend
–Enum representing available backends on which to run the plugin.
-
FilterType
–Enumeration of filtering types used in DFTTest plugin.
-
SLocation
–A helper class for handling sigma values as functions of frequency in different dimensions.
-
SynthesisType
–Enumeration of synthesis window types used in DFTTest plugin.
Methods:
-
denoise
–Denoises a clip using Discrete Fourier Transform (DFT).
-
extract_freq
–Extracts the frequency domain from the given clip by subtracting the denoised clip from the original.
-
insert_freq
–Inserts the frequency domain from one clip into another by merging the frequency information.
-
merge_freq
–Merges the low and high-frequency components by applying denoising to the low-frequency component.
Attributes:
-
backend
– -
clip
– -
default_args
– -
default_slocation
–
Source code
841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 |
|
Backend ¶
Bases: _BackendBase
Enum representing available backends on which to run the plugin.
Methods:
-
DFTTest
–Applies the DFTTest denoising filter using the plugin associated with the selected backend.
-
__call__
–This method is used to apply the specified backend configuration with provided keyword arguments.
-
resolve
–Resolves the appropriate DFTTest backend to use based on availability.
Attributes:
-
AUTO
–Automatically select the most appropriate backend based on system capabilities.
-
CPU
–Modern CPU backend using optimized multi-threaded CPU code.
-
GCC
–CPU backend compiled with GCC.
-
HIPRTC
–AMD GPU backend using HIPRTC (HIP Runtime Compilation).
-
NVRTC
–NVIDIA GPU backend using NVRTC (NVIDIA Runtime Compilation).
-
OLD
–Legacy DFTTest implementation by HolyWu.
-
cuFFT
–NVIDIA GPU backend using precompiled CUDA and cuFFT.
-
hipFFT
–AMD GPU backend using precompiled HIP and hipFFT.
-
kwargs
– -
plugin
(Plugin
) –Returns the appropriate DFTTest plugin based on the current backend.
Source code
668 669 670 |
|
AUTO class-attribute
instance-attribute
¶
AUTO = 'auto'
Automatically select the most appropriate backend based on system capabilities. Typically prioritizes GPU backends if available, otherwise falls back to CPU.
CPU class-attribute
instance-attribute
¶
CPU = 'dfttest2_cpu'
Modern CPU backend using optimized multi-threaded CPU code.
HIPRTC class-attribute
instance-attribute
¶
HIPRTC = 'dfttest2_hiprtc'
AMD GPU backend using HIPRTC (HIP Runtime Compilation).
NVRTC class-attribute
instance-attribute
¶
NVRTC = 'dfttest2_nvrtc'
NVIDIA GPU backend using NVRTC (NVIDIA Runtime Compilation).
cuFFT class-attribute
instance-attribute
¶
cuFFT = 'dfttest2_cuda'
NVIDIA GPU backend using precompiled CUDA and cuFFT.
hipFFT class-attribute
instance-attribute
¶
hipFFT = 'dfttest2_hip'
AMD GPU backend using precompiled HIP and hipFFT.
plugin property
¶
plugin: Plugin
Returns the appropriate DFTTest plugin based on the current backend.
Returns:
-
Plugin
–The corresponding DFTTest plugin for the resolved backend.
DFTTest ¶
Applies the DFTTest denoising filter using the plugin associated with the selected backend.
Parameters:
-
clip
¶VideoNode
) –Source clip.
-
*args
¶Any
, default:()
) –Positional arguments passed to the selected plugin.
-
**kwargs
¶Any
, default:{}
) –Keyword arguments passed to the selected plugin.
Returns:
-
ConstantFormatVideoNode
–Denoised clip.
Raises:
-
CustomRuntimeError
–If the selected backend is not available or unsupported.
Source code
807 808 809 810 811 812 813 814 815 816 817 |
|
__call__ ¶
__call__(**kwargs: Any) -> Backend
This method is used to apply the specified backend configuration with provided keyword arguments.
Depending on the backend, the arguments may represent device IDs, streams, or other backend-specific settings.
Parameters:
Returns:
-
Backend
–The configured backend with applied parameters.
Source code
787 788 789 790 791 792 793 794 795 796 797 798 799 |
|
resolve cached
¶
resolve() -> Self
Resolves the appropriate DFTTest backend to use based on availability.
If the current instance is not DFTTest.Backend.AUTO, it returns itself. Otherwise, it attempts to select the best available backend.
Returns:
-
Self
–The resolved DFTTest.Backend to use for processing.
Raises:
-
CustomRuntimeError
–If no supported DFTTest implementation is available on the system.
Source code
819 820 821 822 823 824 825 826 827 828 829 830 |
|
FilterType ¶
Bases: CustomIntEnum
Enumeration of filtering types used in DFTTest plugin.
These filters define how the real and imaginary parts of each complex DFT coefficient are scaled (via mult
) during denoising, based on their power spectrum density (PSD).
The term psd refers to the power spectral density, computed as psd = real² + imag²
.
Attributes:
-
MULT
–Constant multiplier.
-
MULT_PSD
–Conditional multiplier based on PSD range.
-
MULT_RANGE
–Smooth range-based multiplier.
-
THR
–Hard threshold filter.
-
WIENER
–Generalized Wiener filter.
MULT class-attribute
instance-attribute
¶
MULT = 2
Constant multiplier.
Applies a fixed scaling factor to all coefficients, regardless of PSD.
Formula:
mult = sigma
MULT_PSD class-attribute
instance-attribute
¶
MULT_PSD = 3
Conditional multiplier based on PSD range.
Switches between two scaling values depending on whether psd
falls within a specific range.
Formula:
mult = sigma if (pmin <= psd <= pmax)
sigma2 otherwise
MULT_RANGE class-attribute
instance-attribute
¶
MULT_RANGE = 4
Smooth range-based multiplier.
Computes a smooth gain based on PSD and specified min/max bounds.
Formula:
mult = sigma * sqrt((psd * pmax) / ((psd + pmin) * (psd + pmax)))
THR class-attribute
instance-attribute
¶
THR = 1
Hard threshold filter.
Removes frequency components below a given PSD threshold.
Formula:
mult = 0.0 if psd < sigma else 1.0
WIENER class-attribute
instance-attribute
¶
WIENER = 0
Generalized Wiener filter.
Suppresses noise while preserving signal using an adaptive formula.
Formula:
mult = max((psd - sigma) / psd, 0) ** f0beta
SLocation ¶
SLocation(
locations: (
Sequence[Frequency | Sigma]
| Sequence[tuple[Frequency, Sigma]]
| Mapping[Frequency, Sigma]
),
interpolate: InterMode | None = None,
strict: bool = True,
)
Bases: Mapping[Frequency, Sigma]
A helper class for handling sigma values as functions of frequency in different dimensions.
This class allows you to specify and interpolate sigma values at different frequency locations. The frequency range is normalized to [0.0,1.0] with 0.0 being the lowest frequency and 1.0 being the highest. The class also supports handling sigma values as a function of horizontal (ssx), vertical (ssy), and temporal (sst) frequencies.
Initializes the SLocation object by processing frequency-sigma pairs and sorting them.
Example:
sloc = DFTTest.SLocation(
[(0.0, 4), (0.25, 8), (0.5, 10), (0.75, 32), (1.0, 64)], DFTTest.SLocation.InterMode.SPLINE
)
>>> sloc # rounded to 3 digits
>>> {
0.0: 4, 0.053: 4.848, 0.105: 5.68, 0.158: 6.528, 0.211: 7.376, 0.25: 8, 0.263: 8.104, 0.316: 8.528,
0.368: 8.944, 0.421: 9.368, 0.474: 9.792, 0.5: 10, 0.526: 12.288, 0.579: 16.952, 0.632: 21.616, 0.684: 26.192,
0.737: 30.856, 0.75: 32, 0.789: 36.992, 0.842: 43.776, 0.895: 50.56, 0.947: 57.216, 1.0: 64
}
Parameters:
-
locations
¶Sequence[Frequency | Sigma] | Sequence[tuple[Frequency, Sigma]] | Mapping[Frequency, Sigma]
) –A sequence of tuples or a dictionary that specifies frequency and sigma pairs.
-
interpolate
¶InterMode | None
, default:None
) –The interpolation method to be used for sigma values. If
None
, no interpolation is done. -
strict
¶bool
, default:True
) –If
True
, raises an error if values are out of bounds. IfFalse
, it will clamp values to the bounds.
Raises:
-
CustomValueError
–If
locations
has not an even number of items.
Classes:
-
InterMode
–Interpolation modes for sigma values in
SLocation
. -
MultiDim
–A helper class for handling multi-dimensional frequency-sigma mappings for horizontal, vertical,
Methods:
-
NoProcess
–Returns a pre-defined
SLocation
instance that performs no processing (i.e., sigma is zero for all locations). -
bounds_check
–Checks and bounds the sigma values to the specified limits.
-
from_param
–Converts a frequency-sigma pair or a literal
False
to anSLocation
instance. -
interpolate
–Interpolates the sigma values across a specified resolution.
Attributes:
-
frequencies
(tuple[Frequency, ...]
) –The list of frequency locations.
-
sigmas
(tuple[Sigma, ...]
) –The corresponding sigma values for each frequency.
Source code
260 261 262 263 264 265 266 267 268 269 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 304 305 306 307 308 309 |
|
frequencies instance-attribute
¶
The list of frequency locations.
sigmas instance-attribute
¶
The corresponding sigma values for each frequency.
InterMode ¶
Bases: CustomEnum
Interpolation modes for sigma values in SLocation
.
Defines how sigma values should be interpolated across frequency locations.
Methods:
-
__call__
–Interpolates sigma values for given frequency locations. Can handle multiple locations for horizontal,
Attributes:
-
CUBIC
–Cubic Interpolation:
-
LINEAR
–Linear Interpolation:
-
NEAREST
–Nearest Neighbor Interpolation:
-
NEAREST_UP
–Nearest Neighbor with Rounding Up:
-
QUADRATIC
–Quadratic Interpolation:
-
SPLINE
–Spline Interpolation:
-
SPLINE_LINEAR
–Spline-Linear Interpolation:
-
ZERO
–Zero Order Hold (ZOH):
CUBIC class-attribute
instance-attribute
¶
CUBIC = 'cubic'
Cubic Interpolation:
Performs cubic interpolation, fitting a third-degree polynomial through the data points.
This is commonly used to produce smooth and visually appealing curves, especially when higher smoothness is needed between data points.
LINEAR class-attribute
instance-attribute
¶
LINEAR = 'linear'
Linear Interpolation:
Performs a linear interpolation between given frequency and sigma values. This is the default interpolation method.
This method connects adjacent points with straight lines and is typically used when data points change at a constant rate.
NEAREST class-attribute
instance-attribute
¶
NEAREST = 'nearest'
Nearest Neighbor Interpolation:
Uses the nearest value for interpolation. This method does not smooth the data, but rather uses the value closest to the target frequency.
This can result in discontinuous transitions, especially if the data is not uniform.
NEAREST_UP class-attribute
instance-attribute
¶
NEAREST_UP = 'nearest-up'
Nearest Neighbor with Rounding Up:
A variation of nearest neighbor interpolation where the value is always rounded up.
This can be useful when you want to ensure that the sigma value is never lower than a certain threshold, avoiding underestimation.
QUADRATIC class-attribute
instance-attribute
¶
QUADRATIC = 'quadratic'
Quadratic Interpolation:
Performs quadratic interpolation, fitting a second-degree polynomial through the data points.
This method creates a parabolic curve between points, which can provide better smoothness for certain types of data.
SPLINE class-attribute
instance-attribute
¶
SPLINE = 1
Spline Interpolation:
Performs a spline interpolation between given frequency and sigma values.
This method fits a smooth curve (using spline functions) through the given data points, resulting in a smoother transition between values than linear interpolation.
SPLINE_LINEAR class-attribute
instance-attribute
¶
SPLINE_LINEAR = 'slinear'
Spline-Linear Interpolation:
A combination of spline interpolation with linear interpolation for smoother transitions.
This method combines spline interpolation with linear methods, making it useful for smoother transitions but retaining linear simplicity where needed.
ZERO class-attribute
instance-attribute
¶
ZERO = 'zero'
Zero Order Hold (ZOH):
A simple method that holds the last value before the target frequency location.
This is equivalent to piecewise constant interpolation, where the sigma value is "held" at the last known value until the next point.
__call__ ¶
__call__(
h_loc: SLocationT | None,
v_loc: SLocationT | None,
t_loc: SLocationT | None,
/,
*,
res: int = 20,
digits: int = 3,
) -> MultiDim
__call__(
*locations: SLocationT | None, res: int = 20, digits: int = 3
) -> SLocation | None | MultiDim
Interpolates sigma values for given frequency locations. Can handle multiple locations for horizontal, vertical, and temporal frequencies.
Parameters:
-
locations
¶SLocationT | None
, default:()
) –The frequency locations for interpolation.
-
res
¶int
, default:20
) –The resolution of the interpolation (default is 20).
-
digits
¶int
, default:3
) –The precision of the frequency values (default is 3 decimal places).
Returns:
-
SLocation | None | MultiDim
–The interpolated
SLocation
object or aMultiDim
object if multiple locations are provided.
Source code
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
MultiDim ¶
MultiDim(
horizontal: SLocationT | Literal[False] | None = None,
vertical: SLocationT | Literal[False] | None = None,
temporal: SLocationT | Literal[False] | None = None,
)
A helper class for handling multi-dimensional frequency-sigma mappings for horizontal, vertical, and temporal dimensions.
Initializes a MultiDim
object with specified frequency-sigma mappings for horizontal, vertical, and temporal dimensions.
Example: Denoise only on the vertical dimension:
sloc = DFTTest.SLocation.MultiDim(vertical=[(0.0, 8.0), (0.25, 16.0), (0.5, 0.0), (0.75, 16.0), (1.0, 0.0)])
denoised = DFTTest(clip).denoise(sloc)
Parameters:
-
horizontal
¶SLocationT | Literal[False] | None
, default:None
) –The sigma values for horizontal frequency locations.
-
vertical
¶SLocationT | Literal[False] | None
, default:None
) –The sigma values for vertical frequency locations.
-
temporal
¶SLocationT | Literal[False] | None
, default:None
) –The sigma values for temporal frequency locations.
Raises:
-
CustomValueError
–If no dimension is specified.
Attributes:
-
horizontal
– -
temporal
– -
vertical
–
Source code
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 |
|
NoProcess classmethod
¶
NoProcess() -> Self
Returns a pre-defined SLocation
instance that performs no processing (i.e., sigma is zero for all locations).
Returns:
-
Self
–A
SLocation
instance with no processing.
Source code
451 452 453 454 455 456 457 458 459 |
|
bounds_check classmethod
¶
bounds_check(
values: Sequence[float],
bounds: tuple[float | None, float | None],
strict: bool = False,
) -> list[float]
Checks and bounds the sigma values to the specified limits.
Parameters:
-
values
¶Sequence[float]
) –The list of sigma values to check.
-
bounds
¶tuple[float | None, float | None]
) –The valid bounds for the sigma values.
-
strict
¶bool
, default:False
) –If
True
, raises an error for out-of-bounds values, otherwise clamps them to bounds.
Returns:
Source code
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 |
|
from_param classmethod
¶
from_param(location: SLocationT | Literal[False]) -> Self
from_param(location: SLocationT | Literal[False] | None) -> Self | None
from_param(location: SLocationT | Literal[False] | None) -> Self | None
Converts a frequency-sigma pair or a literal False
to an SLocation
instance. Returns None
if no processing.
Parameters:
-
location
¶SLocationT | Literal[False] | None
) –A frequency-sigma pair,
False
for no processing, orNone
.
Returns:
-
Self | None
–An
SLocation
instance orNone
.
Source code
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
|
interpolate ¶
Interpolates the sigma values across a specified resolution.
Parameters:
-
method
¶InterMode
, default:LINEAR
) –The interpolation method to use.
-
res
¶int
, default:20
) –The resolution of the interpolation (default is 20).
-
digits
¶int
, default:3
) –The precision of the frequency values (default is 3 decimal places).
Returns:
-
SLocation
–A new
SLocation
instance with interpolated sigma values.
Source code
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
SynthesisType ¶
Bases: CustomIntEnum
Enumeration of synthesis window types used in DFTTest plugin.
These constants are used with the swin
(spatial) and twin
(temporal) parameters to specify the window function applied during frequency-domain processing.
Attributes:
-
BARLETT
–Bartlett window (8). Also known as a triangular window; moderate leakage reduction.
-
BARLETT_HANN
–Bartlett-Hann window (9). Hybrid of Bartlett and Hanning with a smoother taper.
-
BLACKMAN
–Blackman window (2). Better side lobe attenuation than Hamming or Hanning at the cost of wider main lobe.
-
BLACKMAN_HARRIS_4TERM
–4-term Blackman-Harris window (3). Low side lobes, ideal for high dynamic range applications.
-
BLACKMAN_HARRIS_7TERM
–7-term Blackman-Harris window (5). Extended version with even greater side lobe suppression.
-
BLACKMAN_NUTTALL
–Blackman-Nuttall window (11). Variant of Nuttall with even stronger side lobe suppression.
-
FLAT_TOP
–Flat top window (6). Optimized for amplitude accuracy and minimizing scalloping loss.
-
HAMMING
–Hamming window (1). Similar to Hanning but with slightly reduced side lobe attenuation.
-
HANNING
–Hanning window (0). A raised cosine window with good frequency resolution and low spectral leakage.
-
KAISER_BESSEL
–Kaiser-Bessel window (4). Adjustable window (beta parameter) balancing resolution and leakage.
-
NUTTALL
–Nuttall window (10). Four-term cosine window with very low side lobes.
-
RECTANGULAR
–Rectangular window (7). Equivalent to no windowing; highest resolution, but worst leakage.
BARLETT class-attribute
instance-attribute
¶
BARLETT = 8
Bartlett window (8). Also known as a triangular window; moderate leakage reduction.
See: https://en.wikipedia.org/wiki/Window_function#Bartlett_window
BARLETT_HANN class-attribute
instance-attribute
¶
BARLETT_HANN = 9
Bartlett-Hann window (9). Hybrid of Bartlett and Hanning with a smoother taper.
See: https://en.wikipedia.org/wiki/Window_function#Bartlett%E2%80%93Hann_window
BLACKMAN class-attribute
instance-attribute
¶
BLACKMAN = 2
Blackman window (2). Better side lobe attenuation than Hamming or Hanning at the cost of wider main lobe.
See: https://en.wikipedia.org/wiki/Window_function#Blackman_window
BLACKMAN_HARRIS_4TERM class-attribute
instance-attribute
¶
BLACKMAN_HARRIS_4TERM = 3
4-term Blackman-Harris window (3). Low side lobes, ideal for high dynamic range applications.
See: https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Harris_window
BLACKMAN_HARRIS_7TERM class-attribute
instance-attribute
¶
BLACKMAN_HARRIS_7TERM = 5
7-term Blackman-Harris window (5). Extended version with even greater side lobe suppression.
See: - https://ccrma.stanford.edu/~jos/Windows/Blackman_Harris_Window_Family.html - https://github.com/hukenovs/blackman_harris_win
BLACKMAN_NUTTALL class-attribute
instance-attribute
¶
BLACKMAN_NUTTALL = 11
Blackman-Nuttall window (11). Variant of Nuttall with even stronger side lobe suppression.
See: https://en.wikipedia.org/wiki/Window_function#Blackman%E2%80%93Nuttall_window
FLAT_TOP class-attribute
instance-attribute
¶
FLAT_TOP = 6
Flat top window (6). Optimized for amplitude accuracy and minimizing scalloping loss.
See: https://en.wikipedia.org/wiki/Window_function#Flat_top_window
HAMMING class-attribute
instance-attribute
¶
HAMMING = 1
Hamming window (1). Similar to Hanning but with slightly reduced side lobe attenuation.
See: https://en.wikipedia.org/wiki/Window_function#Hamming_window
HANNING class-attribute
instance-attribute
¶
HANNING = 0
Hanning window (0). A raised cosine window with good frequency resolution and low spectral leakage.
See: https://en.wikipedia.org/wiki/Window_function#Hann_(Hanning)_window
KAISER_BESSEL class-attribute
instance-attribute
¶
KAISER_BESSEL = 4
Kaiser-Bessel window (4). Adjustable window (beta parameter) balancing resolution and leakage.
See: https://en.wikipedia.org/wiki/Window_function#Kaiser_window
NUTTALL class-attribute
instance-attribute
¶
NUTTALL = 10
Nuttall window (10). Four-term cosine window with very low side lobes.
See: https://en.wikipedia.org/wiki/Window_function#Nuttall_window,_continuous_first_derivative
RECTANGULAR class-attribute
instance-attribute
¶
RECTANGULAR = 7
Rectangular window (7). Equivalent to no windowing; highest resolution, but worst leakage.
See: https://en.wikipedia.org/wiki/Window_function#Rectangular_window
denoise ¶
denoise(
clip_or_sloc: VideoNode | SLocationT | MultiDim,
sloc: SLocationT | MultiDim | None = None,
/,
tr: int = 0,
ftype: int = WIENER,
swin: int | SynthesisType | None = None,
twin: int | SynthesisType | None = None,
planes: PlanesT = None,
func: FuncExceptT | None = None,
**kwargs: Any,
) -> VideoNode
Denoises a clip using Discrete Fourier Transform (DFT).
More informations: - VapourSynth DFTTest plugin: https://github.com/HomeOfVapourSynthEvolution/VapourSynth-DFTTest/blob/master/README.md - AviSynth DFTTest docs: http://avisynth.nl/index.php/Dfttest - vs-dfttest2 docstring: https://github.com/AmusementClub/vs-dfttest2/blob/573bb36c53df93c46a38926c7c654569e3679732/dfttest2.py#L614-L764
Examples: Apply a constant sigma:
denoised = DFTTest().denoise(clip, sigma=16)
Use frequency-dependent sigma values:
```py
denoised = DFTTest().denoise(clip, {0: 0, 0.25: 4, 0.5: 8, 0.75: 16, 1.0: 32})
```
Parameters:
-
clip_or_sloc
¶VideoNode | SLocationT | MultiDim
) –Either a video clip or frequency location.
-
sloc
¶SLocationT | MultiDim | None
, default:None
) –Frequency location (used if
clip_or_sloc
is a video clip). -
tr
¶int
, default:0
) –Temporal radius for denoising (equivalent to
tbsize
). -
ftype
¶int
, default:WIENER
) –Filter type for denoising (see FilterType enum, e.g.).
-
swin
¶int | SynthesisType | None
, default:None
) –Synthesis window size (can use SynthesisType enum).
-
twin
¶int | SynthesisType | None
, default:None
) –Temporal window size (can use SynthesisType enum).
-
planes
¶PlanesT
, default:None
) –Planes to apply the denoising filter.
-
func
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
-
kwargs
¶Any
, default:{}
) –Additional parameters for the denoising process.
Returns:
-
VideoNode
–The denoised video node.
Source code
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 |
|
extract_freq ¶
extract_freq(
clip: VideoNode, sloc: SLocationT | MultiDim, **kwargs: Any
) -> VideoNode
Extracts the frequency domain from the given clip by subtracting the denoised clip from the original.
Parameters:
-
clip
¶VideoNode
) –The clip from which the frequency domain is to be extracted.
-
sloc
¶SLocationT | MultiDim
) –The frequency location for the extraction process.
-
kwargs
¶Any
, default:{}
) –Additional parameters for the extraction process.
Returns:
-
VideoNode
–The clip with the extracted frequency domain.
Source code
980 981 982 983 984 985 986 987 988 989 990 991 992 |
|
insert_freq ¶
insert_freq(
low: VideoNode, high: VideoNode, sloc: SLocationT | MultiDim, **kwargs: Any
) -> VideoNode
Inserts the frequency domain from one clip into another by merging the frequency information.
Parameters:
-
low
¶VideoNode
) –The low-frequency component clip.
-
high
¶VideoNode
) –The high-frequency component clip.
-
sloc
¶SLocationT | MultiDim
) –The frequency location for the merging process.
-
kwargs
¶Any
, default:{}
) –Additional parameters for the merging process.
Returns:
-
VideoNode
–The merged clip with the inserted frequency domain.
Source code
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 |
|
merge_freq ¶
merge_freq(
low: VideoNode, high: VideoNode, sloc: SLocationT | MultiDim, **kwargs: Any
) -> VideoNode
Merges the low and high-frequency components by applying denoising to the low-frequency component.
Parameters:
-
low
¶VideoNode
) –The low-frequency component clip.
-
high
¶VideoNode
) –The high-frequency component clip.
-
sloc
¶SLocationT | MultiDim
) –The frequency location for the merging process.
-
kwargs
¶Any
, default:{}
) –Additional parameters for the merging process.
Returns:
-
VideoNode
–The merged clip with the denoised low-frequency and high-frequency components.
Source code
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 |
|
fft3d ¶
Applies FFT3DFilter, a 3D frequency-domain filter used for strong denoising and mild sharpening.
This filter processes frames using the Fast Fourier Transform (FFT) in the frequency domain. Unlike local filters, FFT3DFilter performs block-based, non-local processing.
Official documentation: https://github.com/myrsloik/VapourSynth-FFT3DFilter/blob/master/doc/fft3dfilter.md
Possibly faster implementation: https://github.com/AmusementClub/VapourSynth-FFT3DFilter/releases
Note: Sigma values are internally scaled according to bit depth, unlike when using the plugin directly.
Parameters:
-
clip
¶VideoNode
) –Input video clip.
-
**kwargs
¶Any
, default:{}
) –Additional parameters passed to the FFT3DFilter plugin.
Returns:
-
ConstantFormatVideoNode
–A heavily degraded version of DFTTest, with added banding and color shifts.
Source code
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
|