Advertisement
Guest User

DFMDerainBow5

a guest
Jan 28th, 2015
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. #
  2. # Last updated 28/01/2015
  3. # modified from http://avisynth.nl/index.php/DFMDeRainbow
  4. #
  5. ###################
  6. #
  7. # By Scintilla, with the third line of themask's definition
  8. # borrowed from Shodan's derainbower
  9. #
  10. ###################
  11. #
  12. # Syntax:
  13. # DFMDeRainbow(clip org, int "maskthresh", bool "mask")
  14. #
  15. # Requires YV12 input. Is kinda slow.
  16. # Suggestions for improvement welcome: scintilla@aquilinestudios.org
  17. #
  18. # Required plugins:
  19. # MSharpen, MaskTools2, FluxSmooth, Deen
  20. #
  21. # Arguments:
  22. # maskthresh (default=10) - This is MSharpen's threshold value.
  23. # Lower values will increase the area in which the blurred chroma
  24. # is allowed to come through, which catches more edges but may
  25. # cause desaturation and/or chroma bleeding.
  26. # Set this as high as you can while still catching all the edges
  27. # that need to be derainbowed.
  28. # mask (default=false) - When true, this displays the mask instead of
  29. # the image. Use this to find the optimal value of maskthresh.
  30. #
  31. ###################
  32.  
  33. function DFMDeRainbow5(clip org, int "maskthresh", bool "mask", bool "interlaced")
  34. {
  35. Assert(org.IsYV12(),"DFMDeRainbow: YV12 input only")
  36.  
  37. maskthresh = default(maskthresh, 10)
  38. mask = default(mask, false)
  39. interlaced = default(interlaced, false)
  40.  
  41. org = interlaced==true? org.separatefields() : org
  42.  
  43. org_u=org.UtoY()
  44. org_v=org.VtoY()
  45.  
  46. first_u=org_u.Flux5framesT(17).Blur(1.5)
  47. first_v=org_v.Flux5framesT(17).Blur(1.5)
  48.  
  49. themask=subtract(org,YtoUV(first_u,first_v,org)).Levels(108,1,148,0,255)
  50. \ .MSharpen(mask=true,threshold=maskthresh).Invert()
  51. \ .Blur(0.5).Levels(0,2,255,0,255).Blur(0.5)
  52.  
  53. fixed_u=org_u.FluxSmoothST(17,14).Flux5framesT(17).Deen("a2d",4,14,14).Blur(1.0)
  54. fixed_v=org_v.FluxSmoothST(17,14).Flux5framesT(17).Deen("a2d",4,14,14).Blur(1.0)
  55. fixed=YtoUV(fixed_u,fixed_v,org)
  56.  
  57. output=mt_Merge(fixed,org,themask,y=2,u=3,v=3)
  58.  
  59. show = mask==true? themask : interlaced==true? output.weave() : output
  60.  
  61. return show
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement