MedianBlur2

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Requirements: AviSynth 2.6)
(Update)
Line 2: Line 2:
 
[[Category:Plugins]]
 
[[Category:Plugins]]
 
{{Filter3
 
{{Filter3
| {{Author/tp7}}
+
| {{Author/tp7}}, [https://github.com/pinterf pinterf]
 
| v0.94
 
| v0.94
| [http://github.com/tp7/MedianBlur2/releases/download/0.94/MedianBlur2-x86.zip MedianBlur2-x86.zip]
+
| [https://github.com/tp7/MedianBlur2/releases Releases]
[http://github.com/tp7/MedianBlur2/releases/download/0.94/MedianBlur2-x64.zip MedianBlur2-x64.zip]
+
 
| Blurring  
 
| Blurring  
| [http://opensource.org/licenses/MIT MIT] but binaries are [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
+
| [https://opensource.org/licenses/MIT MIT] but binaries are [https://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
|6=[http://forum.doom9.org/showthread.php?t=169832 Doom9 Thread]}}
+
|6=[https://forum.doom9.org/showthread.php?t=169832 Doom9 Thread]}}
 
<br>
 
<br>
 
== Description ==
 
== Description ==
Line 26: Line 25:
 
<br>
 
<br>
 
== Requirements ==
 
== Requirements ==
* [http://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0] or greater
+
* [https://sourceforge.net/projects/avisynth2/ AviSynth 2.6.0] or greater
* x64 version requires [http://forum.doom9.org/showthread.php?t=168856 AviSynth+ r1576] or later
+
* x64 version requires [https://forum.doom9.org/showthread.php?t=168856 AviSynth+ r1576] or later
 
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 
* Supported color formats: [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 
<br>
 
<br>
* [http://www.microsoft.com/en-us/download/details.aspx?id=30679 Microsoft Visual C++ 2012 Redistributable Package (x86 / x64)]
+
* [https://www.microsoft.com/en-us/download/details.aspx?id=30679 Microsoft Visual C++ 2012 Redistributable Package (x86 / x64)]
 
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>MedianBlur2-x86</tt>
 
:<span style="color:red">***</span> <tt>vcredist_x86.exe</tt> is required for <tt>MedianBlur2-x86</tt>
 
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>MedianBlur2-x64</tt>
 
:<span style="color:red">***</span> <tt>vcredist_x64.exe</tt> is required for <tt>MedianBlur2-x64</tt>
Line 103: Line 102:
 
                                 both chroma planes will now be processed by the optimized routine, rather than the general one as before.<br>
 
                                 both chroma planes will now be processed by the optimized routine, rather than the general one as before.<br>
 
  v0.9        12/08/2013      - Initial release.
 
  v0.9        12/08/2013      - Initial release.
<br>
 
== Archived Downloads ==
 
Take a look at the [http://github.com/tp7/MedianBlur2/releases GitHub releases page].
 
 
<br>
 
<br>
 
<br>
 
<br>
 
== External Links ==
 
== External Links ==
*[http://forum.doom9.org/showthread.php?t=169832 Doom9 Forum] - MedianBlur2 discussion, more information [http://forum.doom9.org/showthread.php?p=1656988#post1656988 here].
+
*[https://forum.doom9.org/showthread.php?t=169832 Doom9 Forum] - MedianBlur2 discussion, more information [http://forum.doom9.org/showthread.php?p=1656988#post1656988 here].
*[http://nomis80.org/ctmf.html Median Filtering in Constant Time] | [http://web.archive.org/web/20141115173428/http://nomis80.org/ctmf.html Mirror]
+
*[http://nomis80.org/ctmf.html Median Filtering in Constant Time] | [https://web.archive.org/web/20141115173428/http://nomis80.org/ctmf.html Mirror]
 
<br>
 
<br>
 
<br>
 
<br>
 
-----------------------------------------------
 
-----------------------------------------------
 
'''Back to [[External_filters#Blurring|External Filters]] &larr;'''
 
'''Back to [[External_filters#Blurring|External Filters]] &larr;'''

Revision as of 03:03, 18 June 2018

Abstract
Author tp7, pinterf
Version v0.94
Download Releases
Category Blurring
License MIT but binaries are GPLv2
Discussion Doom9 Thread


Contents

Description

MedianBlur2 is an implementation of constant time median filter for AviSynth; it includes 2 functions:

  • MedianBlur - a simple median filter similar to the old MedianBlur (function name is still MedianBlur).
  • MedianBlurTemporal - partially implements the old MedianBlurT function but doesn't have MVTools2-related parameters (hence the function name change). If you don't use the mo-comp part of it, you should be able to just change the name used without any other changes.
    Please do note that for temporal-only processing this filter is extremely inefficient (just like the original).


Performance

Unlike the old MedianBlur, this implementation has constant runtime complexity, meaning that theoretical performance is the same for any radius. Implementation is based on this paper, but includes some additional optimizations.

  1. When SSE2 is available and radius is 1 or 2, special routines are used. They're a lot faster than the generic one for these radii.
  2. For 2 < radius < 8, generic approach with 8-bit bin size is used. Using 8-bit bins makes histogram addition/subtraction faster with SSE2.
  3. For large radii, 16-bit bins are used, as described in the paper.

In other words, you can expect huge performance drop when going from 1 to 2, not so huge but still large from 2 to 3 and a noticeable slowdown from 7 to 8. Between them the fps should be constant and it actually might get a bit faster with larger radius. Performance with radius > 2 also depends on the actual frame content. Processing ColorBars() is a lot faster than AddGrainC(10000). It is quite possible that you'll get worse performance for radius = 3 with this plugin compared to the original MedianBlur. All other radii should be (a lot) faster.

Requirements


*** vcredist_x86.exe is required for MedianBlur2-x86
*** vcredist_x64.exe is required for MedianBlur2-x64


Syntax and Parameters

MedianBlur

Spatial-only version.

MedianBlur (clip, int "radiusy", int "radiusu", int "radiusv")


clip   =
Input clip must be planar.


int  radiusy = 2
int  radiusu = 2
int  radiusv = 2
Spatial radius; YUV planes are independently processed.
  • If set to 0 the corresponding plane is copied from the input clip unaltered.
  • If set between -1 and -255 the corresponding plane will be set to -radius.
  • If set to any value less than -255 the corresponding plane will be set to zero.
  • 2 is the default for all planes; maximum value is limited to 127.



MedianBlurTemporal

Spatio-temporal version.


MedianBlurTemporal (clip, int "radiusy", int "radiusu", int "radiusv", int "temporalradius")


clip   =
Input clip must be planar.


int  radiusy = 2
int  radiusu = 2
int  radiusv = 2
Spatial radius; YUV planes are independently processed.
  • Setting it to 0 will just disable spatial filtering.
  • Setting it to -1 will copy the plane from the input clip.
  • All other values will set the plane to absolute value of radius. Yes, there is no way to set the plane to -1.
  • If set to any value less than -255 the corresponding plane will be set to zero.
  • 2 is the default for all planes; maximum value is limited to 127.


int  temporalradius = 1
Value must be greater than 0; the higher the value the slower it gets.


Examples

  • MedianBlur with default settings:
AviSource("blah.avi")
MedianBlurTemporal(radiusy=2, radiusu=2, radiusv=2)
  • MedianBlurTemporal with default settings:
MedianBlurTemporal(radiusy=2, radiusu=2, radiusv=2, temporalradius=1)  
MedianBlurTemporal(radiusy=0, radiusu=0, radiusv=0, temporalradius=1)  


Changelog

Version      Date            Changes
v0.94 02/10/2014 - MedianBlurTemporal now produces more correct result around the clip borders (first and last frames). - Both functions allow radii less than -255, corresponding plane is set to zero. For compatibility with YAHR and possible other functions.
v0.93 12/27/2013 - This fixes a huge memory leak in MedianBlurTemp which made it unusable in complex scripts. The function is also renamed to MedianBlurTemporal, which is probably the final name.
v0.92 12/09/2013 - Spatiotemporal median filter called MedianBlurTemp added. Function name is subject to change.
v0.91 12/08/2013 - Plane processors are now independent from each other. It means when you write something like MedianBlur(5,1,1), both chroma planes will now be processed by the optimized routine, rather than the general one as before.
v0.9 12/08/2013 - Initial release.



External Links




Back to External Filters

Personal tools