Avisynth FineDeHalo

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

FineDeHalo removes halos around edges like DeHaloAlpha, but applies the correction only through an edge-based halo mask, so real detail and strong lines are spared.

Filtering → Avisynth → DeHalo

FineDeHalo controls in Hybrid
FineDeHalo controls in Hybrid

What it does

FineDeHalo runs DeHalo_alpha on the clip and then builds a mask that covers only the area around lines. The dehaloed result is blended in through that mask, so the rest of the picture stays untouched. Optional contrast sharpening brings back some line contrast, and an exclusion step protects places where several edges lie close together. Only luma is processed, chroma is taken from the source.

The Show mask list outputs one of the internal masks instead of the result, which helps to tune the thresholds.

Requirements

  • Windows, CPU only.
  • The helper plugins and scripts are shipped with Hybrid.

Settings

Control Parameter Range Hybrid default Meaning
Radius x/y rx / ry 1–10 2 / 2 Halo radii, used by DeHalo_alpha and for growing the mask. Values between 1 and 3 are typical.
Edge threshold min/max thmi / thma 0–255 80 / 128 Keeps only the sharpest edges in the mask (strong mask).
Limit threshold min/max thlimi / thlima 0–255 50 / 100 Includes more edges but ignores simple details (exclusion zones).
Strength dark/bright darkstr / brightstr −10–10 1 / 1 Strength against dark and bright halos.
Edge processing edgeproc 0–10 0 Also processes the edges themselves (adds the edge mask × 0.66 × value). High values eat lines.
Show mask showmask list none none, outside mask, shrink mask, edge mask or strong mask: shows that mask instead of the result.
Contrast sharpening contra 0–1 0 0 is off, 1 is normal contra-sharpening.
Exclusion zone excl on/off on Extra step that excludes main edges from smoothing.

Example

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

FineDehalo()

How Hybrid calls it

  • Hybrid loads masktools2, the RemoveGrain helper and the scripts DeHalo_alpha_mt2.avsi, FineDehalo.avsi and mt_xxpand_multi.avsi, then calls FineDehalo.
  • Planar Y8, YV12, YV16, YV24 and YV411 input; other formats are converted first. The example needs no conversion.
  • Parameters are only written when they differ from the defaults. Radius y is also written whenever it differs from Radius x. Show mask is written as its list index (0–4).
  • The filter is not interlace-aware.
  • FineDeHalo also offers the common options and can be added to the filter queue several times.

Background

  • The script is FineDehalo 1.1 mod8.79 (WTFPL licence). It wraps DeHalo_alpha and passes on only rx, ry, darkstr and brightstr.
  • The script file also contains FineDehalo2, which Hybrid does not use. The mask parameters exdehalo and exedgesm are not offered.

See also: Vapoursynth FineDeHalo, BlindDeHalo

Sources

  • The AviSynth+ documentation does not cover FineDeHalo.
  • Header of the script FineDehalo.avsi
  • Hybrid's tooltips