Vapoursynth AVDenoise

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

AVDenoise is a GPU denoiser based on ChillFish8's av-denoise. Both of its methods measure the noise of each scene themselves, so there is no sigma or strength to search for: the defaults are a good start, and a few scale factors adjust the result.

Filtering → Vapoursynth → DeNoise

AVDenoise controls in Hybrid
AVDenoise controls in Hybrid

What it does

  • NL4D (default) is a spatio-temporal denoiser: it follows the motion into the neighbor frames and thresholds transform coefficients against the measured noise. It is the stronger method and keeps detail best.
  • NLMeans-HQ is a non-local means denoiser with the same automatic noise estimate.

Both keep the input format.

Requirements

  • A GPU with Vulkan (Windows, Linux; on Linux Vulkan 1.4, no CPU-only Vulkan device) or Metal (macOS on Apple Silicon). Hybrid only offers the filter when such a GPU is found.
  • The first frame of a new setting is slow: av-denoise tunes its GPU kernels (seconds up to about a minute) and caches the result, so later runs start fast.

Settings

Control Parameter Range / values Hybrid default Meaning
Method – NL4D, NLMeans-HQ NL4D Which method runs; the controls of the other method are disabled.
Preset preset base, slow base NL4D only. slow searches badly matched blocks again with a wider window.
HQ preset preset veryfast, fast, base, slow, veryslow base NLMeans-HQ only; mainly sets the temporal window (veryfast: current frame only, base: 2 frames on each side, veryslow: 8).
Channels channel_mode lumachroma, luma, chroma lumachroma Planes that are denoised (chroma still reads the luma plane).
Device device auto, discrete:0–2, integrated:0 auto GPU to use; auto lets the plugin choose.
Lambda scale lambda_ht_scale 0.5 – 3.0 1.0 NL4D only; the main dial. Higher removes more noise and more fine detail.
Sigma scale sigma_scale 0.1 – 5.0 1.0 Multiplies the measured noise level; the main dial of NLMeans-HQ (try 1.1 to clean more, 0.9 to keep more detail).
Spatial radius spatial_radius 0 – 32 0 (preset) NL4D only; search area of (2r+1)² positions. Mainly a speed setting; 0 keeps the preset value (base: 9).
Temporal radius temporal_radius 0 – 8 0 (preset) Frames searched on each side; 0 keeps the preset value (base: 2).
Refine refine 1 – 4 2 NL4D only; half-width of the search around the predicted motion position.
Strength / Luma / Chroma strength strength, luma_strength, chroma_strength 0 – 5 0 (plugin value) NLMeans-HQ only; multipliers on the measured noise, a last resort. Raise the chroma strength when color speckles survive.
Motion compensation motion_compensation on/off off NLMeans-HQ only; helps with fast motion, not recommended for most anime.
Noise map noise_map on/off on NL4D only; adapts the luma threshold to how noisy each brightness level is.
Pooled threshold pooled_threshold on/off on NL4D only; judges each frequency together with its neighbors, which keeps faint texture.

Example

Default settings on a 10-bit YUV 4:2:0 source:

# denoising using av-denoise NL4D
clip = core.avd.NL4D(clip, accelerators="vulkan")

How Hybrid calls it

  • AVDenoise works on 8-, 10- and 12-bit integer YUV; 16-bit sources are converted to 12 bit, other formats to a supported YUV format.
  • Hybrid always uses Vulkan (Metal on macOS); CUDA is not used.
  • Values are only written when they differ from the defaults; parameters of the method that is not chosen are never written, and 0 radii, 0 strengths and the auto device are left out so that the preset or plugin values apply.
  • AVDenoise also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

av-denoise

av-denoise is a Rust project (Apache-2.0) that provides a command-line tool, a library and a VapourSynth plugin, with Vulkan, CUDA, ROCm and Metal backends. It started from ideas in KNLMeansCL and FFmpeg's nlmeans and handles 8–12-bit input. Its VapourSynth tuning guide recommends changing one dial at a time in small steps: lambda_ht_scale for NL4D and sigma_scale for NLMeans-HQ first, the per-channel strengths only as a last resort.

Sources