Vapoursynth UnsharpMask: 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 17: Line 17:
| Radius || radius || 1 – 128 || 3 || Horizontal and vertical radius of the box blur; larger values boost coarser detail.
| Radius || radius || 1 – 128 || 3 || Horizontal and vertical radius of the box blur; larger values boost coarser detail.
|-
|-
| Threshold || threshold || 1 – 255 || 8 || Smallest difference (8-bit scale) that is still sharpened.
| Threshold || threshold || 0 – 255 || 8 || Smallest difference (8-bit scale) that is still sharpened; 0 sharpens every difference.
|-
|-
| Tools: Expr || – || akarin, cranexpr, std || akarin (std without AVX2) || Expression plugin.
| Tools: Expr || – || akarin, cranexpr, std || akarin (std without AVX2) || Expression plugin.
Line 26: Line 26:
== 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 UnsharpMask
# sharpening using UnsharpMask
clip = sharpen.UnsharpMask(clip, tools={'expr': 'akarin', 'boxblur': 'vszip'})
clip = sharpen.UnsharpMask(clip, tools={'expr': 'akarin', 'boxblur': 'vszip'})
</syntaxhighlight>
</pre>


== How Hybrid calls it ==
== How Hybrid calls it ==

Latest revision as of 09:53, 16 November 2026

UnsharpMask is classic unsharp masking: the detail difference between the picture and a blurred copy is boosted and added back.

Filtering → Vapoursynth → Sharpen

UnsharpMask controls in Hybrid
UnsharpMask controls in Hybrid

What it does

A box-blurred copy of the luma plane is subtracted from the original. Where the difference is larger than Threshold, the difference is scaled by Strength and added to the original; smaller differences are left alone, so flat noise is not amplified. Only luma is sharpened; chroma passes through unchanged.

Settings

Control Parameter Range / values Hybrid default Meaning
Strength strength 0 – 128 64 Amount, used as strength/128: 64 adds half of the detail difference, 128 all of it, 0 nothing.
Radius radius 1 – 128 3 Horizontal and vertical radius of the box blur; larger values boost coarser detail.
Threshold threshold 0 – 255 8 Smallest difference (8-bit scale) that is still sharpened; 0 sharpens every difference.
Tools: Expr – akarin, cranexpr, std akarin (std without AVX2) Expression plugin.
Tools: BoxBlur – vszip, std vszip Box blur plugin.

Example

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

# sharpening using UnsharpMask
clip = sharpen.UnsharpMask(clip, tools={'expr': 'akarin', 'boxblur': 'vszip'})

How Hybrid calls it

  • UnsharpMask works on integer YUV clips with 8, 10, 12 or 16 bit; other formats are converted first.
  • Values are only written when they differ from 64 / 3 / 8, the script's own defaults.
  • Threshold stays on the 8-bit scale; the script scales it to the bit depth. Strength and Radius do not depend on the bit depth.
  • UnsharpMask also offers the common options (Masked, ApplyOnlyTo, Merge, OnRegion, Gimmick).

Sources