Advertisement
Guest User

Untitled

a guest
May 6th, 2010
983
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Yet Another Rainbow Killer - jase99
  2. # based on mfRainbow v0.31, chubbyrain2, various other doom9 posts
  3. # http://forum.doom9.org/showthread.php?t=141165
  4. function YARK(clip c, int "thr", int "rad", int "str", int "scd", bool "show") {
  5.   thr  = default(thr, 10)    # threshold as per ChubbyRain2
  6.   rad  = default(rad, 2)     # temporal smoothing radius as per mfRainbow
  7.   str  = default(str, 25)    # temporal smoothing strength as per mfRainbow
  8.   scd  = default(scd, 2)     # scene change detection strength as per mfRainbow
  9.   show = default(show, false)
  10.  
  11.   u = c.UToY()
  12.   v = c.VToY()
  13.  
  14.   uc = u.mt_convolution(horizontal="1", vertical="1 -2 1", Y=3, U=0, V=0)
  15.   vc = v.mt_convolution(horizontal="1", vertical="1 -2 1", Y=3, U=0, V=0)
  16.   mt_lutxy(uc, vc, Yexpr = string("x y + " + string(thr) + " > 256 0 ?"))
  17.   PointResize(c.width, c.height)
  18.   mt_expand(Y=3, U=-128, V=-128)
  19.   uvcmask = Blur(1.5)
  20.  
  21.   c.UnsharpMask(200).UnsharpMask(200)
  22.   mt_edge(thY1=3, thY2=255, thC1=255, thC2=255, mode="roberts", Y=3, V=1, U=1)
  23.   mt_deflate().Levels(0, 1.0, 45, 0, 255).Blur(1.0)
  24.   mt_deflate().Levels(0, 1.0, 75, 0, 255)
  25.   mt_deflate().mt_deflate().mt_deflate()
  26.   ymask = Greyscale()
  27.  
  28.   u.Unsharpmask(500).Unsharpmask(500)
  29.   mt_edge(thY1=3, thY2=255, thC1=255, thC2=255, mode="roberts", Y=3, V=1, U=1)
  30.   Levels(0, 1.0, 100, 0, 255)
  31.   Greyscale()
  32.   umask = LanczosResize(c.width, c.height)
  33.  
  34.   v.Unsharpmask(500).Unsharpmask(500)
  35.   mt_edge(thY1=3, thY2=255, thC1=255, thC2=255, mode="roberts", Y=3, V=1, U=1)
  36.   Levels(0, 1.0, 75, 50, 255)
  37.   Greyscale()
  38.   vmask = LanczosResize(c.width, c.height)
  39.  
  40.   Overlay(ymask,  umask, mode="lighten")
  41.   Overlay(vmask, mode="hardlight")
  42.   mt_inflate().mt_inflate()
  43.   Levels(0, 1, 100, 0, 255, false)
  44.   yuvmask = Greyscale()
  45.  
  46.   Overlay(yuvmask, uvcmask, mode="lighten")
  47.   mask = LanczosResize(u.width, u.height)
  48.  
  49.   derainu = u.TemporalSoften(rad, str, 1, scd, 2)
  50.   derainv = v.TemporalSoften(rad, str, 1, scd, 2)
  51.  
  52.   derainmasku = mt_merge(u, derainu, mask, Y=3, U=1, V=1)
  53.   derainmaskv = mt_merge(v, derainv, mask, Y=3, U=1, V=1)
  54.  
  55.   c.Overlay(c.blankclip(color=$0000FF), mask=yuvmask)
  56.   visual = Overlay(c.blankclip(color=$00FF00), mask=uvcmask)
  57.  
  58.   show == false ?  c.MergeChroma(YToUV(derainmasku, derainmaskv, c.Greyscale())) : visual
  59. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement