View Full Version : FastBlur - fast approximate Gaussian blurs


wonkey_monkey
30th June 2019, 17:39
FastBlur v0.4 (https://horman.net/avisynth/download/fastblur0.4.zip)
Doc: https://horman.net/avisynth/FastBlur.html


0.4: can now accept a function to animate blurs
0.3.2: new build from pinterf's GitHub project (https://github.com/pinterf/FastBlur/) which fixes bugs and supports frame properties
0.3.1: enabled clamping to avoid rounding error overflows
0.3: added threads parameter


Having been frustrated one too many times by VariableBlur's GaussianBlur and its bizarre syntax (and wildly variable speed), I've now written FastBlur, which performs an approximately Gaussian blur by repeated box blurs. It's much faster than GaussianBlur by default, and still at least 1.5x faster than GaussianBlur with multi-threading enabled (FastBlur is multi-threaded by default).

It also doesn't suffer from GaussianBlur's long start-up times.

https://i.imgur.com/u8Ffqhq.png

It supports all colour spaces and can optionally dither the output. It's also (approximately) gamma-aware, which means more visually-pleasing blurs (although this should be disabled if you're blurring a mask).

v0.4 can now also accept a function name as a parameter so that blurs can be animated without the overhead of the built-in Animate function:

function blur_function(int frame_no) {
return frame_no * 0.1; // increasing blur over time
}

function blur_function2(int frame_no) {
return [ sin(frame_no * 0.1) * 50, -sin(frame_no * 0.1) * 50 ] // bounce between horizontal and vertical blur (negative values have on effect)
}

FastBlur(ColorBars, "blur_function")
FastBlur(ColorBars, "blur_function2")

Sparktank
30th June 2019, 21:38
Pretty! Thanks!

StainlessS
1st July 2019, 03:23
Looks great, thanks awfully.

Fingerprint link @ you downloads page is 404.

EDIT: Is there a limit to iterations ?

wonkey_monkey
1st July 2019, 09:17
http://horman.net/fingerprint.zip

No limit to iterations. Three is usually plenty, you probably won't see any difference beyond five, and seven would definitely be overkill.

StainlessS
1st July 2019, 10:16
Thanks David.
Currently playing with S_Exlogo, got it working on RGB32 as well as original YUY2 (2.58+).
Will be adding Avs+ colorspaces when I figure out how, and what the new rules are.
Added Post Process Multi-blur as in StringRepeater thing posted yesterday.
Will add your FastBlur as Option, much better than repeated blur(1.58,1.58). [EDIT: Will be the only S_ExLogo required plugin if fastblur option is used.]

By the way, S_ExLogo script probably has more downloads than anything else that I've ever done, so is well popular.

EDIT: Would be lovely if YUY2 was also supported, but no sweat if not.

EDIT: Below new hi-liting in S_ExLogo(),
Outer purple border is clipping area to be ignored (ie black borders, pretend in this case),
Yellow area is the valid logo patch area that will have blurring applied [after the clipping has removed the red area (above yellow patch) from selected logo area, ie logo over black border ignored].
https://i.postimg.cc/C5CnMC6k/ExLogo.jpg (https://postimages.org/)

EDIT: Above, LogoMode=1, ie show coords

S_ExLogo(100,0,100,100,LOGOMODE=1,ClipX=32,ClipY=32,ClipW=-32,ClipH=-32,PostBlurCnt=POSTBLURCNT)

EDIT: For above example image, the [destined to be] blurred patch area in yellow will use only data from Left, Right, and Below valid yellow patch, black border area is ignored so
as to avoid getting a horrid blurred black mess instead of a ghastly logo. [EDIT: Although I guess I could additionally use LetterBox() on border area to blank to black].

