Vapoursynth vsPlacebo Deband

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

vsPlacebo Deband removes banding with libplacebo's debanding algorithm and can add a little grain to hide the remaining steps.

Filtering → Vapoursynth → DeBand

vsPlacebo Deband controls in Hybrid
vsPlacebo Deband controls in Hybrid

What it does

For each sample, random nearby pixels within Radius are averaged as long as the difference stays below Threshold. This is repeated for the given number of iterations with a growing radius. Afterwards grain is added. The filter can be limited to any combination of planes.

Requirements

  • placebo: a GPU with Vulkan (Windows, Linux, macOS).
  • vszipcl: OpenCL; vszipcu: an NVIDIA GPU with CUDA. Hybrid only offers these when they are available.

Settings

Control Parameter Range / values Hybrid default Meaning
Radius radius 0.01 – 100 16 Initial search radius; grows with each iteration. Higher finds more gradients, lower smooths more aggressively.
Iterations iterations 1 – 10 1 Debanding steps per sample; each step adds less, above about 4 there is practically no gain.
Grain grain 0 – 100 6 Added noise; 0 = off. With HDR sources even small values can shift brightness noticeably: lower it or use 0.
Threshold threshold 0.01 – 100 4 Cut-off; higher debands much stronger but loses detail.
Dither dither on/off on Dither instead of round when the result is brought back to 8 bit. Only used when the clip is 8-bit at this filter.
Dither algorithm dither_algo blue noise, ordered LUT, ordered fixed, white noise blue noise Dither method; only used with Dither on and an 8-bit clip at this filter.
Planes planes Y, U, V, YU, YV, UV, YUV Y Planes that are debanded.
Tools: PlaceboDeband – placebo, vszipcl, vszipcu placebo Implementation: libplacebo (Vulkan), or the OpenCL or CUDA port.
Tools: device device_id – 0 GPU to use; only for vszipcl and vszipcu (placebo picks its own GPU).

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# adjusting color space from YUV420P10 to YUV444PS for vsPlaceboDeband
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS)
# applying debanding using vs-placebo.Deband
clip = core.placebo.Deband(clip, planes=1)

How Hybrid calls it

  • vsPlacebo Deband works on 8-bit and 16-bit integer and 32-bit float clips in YUV, gray and RGB; other bit depths (10, 12, 14 bit) are converted first (to the highest supported format, e.g. 4:4:4 float for a 10-bit 4:2:0 source), so Dither only applies to 8-bit clips.
  • Radius, threshold and grain are passed unchanged at every bit depth; libplacebo works on normalized values.
  • Values are only written when they differ from the defaults, which are the plugin's own. Planes is always written (a bit mask for placebo, a plane list for the ports).
  • Only the chosen implementation is loaded. With the same settings all three gave identical output on test clips; with 8-bit blue-noise dither the output can vary slightly between runs.
  • vsPlacebo Deband also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

vs-placebo

vs-placebo is the VapourSynth interface to libplacebo, the rendering library behind mpv. Its Deband also accepts 32-bit float clips and has a log level setting, which Hybrid does not use. For AviSynth+ the same algorithm is available as libplacebo_Deband in avs_libplacebo.

Sources