Vapoursynth YAHR

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

YAHR ("Yet Another Halo Reducing") removes bright halos next to oversharpened edges by warping a copy of the luma towards the edges. It suits mild to moderate edge-enhancement halos; the effect is subtle.

Filtering → Vapoursynth → DeHalo

YAHR controls in Hybrid
YAHR controls in Hybrid

What it does

The luma is blurred (MinBlur plus a 3×3 Gaussian) to get its fine detail. A warp-sharpened copy gets the same treatment, and Repair (mode 13) limits the source detail by the detail of the warped copy. The part of the detail that exceeds it – the halo – is subtracted from the source. Only luma is processed; chroma passes through unchanged.

Settings

Control Parameter Range / values Hybrid default Meaning
Blur blur 0 – 100 2 Blur passes over the AWarpSharp2 edge mask; more passes give a smoother mask and weaker, more even warping.
Depth depth −128 – 127 32 AWarpSharp2 warp strength; higher pushes the halo back into the line, too high visibly bends lines. Negative values warp the other way.
Count – 1 – 10 1 How many times YAHR is applied in a row.
Tools: Warp tools warp, awarp warp AWarpSharp2 plugin, or AWarp with an emulated edge mask (not bit-identical).
Tools: RG tools zsmooth, neo_smo zsmooth Repair implementation.
Tools: Median tools zsmooth zsmooth Median implementation for MinBlur.

Example

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

# applying dehalo using YAHR
clip = dehalo.YAHR(clip, tools={'warp': 'warp', 'rg': 'zsmooth', 'median': 'zsmooth'})

How Hybrid calls it

  • YAHR works on 8–16-bit integer YUV clips; other formats are converted first.
  • Blur and depth are only written when they differ from the defaults; they are not pixel values and need no bit-depth scaling.
  • With a Count above 1 the call is repeated that many times.
  • The luma is padded by 6 pixels before warping and cropped afterwards.
  • YAHR also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

The script

YAHR is a port of Didée's AviSynth script; havsfunc carried the classic VapourSynth port.

AWarpSharp2

In AWarpSharp2, blur sets how often the edge mask is blurred (higher values weaken the effect) and depth the warp strength from −128 to 127, where negative values blur instead of sharpen. The plugin's own luma depth default is 16; YAHR uses twice that.

Sources