Avisynth LimitedSharpen

From wiki.selur.net
Revision as of 19:48, 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

LimitedSharpen is a multi-purpose sharpener by Didée. It sharpens the luma and then limits how far each pixel may move beyond its neighbours, so strong halos and seams do not appear. Hybrid uses the faster variant, LimitedSharpenFaster.

Filtering → Avisynth → Sharpen

LimitedSharpen controls in Hybrid
LimitedSharpen controls in Hybrid

What it does

The filter first sharpens with the selected Mode (unsharp mask, simple sharpen, range sharpening or a non-linear sharpener). Then it compares every pixel with the darkest and brightest pixel of its 3×3 neighbourhood (5×5 with Wide) and only lets it exceed that range by the Overshoot and Undershoot amounts. This keeps the sharpening from producing bright or dark halos.

Optional extras: SuperSampling enlarges the picture before sharpening and shrinks it afterwards, which gives cleaner edges but is slower. Softening weakens the effect, and Edge can restrict the sharpening to edges or to non-edges (or show the edge mask). Only luma is processed; chroma passes through unchanged.

Typical uses: general sharpening of soft DVD or web sources. If blocking artifacts get emphasised, lower Overshoot to 0 or use some Softening (around 40).

Requirements

Windows only, CPU only. The filter needs several plugins that ship with Hybrid (MaskTools2, RemoveGrain, aWarpSharp, and WarpSharp for the unsharp mask mode).

Settings

Control Parameter Range / values Hybrid default Meaning
Mode Smode UnsharpMask, Sharpen, Range sharpening, Non-linear sharpening Range sharpening Sharpening method.
Strength strength 0–8196 100 Amount of sharpening. Choosing UnsharpMask sets 160, choosing Sharpen sets 100 (maximum 100); the other modes use 100.
Unsharp radius radius 1–10 2 Blur radius of the unsharp mask. Only available in mode UnsharpMask.
Limit Lmode No effect, Clamp to over/undershoot, Only over/undershoot on non-edges Clamp to over/undershoot How the result is limited against the neighbourhood.
Wide wide on/off off Limit against a 5×5 instead of a 3×3 neighbourhood.
Under-/Overshoot undershoot / overshoot 0–100 each 1 / 1 How much darker (undershoot) or brighter (overshoot) than the neighbours a pixel may become, in 8-bit steps.
SuperSampling (x/y) ss_x / ss_y 1.0–3.0 1.5 / 1.5 Enlargement factors for the sharpening step; 1.0 = off. Values above 2.0 are rarely useful.
Softening soft −1–100 0 Softens the sharpening effect; −1 selects an automatic value derived from the supersampling.
Edge edgemode shows edges, does nothing, restricts sharpening to edges, restricts sharpening to non-edges does nothing Edge mask handling.

Example

Default settings on a 10-bit YUV 4:2:0 source. LimitedSharpenFaster works on 8-bit data, so Hybrid converts to 8 bit and back:

# Converting from 10 to 8bit for LimitedSharpen
ConvertBits(8)
LimitedSharpenFaster(Smode=3,edgemode=0)
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Hybrid loads MaskTools2, RemoveGrain, aWarpSharp (plus WarpSharp for UnsharpMask) and the script LimitedSharpenFaster.avs, and calls LimitedSharpenFaster(...).
  • The filter needs 8-bit YV12 or YUY2; other formats are converted first. It is not offered for interlaced material.
  • Smode and edgemode are always written. The other parameters are only written when they differ from the script's own defaults. Those defaults depend on the mode: strength is 160 for UnsharpMask, the supersampling is 1.25 for Non-linear sharpening, ss_y follows ss_x and undershoot follows overshoot. The radius is only written in UnsharpMask mode.
  • LimitedSharpen also offers the common options and can be added to the filter queue several times.

Background

  • LimitedSharpenFaster is a speed-optimised version of Didée's LimitedSharpen that uses MaskTools2. The version Hybrid ships adds the non-linear mode, a separate undershoot, the non-edge limit mode, an integer soft with −1 for automatic, and an edge-mask view.
  • The Doom9 thread recommends lowering the overshoot or deblocking first if blocking becomes visible, and notes that load errors usually come from an outdated RemoveGrain.

See also: LimitedSharpenFaster(mod), pSharpen

Sources