Vapoursynth WNNM

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

WNNM (Weighted Nuclear Norm Minimization) is a block-matching denoiser like BM3D, but it cleans each group of similar blocks with a low-rank matrix approximation instead of a frequency transform. It gives less blocking and ringing than BM3D and is much slower.

Filtering → Vapoursynth → DeNoise

WNNM controls in Hybrid
WNNM controls in Hybrid

What it does

For every block, similar blocks are searched and stacked into a group. The group is approximated by a matrix of low rank – the strong structures shared by the blocks stay, the noise does not – and the blocks are put back and averaged. With a radius above 0 the search continues in the neighbor frames (predictive search as in V-BM3D). Each plane is processed on its own.

Settings

Control Parameter Range / values Hybrid default Meaning
Sigma sigma 0.01 – 100 3.0 Strength.
Split sigma on/off, 3 × 0.01 – 100 off One sigma per plane (Y/U/V or R/G/B).
Block (size / step) block_size, block_step 1 – 128 8 / 8 Block size and the distance between processed blocks (the step is never larger than the size).
Group size group_size 1 – 128 8 Blocks per group; with vszip block size² and group size may not both exceed 64.
BM range bm_range 0 – 128 7 Spatial search radius.
Radius radius 0 – 15 0 Frames on each side; 0 = spatial only. Needs a lot of memory.
Predictive search (num / range) ps_num, ps_range 1 – 20 / 0 – 20 2 / 4 Search in the neighbor frames; only with a radius above 0.
Residual residual on/off off Subtracts the group mean before filtering.
Adaptive aggregation adaptive_aggregation on/off on Weights blocks by how many singular values were kept.
Tools: WNNM – vszip, vsfeel vszip vszip (CPU, all systems) or vsfeel (Vulkan, VapourSynth R80+, Windows); with vsfeel block size, group size and radius have lower limits (64/32/15).

Example

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

# adjusting color space from YUV420P10 to YUV444PS for vsWNNM
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS)
# denoising using WNNM
clip = core.vszip.WNNM(clip)

How Hybrid calls it

  • vszip takes 32-bit float RGB and YUV; vsfeel also 16-bit integer and half float. Hybrid converts the clip accordingly; with vsfeel the frames are downloaded from the GPU afterwards.
  • Values are only written when they differ from the defaults; a split sigma is always written as a list. Sigma is not scaled.
  • WNNM also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

VapourSynth-WNNM

WolframRhodium's original plugin combines BM3D-style block matching with the WNNM algorithm of Gu et al. (CVPR 2014); it only takes float input. vszip's port replaces the external math libraries with its own solver, is several times faster and matches the original within about 2e-4. vapoursynth-feel runs WNNM on Vulkan GPUs.

Sources