Vapoursynth aWarpSharp2: Difference between revisions

From wiki.selur.net
Jump to navigation Jump to search
New filter page (via create-page on MediaWiki MCP Server)
 
Update to current Hybrid behaviour; code as <pre> (via update-page on MediaWiki MCP Server)
 
Line 23: Line 23:
| Planes || planes || all, chroma only, luma only || all || Planes that are processed.
| Planes || planes || all, chroma only, luma only || all || Planes that are processed.
|-
|-
| Tools: Warp || – || warp, awarp || warp || ''warp'' is the aWarpSharp2 plugin; ''awarp'' uses the AWarp plugin with an emulated edge mask (results differ).
| Tools: Warp || – || warp, awarp || warp || ''warp'' is the aWarpSharp2 plugin; ''awarp'' uses the AWarp plugin with an emulated edge mask (close to the plugin output, small differences are possible).
|}
|}


== Example ==
== Example ==
Default settings on a 10-bit YUV 4:2:0 source (640x356):
Default settings on a 10-bit YUV 4:2:0 source (640x356):
<syntaxhighlight lang="python">
<pre>
# sharpening using AWarpSharp2
# sharpening using AWarpSharp2
clip = sharpen.AWarpSharp2(clip, blur=2, tools={'warp': 'awarp'})
clip = sharpen.AWarpSharp2(clip, blur=2, tools={'warp': 'awarp'})
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==
Line 38: Line 38:
* Depth is written as one number; the plugin uses half of it for the chroma planes.
* Depth is written as one number; the plugin uses half of it for the chroma planes.
* The blur kernel and the chroma placement are not offered; the plugin defaults are used.
* The blur kernel and the chroma placement are not offered; the plugin defaults are used.
* With the ''awarp'' tool the edge mask is emulated: Sobel edges, cut at the threshold, Gaussian blur, and Depth rescaled to the AWarp scale (16 becomes 3). The threshold then acts as an edge switch and per-plane chroma masks are not emulated, so the result can look clearly different.
* With the ''awarp'' tool the edge mask is emulated like the plugin builds it: Sobel edges capped at the threshold, then the blur passes with the default blur kernel; Depth keeps the same scale. Chroma is honored: off warps the chroma with the luma mask scaled to the chroma size, on gives each chroma plane its own mask with half the blur passes. The result is close to the plugin output but can differ slightly.
* aWarpSharp2 also offers the [[Vapoursynth common filter options|common options]] (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).
* aWarpSharp2 also offers the [[Vapoursynth common filter options|common options]] (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).



Latest revision as of 09:47, 16 November 2026

aWarpSharp2 is a warp sharpener: instead of adding contrast it moves pixels towards the edges, so lines get thinner and crisper without the halos of classic sharpeners.

Filtering → Vapoursynth → Sharpen

aWarpSharp2 controls in Hybrid
aWarpSharp2 controls in Hybrid

What it does

An edge mask is built from the picture, capped at Threshold and blurred Blur times. The pixels are then warped along the gradient of this mask by Depth. Positive depth sharpens, negative depth warps the other way and softens. Strong settings thin lines noticeably, which is popular for anime line art, but they can also distort fine detail.

Settings

Control Parameter Range / values Hybrid default Meaning
Threshold thresh 0 – 255 128 Upper limit of the edge mask values; lower = weaker effect. 8-bit scale, the plugin scales it for higher bit depths.
Blur blur 0 – 100 2 Blur passes over the edge mask; more passes give a smoother mask and a gentler effect.
Depth depth -128 – 127 16 Warp strength; negative values blur. Chroma gets half the value.
Chroma chroma on/off off Off: chroma is warped with the luma mask. On: each chroma plane gets its own mask.
Planes planes all, chroma only, luma only all Planes that are processed.
Tools: Warp – warp, awarp warp warp is the aWarpSharp2 plugin; awarp uses the AWarp plugin with an emulated edge mask (close to the plugin output, small differences are possible).

Example

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

# sharpening using AWarpSharp2
clip = sharpen.AWarpSharp2(clip, blur=2, tools={'warp': 'awarp'})

How Hybrid calls it

  • aWarpSharp2 works on gray clips with 8–16 bit and on YUV clips with 8, 10 or 16 bit; other formats are converted first. It can also be used on interlaced sources.
  • Blur is always written; Threshold, Depth, Chroma and Planes only when they differ from the defaults, which equal the plugin's own defaults.
  • Depth is written as one number; the plugin uses half of it for the chroma planes.
  • The blur kernel and the chroma placement are not offered; the plugin defaults are used.
  • With the awarp tool the edge mask is emulated like the plugin builds it: Sobel edges capped at the threshold, then the blur passes with the default blur kernel; Depth keeps the same scale. Chroma is honored: off warps the chroma with the luma mask scaled to the chroma size, on gives each chroma plane its own mask with half the blur passes. The result is close to the plugin output but can differ slightly.
  • aWarpSharp2 also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Background

Plugin

The VapourSynth plugin by dubhater is a port of the AviSynth plugin aWarpSharp2. It knows two blur kernels: a 13×13-style average (type 0, the default used here) and a 5×5 kernel (type 1, better quality but needs more passes). The chroma depth defaults to half the luma depth; the equivalent strength for AWarp is 3.

Sources