Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #
- # Last updated 28/01/2015
- # modified from http://avisynth.nl/index.php/DFMDeRainbow
- #
- ###################
- #
- # By Scintilla, with the third line of themask's definition
- # borrowed from Shodan's derainbower
- #
- ###################
- #
- # Syntax:
- # DFMDeRainbow(clip org, int "maskthresh", bool "mask")
- #
- # Requires YV12 input. Is kinda slow.
- # Suggestions for improvement welcome: scintilla@aquilinestudios.org
- #
- # Required plugins:
- # MSharpen, MaskTools2, FluxSmooth, Deen
- #
- # Arguments:
- # maskthresh (default=10) - This is MSharpen's threshold value.
- # Lower values will increase the area in which the blurred chroma
- # is allowed to come through, which catches more edges but may
- # cause desaturation and/or chroma bleeding.
- # Set this as high as you can while still catching all the edges
- # that need to be derainbowed.
- # mask (default=false) - When true, this displays the mask instead of
- # the image. Use this to find the optimal value of maskthresh.
- #
- ###################
- function DFMDeRainbow5(clip org, int "maskthresh", bool "mask", bool "interlaced")
- {
- Assert(org.IsYV12(),"DFMDeRainbow: YV12 input only")
- maskthresh = default(maskthresh, 10)
- mask = default(mask, false)
- interlaced = default(interlaced, false)
- org = interlaced==true? org.separatefields() : org
- org_u=org.UtoY()
- org_v=org.VtoY()
- first_u=org_u.Flux5framesT(17).Blur(1.5)
- first_v=org_v.Flux5framesT(17).Blur(1.5)
- themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
- \ .MSharpen(mask=true,threshold=maskthresh).Invert()
- \ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)
- fixed_u=org_u.FluxSmoothST(17,14).Flux5framesT(17).Deen("a2d",4,14,14).Blur(1.0)
- fixed_v=org_v.FluxSmoothST(17,14).Flux5framesT(17).Deen("a2d",4,14,14).Blur(1.0)
- fixed=YtoUV(fixed_u,fixed_v,org)
- output=mt_Merge(fixed,org,themask,y=2,u=3,v=3)
- show = mask==true? themask : interlaced==true? output.weave() : output
- return show
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement