Avisynth GradFun2DB

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

GradFun2DB removes banding (visible steps in smooth gradients such as skies or fades) and adds light dithering so the smoothed areas do not turn into flat patches. It is a small, fast 8-bit filter with a single strength parameter.

Filtering → Avisynth → DeBand

GradFun2DB controls in Hybrid
GradFun2DB controls in Hybrid

What it does

GradFun2DB is a port of the gradfun2 idea from MPlayer by prunedtree. Where neighbouring pixels differ by less than the threshold, the step is treated as banding and smoothed. Dithering noise is added afterwards so the gradient stays natural and survives encoding.

If bands remain, raise the threshold. Values that are too high smooth real detail and can create artifacts between two flat areas.

Settings

Control Parameter Range Hybrid default Meaning
Threshold thr 0.1–10 1.2 Strength: how large a step between neighbouring levels is still treated as banding.

Example

Default settings on a 10-bit YUV 4:2:0 source. Hybrid converts to 8 bit before the filter and back to 10 bit afterwards:

# Converting from 10 to 8bit for GradFun2DB
ConvertBits(8)
GradFun2db()
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Hybrid loads gradfun2db.dll and calls GradFun2db.
  • The plugin works on 8-bit YV12, YV16 and YV24 only; other bit depths are converted to 8 bit before the filter and back afterwards.
  • thr is only written when it is not 1.2, which is the plugin's default.
  • The filter is not offered for interlaced sources.
  • GradFun2DB also offers the common options and can be added to the filter queue several times.

Background

  • The plugin is from 2010 and written by prunedtree. Its successor script GradFun2DBmod (Doom9) adds a mask and radius options; Hybrid does not use it.
  • On Doom9 the GradFun3 defaults were tuned to match GradFun2DB.

See also: Flash3kyuu

Sources