Variableblur

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (redirect to VariableBlur)
Line 1: Line 1:
{{FilterCat|Plugins|External_filters|Adjustment_filters|Blurring}}
+
#REDIRECT [[VariableBlur]]
Name:  variableblur<br>
+
Author:  Tritical<br>
+
Version:  0.50<br>
+
Date:  2011-03-14<br>
+
Architecture:  x86<br>
+
Dll:  variableblur.dll<br>
+
MD5:  f6237fc5b1570ae99fa1d689222c2607<br>
+
FilterType:  plugin<br>
+
Homepage:  http://forum.doom9.org/showthread.php?p=1484911#post1484911<br>
+
Support:  http://forum.doom9.org/showthread.php?p=1484911#post1484911<br>
+
Download:  http://bengal.missouri.edu/~kes25c/variableblur.zip<br>
+
Downloadx64:  http://www.mediafire.com/?0z0hl43za6bwlb4<br>
+
Dependencies:  fftw3.dll<br>
+
Type:  blur<br>
+
Colorspaces:  YV12<br>
+
Gamma-Aware: yes<br>
+
Functions:  binomialBlur(float varY,float varC,int Y,int U,int V,bool usemmx)<br>
+
Functions:  averageblur(int radY,int radC,int Y,int U,int V)<br>
+
Functions:  gaussianblur(float varY,float varC,int border,bool integrate,int Y,int U,int V, int gfunc, int gfuncc, int pcr, int pcrc)<br>
+
Functions:  unsharp(float varY,float varC,float strength,int border,bool integrate,int Y,int U,int V, int gfunc, int gfuncc, int pcr, int pcrc)<br>
+
  
Readme:
+
{{Filter3
<pre>
+
| {{Author/tsp}}, {{Author/tritical}}
VariableBlur version 0.5 - (March 14, 2011 - tritical)
+
| v0.7
 +
|[http://bengal.missouri.edu/~kes25c/variableblur.zip variableblur.zip]
 +
| Blurring
 +
| [http://www.gnu.org/licenses/gpl-2.0.txt GPLv2]
 +
|6=[http://forum.doom9.org/showthread.php?t=88645 Doom9 Thread]
 +
}}
 +
<br>
 +
== Description ==
 +
:VariableBlur is a Gaussian, binomial or average blur filter with a variable radius (variance). Also includes an unsharp mask filter based on the Gaussian filter meaning it is fast for big variance.
 +
:The binomial filter part is based on a paper by Frederick M. Waltz and John W. V. Miller. [http://mii-prakse.googlecode.com/svn/prakse/AtteluApstrade/Subprojects/PixelMaster/trunk/doc/materi%C4%81li/Gaussian%20blur%20using%20finite-state%20machines.pdf An efficient algorithm for Gaussian blur using finite-state machines]. SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII page 3521-37
 +
<br>
  
Modified from version 0.4 by Tonny Petersen(C)2005 (tsp@person.dk)
+
== Requirements ==
  (specifically http://forum.doom9.org/showthread.php?p=1177210#post1177210 which included some fixes from Neuron2)
+
:- AviSynth 2.5.8 or later
 +
:- Supported color formats: [[RGB24]], [[RGB32]], [[YUY2]], [[YV12]]
 +
<br>
 +
:- [http://www.microsoft.com/en-us/download/details.aspx?id=8328 Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)]
 +
::<span style="color:red">***</span> Required due to [http://msdn.microsoft.com/en-us/library/tt15eb9t%28v=vs.100%29.aspx OpenMP] multithreading.
  
 +
:- [http://www.fftw.org/install/windows.html FFTW 3.3.4 <tt>(fftw-3.3.4-dll32.zip)</tt>]
 +
::<span style="color:red">***</span> 32-bit version of <tt>libfftwf3-3.dll</tt> needs to be in the search path (<tt>C:\Windows\SysWOW64</tt> 64-bit OS or <tt>C:\windows\system32</tt> 32-bit OS)
 +
::<span style="color:red">***</span> VariableBlur will not run or load without it.
  
  Variableblur is a gaussian, binomial or average blur filter with a variable radius(variance).
+
:- [[VariableBlur/GaussianBlur|GaussianBlur]] function requires an [[SSE2]] capable CPU.  
  The binomial filter part is based on a paper by Frederick M. Waltz and John W. V. Miller. An efficient algorithm for Gaussian blur using finite-state machines.  
+
<br>
  SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII page 3521-37
+
  
  The gaussian filter uses fftw version 3(http://www.fftw.org) available from ftp://ftp.fftw.org/pub/fftw/fftw3win32mingw.zip and wouldn't run without it.  
+
== Filters ==
  If you have fft3ffilter or defreq installed you already have it.
+
{{PluginFilterTable2}}
 +
{{PluginFilterRow|VariableBlur|AverageBlur|
 +
AverageBlur works by taking the average value of the pixels inside the radius.
 +
| [[YV12]]
 +
}}
 +
{{PluginFilterRow|VariableBlur|BinomialBlur|
 +
BinomialBlur works by repeating a 5x5 or 3x3 kernel based on pascals triangle multiple times to blur the image.
 +
| [[YV12]]
 +
}}
 +
{{PluginFilterRow|VariableBlur|GaussianBlur|
 +
GaussianBlur works by converting the image to the frequency domain using FFTW and complex multiplying it with the Gaussian kernel in the frequency domain before converting the result back to the spatial domain giving the same result as doing a convolution in the spatial domain just faster for large kernel sizes.
 +
| [[RGB24]], [[RGB32]], [[YUY2]], [[YV12]]
 +
}}
 +
{{PluginFilterRow|VariableBlur|Unsharp|
 +
Sharpens the image using unsharp filtering (http://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm for an explanation).
 +
| [[RGB24]], [[RGB32]], [[YUY2]], [[YV12]]
 +
}}
 +
|}
 +
<br>
  
  Also includes an unsharp mask filter based on the gaussian filter meaning it is fast for big variance.
+
<br>
  
 
+
== Changelog ==
USAGE:
+
Version      Date            Changes<br>
 
+
  v0.7        05/24/2012      - Fix integrate=true giving incorrect results due to lack of precision in weight
  -------------------------------------------------------------------
+
                                calculation. Integrate=true now gives results much closer to integrate=false, as
  binomialBlur(float varY,float varC,int Y,int U,int V,bool usemmx)
+
                                would be expected.
 
+
                              - Add support for YUY2, RGB24, and RGB32 input to GaussianBlur/Unsharp<br>
      binomialBlur works by repeating a 5x5 or 3x3 kernel based on pascals triangle multiple times to blur the image. With a variance above 1 the result is
+
v0.6        05/22/2012      - Fix border=3 bug for gfunc/gfuncc >= 0 (gamma processing was not done on border values)
      very close to a true gaussian blur and much faster (for variance below ~30).  
+
                              - Make radius for GaussianBlur 4*std instead of 3*std
 
+
                              - Add border=4 (mirroring) option to gaussianblur and make it the default
 
+
                              - Dynamically load FFTW (libfftwf3-3.dll) instead of statically linking to old .lib
     varY,varC: variance to use. Remember variance=sd^2. The variance is rounded down to the nearest half integer(0.5,1.0,1.5 etc).  
+
                              - Multithread GaussianBlur using OpenMP and use FFTW multithreaded plans
                Radius 1 in version <=0.2 is equal to variance 0.5. Default 1.5
+
                              - SSE/SSE2 optimizations. GaussianBlur now requires SSE2 capable CPU.<br>
 
+
v0.5        03/14/2011     - Add gfunc/gfuncc/pcr/pcrc parameters to gaussianblur/unsharp  (tritical)<br>
     Y,U,V: Controls which planes the filter is applied to. If set to 3 the plane will be filtered, if 2 the plane will be copied from the source, if 1 the plane
+
v0.4+        08/30/2008      - [http://forum.doom9.org/showpost.php?p=1157772&postcount=39 Memory leak] fix by [http://forum.doom9.org/showpost.php?p=1177210&postcount=45 Neuron2]<br>
            will be ignored and from 0 to -255 the plane will be assigned the absolute value. Default Y 3,U=2, V=2
+
v0.4        05/24/2005      - Fixed bug with converting float to unsigned char without proper clamping.
 
+
                                Also included an sharp filter and optional integrated Gaussian coefficients.
    useMMX: If true MMX instructions will be used. Default true for variance>1 else false.
+
v0.3        05/06/2005     - GaussianBlur is included, old Gaussian is renamed to BinomialBlur.<br>
 
+
v0.2         01/24/2005      - optimization of the Gaussian blur (now uses a 5x5 mask instead of 3x3) and the  
 
+
                                average blur(smarter algorithm resulting in a factor 20 to 100 speed increase)<br>
-------------------------------------------------------------------
+
v0.1        01/19/2005      - Initial release
  averageblur(int radY,int radC,int Y,int U,int V)
+
<br>
 
+
== Archived Downloads ==
        averageblur works by taken the average value of the pixels inside the radius.
+
{| class="wikitable" border="1"; width="700px"
 
+
|-
    radY,radC: radius of the kernel. default 3.
+
!!width="100px"| Version
 
+
!!width="150px"| Download
    Y,U,V: same as binomialblur
+
!!width="150px"| Mirror
 
+
!!width="150px"| Mirror 2
 
+
|-
-------------------------------------------------------------------
+
!v0.7
  gaussianblur(float varY,float varC,int border,bool integrate,int Y,int U,int V, int gfunc, int gfuncc, int pcr, int pcrc)
+
|[http://bengal.missouri.edu/~kes25c/variableblur.zip variableblur.zip]
 
+
|[http://web.archive.org/web/20140420184040/http://bengal.missouri.edu/~kes25c/variableblur.zip variableblur.zip]
        gaussianblur works by converting the image to the frequency domain using fftw and complex multiplying it with the gaussian kernel in the frequency domain
+
|
        before converting the result back to the spatial domain giving the same result as doing a convolution in the spatial domain just faster for large kernelsizes.
+
|-
 
+
!v0.4+
    varY,varC: Variance to use. This will not be rounded. default 1.5
+
|[http://rationalqm.us/misc/VariableBlur.zip VariableBlur.zip]
 
+
|[http://web.archive.org/web/20140713164910/http://rationalqm.us/misc/VariableBlur.zip VariableBlur.zip]
    border: Setup how the border of the image is threated. Posible values:
+
|[http://web.archive.org/web/20140703022116/http://neuron2.net/misc/VariableBlur.zip VariableBlur.zip]
      -255 - 0: the area outside the image is filled with the absolute value
+
|-
1: Wrap around. The right border will be blured with the left border and the top border with the bottom border.  
+
!v0.4
                    This is the default behaivior when doing convolution in the frequency domain so this will be the fastest option. Default value
+
|[http://www.tsp.person.dk/VariableBlur040.zip VariableBlur040.zip]
2: Don't process borders.
+
|[http://web.archive.org/web/20111212022051/http://www.tsp.person.dk/VariableBlur040.zip VariableBlur040.zip]
3: fill the area outside the border with the border value. Slowest but produces the nicest result.
+
|[http://www.avisynth.nl/users/tsp/VariableBlur040.zip VariableBlur040.zip]
 
+
|-
    integrate: if true the coefficient used will be a mean value of the area the pixel covers. Use this if you consider each pixel to be made of an infinite number
+
!v0.3
                of infinite small pixels or if you like the result :-). If integration is used the image will be softer. Default false.
+
|[http://www.64k.it/andres/data/avisynth/variableblur_25_dll_20050506.zip variableblur_25_dll_20050506.zip]
 
+
|[http://web.archive.org/web/20140630103035/http://www.64k.it/andres/data/avisynth/variableblur_25_dll_20050506.zip variableblur_25_dll_20050506.zip]
    Y,U,V: same as binomialblur
+
|
 
+
|}
    gfunc,gfuncc: set the gamma function to use for Y and U/V planes. Default (-1,-1). Possible values:
+
<br>
 
+
== External Links ==
          -1 = do not correct gamma (same processing as version 0.4) - Default
+
*[http://forum.doom9.org/showthread.php?t=88645 Doom9 Forum] - VariableBlur discussion.
          0 = sRGB
+
<br>
          1 = BT.709, SMPTE 170M
+
<br>
          2 = SMPTE 240M
+
<br>
          3 = BT.470-2 System M  (straight 2.2 gamma, no linear segment)
+
-----------------------------------------------
          4 = BT.470-2 System B,G (straight 2.8 gamma, no linear segment)
+
'''Back to [[External_filters#Blurring|External Filters]] &larr;'''
          5 = (straight 2.22222 gamma, no linear segment)
+
          6 = (straight 1.8 gamma, no linear segment)
+
          7 = linear, no gamma compensation
+
 
+
        Gamma-correction will be undone (forward gamma transfer function) prior to filtering, and then reapplied (inverse gamma transfer function) after filtering.
+
 
+
    pcr/pcrc: set the pixel value range for Y and U/V planes. Only used if gfunc or gfuncc >= 0. Default(0,0). Possible values:
+
 
+
          0 = [0,255]
+
          1 = [16,235]
+
          2 = [16,240]
+
         
+
 
+
-------------------------------------------------------------------
+
  unsharp(float varY,float varC,float strength,int border,bool integrate,int Y,int U,int V, int gfunc, int gfuncc, int pcr, int pcrc)
+
 
+
        Sharpens the image using unsharp filtering (http://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm for an explanation).
+
 
+
    strength: Strength of the sharpener best values is between 0(no sharpen) to 1(more sharpen). Values outside this will produce strange results.
+
 
+
    Rest of the options is the same as for gaussianblur
+
 
+
 
+
 
+
EXAMPLE:
+
 
+
        binomialBlur(radY=0.5,RadC=0.5) #nearly the same as Blur(1)
+
 
+
 
+
 
+
        #Unsharpen (it will sharpen the image)
+
 
+
        function unsharpen(clip c,float variance,float k)
+
        {
+
            blr=gaussianblur(c,vary=variance,varc=2,Y=3,U=2,V=2,border=1)
+
            return yv12lutxy(blr,c,"y x - "+string(k)+" * y +",y=3,u=2,v=2)
+
        }
+
 
+
 
+
 
+
CHANGELOG:
+
 
+
  0.1 Initial release
+
 
+
  0.2 optimization of the gaussian blur (now uses a 5x5 mask instead of 3x3) and the average blur(smarter algorithm resulting in a factor 20 to 100 speed increase)
+
 
+
  0.3 GaussianBlur is included old gaussian is renamed to binomialblur.
+
 
+
  0.4 Fixed bug with converting float to unsigned char without proper clamping. Also included an unsharp filter and optional integrated gaussian coefficients
+
 
+
  0.5 Add gfunc/gfuncc/pcr/pcrc parameters to gaussianblur/unsharp  (tritical)
+
 
+
 
+
 
+
LICENSE:
+
 
+
  This filter is released under GPL se copying.txt
+
</pre>
+

Revision as of 23:29, 13 July 2014

  1. REDIRECT VariableBlur
Abstract
Author tsp, tritical
Version v0.7
Download variableblur.zip
Category Blurring
License GPLv2
Discussion Doom9 Thread


Contents

Description

VariableBlur is a Gaussian, binomial or average blur filter with a variable radius (variance). Also includes an unsharp mask filter based on the Gaussian filter meaning it is fast for big variance.
The binomial filter part is based on a paper by Frederick M. Waltz and John W. V. Miller. An efficient algorithm for Gaussian blur using finite-state machines. SPIE Conf. on Machine Vision Systems for Inspection and Metrology VII page 3521-37


Requirements

- AviSynth 2.5.8 or later
- Supported color formats: RGB24, RGB32, YUY2, YV12


- Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
*** Required due to OpenMP multithreading.
- FFTW 3.3.4 (fftw-3.3.4-dll32.zip)
*** 32-bit version of libfftwf3-3.dll needs to be in the search path (C:\Windows\SysWOW64 64-bit OS or C:\windows\system32 32-bit OS)
*** VariableBlur will not run or load without it.
- GaussianBlur function requires an SSE2 capable CPU.


Filters

Filter Description Color format
AverageBlur

AverageBlur works by taking the average value of the pixels inside the radius.

YV12
BinomialBlur

BinomialBlur works by repeating a 5x5 or 3x3 kernel based on pascals triangle multiple times to blur the image.

YV12
GaussianBlur

GaussianBlur works by converting the image to the frequency domain using FFTW and complex multiplying it with the Gaussian kernel in the frequency domain before converting the result back to the spatial domain giving the same result as doing a convolution in the spatial domain just faster for large kernel sizes.

RGB24, RGB32, YUY2, YV12
Unsharp

Sharpens the image using unsharp filtering (http://homepages.inf.ed.ac.uk/rbf/HIPR2/unsharp.htm for an explanation).

RGB24, RGB32, YUY2, YV12



Changelog

Version      Date            Changes
v0.7 05/24/2012 - Fix integrate=true giving incorrect results due to lack of precision in weight calculation. Integrate=true now gives results much closer to integrate=false, as would be expected. - Add support for YUY2, RGB24, and RGB32 input to GaussianBlur/Unsharp
v0.6 05/22/2012 - Fix border=3 bug for gfunc/gfuncc >= 0 (gamma processing was not done on border values) - Make radius for GaussianBlur 4*std instead of 3*std - Add border=4 (mirroring) option to gaussianblur and make it the default - Dynamically load FFTW (libfftwf3-3.dll) instead of statically linking to old .lib - Multithread GaussianBlur using OpenMP and use FFTW multithreaded plans - SSE/SSE2 optimizations. GaussianBlur now requires SSE2 capable CPU.
v0.5 03/14/2011 - Add gfunc/gfuncc/pcr/pcrc parameters to gaussianblur/unsharp (tritical)
v0.4+ 08/30/2008 - Memory leak fix by Neuron2
v0.4 05/24/2005 - Fixed bug with converting float to unsigned char without proper clamping. Also included an sharp filter and optional integrated Gaussian coefficients. v0.3 05/06/2005 - GaussianBlur is included, old Gaussian is renamed to BinomialBlur.
v0.2 01/24/2005 - optimization of the Gaussian blur (now uses a 5x5 mask instead of 3x3) and the average blur(smarter algorithm resulting in a factor 20 to 100 speed increase)
v0.1 01/19/2005 - Initial release


Archived Downloads

Version Download Mirror Mirror 2
v0.7 variableblur.zip variableblur.zip
v0.4+ VariableBlur.zip VariableBlur.zip VariableBlur.zip
v0.4 VariableBlur040.zip VariableBlur040.zip VariableBlur040.zip
v0.3 variableblur_25_dll_20050506.zip variableblur_25_dll_20050506.zip


External Links





Back to External Filters

Personal tools