Difference between revisions of "LimitedSharpen"

From Avisynth wiki
Jump to: navigation, search
m (1 revision)
(formatting)
Line 1: Line 1:
 
__TOC__
 
__TOC__
{{FilterCat|External_filters|Adjustment_filters|Sharpeners}}
+
{{FilterCat4|External_filters|Scripts|Adjustment_filters|Sharpeners}}
{{Filter|Didée|2.0b|[[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]]|Sharpeners|
+
{{Filter|Didée
 +
|2.0b
 +
|[[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]]
 +
|Sharpeners
 +
|
 
* YV12
 
* YV12
|}}
+
|7=[http://forum.doom9.org/showthread.php?s=&threadid=84196 Doom9 Thread]}}
{{FuncDef|LimitedSharpen(clip clp, float ''ss_x'', float ''ss_y'', int ''dest_x'', int ''dest_y'', int ''Smode'', int ''strength'', int ''radius'', int ''Lmode'', bool ''wide'', int ''overshoot'', int ''undershoot'', int ''soft'', int ''edgemode'', bool ''special'', int ''exborder'')}}
 
  
 
== Abstract ==
 
== Abstract ==
 +
Applies a strong sharpening to edges and fine details by controlling halos and minimising artifacts. All sharpening is a 3-way struggle between edge-halos, edge-aliasing, and confetti artifacts; LimitedSharpen is an attempt to minimize each in the most visually pleasing way. For a similar filter that integrates denoising and sharpening into a single step, look at [[SeeSaw]].
  
Applies a strong sharpening to edges and fine details by controlling halos and minimising artifacts. All sharpening is a 3-way struggle between edge-halos, edge-aliasing, and confetti artifacts; LimitedSharpen is an attempt to minimize each in the most visually pleasing way. For a similar filter that integrates denoising and sharpening into a single step, look at [[SeeSaw]].
 
  
=== Requires Filters ===
+
== Required Plugins ==
 +
Latest version of the following plugins are recommended unless stated otherwise.<br>
 
*[[MaskTools]] 1.5x
 
*[[MaskTools]] 1.5x
*[[MaskTools2]] 2a21+
+
*[[MaskTools2]] 2a48+
*[[Removegrain]] 1.0-pre (Do not use SSE3 or it'll crash)
+
*[[RemoveGrain]] v1.0b (Do not use SSE3 or it'll crash)
*[[Warpsharp]] for UnsharpMask
+
*WarpSharp for UnsharpMask | [http://web.archive.org/web/20120212062428/http://vfrmaniac.fushizen.eu/seraphy_mirror/warpsharp/bin/warpsharp_20080325.7z warpsharp_20080325.7z]
  
== Description ==
 
  
 +
== [[Script variables|Syntax and Parameters]] ==
 
This should be used as the last filter in a chain if possible, like any sharpener. The different Smodes cause different defaults to be used in certain cases, or limit the ranges differently. See the source for specifics.
 
This should be used as the last filter in a chain if possible, like any sharpener. The different Smodes cause different defaults to be used in certain cases, or limit the ranges differently. See the source for specifics.
  
{{ParR|Smode|int|3|1-4}}
 
Sharpen mode:
 
* 1 : [[WarpSharp|UnsharpMask]]
 
* 2 : [[Sharpen]]
 
* 3 : Range sharpening.
 
* 4 : nonlinear sharpening.
 
Each mode has progressively less haloing in its sharpening.
 
  
{{Par|ss_x|float|1.5}}
+
:{{FuncDef|LimitedSharpen(clip clp, float ''ss_x'', float ''ss_y'', int ''dest_x'', int ''dest_y'', int ''Smode'', int ''strength'', int ''radius'', int ''Lmode'', bool ''wide'', int ''overshoot'', int ''undershoot'', int ''soft'', int ''edgemode'', bool ''special'', int ''exborder'')}}
{{Par|ss_y|float|1.5}}
+
 
[[Supersampling]] when > 1, which reduces aliasing on edges.
+
::{{ParR|Smode|int|3|1-4}}
 +
:::Sharpen mode:
 +
::::* 1 : [[WarpSharp|UnsharpMask]]
 +
::::* 2 : [[Sharpen]]
 +
::::* 3 : Range sharpening.
 +
::::* 4 : nonlinear sharpening.
 +
:::Each mode has progressively less haloing in its sharpening.
 +
 
 +
::{{Par|ss_x|float|1.5}}
 +
::{{Par|ss_y|float|1.5}}
 +
:::[[Supersampling]] when > 1, which reduces aliasing on edges.
 +
 
 +
::{{Par|dest_x|float|width}}
 +
::{{Par|dest_y|float|height}}
 +
:::Resize directly to final size, saves a resize step.
  
{{Par|dest_x|float|width}}
+
::{{Par|strength|int|160}}
{{Par|dest_y|float|height}}
+
:::Sharpening strength:
Resize directly to final size, saves a resize step.
+
::::* For Smode=1, it can be 0~127 (simple sharpening), 128~255 (simple overdrive), 255~4096 (big overdrive).
 +
::::* For Smode=2, values 0~100 are handled over to Sharpen() as 0.0~1.0. Values >100 are mapped to 100.
 +
::::* For Smode=3, 0~100 is common, but 100~inf. can be used if necessary.
 +
:::Default is strength=160 for Smode=1, and strength=100 otherwise.
  
{{Par|strength|int|160}}
+
::{{ParR|radius|int|1|1-10}}
Sharpening strength:
+
:::Radius of UnsharpMask, only used in Smode=1.
* For Smode=1, it can be 0~127 (simple sharpening), 128~255 (simple overdrive), 255~4096 (big overdrive).
 
* For Smode=2, values 0~100 are handled over to Sharpen() as 0.0~1.0. Values >100 are mapped to 100.
 
* For Smode=3, 0~100 is common, but 100~inf. can be used if necessary.
 
Default is strength=160 for Smode=1, and strength=100 otherwise.
 
  
{{ParR|radius|int|1|1-10}}
+
::{{Par|overshoot|int|1}}
Radius of UnsharpMask, only used in Smode=1.
+
:::Sharpening limit: a sharpened pixel may not exceed [min,max] of the local  neighborhood by more than 'overshoot'.
 +
:::(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
  
{{Par|overshoot|int|1}}
+
::{{Par|undershoot|int|[overshoot]}}
Sharpening limit: a sharpened pixel may not exceed [min,max] of the local  neighborhood by more than 'overshoot'.
+
:::Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines. (If not specified, then undershoot==overshoot.)
(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
 
  
{{Par|undershoot|int|[overshoot]}}
+
::{{ParR|Lmode|int|1|0-3}}
Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines.
+
:::Lmode:
(If not specified, then undershoot==overshoot.)
+
::::* 0 : No effect
 +
::::* 1 : Clamp to over/undershoot.
 +
::::* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
  
{{ParR|Lmode|int|1|0-3}}
+
::{{ParR|soft|int|0|0-100}}
Lmode:
+
:::Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
* 0 : No effect
 
* 1 : Clamp to over/undershoot.
 
* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
 
  
{{ParR|soft|int|0|0-100}}
+
::{{ParR|edgemode|int|0|-1 to 2}}
Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
+
::::* -1 : shows edges.
 +
::::* 0 : does nothing.
 +
::::* 1 : restricts sharpening to edges
 +
::::* 2 : restricts sharpening to mostly non-edges (I think?)
  
{{ParR|edgemode|int|0|-1 to 2}}
+
::{{Par|special|bool|false}}
* -1 : shows edges.
+
:::special=true tries to raise detail contrast in dark areas of a frame.
* 0 : does nothing.
+
:::(Usage not really recommended - the method is simple and might cause artefacts.)
* 1 : restricts sharpening to edges
 
* 2 : restricts sharpening to mostly non-edges (I think?)
 
  
{{Par|special|bool|false}}
+
::{{Par|wide|bool|false}}
special=true tries to raise detail contrast in dark areas of a frame.
+
:::With wide=true, the local [min,max] limits are gathered from the 5x5 neighborhood, instead just 3x3.
(Usage not really recommended - the method is simple and might cause artefacts.)
+
:::Enables more gain in detail contrast. Increasingly useful with increasing [[supersampling]] factors.
  
{{Par|wide|bool|false}}
+
::{{ParR|exborder|int|0|0-16}}
With wide=true, the local [min,max] limits are gathered from the 5x5 neighborhood, instead just 3x3.
 
Enables more gain in detail contrast. Increasingly useful with increasing [[supersampling]] factors.
 
  
{{ParR|exborder|int|0|0-16}}
 
  
 
== Examples ==
 
== Examples ==
Line 84: Line 91:
 
LimitedSharpenFaster()
 
LimitedSharpenFaster()
 
</pre>
 
</pre>
 +
 +
 
== Changelog ==
 
== Changelog ==
  
 
+
==External Links ==
== Links ==
 
 
* Download [[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]] : Current version, using masktools2.<br/>
 
* Download [[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]] : Current version, using masktools2.<br/>
 
 
* Advanced version, alias "v3.x" : [[LSFmod]]
 
* Advanced version, alias "v3.x" : [[LSFmod]]
 
+
* [http://forum.doom9.org/showthread.php?s=&threadid=84196 LimitedSharpen thread in Doom9]
* [http://forum.doom9.org/showthread.php?s=&threadid=84196 LimitedSharpen thread in doom9]
 

Revision as of 00:15, 27 September 2014

Abstract
Author Didée
Version 2.0b
Download LimitedSharpenFaster.avs
Category Sharpeners
Requirements
  • YV12
License
Discussion Doom9 Thread

Abstract

Applies a strong sharpening to edges and fine details by controlling halos and minimising artifacts. All sharpening is a 3-way struggle between edge-halos, edge-aliasing, and confetti artifacts; LimitedSharpen is an attempt to minimize each in the most visually pleasing way. For a similar filter that integrates denoising and sharpening into a single step, look at SeeSaw.


Required Plugins

Latest version of the following plugins are recommended unless stated otherwise.


Syntax and Parameters

This should be used as the last filter in a chain if possible, like any sharpener. The different Smodes cause different defaults to be used in certain cases, or limit the ranges differently. See the source for specifics.


LimitedSharpen(clip clp, float ss_x, float ss_y, int dest_x, int dest_y, int Smode, int strength, int radius, int Lmode, bool wide, int overshoot, int undershoot, int soft, int edgemode, bool special, int exborder)
Smode int (1-4, default 3)
Sharpen mode:
Each mode has progressively less haloing in its sharpening.
ss_x float = 1.5
ss_y float = 1.5
Supersampling when > 1, which reduces aliasing on edges.
dest_x float = width
dest_y float = height
Resize directly to final size, saves a resize step.
strength int = 160
Sharpening strength:
  • For Smode=1, it can be 0~127 (simple sharpening), 128~255 (simple overdrive), 255~4096 (big overdrive).
  • For Smode=2, values 0~100 are handled over to Sharpen() as 0.0~1.0. Values >100 are mapped to 100.
  • For Smode=3, 0~100 is common, but 100~inf. can be used if necessary.
Default is strength=160 for Smode=1, and strength=100 otherwise.
radius int (1-10, default 1)
Radius of UnsharpMask, only used in Smode=1.
overshoot int = 1
Sharpening limit: a sharpened pixel may not exceed [min,max] of the local neighborhood by more than 'overshoot'.
(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
undershoot int = [overshoot]
Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines. (If not specified, then undershoot==overshoot.)
Lmode int (0-3, default 1)
Lmode:
  • 0 : No effect
  • 1 : Clamp to over/undershoot.
  • 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
soft int (0-100, default 0)
Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
edgemode int (-1 to 2, default 0)
  • -1 : shows edges.
  • 0 : does nothing.
  • 1 : restricts sharpening to edges
  • 2 : restricts sharpening to mostly non-edges (I think?)
special bool = false
special=true tries to raise detail contrast in dark areas of a frame.
(Usage not really recommended - the method is simple and might cause artefacts.)
wide bool = false
With wide=true, the local [min,max] limits are gathered from the 5x5 neighborhood, instead just 3x3.
Enables more gain in detail contrast. Increasingly useful with increasing supersampling factors.
exborder int (0-16, default 0)


Examples

avisource("Blah.avi")
LimitedSharpenFaster()


Changelog

External Links