LimitedSharpen

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (Required Plugins: typo)
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
__TOC__
+
{{FilterCat4|External_filters|Scripts|Adjustment_filters|Sharpeners}}
{{FilterCat|External_filters|Adjustment_filters|Sharpeners}}
+
{{Filter3
{{Filter|Didée|2.0b|[[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]]|Sharpeners|
+
|Didée
* YV12
+
|2.0b
|}}
+
|[[Media:LimitedSharpenFaster.avsi|LimitedSharpenFaster.avsi]]
{{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'')}}
+
|Sharpeners
 
+
|
== Abstract ==
+
|6=[http://forum.doom9.org/showthread.php?s=&threadid=84196 Doom9 Thread]}}
  
 +
== Description ==
 
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]].
 +
<br>
 +
<br>
 +
== Requirements ==
 +
* AviSynth 2.5.8 or [http://sourceforge.net/projects/avisynth2/ greater]
 +
* Supported color formats: [[YV12]]
  
=== Requires Filters ===
+
=== Required Plugins ===
*[[MaskTools]] 1.5x
+
Latest version of the following plugins are recommended unless stated otherwise.<br>
*[[MaskTools2]] 2a21+
+
*[[MaskTools2]]
*[[Removegrain]] 1.0-pre (Do not use SSE3 or it'll crash)
+
*<strike>RemoveGrain- part of the [[RemoveGrain v1.0b]] package.</strike>
*[[Warpsharp]] for UnsharpMask
+
*[[RgTools]] - recommended drop-in replacement for RemoveGrain!
 
+
*[[WarpSharp]] - only required when <code>{{FuncDef3|Smode}}=1</code>
== Description ==
+
<br>
  
 +
== [[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.
 
+
<br>
{{ParR|Smode|int|3|1-4}}
+
<br>
Sharpen mode:
+
:{{FuncDef|LimitedSharpenFaster (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" )}}
* 1 : [[WarpSharp|UnsharpMask]]
+
<br>
* 2 : [[Sharpen]]
+
::{{Par2| |clip| }}
* 3 : Range sharpening.
+
:::Input clip.
* 4 : nonlinear sharpening.
+
<br>
Each mode has progressively less haloing in its sharpening.
+
::{{Par2|ss_x|float|1.5}}
 
+
::{{Par2|ss_y|float|1.5}}
{{Par|ss_x|float|1.5}}
+
:::[[Supersampling]] when > 1, which reduces aliasing on edges.
{{Par|ss_y|float|1.5}}
+
<br>
[[Supersampling]] when > 1, which reduces aliasing on edges.
+
::{{Par2|dest_x|float|width}}
 
+
::{{Par2|dest_y|float|height}}
{{Par|dest_x|float|width}}
+
:::Resize directly to final size, saves a resize step.
{{Par|dest_y|float|height}}
+
<br>
Resize directly to final size, saves a resize step.
+
::{{Par2|Smode|int|3}}
 
+
:::Sharpen mode:
{{Par|strength|int|160}}
+
::::* 1 : [[WarpSharp|UnsharpMask]]
Sharpening strength:
+
::::* 2 : [[Sharpen]]
* For Smode=1, it can be 0~127 (simple sharpening), 128~255 (simple overdrive), 255~4096 (big overdrive).
+
::::* 3 : Range sharpening.
* For Smode=2, values 0~100 are handled over to Sharpen() as 0.0~1.0. Values >100 are mapped to 100.
+
::::* 4 : nonlinear sharpening.
* For Smode=3, 0~100 is common, but 100~inf. can be used if necessary.
+
:::Each mode has progressively less haloing in its sharpening.
Default is strength=160 for Smode=1, and strength=100 otherwise.
+
<br>
 
+
::{{Par2|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.
{{Par|overshoot|int|1}}
+
::::* For Smode=3, 0~100 is common, but 100~inf. can be used if necessary.
Sharpening limit: a sharpened pixel may not exceed [min,max] of the local  neighborhood by more than 'overshoot'.  
+
:::Default is strength=160 for Smode=1, and strength=100 otherwise.
(High values remove the "Limited" of LimitedSharpen, and cause excessive haloing.)
+
<br>
 
+
::{{Par2|radius|int|1}}
{{Par|undershoot|int|[overshoot]}}
+
:::Radius of UnsharpMask, only used in Smode=1.
Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines.
+
:::Range: 1 to 10
(If not specified, then undershoot==overshoot.)
+
<br>
 
+
::{{Par2|Lmode|int|1}}
{{ParR|Lmode|int|1|0-3}}
+
:::Lmode:
Lmode:
+
::::* 0 : No effect
* 0 : No effect
+
::::* 1 : Clamp to over/undershoot.
* 1 : Clamp to over/undershoot.
+
::::* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
* 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.
+
<br>
 
+
::{{Par2|wide|bool|false}}
{{ParR|soft|int|0|0-100}}
+
:::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.
Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
+
<br>
 
+
::{{Par2|overshoot|int|1}}
{{ParR|edgemode|int|0|-1 to 2}}
+
:::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.)
* -1 : shows edges.
+
<br>
* 0 : does nothing.
+
::{{Par2|undershoot|int|[overshoot]}}
* 1 : restricts sharpening to edges
+
:::Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines. (If not specified, then undershoot==overshoot.)
* 2 : restricts sharpening to mostly non-edges (I think?)
+
<br>
 
+
::{{Par2|soft|int|0}}
{{Par|special|bool|false}}
+
:::Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
special=true tries to raise detail contrast in dark areas of a frame.
+
:::Range: 0 to 100
(Usage not really recommended - the method is simple and might cause artefacts.)
+
<br>
 
+
::{{Par2|edgemode|int|0}}
{{Par|wide|bool|false}}
+
::::* -1 : shows edges.
With wide=true, the local [min,max] limits are gathered from the 5x5 neighborhood, instead just 3x3.
+
::::* 0 : does nothing.
Enables more gain in detail contrast. Increasingly useful with increasing [[supersampling]] factors.
+
::::* 1 : restricts sharpening to edges
 
+
::::* 2 : restricts sharpening to mostly non-edges (I think?)
{{ParR|exborder|int|0|0-16}}
+
<br>
 
+
::{{Par2|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.)
 +
<br>
 +
::{{Par2|exborder|int|0}}
 +
:::Border exclusion; range: 0 to 16
 +
<br>
 
== Examples ==
 
== Examples ==
 
<pre>
 
<pre>
Line 84: Line 96:
 
LimitedSharpenFaster()
 
LimitedSharpenFaster()
 
</pre>
 
</pre>
 +
<br>
 
== Changelog ==
 
== Changelog ==
 +
Version      Date          Changes<br>
 +
2.0b        2006/01/14    - LimitedSharpenFaster; modified 2005/11/29 version using MaskTools 2.0 by Manao
 +
                              released in MaskTools-v2.0a18<br>
 +
              2005/12/23    - NOTE: these changes are not available in LimitedSharpenFaster.
 +
                            - new:[http://forum.doom9.org/showpost.php?p=755140&postcount=377]                             
 +
                              * "strengthV" parameter, used only when Smode=2. Enables asymetric sharpening,
 +
                                internally it's just "sharpen( strength/100, strengthV/100 ).
 +
                            - * Smode=0: "custom" unsharp masking (bicubic resizing approximation).
 +
                                Radii can be given through "radius" (--> x-radius) and "radiusV" (--> y-radius).<br>
 +
              2005/11/29    - the small bug in Smode=4 was only fixed in the version for MaskTools 2.0alpha by Socio.[http://forum.doom9.org/showpost.php?p=743701&postcount=295]
 +
                              now corrected this version for old MaskTools, too[http://forum.doom9.org/showpost.php?p=743106&postcount=284] <br>
 +
              2005/11/01    - it adds a new Smode, a new Lmode as well, allows a seperate "undershoot",
 +
                              and handles the "soft" option completely different.[http://forum.doom9.org/showpost.php?p=731909&postcount=208]<br>
 +
              2004/11/26    - made the "wide=true" limiting mode working correctly<br>
 +
              2004/10/24    - added "exborder" parameter (border exclusion)<br>
 +
              2004/10/21    - LimitedSharpen; initial release
 +
<br>
  
 
+
==External Links ==
== Links ==
+
*[http://forum.doom9.org/showthread.php?s=&threadid=84196 Doom9 Forum] - LimitedSharpen discussion thread.
* Download [[Media:LimitedSharpenFaster.avs|LimitedSharpenFaster.avs]] : Current version, using masktools2.<br/>
+
*[[LSFmod]] - Advanced version, alias "v3.x"
 
+
<br>
* Advanced version, alias "v3.x" : [[LSFmod]]
+
<br>
 
+
-----------------------------------------------
* [http://forum.doom9.org/showthread.php?s=&threadid=84196 LimitedSharpen thread in doom9]
+
'''Back to [[External_filters#Sharpeners|External Filters]] &larr;'''

Latest revision as of 01:03, 28 November 2015

Abstract
Author Didée
Version 2.0b
Download LimitedSharpenFaster.avsi
Category Sharpeners
License
Discussion Doom9 Thread

Contents

[edit] Description

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.

[edit] Requirements

  • AviSynth 2.5.8 or greater
  • Supported color formats: YV12

[edit] Required Plugins

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


[edit] 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.

LimitedSharpenFaster (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" )


clip   =
Input clip.


float  ss_x = 1.5
float  ss_y = 1.5
Supersampling when > 1, which reduces aliasing on edges.


float  dest_x = width
float  dest_y = height
Resize directly to final size, saves a resize step.


int  Smode = 3
Sharpen mode:
Each mode has progressively less haloing in its sharpening.


int  strength = 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.


int  radius = 1
Radius of UnsharpMask, only used in Smode=1.
Range: 1 to 10


int  Lmode = 1
Lmode:
  • 0 : No effect
  • 1 : Clamp to over/undershoot.
  • 3 : Zero over/undershoot on edges, normal over/undershoot on not-edges.


bool  wide = 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.


int  overshoot = 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.)


int  undershoot = [overshoot]
Separate limit for pixels that get darker during sharpening. Good for cartoons with strong lines. (If not specified, then undershoot==overshoot.)


int  soft = 0
Softens the effect of sharpening. -1 will (try to) autocalculate a good value.
Range: 0 to 100


int  edgemode = 0
  • -1 : shows edges.
  • 0 : does nothing.
  • 1 : restricts sharpening to edges
  • 2 : restricts sharpening to mostly non-edges (I think?)


bool  special = 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.)


int  exborder = 0
Border exclusion; range: 0 to 16


[edit] Examples

avisource("Blah.avi")
LimitedSharpenFaster()


[edit] Changelog

Version      Date           Changes
2.0b 2006/01/14 - LimitedSharpenFaster; modified 2005/11/29 version using MaskTools 2.0 by Manao released in MaskTools-v2.0a18
2005/12/23 - NOTE: these changes are not available in LimitedSharpenFaster. - new:[1] * "strengthV" parameter, used only when Smode=2. Enables asymetric sharpening, internally it's just "sharpen( strength/100, strengthV/100 ). - * Smode=0: "custom" unsharp masking (bicubic resizing approximation). Radii can be given through "radius" (--> x-radius) and "radiusV" (--> y-radius).
2005/11/29 - the small bug in Smode=4 was only fixed in the version for MaskTools 2.0alpha by Socio.[2] now corrected this version for old MaskTools, too[3]
2005/11/01 - it adds a new Smode, a new Lmode as well, allows a seperate "undershoot", and handles the "soft" option completely different.[4]
2004/11/26 - made the "wide=true" limiting mode working correctly
2004/10/24 - added "exborder" parameter (border exclusion)
2004/10/21 - LimitedSharpen; initial release


[edit] External Links

  • Doom9 Forum - LimitedSharpen discussion thread.
  • LSFmod - Advanced version, alias "v3.x"




Back to External Filters

Personal tools