EDIT:
[float]:
Blur radius (equivalent to PhotoShop Gaussian Blur's radius)
Any chance you could divulge anything about Photoshop blur radius in docs ?

[I find it real annoying when docs say 'does same as some other plugin arg', esp when other plugin aint no longer available]
EDIT: Guess I'll just pass the buck, and refer user to FastBlur docs, which refer to PhotoShop docs, and who knows what they say.

MysteryX
3rd July 2019, 12:34
EDIT: Guess I'll just pass the buck, and refer user to FastBlur docs, which refer to PhotoShop docs, and who knows what they say.
Sounds like administrative paperwork

wonkey_monkey
3rd July 2019, 13:01
Any chance you could divulge anything about Photoshop blur radius in docs ?

[I find it real annoying when docs say 'does same as some other plugin arg', esp when other plugin aint no longer available]
EDIT: Guess I'll just pass the buck, and refer user to FastBlur docs, which refer to PhotoShop docs, and who knows what they say.

Bigger numbers make more blur, that's all really. The connection with PhotoShop isn't really to assist with usage, it's just so, if you happen to know that in PhotoShop you'd use a radius of 16, you can use the same with FastBlur.

A radius of x is similar to three box blurs of radius x (centre pixel, plus x pixels on either side - perhaps not quite as blurry, but very close). And that's independent of the number of iterations used.

If you just want a box blur, set iterations = 1.

StainlessS
3rd July 2019, 13:24
Bigger numbers make more blur
See, now that wern't so difficult, now add it to your docs :)

Your Fastblur works great in S_ExLogo. [and does not by the way, suffer from RGB64 prob as posted in Devs forum just now]

StainlessS
3rd July 2019, 23:42
Wonkey,
Would you know of any blur type arrangement that when applied to a rectangular area, applied liittle to the perimeter
but greater variable amount to inner of rect. Maybe (sort of) in that well known bell shape in two dimensions. [3rd dim being blur amount bell shape]

EDIT: Or in simple pyramid style, linear to a peak in center.
[EDIT: or variable in between both styles, linear pyramid to bell.
[EDIT: or at max power a [squarish near corners] semi sphere].

EDIT: Maybe I can do it with Fast/Blur and masks, based on maybe distance from nearest edge, or something.
Dogway (in the devs forum, bout 6 months ago, I think) was doing what he called "vignette" or something like that,
think I need something like the opposite of that.

wonkey_monkey
4th July 2019, 09:51
There may be a way with another filter I'm writing but I don't see it being simple. Otherwise some solution with animate, crop, and stack might work, but it would be slow.

StainlessS
4th July 2019, 10:02
Would a mask together with blur be any prob, you think. [nearer white, more blur let through].

EDIT: Dogway thing:- https://forum.doom9.org/showthread.php?p=1872801&highlight=vignette#post1872801

wonkey_monkey
4th July 2019, 10:22
It wouldn't be the same as a true graduated blur, but it might work well enough for your purposes.

StainlessS
4th July 2019, 10:24
I guess a man on a galloping horse might not notice, thanks for your answer, think I might try make mask with the mysterious Expr() thing.

StainlessS
4th July 2019, 10:43
JFYI,

Its this that I would like to try avoid [trouble is, sometimes is desirable to work as it does, and sometimes not]

Original without blur
https://i.postimg.cc/Dy9N72bF/T1.jpg (https://postimages.org/)

blurred [upper left]
https://i.postimg.cc/2yqHfJkV/T2.jpg (https://postimages.org/)

EDIT:
Damn Wonkey, remember that you pointed out a PhotoImage.org "Petrol stations near me" advert,
they gotta be sneaking them in on purpose every now and then,
Had a "Banks near me" link inserted into the "hotlink for forums", if you link the page with advert link, and open another browser page and jump to link, the advert changes to another
different advert. A bit cheeky, but I can live with it.
[EDIT: Maybe only does it sometimes when you dont use your account to upload image]

EDIT: Think I'm gonna totally abandon any thoughts on above, may just make worse sometimes.

vcmohan
8th July 2019, 12:27
in my modplus (http://www.avisynth.nl/users/vcmohan/modPlus/modPlus.html) plugin there is a Gaussian blur filter GBlur. It has a radius and standard deviation (strength ) arguments to control the area of and amount of blur . It works multi thread under avisynth+. Request please check it and whether it works in a similar fashion. It does not take any time to start and does only one iteration. Borders equal to radius will remain unfiltered.

wonkey_monkey
8th July 2019, 13:18
I'm not really sure what you're asking... I'm a bit confused as to how radius and standard deviation work together in GBlur, since in FastBlur the parameter is actually a standard deviation which defines the radius (and just happens to be roughly equal to the radius with the default three iterations).

For what it's worth, the following calls give similar results:

a = FastBlur(1.5, gamma = false)
b = GBlur(8)

Increasing Gblur's standard deviation seems to make the result closer to a box blur, as these are similar:

a = FastBlur(5, iterations = 1, gamma = false)
b = GBlur(8, 10000)

vcmohan
15th July 2019, 14:10
I'm not really sure what you're asking... I'm a bit confused as to how radius and standard deviation work together in GBlur, since in FastBlur the parameter is actually a standard deviation which defines the radius (and just happens to be roughly equal to the radius with the default three iterations).[/code]

In Gaussian Blur depending on the standard deviation and radius values the outer values can be insignificant but are used neverthless increasing the computation time. By increase of std deviation this can be avoided but the blur deviates(theorotically) from pure gaussian. In GBlur it warns if insignificant values (those that will not change the end result) are in the outer part . Use of separable symmetric matrix of coefficients speeds up the process.

hello_hello
19th July 2019, 07:52
Does anyone else have a problem with FastBlur crashing when the width is not mod8, at least for YV12 video. The height mod doesn't seem to matter.
I'm running XP and Avisynth 2.6, if it matters.

Thanks for a nice plugin!

Groucho2004
19th July 2019, 08:39
Does anyone else have a problem with FastBlur crashing when the width is not mod8, at least for YV12 video. The height mod doesn't seem to matter.
I'm running XP and Avisynth 2.6, if it matters.Can't reproduce this. The only requirement is that the dimensions are even.

wonkey_monkey
19th July 2019, 09:32
It's possible there's an SSE instruction you don't have which is only used when the width isn't mod8. Does the following script crash?


colorbars(pixel_type = "yv12", width = 638, height = 480)
FastBlur(10)

pinterf
19th July 2019, 09:42
Does anyone else have a problem with FastBlur crashing when the width is not mod8, at least for YV12 video. The height mod doesn't seem to matter.
I'm running XP and Avisynth 2.6, if it matters.

Thanks for a nice plugin!
Possibly an unaligned Crop issue.

wonkey_monkey
19th July 2019, 10:23
Yes, it definitely could be that, because Avisynth+ keeps everything aligned (and FastBlur, a little lazily, relies on it), but older versions of Avisynth don't.

pinterf
19th July 2019, 10:40
Yes, it definitely could be that, because Avisynth+ keeps everything aligned (and FastBlur, a little lazily, relies on it), but older versions of Avisynth don't.
It's not lazyness, no other use case produces unaligned frames in classic Avisynth, unaligned crop just adjusts internal frame pointers.
It should be used with precaution.
Speed gain is marginal (if any, because next filter would fall back to C version internally if frame is not well aligned), scripts should do the Crop with "align"=true. This parameter is kept in Avisynth+ only for compatibility reasons.

hello_hello
19th July 2019, 12:41
All I can report at this stage is this will crash every time:

Spline36Resize(704,396)
Crop(2,0,-2,0,Align=true)
FastBlur(50)

Whereas this does not:

Spline36Resize(704,396)
Crop(4,0,-4,0)
FastBlur(50)

StainlessS
19th July 2019, 12:50
Tried the first example above with colorbars YV12, no problems with avs+, avs 2.60, avs v2.61alpha, avs Neo.

EDIT: Same with 2nd example script.

hello_hello
19th July 2019, 12:52
That's not fair. It crashes reliably for me. :(

Could you try it without Align=true? Just out of curiosity.

Cheers.

StainlessS
19th July 2019, 12:57
Later, gotta leave right now.

pinterf
19th July 2019, 12:59
That's not fair. It crashes reliably for me. :(

Could you try it without Align=true? Just out of curiosity.

Cheers.

No crash here, either.

What does "crash" means? Exit? Error message?
When fed into Avsmeter it would show the Exception text whether it is C0000005 or illegal instruction, whatever.

StainlessS
19th July 2019, 14:20
Same with Align=False

What player ?
Also, Vdub2 would show error message properly (usually).

pinterf
19th July 2019, 15:33
SSE4.1 is used but hello_hello's processor does not support it.

Tried Intel SDE emulator (https://software.intel.com/en-us/articles/intel-software-development-emulator) with --mrm option
I'm using this tool to emulate either pre-historic :) or too modern (= not available for me, e.g. AVX512) instruction sets.

This --mrm emulates Merom architecture.

AVSMeter 2.9.0 (x86) - Copyright (c) 2012-2019, Groucho2004
AviSynth 2.60, build:Aug 28 2012 [18:17:07] (2.6.0.3)
TID 16 SDE-ERROR: Executed instruction not valid for specified chip (CORE2): 0x16512cb7: pextrb byte ptr [ecx], xmm0, 0x0
Image: C:\Program Files (x86)\AviSynth+\plugins\FastBlur.dll+0x2cb7
Instruction bytes are: 66 0f 3a 14 01 00

TID 20 SDE-ERROR: Executed instruction not valid for specified chip (CORE2): 0x16512cb7: pextrb byte ptr [ecx], xmm0, 0x0
Image: C:\Program Files (x86)\AviSynth+\plugins\FastBlur.dll+0x2cb7
Instruction bytes are: 66 0f 3a 14 01 00

TID 19 SDE-ERROR: Executed instruction not valid for specified chip (CORE2): 0x16512cb7: pextrb byte ptr [ecx], xmm0, 0x0
Image: C:\ProTID 23 SDE-ERROR: Executed ig

wonkey_monkey
19th July 2019, 16:48
That makes sense. Pixels are written out in groups of four using older SSE instructions, but any stragglers get dealt with using newer instructions. For YV12 that means you have to be mod8 so that the chroma channels are mod4.

If you pad the video to the right by repeating the final column of pixels, the FastBlur result (after cropping again) should be identical.

StainlessS
19th July 2019, 17:53
Source available yet so as I can recompile, I am unlikely to use if not OK on my other machines [well once in a blue moon I might use it on No1 m/c].
(one a P4 with hyperthreading, no SSE4.1 , I'm pretty sure.
My core2 Q6600 has SSE4 I think but not SSE4.1, cant check at moment, I knocked it off a table a coupla days back and CPU + heatsink is currently detached from Motherboard).

That Emulator sounds pretty nifty.
EDIT: From The emulator FAQ:
Q: What are the system requirements?
Intel® SDE will run on IA-32 or Intel® 64 processors running Windows or Linux or OS X operating systems.

Q: What are the CPUID requirements?
Pin, and thus Intel SDE requires a Pentium 4 or later processor.
EDIT: Emulator [Windows] Downloads 17MB + 1.2MB. [Req:- Intel devs account (not so difficult to sign up, Free and pretty quick IIRC + access to loads of Intel stuff)]

EDIT: Looks like Q6600 only has SSE3/SSSE3, no SSE4.

hello_hello
20th July 2019, 06:55
Sorry, I was gone for a while but I see pinterf found the cause. It's nice to know I wasn't going mad. :)

StainlessS
20th July 2019, 07:58
It's nice to know I wasn't going mad. :)
A rather large conclusion to jump to based on Pinterf comment. :)

hello_hello
20th July 2019, 14:45
Here's what AVS meter shows when it crashes. Usually the program opening the script simply vanishes, so that's as close as I get to an error message. Is there a way to dig out more info?

https://i.postimg.cc/X7mxkq2h/AVSMeter.gif

StainlessS
20th July 2019, 16:12
Easiest way to see invisible error message is to right click on avs and Open with VDub2.

Here result of loading empty avs file info VD2 (I was kinda curious what it would produce):-
https://i.postimg.cc/CRp0nr4S/Empty.png (https://postimg.cc/CRp0nr4S)
MPC-HC just gives a "Scripts return was not a video clip (is the undefined value)".

hello_hello
20th July 2019, 21:30
It looks like Pinterf was correct.

https://i.postimg.cc/N0S3DSt7/VD.gif

For the function I'm using FastBlur for (blurring borders), I originally did something like this:

Left = Blend_Left.GaussResize(BorderL, Total_Height)\
.FastBlur(50, dither=true)\
.AddGrain(var=5.0, constant=true)

I worked around it by following wonkey_monkey's advice. Inside a function it's not a big hassle.

LMod = ((BorderL % 8) == 0) ? 0 : 8 - (BorderL - (floor(float(BorderL) / 8.0) * 8))

Left = Blend_Left.GaussResize(BorderL, Total_Height)\
.PointResize(BorderL+LMod, Total_Height, -LMod, 0, BorderL+LMod, 0)\
.FastBlur(50, dither=true)\
.Crop(LMod, 0,0, 0)\
.AddGrain(var=5.0, constant=true)

wonkey_monkey
25th December 2019, 01:40
Updated to fix a rounding/accumulation bug with floating point clips.

http://horman.net/avisynth/download/FastBlur.zip

Adrammelech
30th December 2019, 20:11
How does this compare with `Dither_box_filter16()` when using iterations=1
and gamma=false?

I tried matching the output between the two but I couldn't get the equivalent
radius from one to the other.

And since I'm on it, would you be willing to add the usual `y, u, v`
parameters from MaskTools/DitherTools, for convenience?

wonkey_monkey
31st December 2019, 12:07
FastBlur(9, iterations = 1, gamma = false) is pretty close. In general multiplying by 9/16 seems to work for other radiuses.

There seems to be a border bug in the version I recently uploaded which I'll sort out later. EDT: never mind, there was no bug, it was a dithertools misunderstanding.

Copying all the functionality of y/u/v seems more trouble than its worth at the moment.

StainlessS
31st December 2019, 18:38
YUY2 would also be lovely if not too much bother [we all know just how eager you are to please :) ]

