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. |
|
17th March 2006, 23:44 | #1 | Link |
Registered User
Join Date: Mar 2005
Posts: 366
|
Bloom filter for film look
I think this could be very useful for making filmlooks:
Bloomfilter/Filtermeister Couldn't this turn into a nice avisynth filter too? Personally I haven't the C skills needed - but I guess the math part might be a leap ahead? The FilmMeister manuals looks quite interesting too. Tin2tin
__________________
DVD slideshow GUI(Freeware). |
18th March 2006, 23:33 | #3 | Link |
ReMember
Join Date: Nov 2003
Posts: 416
|
Code:
AVISource("hi.avi") o=last AVISource("hi.avi") Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58).Blur(1.58) Levels(15, .8, 80, 0, 255, coring=false) e=last Overlay(o,e,mode="add",opacity=.25) |
19th March 2006, 00:26 | #4 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
It might not matter too much in this case, because of the rather low opacity setting in Overlay ... however:
Never, never ever make a strong blur by chaining blur() several times. Not only it is slow, but more seriously blur() is not precise enough. Especially chroma will get *very noticeable* distortions. Use VariableBlur() instead, or simulate it through down&up-bicubicresize (not quite as accurate, but fairly fast): Code:
function FastGauss(clip clp, float rx, float ry) { ox=clp.width() oy=clp.height() clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0) } function m4(float x) {x<16?16:int(round(x/4.0)*4)}
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
19th March 2006, 02:26 | #5 | Link |
ReMember
Join Date: Nov 2003
Posts: 416
|
I know I used FastGaussBlur, but I wasn't sure what parameters to use on FastGauss. With FastGaussBlur there is more of a Bloom effect of glowing edges and Blurx7 seems to hold more detail but not really shine much. I was thinking of using FastGaussBlur but then forgot to look for it and just went with Blur quickly. So yes, FastGaussBlur would be better to use. Code:
AVISource("yea.avi") o=last AVISource("yea.avi") FastGaussBlur(24) Levels(15, .8, 80, 0, 255, coring=false) e=last Overlay(o,e,mode="add",opacity=.25) function FastGaussBlur(clip clp, float rx, float "ry") { ry = default(ry, rx) rx = rx+1.0 ry = ry+1.0 ox = clp.width oy = clp.height oxs1 = int(round(ox/4.0/sqrt(rx))*4) oys1 = int(round(oy/4.0/sqrt(ry))*4) oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4) oys2 = int(round(sqrt(oy*oys1)/4.0)*4) oxs1 = oxs1<16 ? 16 : oxs1 oys1 = oys1<16 ? 16 : oys1 clp.bicubicresize(oxs1,oys1) rx>9.0||ry>9.0 ? bicubicresize(oxs2,oys2,0.5,0.25) : last return bicubicresize(ox,oy,1,0) } |
19th March 2006, 03:56 | #6 | Link | ||
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
I knew I had once posted FastGaussBlur, but couldn't find it ATM
Quote:
Quote:
FastGauss uses radius as parameter, FastGaussBlur uses variance, as does tsp's VariableBlur. Variance = radius^2 resp. radius = sqrt(variance). Personally, I like much more to think in "radius" than "variance", because radius is the usual way how Gaussian blurring is handled in image editors. Last note for this long useless post: There's something interesting about the "precision" of Avisynth's Blur() filter. Compare an 8fold chain of "Blur(1.0)" with the same 8fold chain of "Blur(1.58)". The former, being a true radius=1 Gaussian Blur, will produce a very noticeable color shift. The latter, being a plain 3*3 average blur, treats chroma correctly. Then compare both with FastGauss(8,8), FastGaussBlur(64,64), and GaussianBlur(64,64, Y=3,U=3,V=3,border=2), and see all the differences. Aditionally, check the histograms of all the outputs, it's interesting: Code:
o = last blur8gss = o.blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0).blur(1.0) blur8avg = o.blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58).blur(1.58) fastg8 = o.FastGauss(8,8) fastgb8 = o.FastGaussBlur(64,64) gb8exct = o.GaussianBlur(64,64,Y=3,U=3,V=3, border=3) # VariableBlur.dll interleave(o,blur8gss,blur8avg,fastg8,fastgb8,gb8exct) .histogram(mode="levels")
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
||
4th May 2006, 13:50 | #7 | Link |
Movie buff & shine
Join Date: Jan 2004
Location: Logan, the only hole above ground.
Posts: 257
|
I know its been a while since this thread has been visited, but I was recently creating a similar filter for this effect, based on similar settings found in the AfterEffects filter.
This what I came up with: Code:
Function Glow (clip Last, int "radius", int "min", int "max", int "opacity") { radius = Default (radius, 5) min = Default (min, 234) max = Default (max, min + 1) opacity = Default (opacity, 1.0) Mask = Levels (min, 1, max, 0, 255, false).ConvertToYUY2 ().\ SpatialSoften (radius, 255, 255).Levels (0, 1, 127, 0, 255, False) White = Blankclip (Mask).Invert ("Y") Overlay (Last, White, mask = mask, opacity = opacity) }
__________________
I'm a boxer who can Bob () & Weave (). I like to Overlay () punches and Blur () his vision to ShowFiveVersions (). My KO punch will always Pulldown ().TimeStretch () and all he will hear is Tone (). |
5th May 2006, 07:31 | #9 | Link | |
Registered User
Join Date: Apr 2006
Posts: 10
|
Quote:
Code:
function FastGaussBlur(clip clp, float rx, float "ry") { ry = default(ry, rx) rx = rx+1.0 ry = ry+1.0 ox = clp.width oy = clp.height oxs1 = int(round(ox/4.0/sqrt(rx))*4) oys1 = int(round(oy/4.0/sqrt(ry))*4) oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4) oys2 = int(round(sqrt(oy*oys1)/4.0)*4) oxs1 = oxs1<16 ? 16 : oxs1 oys1 = oys1<16 ? 16 : oys1 clp.bicubicresize(oxs1,oys1) rx>9.0||ry>9.0 ? bicubicresize(oxs2,oys2,0.5,0.25) : last return bicubicresize(ox,oy,1,0) } |
|
22nd May 2006, 04:23 | #10 | Link |
Registered User
Join Date: Aug 2005
Location: Asylum
Posts: 46
|
@actionman133
thank you! this works very well for me! Norman Bates
__________________
AVStoMPEG Forum: http://forum.doom9.org/showthread.php?t=110596 Blog: http://avstompeg.spaces.live.com/ |
22nd May 2006, 08:17 | #11 | Link |
Registered User
Join Date: Feb 2002
Posts: 1,195
|
work like a charm thank u.
++
__________________
AutoDub v1.8 : Divx3/4/5 & Xvid Video codec and .OGG/.MP3/.AC3/.WMA audio codec. AutoRV10 v1.0 : Use RealVideo 10 Codec and support 2 Audio Streams and Subtitles. |
8th July 2013, 03:57 | #12 | Link |
Registered User
Join Date: Mar 2012
Posts: 29
|
Color lighting
I'm still new to this, I use gaussresize for speed and mt_lutxy u and v to enhance color (experiemental) for 30p DVDNTSC video or HD downscale to 720X480p (simple resize s fastest to me)
code : Function CBloom (clip Last, int "radius", int "radiusc", int "min", int "max", int "sat") { radius = Default (radius, 5) edges = (radius % 4) == 0 ? radius : radius + 4 - (radius % 4) radiusc = Default(radiusc,Round (Width / 120.0)) min = Default (min, 254) max = Default (max, min + 1) sat = Default (sat, 128) Mask = ConvertToYV12().Levels (min, 1, max, 0, 255, false) Mask = MergeLuma(Mask.GaussResize(width/radiusc,height/radiusc,p=1) \ .BilinearResize(width,height).Levels (0, 1, 127, 0, 255, False), 0.5) \ .ColorYUV(cont_u = sat, cont_v = sat) White = BlankClip(Mask, color=$FFFFFF, pixel_type = "YV12") \ .MT_lutxy(Mask.AddBorders (edges, edges, edges, edges) \ .FastGaussBlur(24) \ .Crop (edges, edges, edges * -1, edges * -1) \ ,yexpr="256 256 x - 256 y - * 256 / -" \ ,uexpr=" y 128 < x y * 128 /" \ ,vexpr=" y 128 < x y * 128 /" ,Y=3,U=3,V=3) MT_Merge (Last, White, mask, chroma = "process") } CBloom (radiusc=12,min=100,max=200,sat=512) #720X480psimpleresize and 24p_30p footage on 2 core cpu (1.6 ghz), media player classic set to evr in options. feel free to edit, enjoy Last edited by MJLives12; 9th July 2013 at 21:20. Reason: corrections in color |
19th July 2013, 21:51 | #14 | Link |
Registered User
Join Date: Mar 2012
Posts: 29
|
NeonBloom (experiemental)
Here's a cleaner way for color (trying to get that neon light look) code : Function NeonBloom (clip c, int "radius", int "min", int "max", int "sat", int "blur") { c radius = Default (radius, 2) min = Default (min, 254) max = Default (max, min +1) sat = Default (sat, 255) blur = Default (blur, 96) Mask = YLevelsG (min, 1, max, 0, 255) #gradient Mask = Mask.ConvertToRGB32 ().RGBAdjust(sat,sat,sat).ConvertToYV12 () \ .AddBorders (radius, radius, radius, radius) \ .FastGaussBlur (blur) \ .Crop (radius, radius, radius * -1, radius * -1) White = MT_lutxy (Mask \ ,yexpr="256 0 x - 256 y - * 256 / -" \ ,uexpr="x 255 == x 255 y y * 255 x - / min ?" \ ,vexpr="x 255 == x 255 y y * 255 x - / min ?", U = 3, V = 3) MT_Merge (white, Mask, U = 3, V = 3) } NeonBloom (min = 200, sat = 20) Enjoy. |
20th July 2013, 13:18 | #15 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
OMG my eyes :b
No seriously, that's really original and interesting. Not a "film look" at all, though! When animated it makes an interesting variation of the "fade-to-white" scene transition Code:
## neon fade from normal to white and back e.g. for scene transitions centerframe=150 ## frame at center of transition; maximum whiteness half_len=20 ## transition speed in frames (1/2 total duration) C C = C.Trim(0, (centerframe - half_len)) \ \ + Animate(C.Trim((centerframe - half_len), -half_len), \ 1, half_len-1, "NeonBloom", \ 2, 100, 235, 0, 96, \ 2, 0, 235, 20, 96) \ \ + Animate(C.Trim(centerframe, -half_len), \ 1, half_len-1, "NeonBloom", \ 2, 0, 235, 20, 96, \ 2, 100, 235, 0, 96) \ \ + C.Trim((centerframe + half_len), 0) return C With a little tweaking it can make titles flare with that '80's neon look... Last edited by raffriff42; 18th March 2017 at 01:35. Reason: (fixed image links) |
21st July 2013, 23:31 | #17 | Link |
Registered User
Join Date: Mar 2012
Posts: 29
|
FastGaussBlur no artifacts
Animate is a cool function with exception my cpu lags and I'm still new to editing.
Here's an improve bloom/glow function without the "white spikes" or less blocky.. Code:
Function NeonGlow (clip c, int "min", int "max", float "r", float "g", float "b", int "blur", int "radius") { c radius = Default (radius, 2) min = Default (min, 250) max = Default (max, min +1) r = Default (r, 1) g = Default (g, 1) b = Default (b, 1) blur = Default (blur, 96) cbloom = YLevelsG (min, 1, max, 0, 255) \ .ConvertToRGB24 ().RGBAdjust (r, g, b).ConvertToYV12 () \ .ColorYUV (gain_y = 0, off_y = 10, cont_y = 80, gamma_y = 0 \ ,cont_u = 18, cont_v = 18) c = MT_lutxy (cbloom \ , yexpr="256 255 x - 256 y - * 256 / -" \ , uexpr=" y 128 < x y * 128 /" \ , vexpr=" y 128 < x y * 128 /", Y = 3, U = 3, V = 3, chroma = "process") cbloom = cbloom.AddBorders (radius, radius, radius, radius) \ .FastGaussBlur (blur) \ .Crop (radius, radius, radius * -1, radius * -1) MT_lutxy (cbloom \ , yexpr="256 255 x - 256 y - * 256 / -" \ , uexpr=" y 128 < x y * 128 /" \ , vexpr=" y 128 < x y * 128 /", Y = 3, U = 3, V = 3, chroma = "process") bloommask = BlankClip (cbloom, color_yuv = $FF8080, pixel_type = "YV12") MaskedMerge (bloommask, cbloom) } ############################################## Paste fastgaussblur in separate file function FastGaussBlur(clip clp, float rx, float "ry") { ry = default(ry, rx) rx = rx+1.0 ry = ry+1.0 ox = clp.width oy = clp.height oxs1 = int(round(ox/4.0/sqrt(rx))*4) oys1 = int(round(oy/4.0/sqrt(ry))*4) oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4) oys2 = int(round(sqrt(oy*oys1)/4.0)*4) oxs1 = oxs1<16 ? 16 : oxs1 oys1 = oys1<16 ? 16 : oys1 clp.biCubicresize(oxs1,oys1) rx>9.0||ry>9.0 ? biCubicresize(oxs2,oys2,0.5,0.25) : last return gaussresize(ox,oy,1,0,p=1) #just testing } ############################################# Last edited by MJLives12; 1st August 2013 at 03:09. Reason: code tag, contrast control / separate functions |
1st August 2013, 03:16 | #18 | Link |
Registered User
Join Date: Mar 2012
Posts: 29
|
Neon effect (experimental) with white light
Animate is an amazing function with the effect! My cpu lags and I'm still new to editing.
Here's an improve bloom/glow function without the "white spikes" or less blocky. Code:
Function NeonGlow (clip c, int "min", int "max", float "r", float "g", float "b", int "blur", int "radius") { c radius = Default (radius, 2) min = Default (min, 250) max = Default (max, min +1) r = Default (r, 1) g = Default (g, 1) b = Default (b, 1) blur = Default (blur, 96) cbloom = YLevelsG (min, 1, max, 0, 255) \ .ConvertToRGB24 ().RGBAdjust (r, g, b).ConvertToYV12 () \ .ColorYUV (gain_y = 0, off_y = 10, cont_y = 80, gamma_y = 0 \ ,cont_u = 18, cont_v = 18) c = MT_lutxy (cbloom \ , yexpr="256 255 x - 256 y - * 256 / -" \ , uexpr=" y 128 < x y * 128 /" \ , vexpr=" y 128 < x y * 128 /", Y = 3, U = 3, V = 3, chroma = "process") cbloom = cbloom.AddBorders (radius, radius, radius, radius) \ .FastGaussBlur (blur) \ .Crop (radius, radius, radius * -1, radius * -1) MT_lutxy (cbloom \ , yexpr="256 255 x - 256 y - * 256 / -" \ , uexpr=" y 128 < x y * 128 /" \ , vexpr=" y 128 < x y * 128 /", Y = 3, U = 3, V = 3, chroma = "process") bloommask = BlankClip (cbloom, color_yuv = $FF8080, pixel_type = "YV12") MaskedMerge (bloommask, cbloom) } ############################################## Paste fastgaussblur in separate file function FastGaussBlur(clip clp, float rx, float "ry") { ry = default(ry, rx) rx = rx+1.0 ry = ry+1.0 ox = clp.width oy = clp.height oxs1 = int(round(ox/4.0/sqrt(rx))*4) oys1 = int(round(oy/4.0/sqrt(ry))*4) oxs2 = int(round(sqrt(ox*oxs1)/4.0)*4) oys2 = int(round(sqrt(oy*oys1)/4.0)*4) oxs1 = oxs1<16 ? 16 : oxs1 oys1 = oys1<16 ? 16 : oys1 clp.biCubicresize(oxs1,oys1) rx>9.0||ry>9.0 ? biCubicresize(oxs2,oys2,0.5,0.25) : last return gaussresize(ox,oy,1,0,p=1) #just testing } ############################################# |
10th August 2013, 01:25 | #19 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
@MJLives12, take a look at this for some inspiration: VirtualDub: Kagayaki filter
Wouldn't your soft bloom script look great with a star filter like this: Last edited by raffriff42; 18th March 2017 at 01:33. Reason: (fixed image links) |
|
|