Avisynth KNLMeansCL
Jump to navigation
Jump to search
KNLMeansCL is a non-local means denoiser that runs on OpenCL. It is strong, keeps texture, and is slow without a good GPU.
Filtering → Avisynth → DeNoise

What it does
For every pixel the filter searches the surroundings, and with Distance above 0 also the neighbouring frames, for patches that look like the patch around the pixel. The pixel is replaced by the average of the matching pixels, weighted by how similar the patches are. Noise is random and averages out, while real, repeating structure is kept.
Requirements
- An OpenCL device with driver (GPU, or an OpenCL CPU runtime). CUDA is not needed.
- Windows.
Settings
| Control | Parameter | Range / values | Hybrid default | Meaning |
|---|---|---|---|---|
| Distance | d | 0–100 | 1 | Number of frames used on each side; the temporal size is 2d + 1. 0 = spatial only. |
| Channels | channels | auto, Y, UV, YUV, RGB | auto | Planes to denoise. auto means Y on YUV clips (chroma stays untouched) and RGB on RGB clips. |
| Search radius | a | 1–16 | 2 | Radius of the search window; its size is (2a + 1)². |
| Weighting | wmode | Welsch, modified Bisquare, Bisquare, modified Bisquare 2 | Welsch | Weighting function. Welsch is the original non-local means weighting. |
| Similarity radius | s | 0–8 | 4 | Radius of the compared patch; its size is (2s + 1)². Small effect on speed. |
| Strength | h | 0.01–50 | 1.2 | Filter strength; higher values remove more noise and detail. |
| Device type | device_type | gpu, accelerator, auto | auto | OpenCL device class. auto tries an accelerator, then a GPU, then the CPU. |
| GPU ID | device_id | 0–4 | 0 | Which GPU to use; only available when Device type is gpu. |
Example
Default settings on a 10-bit YUV 4:2:0 source (no conversions are added):
KNLMeansCL(device_type="auto")
How Hybrid calls it
- Hybrid loads KNLMeansCL.dll and calls
KNLMeansCL. - Only values that differ from the plugin defaults are written: d, a, s, channels, wmode and h. Device type is always written; GPU ID only when the device type is gpu.
- Interlaced sources are processed field by field.
- KNLMeansCL also offers the common options and can be added to the filter queue several times.
Background
- KNLMeansCL was written by Khanattila (GPL-3) and exists for AviSynth+ and VapourSynth.
- The plugin has more parameters that Hybrid does not offer: a weight for the centre pixel (wref), a reference clip (rclip), colour distance (cmode), work-group tuning and the 16-bit stacked modes of old AviSynth. The maximum frame size is 8192×8192.
See also: Vapoursynth KNLMeansCL, DeathRay
Sources
- KNLMeansCL wiki: Filter description
- KNLMeansCL on GitHub
- Hybrid's tooltips
- The AviSynth+ documentation does not cover KNLMeansCL.