Avisynth Flash3kyuu

From wiki.selur.net
Revision as of 19:49, 21 November 2026 by Selur (talk | contribs) (Avisynth filter documentation (via create-page on MediaWiki MCP Server))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Flash3kyuu removes banding in gradients and adds grain (dithering) so that smoothed areas keep some texture and survive encoding. It runs through the Deband function of the avszip plugin, a fast reimplementation of f3kdb.

Filtering → Avisynth → DeBand

Flash3kyuu controls in Hybrid
Flash3kyuu controls in Hybrid

What it does

For every pixel the filter looks at reference pixels within a given distance. If the pixel differs from them by less than a threshold, it counts as banded and is replaced by the average of the references. Grain is added afterwards. The Mode decides which reference pixels are used and whether details and gradient angles are checked.

Requirements

  • Windows, CPU only.
  • AviSynth+ 3.7.4 or newer.

Settings

Control Parameter Range Hybrid default Meaning
Range range 1–31 15 Search distance in pixels.
Mode sample_mode list 4px dither 2px dither (1, vertical pair of references), 4px dither (2, square of four), 2px row (3, horizontal pair), 4px average (4, average of 1 and 3), detail-preserving (5, uses Thr1/Thr2), average multi-threshold (6, like 4 with Thr1/Thr2), gradient angle (7, adds a gradient-angle check).
Y-thresh / Cb-thresh / Cr-thresh thr 0–511 64 / 64 / 64 Detection threshold per plane. 0 leaves that plane untouched. Hybrid converts the value × 255 / 16383 for the plugin (64 becomes about 1.0).
Thr1 / Thr2 thr1 / thr2 0–16383 64 / 64 Detail protection (Thr1) and gradient/texture protection (Thr2) of modes 5–7. Same scaling as the thresholds. Only available for modes 5, 6 and 7.
Angle boost angle_boost 0–10 1.5 Only available for mode 7 (gradient angle).
Max angle max_angle 0–1 0.15 Only available for mode 7 (gradient angle).
Y-dither / C-dither grain 0–8159 64 / 64 Grain strength for luma and chroma, same scaling as the thresholds (64 becomes about 1.0). 0 is no grain.
Blur First blur_first on/off on On: compare with the average of the references. Off: all references must be within the threshold. No effect in modes 5–7.
Dynamic dither dynamic_grain on/off off Uses a new grain pattern for every frame.
Force TV Range keep_tv_range on/off off Clamps the output to TV range (16–235 / 16–240). Use it only for TV-range material, on full-range video it clips. No effect on float or RGB input.

Example

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

avszip_Deband(thr=[0.996155, 0.996155, 0.996155],grain=[0.996155, 0.996155])

How Hybrid calls it

  • Hybrid loads avszip.dll and calls avszip_Deband. The build for SSE2, AVX2 or AVX512 is chosen from the CPU at start-up.
  • Accepted input: grayscale, YUV 4:2:0 / 4:2:2 / 4:4:4 and planar RGB, 8–16 bit integer and float (not 4:1:1). Integer input below 16 bit is processed at 16 bit internally and returned at the input depth. The example needs no conversion.
  • thr and grain are always written. range, sample_mode, dynamic_grain, blur_first and keep_tv_range are only written when they differ from the defaults, thr1, thr2 only for modes 5–7 and angle_boost, max_angle only for mode 7.
  • The filter is not offered for interlaced sources.
  • Flash3kyuu also offers the common options and can be added to the filter queue several times.

Background

  • avszip is the AviSynth+ build of vszip by dnjulek (MIT licence). The filter follows flash3kyuu_deband by SAPikachu, which was originally written for AviUtl by flash3kyuu, and its fork neo_f3kdb, which uses the same threshold and grain scale.
  • The plugin also offers random-number algorithms and parameters; Hybrid does not expose them. In Hybrid's Vapoursynth version more options exist, but only the sample modes 1–5.

See also: Vapoursynth Flash3kDB, GradFun2DB

Sources