Adrammelech
31st December 2019, 19:51
I don't know, it doesn't quite seem to match to me, especially after
immediately going with smaller radii than the one you presented in such 9:16
ratio.

I ask mostly because I've been wanting to replace many of the stack16
filters/functions I normally use (particularly from DitherTools) to proper
HBD that AviSynth+ supports, and this one seems to be the closest to fit the
criteria for a box blur.

wonkey_monkey
31st December 2019, 21:23
It was visually indistinguishable to me. Can you post a comparison screenshot and/or your script?

wonkey_monkey
31st December 2019, 22:49
YUY2 would also be lovely if not too much bother [we all know just how eager you are to please :) ]

:rolleyes:

Download it again (now converts internally to YV16 and back)

StainlessS
31st December 2019, 23:40
What a lovely XMas + New Year pressy, thanx muchly :)

EDIT: Would also be good if somewhere there was some indication of version/date eg
zip file, doc file, or version resource details (or even via some eg "Version" arg showing curent version on frame).

Its real easy to add version resource stuff.

From Uglarm,

version.h [Stuff generally changing per plugin or version in BLUE]

#define Version_Major 0
#define Version_Minor 00 // Two Digits
#define Version_Beta 00 // Two Digits (00 = Not beta)
#define MyPlugName "Uglarm\0"

#define MyVersion_Copyright "Krzysztof Wojdon\0"
#define MyVersion_Implementor "Milan Cutka\0"

// #x Encloses the argument x in quotes.
// #@x Encloses the argument x in single quotes.
// ## Concatenates tokens used as arguments to form other tokens.
#define _STR(x) #x
#define STR(x) _STR(x)

#define MyVersion_Number Version_Major,Version_Minor,Version_Beta,0

#if(Version_Beta > 0)
#define MyVersion_String STR(Version_Major) "." STR(Version_Minor) ".Beta" STR(Version_Beta)
#else
#define MyVersion_String STR(Version_Major) "." STR(Version_Minor) "." STR(Version_Beta) "." STR(0)
#endif

// Below MUST BE set for avs v2.58 and avs+ x64, Configuration Properties/Resources/General/PreProcessor Definitions
// Avs v2.58, Add definition 'AVISYNTH_PLUGIN_25'
// Avs+ v2.60 x64, Add definition '_WIN64'
#ifdef AVISYNTH_PLUGIN_25
#define MyComments "Windows XP Rules OK\0"
#define MyOriginalDllName MyPlugName "_25.dll\0"
#define MyDescription "Avisynth v2.58 32 bit CPP Plugin\0"
#else
#ifdef _WIN64
#define MyComments "Windows XP Rules OK\0"
#define MyOriginalDllName MyPlugName "_x64.dll\0"
#define MyDescription "Avisynth+ v2.60 64 bit CPP Plugin\0"
#else
#define MyComments "Windows XP Rules OK\0"
#define MyOriginalDllName MyPlugName "_x86.dll\0"
#define MyDescription "Avisynth+ v2.60 32 bit CPP Plugin\0"
#endif
#endif


resource.h

#ifndef IDC_STATIC
#define IDC_STATIC (-1) // ssS, This dont seem necessary, added by ResEdit. We keep it here anyway.
#endif

#include "Version.h"


resource.rc

#include <windows.h>
#include <commctrl.h> // ssS, This dont seem necessary, added by ResEdit. We keep it here anyway.
#include <richedit.h> // ssS, This dont seem necessary, added by ResEdit. We keep it here anyway.

#include "resource.h"

//
// Version Information resources
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION MyVersion_Number
PRODUCTVERSION MyVersion_Number
FILEOS VOS_NT
FILETYPE VFT_DLL //VFT_DLL for DLL, VFT_APP for application
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", MyComments
VALUE "FileDescription", MyDescription
VALUE "FileVersion", MyVersion_String
VALUE "LegalCopyright", MyVersion_Copyright
VALUE "OriginalFilename", MyOriginalDllName
VALUE "ProductName", MyPlugName
VALUE "SpecialBuild", MyVersion_Implementor
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END


For x64, Need to add _WIN64 to CPP Preprocessor Definitions, also to Resource Preprocessor Definitions.

NOTE, in VS2008 Express, resource editor is not supplied, can right click on an rc file, and select "Open With", and then
"Source Code (Text) Editor (Default)",
and click, "Set Default".

Then you can simply edit as text file, is real easy.

Once you figure it out, just copy above files into new source directory, edit plugin name and version in Version.h,
add the _WIN64 stuff to Project, and thats pretty much it.

EDIT: Stuff to edit in Version.h, per plugin,

#define Version_Major 0
#define Version_Minor 00 // Two Digits
#define Version_Beta 00 // Two Digits (00 = Not beta)
#define MyPlugName "Uglarm\0"

#define MyVersion_Copyright "Krzysztof Wojdon\0"
#define MyVersion_Implementor "Milan Cutka\0"


EDIT: or from TitleBar plugin

#define Version_Major 1
#define Version_Minor 02 // Two Digits
#define Version_Beta 00 // Two Digits (00 = Not beta)
#define MyPlugName "TitleBar\0"

#define MyVersion_Copyright "(c) 2018, Stephen Jones AKA StainlessS\0"
#define MyVersion_Implementor "(c) 2018, Stephen Jones AKA StainlessS\0"



Have a guddun :)

EDIT: Or more here:- https://forum.doom9.org/showthread.php?p=1834694&

EDIT: I dont bother to #include resource.h into project (its included via resource.rc)
https://i.postimg.cc/Rhv65nMp/Untitled-00.jpg (https://postimages.org/)

And in the CPP file


#include "compiler.h"

#include <windows.h>
#include <stdio.h>
#include <math.h>

//#ifdef AVISYNTH_PLUGIN_25 // ONLY if doing v2.5 plug, also need add AvisynthPluginInit2 stuff where AddFunction goes
// #include "Avisynth25.h"
//#else
#include "Avisynth.h"
//#endif

StainlessS
1st January 2020, 01:06
With this very first on-site post of 2020GMT, I'de like to wish everyone a happy New Year 2020, and while I'm at it, a Merry XMas 2020 too (I'm bound to be first at that, I think).

real.finder
2nd February 2021, 05:33
There's no source code yet because it relies on an unfinished library for another filter, but when that's finished I'll release the source code for both.


still not yet?

in my modplus (http://www.avisynth.nl/users/vcmohan/modPlus/modPlus.html) plugin there is a Gaussian blur filter GBlur. It has a radius and standard deviation (strength ) arguments to control the area of and amount of blur . It works multi thread under avisynth+. Request please check it and whether it works in a similar fashion. It does not take any time to start and does only one iteration. Borders equal to radius will remain unfiltered.

I'm not really sure what you're asking... I'm a bit confused as to how radius and standard deviation work together in GBlur, since in FastBlur the parameter is actually a standard deviation which defines the radius (and just happens to be roughly equal to the radius with the default three iterations).

For what it's worth, the following calls give similar results:

a = FastBlur(1.5, gamma = false)
b = GBlur(8)

Increasing Gblur's standard deviation seems to make the result closer to a box blur, as these are similar:

a = FastBlur(5, iterations = 1, gamma = false)
b = GBlur(8, 10000)

In Gaussian Blur depending on the standard deviation and radius values the outer values can be insignificant but are used neverthless increasing the computation time. By increase of std deviation this can be avoided but the blur deviates(theorotically) from pure gaussian. In GBlur it warns if insignificant values (those that will not change the end result) are in the outer part . Use of separable symmetric matrix of coefficients speeds up the process.

Variance = 4.0
rad=round(Variance*2)
#~ sh_Padding(rad,rad,rad,rad).GBlur(rad,sqrt(Variance)).crop(rad,rad,-rad,-rad)
#~ BinomialBlur(Variance)
FastBlur(sqrt(Variance),iterations=rad,gamma=false)


seems all 3 are same to me, but I will not use FastBlur since there are no source code for it, Cuz I will not repeat the past mistakes like using frfun7, SmoothAdjust and many others and then pray for Miracle to happen by someone reverse engineer them (like what happen in sangnom2 or awarpsharp2) or the author give the source code after begging (like what happen in checkmate)!

vcmohan gblur one as it also is not a perfect replace for BinomialBlur https://forum.doom9.org/showpost.php?p=1933514&postcount=13

DTL
3rd February 2021, 15:06
[size=6]
Having been frustrated one too many times by VariableBlur's GaussianBlur and its bizarre syntax (and wildly variable speed), I've now written [b]FastBlur, which performs an approximately Gaussian blur by repeated box blurs.
[/code]

You can very good cosplay FIR gaussian transform with much smaller in kernel size IIR filter and also almost 'radius-independent' so it have one processing time for any blur value. There is even full working SIMD-optimized demo on intel website so I think this plugin is port of IIR-based gauss-blur for Avisynth.

Not sure how it compared with 'repeated box blurs' approach for speed.

I even thinking of IIR-based convolution for 2D/planar resampler for save some time but it looks much harder to cosplay Jinc kernel with limited number samples of IIR filter kernel.

wonkey_monkey
9th March 2021, 18:46
I've updated the Zip file to include what is hopefully the complete source code, now that I've rewritten one of the dependent libraries to not be a mess of files. There's no .sln file or anything though - blame Visual Studio for not supporting hard links, otherwise it would have been simple.

http://horman.net/avisynth/download/FastBlur.zip

StainlessS
9th March 2021, 19:00
Thanks Wonkey.
Does it have any particular version number, or do we just choose our own :)

wonkey_monkey
9th March 2021, 19:07
Take the year you were born in, multiply it by 5 and add up the digits.

StainlessS
9th March 2021, 19:36
v28 it is. Thank you. [unless you meant add up the number of digits, in which case v4].
EDIT: Both above assuming Gregorian calendar.

pinterf
10th March 2021, 09:05
New era in version numbering :) Good or not, much better than having four sub-fields while starting with zero :) e.g. EEDI3 v0.9.2.3. Look at the Vapoursynth style - simplicity in mind: a single release number.

kedautinh12
10th March 2021, 12:17
Need EEDI3 > 8 bit, Pinterf

Reel.Deel
10th March 2021, 18:36
Thanks for releasing the source code, wonkey_monkey :thanks:

Need EEDI3 > 8 bit, Pinterf

Off topic and a bit rude ...

kedautinh12
10th March 2021, 23:33
Very sr

real.finder
13th March 2021, 15:03
I've updated the Zip file to include what is hopefully the complete source code, now that I've rewritten one of the dependent libraries to not be a mess of files. There's no .sln file or anything though - blame Visual Studio for not supporting hard links, otherwise it would have been simple.

http://horman.net/avisynth/download/FastBlur.zip

thanks, I will try it and do update things after I done with the things I got to do now

real.finder
14th March 2021, 02:05
so I did a speed test for BinomialBlur, GBlur and FastBlur

ColorBars
converttoyv12
Variance = 4.0
rad=round(Variance*2)
#~ sh_Padding(rad,rad,rad,rad).GBlur(rad,sqrt(Variance)).crop(rad,rad,-rad,-rad)
#~ BinomialBlur(Variance)
FastBlur(sqrt(Variance),iterations=rad,gamma=false)

done in x86 not x64
1- BinomialBlur give 400~ fps
2- FastBlur 188~ fps
3- GBlur 75~ fps with padding, 80~ fps without padding

kedautinh12
14th March 2021, 02:44
Where you got BinomialBlur??

StainlessS
14th March 2021, 02:52
Its here on wiki:- http://avisynth.nl/index.php/VariableBlur/BinomialBlur
From VariableBlur:- http://avisynth.nl/index.php/VariableBlur#Filters

Reel.Deel
14th March 2021, 04:15
done in x86 not x64
1- BinomialBlur give 400~ fps
2- FastBlur 188~ fps
3- GBlur 75~ fps with padding, 80~ fps without padding

I assume you used Asd's updated VariableBlur?

kedautinh12
14th March 2021, 05:00
Thanks

real.finder
14th March 2021, 13:02
I assume you used Asd's updated VariableBlur?

I use it in x64 only

wonkey_monkey
14th March 2021, 13:11
A few things about that script...


It's a bit unfair to make FastBlur do 8 iterations when anything higher than the default of 3 is visually inidistinguishable - it's not equivalent to GBlur's "grid" parameter.
ColorBars(pixel_type = "yv21") will remove the need for, and constant overhead of, converttoyv12.
The script as posted gives an error when testing Gblur:

GBlur:size of grid must be odd and between 3 and 11
Setting grid = 3 seems to be fastest.
GBlur and BinomialBlur only blur the Y channel by default



With that in mind, the following script:

ColorBars(pixel_type = "yv12")
Variance = 4.0
# GBlur(3, sqrt(Variance), u = true, v = true)
# BinomialBlur(Variance, u = 3, v = 3)
FastBlur(sqrt(Variance), gamma = false)

gives, I think, fairer results:

FastBlur: 837fps
BinomialBlur: 775fps
GBlur (x86): 321fps

Curiously though, BinomialBlur starts off at around 630fps, speeds up a bit fairly quickly then continues to creep up until it hits 775fps, whereas FastBlur starts off at over 1000fps before descending to 837fps. It doesn't seem to have a memory leak though - CPU usage drops from 100% to 82% for some reason. I'll look into that.

I think it may be a multithreading issue. I've got 12 logical cores, but if I reduce multithreading to 4, I can get FastBlur to a constant 1200fps. I may add a parameter to control the number of threads, because I suspect it's going to be one of those things which doesn't have a "best for everyone" solution.

Also BinomialBlur suffers greatly if Variance is increased, e.g. to 40:

FastBlur: 789fps
GBlur (x86): 292fps
BinomialBlur: 115fps

real.finder
14th March 2021, 15:35
The script as posted gives an error when testing Gblur:

GBlur:size of grid must be odd and between 3 and 11


you have very old GBlur, the uptodate can be found here https://forum.doom9.org/showthread.php?t=181891

edit: I use all them like this to replace BinomialBlur in YAHRmask (https://forum.doom9.org/showthread.php?p=1933514#post1933514) since BinomialBlur didn't get update since many years!

I did another test

ColorBars(pixel_type = "yv12")
Variance = 4.0
rad=round(Variance*2)
converttoy8.FastBlur(sqrt(Variance),iterations=rad,gamma=false)

now it's about 440 fps, but (without converttoy8 of course) BinomialBlur now give about 700 :) and gblur about 85 with padding

edit: forget to mention that both BinomialBlur and gblur use about 10% from cpu, While FastBlur use about 75%-85%

wonkey_monkey
14th March 2021, 16:07
Settings iterations=rad makes no sense for FastBlur. Leave it at the default (3).

I'm also uncertain of the logic of setting grid=rad for gblur. grid=3 is much faster with only very little difference to the pixels (similar to what happens when increasing iterations for FastBlur). There also seems to be a border issue with gblur:

https://i.imgur.com/AvuL1Jm.png

real.finder
15th March 2021, 17:47
Settings iterations=rad makes no sense for FastBlur. Leave it at the default (3).

that true, maybe even 2 seems good

FastBlur(sqrt(Variance),iterations=2,gamma=false)

now it's real fast blur :D, but I think it need more parameters for setting MT and control which planer to processes


I'm also uncertain of the logic of setting grid=rad for gblur. grid=3 is much faster with only very little difference to the pixels (similar to what happens when increasing iterations for FastBlur).

well it's not true for gblur, try with Variance = 10.0 and see


There also seems to be a border issue with gblur:
https://i.imgur.com/AvuL1Jm.png

yes that why I use padding for it, vcmohan say this too

Borders equal to radius will remain unfiltered.

wonkey_monkey
16th March 2021, 01:43
Now has a threads parameter to set the number of threads. Defaults to half the number of logical processors minus 1, or 2, whichever is greater (unless you only have one logical processor, in which case: 1). Set threads to 0 to use all available logical processors, or use a floating pointer between 0 and 1 as a multiplier on the number of local processors, e.g. to use 3/4 of them, set threads to 0.75.

http://horman.net/avisynth/download/FastBlur.zip

real.finder
16th March 2021, 15:49
Now has a threads parameter to set the number of threads. Defaults to half the number of logical processors minus 1, or 2, whichever is greater (unless you only have one logical processor, in which case: 1). Set threads to 0 to use all available logical processors, or use a floating pointer between 0 and 1 as a multiplier on the number of local processors, e.g. to use 3/4 of them, set threads to 0.75.

http://horman.net/avisynth/download/FastBlur.zip

thanks, that look good, I will test soon, but what about adding option to not process the chroma?

wonkey_monkey
16th March 2021, 16:19
thanks, that look good, I will test soon, but what about adding option to not process the chroma?

I can't think of a good reason for a blurrer to provide that functionality. You can use Extract/Merge/CombinePlanes.

real.finder
16th March 2021, 17:31
I can't think of a good reason for a blurrer to provide that functionality. You can use Extract/Merge/CombinePlanes.

in masktools u=1,v=1 aka don't care or ignore will be faster than copy it, since it not needed for masking most of times, so maybe adding IgnoreChroma bool parameter or make it like masktools and BinomialBlur will be better

int Y = 3
int U = 2
int V = 2

Controls which planes the filter is applied to:

3 : corresponding plane will be filtered
2 : corresponding plane will be copied from the source
1 : corresponding plane will be ignored
from 0 to -255 : corresponding plane will be assigned the absolute value.

wonkey_monkey
16th March 2021, 18:36
If you're making a mask and UV aren't needed anyway, just use ExtractY/ConvertToY8 first to delete them with no overhead.

It's just not in FastBlur's remit to monkey around with planes when the language already provides the tools.

StainlessS
16th March 2021, 18:48
Monkey See, Monkey do :)

real.finder
16th March 2021, 18:57
If you're making a mask and UV aren't needed anyway, just use ExtractY/ConvertToY8 first to delete them with no overhead.

It's just not in FastBlur's remit to monkey around with planes when the language already provides the tools.

there are small difference

simple test, mt_convolution use u=v=1 by default


ColorBars(pixel_type = "yv12").trim(0, 5000)

CombinePlanes(ExtractY().mt_convolution("2 1 2"),last,planes="YUV",sample_clip=last)

Frames processed: 5001 (0 - 5000)
FPS (min | max | average): 160.1 | 293.2 | 280.3
Process memory usage (max): 73 MiB
Thread count: 16
CPU usage (average): 8.0%

Time (elapsed): 00:00:17.841



ColorBars(pixel_type = "yv12").trim(0, 5000)

mt_convolution("2 1 2")

Frames processed: 5001 (0 - 5000)
FPS (min | max | average): 154.7 | 298.2 | 280.4
Process memory usage (max): 71 MiB
Thread count: 16
CPU usage (average): 7.9%

Time (elapsed): 00:00:17.838


u=v=1 (don't care or ignore) method seems a bit faster and use less ram and cpu

wonkey_monkey
16th March 2021, 19:16
seems a bit faster

0.03% is not a significant difference, and when I ran both scripts I found the first to be consistently faster by about 3%.

In any case, your two scripts produce potentially different outputs anyway. Separating, then recombining, U and V with Y is not the same as ignoring U and V completely.

Not sure why your memory usage is so high. I'd try removing a few plugins and see if it changes.

real.finder
17th March 2021, 20:04
ok, so I did update things in some of the scripts I maintain to use fastblur

they now get more fps than old BinomialBlur, hopefully the source code is complete :D so in any case in the avs+ future update anyone can update things for fastblur too

hello_hello
30th September 2021, 06:43
wonkey_monkey,

I've been using FastBlur to blur an overlay mask and I've experienced some wonkiness with large amounts of blurring. Here's an example. Change the value for Blur to 46 and there's no longer any unhappiness. I'm using the current x86 version but the same applies to FastBlur 0.2.1

BlankClip(pixel_type="YV12", width=480, height=540)
KillAudio()
AddBorders(240, 0, 240, 0, color=$FFFFFF)
ColorYUV(Levels="TV->PC")
FastBlur(44, y_blur=0, iterations=3, dither=true)

Click for the full size version.

https://i.postimg.cc/q6cbPzfg/Testing-avs-snapshot.png (https://postimg.cc/q6cbPzfg)

StainlessS
30th September 2021, 15:59
Yip, even my eyes can see horizontal lines, and note Top Left Hand side corner [EDIT: of black bar], is sorta rounded.
[dont now what them there dots are at left and right edges, result of dither?]

EDIT: Horizontal bars, some kind of 'beat/moire' pattern due to y_blur and dither ?

wonkey_monkey
30th September 2021, 18:24
Yip, even my eyes can see horizontal lines, and note Top Left Hand side corner [EDIT: of black bar], is sorta rounded.

Your brain might see those things, but they're not there. It's an optical illusion.

The black dots are an overflow from dithering, which shouldn't happen but obviously does, and which I'll look into.

StainlessS
30th September 2021, 19:17
in pub on 8 inch tablet, not seeing horizontal bar, nor rounded t.l.h.s corner.

wonkey_monkey
30th September 2021, 19:41
I've enabled clamping (previously only done for 32-bit clips) which should fix the dots.

http://horman.net/avisynth/download/FastBlur0.3.1.zip

hello_hello
30th September 2021, 23:01
The black dots are an overflow from dithering, which shouldn't happen but obviously does, and which I'll look into.

Awesome. Thank you.

I've enabled clamping (previously only done for 32-bit clips) which should fix the dots.

Thanks again. I'll give it a spin shortly.

wonkey_monkey
1st October 2021, 00:38
in pub [...] not seeing horizontal bar

If you're in the pub and the bar isn't horizontal, it's probably because you've fallen over.

hello_hello
1st October 2021, 09:44
wonkey_monkey,

So far so good with the new version. I hadn't discovered a magic formula that'd cause the dots to appear, so I can only remember two combinations of resolution and blurring where they definitely would, but they don't now.

Thanks for the speedy service. :)

Emulgator
3rd October 2021, 09:17
If you're in the pub and the bar isn't horizontal, it's probably because you've fallen over.
ROFL !
And if the bar is vertical, then maybe it's not a pub...have seen Girls around ?

StainlessS
3rd October 2021, 10:36
Nope, there is a Counter in the pub, but I'm more interested in the Bar AKA Barre in the corner, where I do my Ballet barre excercises,
Plié Grand plie on pointe etc, loads fun. And afterwords I have a glass of orange squash, at the counter.
EDIT: Most Wetherspoons down here have a Barre in the corner for us to practice on, alas, my legs are gettin' a bit rusty. [Clank clank, I'm a tank]

Emulgator
6th October 2021, 21:21
Pliés ! And Developpé ! One-two-three-two...

StainlessS
6th October 2021, 22:07
Yep, here a couple of the guys after a night out in the pub,
[where we also do a little morris dancing and are instructed in latin languages].
https://www.youtube.com/watch?v=cAVg66xusqE

johnmeyer
6th October 2021, 22:13
Wow, ballet terms, complete with acute accent! (Some sources include a second accent: Développé. It apparently can be spelled with either one or two.)

My wife was a ballet dancer, and over the last fifty years we've seen just about every company you can name so it's nice to see a little dance discussion here.

StainlessS
7th October 2021, 07:53
complete with acute accent!
Yeah, thats Rajesh, he's got a real cute accent.

hello_hello
11th December 2024, 08:07
wonkey_monkey,
I don't know if you have a PC with an AMD CPU you could check this on, but I've come across a weird problem with FastBlur that only seems to affect AMD CPUs.
There's screenshots of the issue in this post (https://forum.videohelp.com/threads/393762-ImageBorders-FrostyBorders-Scripts/page6#post2759518), as it occurs when using FastBlur with my FrostyBorders function. So far the only cure seems to be to use threads=1 for FastBlur, although I'm not sure if it completely solves the problem yet as it's very intermittent for me, but it seems to occur more frequently for the person who posted the thread I linked to. He/she also confirmed the issue doesn't occur when running the function on an Intel CPU. So far limiting the number of threads has at least been a huge improvement. I've tested making sure the cropped clip is mod16, mod4 and mod2, but none of that made a difference.

Here's a simulation of one of the borders the function creates for a 720p video with the other plugins involved commented out.

Crop(width()-32,0,0,0)
#TemporalSoften(5, 255, 255, 20, 2)
FastBlur(32,72,3, true)
GaussResize(120,720)
#AddGrainC(var=5, uvar=0, constant=true)

It's so intermittent for me that I sometimes have to run the script above for 5 minutes or more before a flash of blocky color appears, but it does occur now and then.

Cheers.

wonkey_monkey
12th December 2024, 01:45
That's an odd one. I'm not sure what might cause that - maybe a memory alignment issue that doesn't come up on Intel? Unfortunately with it being so intermittent, and with me not having an AMD, I don't rate my chances of diagnosing it. Does increasing the iterations parameter make it happen more often?

hello_hello
12th December 2024, 11:42
Unfortunately it's far more intermittent for me than it is for the poster in the thread I linked to. I wonder if that's because I have SMT disabled?

I don't think the number of iterations makes a difference. I tried testing this way to increase my chances of catching a flash and it was probably close to 5 minutes before it happened. The only thing I could determine from doing it this way is the flash of blocky color didn't happen for more than one instance of FastBlur at a time. I was hoping if they all flashed together it might point to something, but they don't.

A = Crop(width()-32,0,0,0).FastBlur(32,72,13, true).GaussResize(120,720)
B = Crop(width()-32,0,0,0).FastBlur(32,72,13, true).GaussResize(120,720)
C = Crop(width()-32,0,0,0).FastBlur(32,72,13, true).GaussResize(120,720)
D = Crop(width()-32,0,0,0).FastBlur(32,72,13, true).GaussResize(120,720)
StackHorizontal(A, B, C, D)

If limiting FastBlur to a single thread has fixed the problem it's probably okay as the clip to be blurred is fairly small and FastBlur still seems to be fast enough. TemporalSoften is by far the slowest part of the process for adding borders with the function.
I haven't had a chance yet but I'll try testing later using the above method with threads=1 to make sure it has cured the problem.
I haven't come across an alternative plugin that'll do the same job as FastBlur. Are you aware of any?

Cheers.

Edit: I tried opening the above script with MPC rather than AvsPmod and the flashing is still very intermittent, but definitely more frequent. Maybe a flash every minute or so. I don't think it's the number of iterations, and I'm testing this with everything running in Wine because I don't think it happens for me when running the script using Windows 11 in VirtualBox, but I'll try that again later. I don't have a lot of time at the moment.

