Avisynth FFT3DFilter

From wiki.selur.net
Jump to navigation Jump to search

FFT3DFilter is a strong frequency-domain denoiser with moderate sharpening. It works on overlapping blocks of the current and neighbouring frames. Hybrid can use the classic plugin or the newer neo-fft implementation.

Filtering → Avisynth → DeNoise

FFT3DFilter controls in Hybrid
FFT3DFilter controls in Hybrid

What it does

Each block is transformed into frequencies. Components that are weak compared to the Sigma noise level are reduced, because they are most likely noise. Two methods are available through Block temporal: a Wiener filter, working in 2D or in 3D with the previous and next frames, and a Kalman filter that accumulates all previous frames. After the inverse transform the picture can be sharpened a little. The filter runs on the CPU and is a good choice for grainy or noisy material.

Requirements

  • The classic plugin needs the FFTW3 library (libfftw3f-3.dll); Hybrid ships it.
  • neo-fft has no extra dependency.
  • CPU only, 64-bit AviSynth+ on Windows.

Settings

Control Parameter Range Hybrid default Meaning
Neo – on/off off Uses the neo-fft implementation (neo_fft_FFT3D) instead of the classic plugin. NCPU is disabled then, neo-fft ignores it.
Sigma sigma 0–40 2 Noise level at the highest frequencies (8-bit units).
Beta beta 1–100 1 Noise margin; the maximum attenuation is (beta − 1) / beta.
Sigma2 / Sigma3 / Sigma4 sigma2 / sigma3 / sigma4 0–40 off (value 2) Noise level for the lower frequency bands. The value is only used when its check box is ticked; otherwise it follows Sigma.
Block width / height bw / bh 4, 8, 16, 32, 48, 64, 128, 256, 512 32 / 32 Size of the FFT blocks.
Block temporal bt 0–5 3 0 = Kalman, 1 = spatial only, 2 = previous and current frame, 3 = previous, current and next frame, 4 = two previous, current and next frame, 5 = two previous, current and two next frames.
Sharpen sharpen −100–100 0 0 = off; positive values sharpen, negative values blur.
NCPU ncpu 0–64 1 Number of threads of the classic plugin; not used with Neo.
Plane plane 0–4 0 0 = luma, 1 = U, 2 = V, 3 = U and V, 4 = luma and chroma.

Example

Default settings on a 10-bit YUV 4:2:0 source (no conversions are added):

FFT3DFilter(interlaced=false)

How Hybrid calls it

  • Classic: Hybrid loads libfftw3f-3.dll and FFT3DFilter.dll and calls FFT3DFilter. With Neo it loads neo-fft.dll and calls neo_fft_FFT3D.
  • Values are only written when they differ from the defaults. interlaced is always written (false for progressive, true otherwise). Sigma2 to Sigma4 are only written when ticked and not equal to 2.
  • With Neo the Plane setting is translated into the plugin's y/u/v modes (3 = process, 2 = copy) and always written, for example plane 0 becomes y=3, u=2, v=2.
  • The filter accepts all planar YUV formats including gray and high bit depth, and planar RGB. Other formats are converted first.
  • FFT3DFilter also offers the common options and can be added to the filter queue several times.

Background

  • FFT3DFilter was written by Fizick. Hybrid uses pinterf's build for AviSynth+.
  • neo-fft is an independent reimplementation of fft3dfilter and dfttest. It gives luma within about 1 LSB of the classic filter. Its multithreading works only through Prefetch; with Prefetch it was measured 2–2.6 times faster than the classic plugin, at SD resolution without Prefetch about equal.
  • Both plugins have more parameters that Hybrid does not offer, for example the sharpening shape (scutoff, svr, smin, smax), degrid and the window type.

See also: Vapoursynth FFT3DFilter, FFT3DGPU

Sources