Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th June 2019, 17:39   #1  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
FastBlur - fast approximate Gaussian blurs

FastBlur v0.1
Direct link

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.


It supports all colour spaces (except YUY2; you'll have to convert to YV16 instead) 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).

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.

Code:
FastBlur
========

Fast Gaussian-approximate blur for all colour spaces.


Usage
=====

FastBlur(
  (clip)
  (float)
  (float)    y_blur
  (int)      iterations   = 3
  (bool)     dither       = false
  (bool)     gamma        = true
)


Parameters
==========

[float]:
    Blur radius (equivalent to PhotoShop Gaussian Blur's radius)

y_blur:
    Vertical blur (if different from horizontal blur)

iterations:
    Number of iterations for approximation. Defaults to 3. A value of 1 performs a box blur.

dither:
    Enable/disable dithering

gamma:
    Approximate gamma awareness. This should be disabled for masks.
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 30th June 2019 at 23:01.
wonkey_monkey is offline   Reply With Quote
Old 30th June 2019, 21:38   #2  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 903
Pretty! Thanks!
__________________
Win10 (x64) build 18362| GPU Caps Viewer 1.42.4.0
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
Intel Xeon X5660 @2.80GHz
Sparktank is offline   Reply With Quote
Old 1st July 2019, 03:23   #3  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
Looks great, thanks awfully.

Fingerprint link @ you downloads page is 404.

EDIT: Is there a limit to iterations ?
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 1st July 2019 at 03:39.
StainlessS is offline   Reply With Quote
Old 1st July 2019, 09:17   #4  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 1st July 2019, 10:16   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
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].


EDIT: Above, LogoMode=1, ie show coords
Code:
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:
Quote:
[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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 2nd July 2019 at 12:34.
StainlessS is offline   Reply With Quote
Old 3rd July 2019, 12:34   #6  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,170
Quote:
Originally Posted by StainlessS View Post
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
MysteryX is offline   Reply With Quote
Old 3rd July 2019, 13:01   #7  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
Quote:
Originally Posted by StainlessS View Post
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 3rd July 2019, 13:24   #8  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
Quote:
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]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd July 2019 at 13:26.
StainlessS is offline   Reply With Quote
Old 3rd July 2019, 23:42   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th July 2019 at 09:58.
StainlessS is offline   Reply With Quote
Old 4th July 2019, 09:51   #10  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
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.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 4th July 2019, 10:02   #11  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
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.p...te#post1872801
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th July 2019 at 10:06.
StainlessS is offline   Reply With Quote
Old 4th July 2019, 10:22   #12  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
It wouldn't be the same as a true graduated blur, but it might work well enough for your purposes.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 4th July 2019, 10:24   #13  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 4th July 2019, 10:43   #14  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 7,086
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


blurred [upper left]


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.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th July 2019 at 11:29.
StainlessS is offline   Reply With Quote
Old 8th July 2019, 12:27   #15  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
in my modplus 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.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 8th July 2019, 13:18   #16  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
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:

Code:
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:

Code:
a = FastBlur(5, iterations = 1, gamma = false)
b = GBlur(8, 10000)
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 8th July 2019 at 13:39.
wonkey_monkey is offline   Reply With Quote
Old 15th July 2019, 14:10   #17  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 733
Quote:
Originally Posted by wonkey_monkey View Post
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.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 19th July 2019, 07:52   #18  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 3,969
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!
hello_hello is offline   Reply With Quote
Old 19th July 2019, 08:39   #19  |  Link
Groucho2004
►◄
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Location: A wretched hive of scum and villainy
Posts: 4,394
Quote:
Originally Posted by hello_hello View Post
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.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline   Reply With Quote
Old 19th July 2019, 09:32   #20  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
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?

Code:
colorbars(pixel_type = "yv12", width = 638, height = 480)
FastBlur(10)
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:35.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.