Vapoursynth DetailSharpen

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

DetailSharpen is Didée's non-haloing sharpener: it lifts fine detail with a non-linear curve and gives strong edges little extra, without any edge mask.

Filtering → Vapoursynth → Sharpen

DetailSharpen controls in Hybrid
DetailSharpen controls in Hybrid

What it does

The picture is compared with a 3×3 blurred copy. The difference is boosted by a non-linear curve: differences below the zero point are amplified more, larger ones less, so detail is lifted while edges do not get halos. A low damp keeps very small differences (noise) from being over-enhanced. On YUV only luma is sharpened, on RGB all planes.

Settings

Control Parameter Range / values Hybrid default Meaning
Zero z 0.001 – 100 4 Zero point of the curve (8-bit difference units): smaller differences are amplified more, larger ones less.
Strength sstr 0 – 100 1.5 Strength of the non-linear sharpening.
Power power 0.001 – 100 4 Exponent of the curve.
Damper ldmp 0 – 100 1 Low damp: keeps very small differences from being over-enhanced (8-bit units).
Mode mode gaussian kernel, box kernel box kernel Kernel of the blurred reference.
Median med on/off off Adds a 3×3 median to the blurred reference for stronger sharpening.
Tools: Expr – akarin, cranexpr, std akarin (std without AVX2) Expression plugin.
Tools: Median – zsmooth, std zsmooth Median plugin; only used with Median on.

Example

Default settings on a 10-bit YUV 4:2:0 source (640x356):

# sharpening using DetailSharpen
clip = sharpen.DetailSharpen(clip, tools={'expr': 'akarin', 'median': 'zsmooth'})

How Hybrid calls it

  • DetailSharpen works on YUV and RGB clips of any bit depth and on 32-bit float RGB; other formats are converted first.
  • Values are only written when they differ from the defaults, which equal the script's own defaults.
  • Zero and Damper stay on the 8-bit scale at every bit depth; the script normalizes the differences itself.
  • DetailSharpen also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Origin

The function comes from a Doom9 thread in which Didée offered sharpening "that causes no haloing" without edge masking. With the defaults it is the original DetailSharpen; power 1.5, gaussian kernel and median on make it a kind of "mini SeeSaw".

Sources