Edit: A quick 90 second encode. 3 iterations. Lots more flashing than running the script in AvsPmod. test-001.mkv (https://files.videohelp.com/u/210984/test-001.mkv)

hello_hello
18th December 2024, 04:47
The poster in the thread I linked to did some more testing and apparently increasing the number of iterations does increase the occurrence of the flashes of blocky colour.

StainlessS
18th December 2024, 19:26
Is the source frame accurate, could any problem with AMD be in source filter rather than FastBlur?
Suggest exlude source by pre-rendering source into Avi, and using that, does problem persist.

Just a suggestion to remove that possibility.

EDIT: Some earlier versions of DgSource produce flashing/weird_colors when seeking.

EDIT: I aint looked closely into your posted problem, perhaps above totally unrelated/nonsense (eg totally blankclip simulated source).

hello_hello
18th December 2024, 22:52
I thought I'd try it with a blank clip as the source, but it does still happen. I increased the number of iterations to 20 as the more iterations, the more likely it'll happen.

A = Some 720 Video
BlankClip(A)
Cropped = Crop(width()-32,0,0,0)
A = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
B = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
C = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
D = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
E = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
F = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
G = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
H = Cropped.FastBlur(32,72,20, true).GaussResize(120,720)
StackHorizontal(A, B, C, D, E, F, G, H)
Trim(0,1999)

test-002.mkv (https://files.videohelp.com/u/210984/test-002.mkv) (93 kB)

Edit: It did just occur to me that I hadn't tried testing with FastBlur's dithering disabled, so I gave it a spin and only saw a single flash in a couple of minutes of video, so then I tried it without dithering and threads=1, and it just might have solved the problem.
To make up for the lack of FastBlur dithering I'm doing it this way and so far it all seems fine. I'll keep testing though....

Crop(width()-32,0,0,0).ConvertBits(16).FastBlur(32,72,3).ConvertBits(8, dither=1).GaussResize(120,720)

hello_hello
16th January 2025, 08:36
wonkey_monkey,

Apparently the problem with FastBlur having a meltdown isn't confined to AMD CPUs. I've been told by a VideoHelp member it does the same with their Intel CPU, only less frequently.

I've been playing around some more and found what seems to be a problem with setting an MT mode for FastBlur. Maybe it's just the wrong MT mode but could it be related?
If I add the following to the script, with or without Prefetch, the first frame decoded after navigating in the video is very likely to be some flavour of mental, but when the video is playing it quickly settles down to mostly outputting pure black as it should, with just the occasional flash of color.

SetFilterMTMode("FastBlur", 1, true)

I'm sure the first time I tried MT mode 3 the output was as equally crazy, but now it's back to normal.
I'm getting the same result running Avisynth in Wine and on Window 11 in VirtualBox.

https://i.imgur.com/nKJR1lO.png

pinterf
16th January 2025, 09:25
wonkey_monkey,

Apparently the problem with FastBlur having a meltdown isn't confined to AMD CPUs. I've been told by a VideoHelp member it does the same with their Intel CPU, only less frequently.


I have Intel and I've seen those flashes as well.


I've been playing around some more and found what seems to be a problem with setting an MT mode for FastBlur. Maybe it's just the wrong MT mode but could it be related?
If I add the following to the script, with or without Prefetch, the first frame decoded after navigating in the video is very likely to be some flavour of mental, but when the video is playing it quickly settles down to mostly outputting pure black as it should, with just the occasional flash of color.

SetFilterMTMode("FastBlur", 1, true)


Don't try MT mode 1. If it fails, it is normal for most filters.

Filters in general can work in MT mode 2 (this is Avisynth's default mode MT_MULTI_INSTANCE).

MT Mode 3 is MT_SERIALIZED this is for filters that maintain so called internal states or variables which must be updated only exactly by a single instance, in this case no threads are allowed. Source filters also work in this mode.

hello_hello
16th January 2025, 10:35
Could it be instruction set related? For quite a while I used a function with FastBlur included running on my old Q9450 Intel CPU and I never once saw any flashes of blocky color.

pinterf
16th January 2025, 11:02
Could it be instruction set related? For quite a while I used a function with FastBlur included running on my old Q9450 Intel CPU and I never once saw any flashes of blocky color.
No, it would fail instantly if it were instruction set related. The issue seems to be due to unfortunate timing conditions. Based on the fail pattern someone posted here, it appears to be threadpool related. Try manually setting the thread number; the layout of the colorful (unprocessed) bars should change accordingly. At least, this is what I would expect.

pinterf
17th January 2025, 14:50
Oh, that was extremely hard to debug and reproduce.
I spent a significant amount of time on the debugging process (though I just wanted to have a quick glance on it, I just went deeper and deeper :) ). I really enjoy playing with such once-in-10000-run random problems, it's like solving a crossword puzzle for me.
Anyway, I found the issue, I plan to discuss it with wonkey_monkey, since source is not on git. I'm gonna PM later this weekend.

wonkey_monkey
17th January 2025, 14:57
Cool, thanks pinterf! I had no idea where to start.

Learning git is on my list, I promise...

hello_hello
17th January 2025, 20:04
Thanks pinterf!!

wonkey_monkey
20th January 2025, 19:36
I've taken pinterf's GitHub project (https://github.com/pinterf/FastBlur/), bumped the version number to 0.3.2, and built some DLLs: link (http://horman.net/avisynth/download/FastBlur0.3.2.zip)

The biggest offender was probably a loop with an accidentally hardcoded limit. It won't have caused a problem for most people (including me).

I may also rethink my threadpool (which I had already rewritten to be properly cross-platform, though I've stuck with pinterf's version for this build) - it's currently a singleton class, which makes sense if you're calling it several times in a linear chain, but maybe not so much if you're trying to MT it in AviSynth (I never use MT).

Thanks again pinterf!

Jamaika
21st January 2025, 08:58
I've taken pinterf's GitHub project (https://github.com/pinterf/FastBlur/), bumped the version number to 0.3.2, and built some DLLs: link (http://horman.net/avisynth/download/FastBlur0.3.2.zip)

The biggest offender was probably a loop with an accidentally hardcoded limit. It won't have caused a problem for most people (including me).

I may also rethink my threadpool (which I had already rewritten to be properly cross-platform, though I've stuck with pinterf's version for this build) - it's currently a singleton class, which makes sense if you're calling it several times in a linear chain, but maybe not so much if you're trying to MT it in AviSynth (I never use MT).

Thanks again pinterf!
Is the sse_mathfun project from 13 years ago to be deleted? There are already projects on github avx, avx2, avx512.
https://github.com/RJVB/sse_mathfun

wonkey_monkey
21st January 2025, 12:44
Is the sse_mathfun project from 13 years ago to be deleted? There are already projects on github avx, avx2, avx512.
https://github.com/RJVB/sse_mathfun

I'm not sure why you're asking here as it's nothing to do with FastBlur or me (except for a vague plan I once had to incorporate into my Expr competitor)...

Jamaika
21st January 2025, 13:20
Since you're praising this product there's a question.
https://github.com/pinterf/FastBlur/pulls\
The same topic
https://github.com/Asd-g/AviSynth-FFTSpectrum/pull/5

wonkey_monkey
14th February 2026, 18:56
FastBlur v0.4 (https://horman.net/avisynth/download/fastblur0.4.zip) can now also accept a function name as a parameter so that blurs can be animated without the overhead of the built-in Animate function:

function blur_function(int frame_no) {
return frame_no * 0.1 # increasing blur over time
}

function blur_function2(int frame_no) {
return [ sin(frame_no * 0.1) * 50, -sin(frame_no * 0.1) * 50 ] # bounce between horizontal and vertical blur (negative values have no effect)
}

FastBlur(ColorBars, "blur_function")
FastBlur(ColorBars, "blur_function2")

Jamaika
14th February 2026, 19:12
Can PYR_DENOISE be used?
plugins/FastBlur1/pyramid.cpp: In member function 'void Pyramid::Denoise(int, float, bool)':
plugins/FastBlur1/pyramid.cpp:1866:94: error: 'cos_ps' was not declared in this scope
1866 | _mm_store_ps((float*)&data[x], _mm_mul_ps(_mm_mul_ps(_mm_sub_ps(one, cos_ps(_mm_min_ps(_mm_and_ps(_mm_mul_ps(d, _power), *_and), pi))), half), d));
| ^~~~~~

wonkey_monkey
14th February 2026, 20:00
Most of pyramid.cpp is irrelevant to FastBlur. Just ignore it.

real.finder
15th February 2026, 03:40
FastBlur v0.4 (https://horman.net/avisynth/download/fastblur0.4.zip) can now also accept a function name as a parameter so that blurs can be animated without the overhead of the built-in Animate function:

function blur_function(int frame_no) {
return frame_no * 0.1; // increasing blur over time
}

function blur_function2(int frame_no) {
return [ sin(frame_no * 0.1) * 50, -sin(frame_no * 0.1) * 50 ] // bounce between horizontal and vertical blur (negative values have on effect)
}

FastBlur(ColorBars, "blur_function")
FastBlur(ColorBars, "blur_function2")

nice update!

BTW
seems you use a c/c++ style which not work, so here the code with the AviSynth style
function blur_function(int frame_no) {
return frame_no * 0.1 # increasing blur over time
}

function blur_function2(int frame_no) {
return [ sin(frame_no * 0.1) * 50, -sin(frame_no * 0.1) * 50 ] # bounce between horizontal and vertical blur (negative values have on effect)
}

FastBlur(ColorBars, "blur_function")
FastBlur(ColorBars, "blur_function2")