LimitedSharpen

From Avisynth wiki
(Difference between revisions)
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.
+
  
{{Par|dest_x|float|width}}
+
::{{ParR|Smode|int|3|1-4}}
{{Par|dest_y|float|height}}
+
:::Sharpen mode:
Resize directly to final size, saves a resize step.
+
::::* 1 : [[WarpSharp|UnsharpMask]]
 +
::::* 2 : [[Sharpen]]
 +
::::* 3 : Range sharpening.
 +
::::* 4 : nonlinear sharpening.
 +
:::Each mode has progressively less haloing in its sharpening.
  
{{Par|strength|int|160}}
+
::{{Par|ss_x|float|1.5}}
Sharpening strength:
+
::{{Par|ss_y|float|1.5}}
* For Smode=1, it can be 0~127 (simple sharpening), 128~255 (simple overdrive), 255~4096 (big overdrive).
+
:::[[Supersampling]] when > 1, which reduces aliasing on edges.
* 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|dest_x|float|width}}
Radius of UnsharpMask, only used in Smode=1.
+
::{{Par|dest_y|float|height}}
 +
:::Resize directly to final size, saves a resize step.
  
{{Par|overshoot|int|1}}
+
::{{Par|strength|int|160}}
Sharpening limit: a sharpened pixel may not exceed [min,max] of the local  neighborhood by more than 'overshoot'.  
+
:::Sharpening strength:
(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
+
::::* 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|undershoot|int|[overshoot]}}
+
::{{ParR|radius|int|1|1-10}}
Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines.
+
:::Radius of UnsharpMask, only used in Smode=1.
(If not specified, then undershoot==overshoot.)
+
  
{{ParR|Lmode|int|1|0-3}}
+
::{{Par|overshoot|int|1}}
Lmode:
+
:::Sharpening limit: a sharpened pixel may not exceed [min,max] of the local  neighborhood by more than 'overshoot'.  
* 0 : No effect
+
:::(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
* 1 : Clamp to over/undershoot.
+
* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
+
  
{{ParR|soft|int|0|0-100}}
+
::{{Par|undershoot|int|[overshoot]}}
Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
+
:::Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines. (If not specified, then undershoot==overshoot.)
  
{{ParR|edgemode|int|0|-1 to 2}}
+
::{{ParR|Lmode|int|1|0-3}}
* -1 : shows edges.
+
:::Lmode:
* 0 : does nothing.
+
::::* 0 : No effect
* 1 : restricts sharpening to edges
+
::::* 1 : Clamp to over/undershoot.
* 2 : restricts sharpening to mostly non-edges (I think?)
+
::::* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
  
{{Par|special|bool|false}}
+
::{{ParR|soft|int|0|0-100}}
special=true tries to raise detail contrast in dark areas of a frame.
+
:::Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
(Usage not really recommended - the method is simple and might cause artefacts.)
+
  
{{Par|wide|bool|false}}
+
::{{ParR|edgemode|int|0|-1 to 2}}
With wide=true, the local [min,max] limits are gathered from the 5x5 neighborhood, instead just 3x3.
+
::::* -1 : shows edges.
Enables more gain in detail contrast. Increasingly useful with increasing [[supersampling]] factors.
+
::::* 0 : does nothing.
 +
::::* 1 : restricts sharpening to edges
 +
::::* 2 : restricts sharpening to mostly non-edges (I think?)
 +
 
 +
::{{Par|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.)
 +
 
 +
::{{Par|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.
 +
 
 +
::{{ParR|exborder|int|0|0-16}}
  
{{ParR|exborder|int|0|0-16}}
 
  
 
== Examples ==
 
== Examples ==
Line 84: Line 91:
 
LimitedSharpenFaster()
 
LimitedSharpenFaster()
 
</pre>
 
</pre>
== Changelog ==
 
  
  
== Links ==
+
== Changelog ==
* Download [[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]] : Current version, using masktools2.<br/>
+
  
 +
==External Links ==
 +
* 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 23:15, 26 September 2014

Contents

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

Personal tools