Avisynth LimitedSharpenFaster(mod)

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

LimitedSharpenFaster(mod) (LSFmod) is a strong sharpener that keeps the usual side effects (halos, ringing, boosted noise, banding) in check. It is LaTo's modification of LimitedSharpenFaster with more sharpening and limiting modes, a non-linear curve and presets.

Filtering → Avisynth → Sharpen

LimitedSharpenFaster(mod) controls in Hybrid
LimitedSharpenFaster(mod) controls in Hybrid

What it does

The filter sharpens, then limits the result against the local minimum and maximum plus an allowed overshoot and undershoot, optionally only on edges. The result can be softened, and a temporal step (Smoothe, also called soothe) stabilises the sharpening over time so it does not flicker. It is slow compared with simple sharpeners.

The Defaults list with the arrow button fills the other controls with the preset values old, slow or fast. fast is the default, slow uses the non-linear mode with more limiting for higher quality, and old reproduces the classic LimitedSharpenFaster. The preset name itself is not written to the script.

Typical uses: sharpening soft sources while avoiding halos. Use PreBlur with a real denoiser if noise gets sharpened.

Requirements

Windows only, CPU only. The script needs MaskTools2, RemoveGrain, VariableBlur, aWarpSharp (WarpSharp for the unsharp mode) and FFTW, all shipped with Hybrid.

Settings

Control Parameter Range / values Hybrid default Meaning
Strength strength 0–8196 100 Scales the sharpening before limiting. Also scales the default over-/undershoot.
Sharpening (Mode) Smode Unsharp (WarpSharp), Unsharp (VariableBlur), Range sharpening, Nonlinear (org), Nonlinear (new) Range sharpening Sharpening method. The two unsharp modes need 8-bit YV12.
Sharpening (Method) Smethod 3x3 Kernel, Min/Max, Min/Max + 3x3 Kernel Min/Max How the limit range is built. Only for the range and non-linear modes.
Sharpening (Kernel) kernel 11, 12, 19, 20 11 Blur kernel of the 3x3 method (strength order 19 > 12 ≫ 20 > 11). Only available when the mode and method use the kernel.
PreBlur preblur OFF, ON, CUSTOM OFF Blurs before sharpening. ON is enough against ringing; CUSTOM takes an AviSynth expression, for example FFT3DFilter(sigma=4,plane=0), which suits noise. Range and non-linear modes only.
secure secure on/off on Avoids banding and a waxy look. Range and non-linear modes.
Zero point Szrp 1–255 16 Non-linear modes: differences below this value are amplified, above it reduced.
Power Spwr 1–16 4 Non-linear modes: strength of the curve.
Damp (lo/hi) SdmpLo / SdmpHi 0–255 4 / 48 Non-linear modes: damping of small (noise) and large (halo) differences; 0 = off.
Undershoot undershoot / undershoot2 1–81 / 1–162 1 / 2 How much darker a pixel may become (8-bit steps). The second value is used by limiting mode 4 and follows the first at twice its value.
Overshoot overshoot / overshoot2 1–81 / 1–162 1 / 2 How much brighter a pixel may become; second value as above.
Soft soft −2–100 0 Softens the sharpening; −1 and −2 select automatic values (old and new).
Limiting mode Lmode Repair(18) … Repair(1), No Limit, Limit to over/undershoot, and three edge-dependent modes Limit to over/undershoot How the result is limited. The edge-dependent modes treat edges and non-edges differently; the last one uses the second over-/undershoot pair away from edges.
Smoothe soothe on/off on Temporal stabilisation of the sharpening.
Keep keep 0–100 20 Percentage of the sharpening kept at minimum; only meaningful with Smoothe.
Edge mode edgemode Show edgemask, Sharpening all, only edges, only not-edges Sharpening all Where sharpening is applied.
HQ edgemaskHQ on/off off Slower, more accurate edge mask.
Show show on/off off Debug view of the intermediate result.

Example

Default settings on a 10-bit YUV 4:2:0 source. The script handles high bit depth, so Hybrid adds no conversion:

LSFmod()

How Hybrid calls it

  • Hybrid loads MaskTools2, VariableBlur, FFTW, aWarpSharp, RemoveGrain (with its helper script), and LSFmod.avsi, and calls LSFmod(...).
  • Every parameter is only written when it differs from the script's own default, so default settings give a bare LSFmod(). The script derives its over-/undershoot defaults from Strength; the values shown in the dialog are what runs for any strength.
  • Method is only written for the range and non-linear modes, Kernel only for the methods that use it, and PreBlur only for those modes as well.
  • The two unsharp modes run on 8-bit YV12 only; Hybrid converts the input and turns off the script's luma-only optimisation for them. All other modes accept the YV12, YV16 and YV24 families at any bit depth.
  • LimitedSharpenFaster(mod) also offers the common options and can be added to the filter queue several times.

Background

  • LSFmod is LaTo's modification of Didée's LimitedSharpenFaster; the shipped script is version 2.185 (2019, A.SONY) of the script based on LaTo's v1.9. It added high bit depth support in 2.12 and an optimisation switch in 2.185.
  • The old preset gives output identical to LimitedSharpenFaster, fast is recommended for real-time speed, slow for quality. Lmode 1 and no soothe are the fastest. Add Limiter() if values leave the TV range. Very soft sources are a poor fit.
  • Hybrid does not offer the script's supersampling, target size, and source parameters.

See also: Vapoursynth LSFmod, LimitedSharpen

Sources