Avisynth pSharpen

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

pSharpen is a sharpener similar to LimitedSharpenFaster: it pushes each pixel towards the nearer local extreme, so it produces no overshoot and no halos.

Filtering → Avisynth → Sharpen

pSharpen controls in Hybrid
pSharpen controls in Hybrid

What it does

For each luma pixel the darkest and brightest value of its 3×3 neighbourhood are taken, and the pixel is moved towards the closer one. Values stay inside the local range, so nothing overshoots. Optional supersampling reduces aliasing on diagonal edges but costs speed. Only luma is sharpened; chroma is copied.

Requirements

Windows only, CPU only. The script needs MaskTools2 and Average.dll, both shipped with Hybrid.

Settings

Control Parameter Range Hybrid default Meaning
Strength strength 0–100 25 How far pixels are pushed to the local minimum or maximum (percent). 100 sets every pixel to its local extreme, 0 does nothing.
Supersampling Factor ss_x / ss_y 1–10 1 / 1 Enlargement factors before sharpening; 1 = off. Higher values reduce aliasing but are slower.
Threshold threshold 0–100 75 How close to the extreme a pixel may be pushed before overshoot correction (compression) begins; 0 does nothing.

If Strength and Threshold are both 0, the filter would do nothing and Hybrid leaves it out of the script. A single 0 still runs.

Example

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

pSharpen()

How Hybrid calls it

  • Hybrid loads MaskTools2, Average.dll and pSharpen.avsi, then calls pSharpen(strength, threshold, ss_x, ss_y). Each argument is only written when it differs from the default (25 / 75 / 1 / 1), so default settings give a bare pSharpen().
  • The filter works on integer YUV 4:2:0, 4:2:2 and 4:4:4 at 8–16 bit. Grey and RGB are converted first. It is not offered for interlaced material.
  • pSharpen also offers the common options and can be added to the filter queue several times.

Background

  • The script is a high-bit-depth version (2020) of an old Doom9 script. It uses Lanczos for the supersampling resize, clamps strength and threshold to 0–100 and raises supersampling values below 1 to 1.
  • The script also has target-size parameters (dest_x / dest_y) that Hybrid does not offer.

See also: Vapoursynth pSharpen, LimitedSharpen

Sources