AVSShock
Raffriff42 (Talk | contribs) (redirect for convenient searching) |
m (→External Links) |
||
(One intermediate revision by one user not shown) | |||
Line 1: | Line 1: | ||
− | + | {{FilterCat|External_filters|Plugins|Restoration_filters|Sharpeners}} | |
− | {{ | + | {{Filter3 |
+ | |1=AMSS0815 | ||
+ | |2=2008-02-23 | ||
+ | |3=[https://web.archive.org/web/20160905074720if_/http://forum.gleitz.info/attachment.php?attachmentid=91901&d=1203778580 AVSShock-2008.02.23.zip] | ||
+ | |4=[[:Category:Sharpeners|Sharpeners]] | ||
+ | |5=[https://www.gnu.org/licenses/gpl-2.0.txt GPLv2] | ||
+ | |6=[http://forum.doom9.org/showthread.php?t=122443 Doom9 Thread]}} | ||
+ | <br> | ||
+ | == Description == | ||
+ | This Shock Filter sharpens edges of images by applying erosions or dilations depending on the sign of the Laplacian (or the so called Haralick-Canny edge detector). | ||
+ | |||
+ | Common sharpening algorithms often evolve the heat equation backwards (so called Gabor algorithm). This is done by convoluting the image with a mask with negative weights (like AviSynths build-in Sharpen function does). As this method violates a so called maximum principle (values of pixels calculated may be outside the value range of the original image), instabilities arise after some iterations, which can be observed as high oscillations. | ||
+ | |||
+ | This filter uses a morphological approach: In each iterations step, pixels are replaced by one of their neighbors. To avoid sharpening noise, a blurred version of the image is used only for the choice of each neighbor. This way high oscillations can be avoided even on large scales. | ||
+ | <br> | ||
+ | <br> | ||
+ | <span style="color:red">'''Note:'''</span> AVSShock is a C-plugin so it must be loaded using [[Plugins#LoadCPlugin|LoadCPlugin]], except if you're using AviSynth+, it allows autoloading of C-plugins. | ||
+ | <br> | ||
+ | <br> | ||
+ | == Requirements == | ||
+ | * [x86]: [[AviSynth+]] or [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6] | ||
+ | * Supported color formats: [[YUY2]], [[YV12]] | ||
+ | <br> | ||
+ | |||
+ | == [[Script variables|Syntax and Parameters]] == | ||
+ | :{{Template:FuncDef|Shock(clip Clip, int "Steps", float "Strength", bool "Canny", float "Blur", int "BlurSize")}} | ||
+ | <br> | ||
+ | ::{{Par2||clip| }} | ||
+ | :::Clip gives the source clip. YV12 or YUY2 are the only colorspaces currently allowed. The resulting clip will have the same properties as the source clip. | ||
+ | <br> | ||
+ | ::{{Par2|Steps|int|1}} | ||
+ | :::Unsharp masking threshold. | ||
+ | :::Steps gives the number of iterations applied to each video frame. (Default: 1). If Steps is zero, the clip is returned unmodified. Use a negative number to display a copyright message (along with an error message). | ||
+ | <br> | ||
+ | ::{{Par2|Strength|float|1.0}} | ||
+ | :::Strength gives the size of each iterations step. Values between 0.0 and 1.0 are allowed (Default: 1.0). The effective scale of the shock filter will be Steps∗Strength. If this product is zero, the source clip will be returned unchanged. | ||
+ | <br> | ||
+ | ::{{Par2|Canny|bool|false}} | ||
+ | :::Canny: If true, the Haralick-Canny edge-detector will be used, which is more precisely and requires more computation time. Otherwise, the Laplacian will be used. (Default: False). | ||
+ | <br> | ||
+ | ::{{Par2|Blur|float|1.0}} | ||
+ | :::Blur defines how strong each frame will be blurred before the edge detector is applied. Note that the blurred image will not be processed further. After applying the edge-detector, the erosions and dilations are applied to the original frame. The Blur value is the standard deviation of a Gaussian convolution kernel which is applied to the frame for blurring. (Default: 1.0). If Blur is zero, the blurring step is completely omitted and computation will be considerably faster. | ||
+ | <br> | ||
+ | ::{{Par2|BlurSize|int|}} | ||
+ | :::BlurSize is the size of the blurring kernel: The kernel used will be a (2∗BlurSize+1)×(2∗BlurSize+1) matrix. (Default: Ceil(2∗Blur)). If BlurSize is zero, the blurring step is completely ommited and computation will be considerably faster. | ||
+ | <br> | ||
+ | |||
+ | == Examples == | ||
+ | AVSShock with default settings: | ||
+ | [[AviSource]]("Blah.avi") | ||
+ | Shock() | ||
+ | <br> | ||
+ | |||
+ | == Changelog == | ||
+ | <pre> | ||
+ | 2006.12.19 | ||
+ | |||
+ | Initial Version. | ||
+ | |||
+ | 2007.01.04 | ||
+ | |||
+ | Changed the Blur default from 2.0 to 1.0. | ||
+ | Changed the BlurSize default from Round(2∗Blur+1) to Ceil(2∗Blur). | ||
+ | Added this helpfile | ||
+ | Maybe memory consumption reduced: Source frame is released before second temporary frame is allocated. I don't know how AviSynth exactly handles frame allocation stuff. | ||
+ | About 25% speed up: Temporary memory was allocated by creating frames, now malloc is used. | ||
+ | Some minor code improvement. Numbering of pixels inside a 3×3 block is more elegant. Maybe undetectable speed up. | ||
+ | |||
+ | 2007.01.25 | ||
+ | |||
+ | Small extensions in the help file. | ||
+ | Small corrections in the help file html-layout. | ||
+ | Small corrections/improvements in code: Added forgotten calling-convention macro to Shock_Free, moved color space dependent undefs in CS-file. | ||
+ | Bug corrected: When an unknown color space was used (e.g. Y8), a "out of memory"-message came up. | ||
+ | Raised gcc optimization level from -O1 to -O3 (silly me). | ||
+ | |||
+ | 2007.02.19 | ||
+ | |||
+ | Simplified distinction of standard deviation and heat equation scale in Code. | ||
+ | GetFrame function rewritten. Size of binary reduced by 1 kB. | ||
+ | Added filter name to error messages. | ||
+ | Changed error handling in filter create function to avoid multiple memory allocation. | ||
+ | Small corrections in help file. | ||
+ | First public version. | ||
+ | |||
+ | 2008.02.23 | ||
+ | |||
+ | AviSynth_C.dll is not needed anymore (I updated MinGW (see the makefile) — thanks to Fizick). | ||
+ | Changed a lot floats to doubles, which increased blurring accuracy and speed. | ||
+ | Blur intensity is checked for too small values now. | ||
+ | Minor change to CreateGaussKernel function. | ||
+ | |||
+ | </pre> | ||
+ | <br> | ||
+ | == Archived Downloads == | ||
+ | {| class="wikitable" border="1"; width="600px" | ||
+ | |- | ||
+ | !!width="100px"| Version | ||
+ | !!width="150px"| Download | ||
+ | !!width="150px"| Mirror | ||
+ | |- | ||
+ | !2008-02-23 | ||
+ | |[https://web.archive.org/web/20160905074720if_/http://forum.gleitz.info/attachment.php?attachmentid=91901&d=1203778580 AVSShock-2008.02.23.zip] | ||
+ | | | ||
+ | |- | ||
+ | !2007-02-19 | ||
+ | |[https://web.archive.org/web/20160905074728if_/http://forum.gleitz.info/attachment.php?attachmentid=85900&d=1171916753 AVSShock-2007.02.19.zip] | ||
+ | | | ||
+ | |} | ||
+ | <br> | ||
+ | == External Links == | ||
+ | *[https://web.archive.org/web/20171116052500/http://forum.gleitz.info/showthread.php?33105-Neues-Plugin-zum-Video-sch%E4rfen-Patent-Problem!&p=321585#post321585 Gleitz Forum] - AVSShock discussion in German (original forum archived) / [https://gleitz.info/forum/index.php?thread/33105-neues-plugin-zum-video-sch%C3%A4rfen-patent-problem/ forum after update]. | ||
+ | <br> | ||
+ | <br> | ||
+ | ----------------------------------------------- | ||
+ | '''Back to [[External_filters#Sharpeners|External Filters]] ←''' |
Latest revision as of 08:50, 25 February 2021
Abstract | |
---|---|
Author | AMSS0815 |
Version | 2008-02-23 |
Download | AVSShock-2008.02.23.zip |
Category | Sharpeners |
License | GPLv2 |
Discussion | Doom9 Thread |
Contents |
[edit] Description
This Shock Filter sharpens edges of images by applying erosions or dilations depending on the sign of the Laplacian (or the so called Haralick-Canny edge detector).
Common sharpening algorithms often evolve the heat equation backwards (so called Gabor algorithm). This is done by convoluting the image with a mask with negative weights (like AviSynths build-in Sharpen function does). As this method violates a so called maximum principle (values of pixels calculated may be outside the value range of the original image), instabilities arise after some iterations, which can be observed as high oscillations.
This filter uses a morphological approach: In each iterations step, pixels are replaced by one of their neighbors. To avoid sharpening noise, a blurred version of the image is used only for the choice of each neighbor. This way high oscillations can be avoided even on large scales.
Note: AVSShock is a C-plugin so it must be loaded using LoadCPlugin, except if you're using AviSynth+, it allows autoloading of C-plugins.
[edit] Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- Supported color formats: YUY2, YV12
[edit] Syntax and Parameters
- Shock(clip Clip, int "Steps", float "Strength", bool "Canny", float "Blur", int "BlurSize")
- clip =
- Clip gives the source clip. YV12 or YUY2 are the only colorspaces currently allowed. The resulting clip will have the same properties as the source clip.
- clip =
- int Steps = 1
- Unsharp masking threshold.
- Steps gives the number of iterations applied to each video frame. (Default: 1). If Steps is zero, the clip is returned unmodified. Use a negative number to display a copyright message (along with an error message).
- int Steps = 1
- float Strength = 1.0
- Strength gives the size of each iterations step. Values between 0.0 and 1.0 are allowed (Default: 1.0). The effective scale of the shock filter will be Steps∗Strength. If this product is zero, the source clip will be returned unchanged.
- float Strength = 1.0
- bool Canny = false
- Canny: If true, the Haralick-Canny edge-detector will be used, which is more precisely and requires more computation time. Otherwise, the Laplacian will be used. (Default: False).
- bool Canny = false
- float Blur = 1.0
- Blur defines how strong each frame will be blurred before the edge detector is applied. Note that the blurred image will not be processed further. After applying the edge-detector, the erosions and dilations are applied to the original frame. The Blur value is the standard deviation of a Gaussian convolution kernel which is applied to the frame for blurring. (Default: 1.0). If Blur is zero, the blurring step is completely omitted and computation will be considerably faster.
- float Blur = 1.0
- int BlurSize =
- BlurSize is the size of the blurring kernel: The kernel used will be a (2∗BlurSize+1)×(2∗BlurSize+1) matrix. (Default: Ceil(2∗Blur)). If BlurSize is zero, the blurring step is completely ommited and computation will be considerably faster.
- int BlurSize =
[edit] Examples
AVSShock with default settings:
AviSource("Blah.avi") Shock()
[edit] Changelog
2006.12.19 Initial Version. 2007.01.04 Changed the Blur default from 2.0 to 1.0. Changed the BlurSize default from Round(2∗Blur+1) to Ceil(2∗Blur). Added this helpfile Maybe memory consumption reduced: Source frame is released before second temporary frame is allocated. I don't know how AviSynth exactly handles frame allocation stuff. About 25% speed up: Temporary memory was allocated by creating frames, now malloc is used. Some minor code improvement. Numbering of pixels inside a 3×3 block is more elegant. Maybe undetectable speed up. 2007.01.25 Small extensions in the help file. Small corrections in the help file html-layout. Small corrections/improvements in code: Added forgotten calling-convention macro to Shock_Free, moved color space dependent undefs in CS-file. Bug corrected: When an unknown color space was used (e.g. Y8), a "out of memory"-message came up. Raised gcc optimization level from -O1 to -O3 (silly me). 2007.02.19 Simplified distinction of standard deviation and heat equation scale in Code. GetFrame function rewritten. Size of binary reduced by 1 kB. Added filter name to error messages. Changed error handling in filter create function to avoid multiple memory allocation. Small corrections in help file. First public version. 2008.02.23 AviSynth_C.dll is not needed anymore (I updated MinGW (see the makefile) — thanks to Fizick). Changed a lot floats to doubles, which increased blurring accuracy and speed. Blur intensity is checked for too small values now. Minor change to CreateGaussKernel function.
[edit] Archived Downloads
Version | Download | Mirror |
---|---|---|
2008-02-23 | AVSShock-2008.02.23.zip | |
2007-02-19 | AVSShock-2007.02.19.zip |
[edit] External Links
- Gleitz Forum - AVSShock discussion in German (original forum archived) / forum after update.
Back to External Filters ←