Vapoursynth ChromaNR

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

ChromaNR reduces color noise. It is a VapourSynth port of FFmpeg's chromanr filter, with a CPU and an optional NVIDIA CUDA version.

Filtering → Vapoursynth → DeNoise

ChromaNR controls in Hybrid
ChromaNR controls in Hybrid

What it does

For every pixel the U/V values of the neighbors inside a rectangle are averaged, but only neighbors whose Y, U and V values are close enough to the pixel. Color edges therefore survive. The luma plane is not changed.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold (sum) thres 1 – 200 30 A neighbor is used only if the sum of its Y, U and V differences stays below this value.
Threshold (y/u/v) threy, threu, threv 1 – 200 20 / 20 / 20 Limits for the single differences.
Size (w/h) sizew, sizeh 1 – 100 3 / 3 Horizontal/vertical radius of the averaging rectangle.
Step (w/h) stepw, steph 1 – 50 1 / 1 Values above 1 skip columns/rows: faster but coarser.
Distance distance manhattan, euclidean manhattan How the differences are combined: absolute or squared.
CUDA – on/off off Uses the CUDA version; enabled only with an NVIDIA GPU.

The thresholds are on the 8-bit scale; the CPU plugin scales them to the clip's bit depth.

Example

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

# chroma denoising using ChromaNR
clip = core.chromanr.CNR(clip, thres=30)

How Hybrid calls it

  • The CPU version works on 8–16-bit integer YUV, the CUDA version on float YUV; Hybrid converts the clip accordingly.
  • Threshold (sum) is always written, because the plugin's own default (4) differs from Hybrid's (30); the other values only when they differ from the defaults.
  • ChromaNR is available on Windows and macOS; the CUDA version on Windows only.
  • ChromaNR also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

FFmpeg chromanr

FFmpeg's chromanr has the same parameters and ranges; there the default size is 5 and the per-plane thresholds default to 200, so a single sum threshold of 30 does the work. The VapourSynth port uses smaller defaults (size 3, per-plane thresholds 20).

Sources