Avisynth DeGrainMedian

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

DeGrainMedian is a spatio-temporal median denoiser for light grain. It limits how far a pixel may change, so fine detail survives.

Filtering → Avisynth → DeGrain

DeGrainMedian controls in Hybrid
DeGrainMedian controls in Hybrid

What it does

Each pixel is compared with its 3×3 neighbourhood in the previous, current and next frame. A median-type value is taken from these neighbours, but the pixel is never moved further than Limit away from its original value. This keeps edges and detail while the grain is pulled toward its surroundings. The Mode picks how many neighbours take part: 0 filters hardest, 5 is the weakest.

Typical use: light film grain or sensor noise where a strong temporal denoiser would be too slow or too aggressive.

Requirements

Windows, CPU only. The neo-smo plugin is shipped with Hybrid.

Settings

Control Parameter Range Hybrid default Meaning
Mode mode 0–5 0 Six variants of the filter; 0 filters hardest, 5 least.
Limit (Y/UV) limit 0–255 4 / 6 Maximum change per pixel for luma and for chroma, on the 8-bit scale (scaled for higher bit depths). 0 leaves that plane unchanged.
norow norow on/off off Leaves the two pixels left and right of the current one out of the calculation. The same position in the previous and next frame is still used.

Example

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

last.neo_smo_DegrainMedian(limit=[4,6],mode=0,scalep=true)

How Hybrid calls it

  • Hybrid loads neo-smo.dll and calls neo_smo_DegrainMedian.
  • Mode and Limit are always written. Gray clips get a single limit, color clips get limits for Y, U and V.
  • scalep=true is always written, so the limits stay on the 8-bit scale at any bit depth.
  • Works on gray and planar YUV, 8–16 bit and float. Hybrid converts the color space before the filter if needed.
  • For interlaced clips Hybrid adds interlaced=true. norow is only written when it is on.
  • DeGrainMedian also offers the common options and can be added to the filter queue several times.

Background

The original DeGrainMedian plugin is by Fizick. The version in Hybrid is the port bundled in neo-smo, which also contains ports of RemoveGrain, TTempSmooth, Deen, CCD and MedianBlur.

See also: Vapoursynth DeGrainMedian. The VapourSynth version has separate limits and modes per plane.

Sources

  • Hybrid's tooltips
  • The AviSynth+ documentation does not cover DeGrainMedian.