Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Loads
  2. # Functions
  3. function HQDering(clip input, int "strength", int "overall", clip "smoother") {
  4.  
  5.  strength = Default(strength, 255)  # strength, 0-255
  6.  overall  = Default(overall, 0)     # overall smoothing, 0-255
  7.  smoothed = defined(smoother) ? smoother : input.Deen("a3d",4,15,15,20) # filter that smooths
  8.  
  9.  normalmask=input.mt_edge(thY1=3, thY2=255, mode="sobel", chroma="none")
  10.  
  11.  amplifiedmask=normalmask.Levels(0, 3.3, 90, 0, 255).Blur(1.0)
  12.  
  13.  thickmask=normalmask.mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 90, 0, 255)
  14.   \ .Blur(1.0).mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 255, 0, 255)
  15.   \ .mt_inflate().mt_inflate()
  16.  
  17.  ringingmask=mt_lutxy(amplifiedmask.mt_invert(), thickmask, expr="x y * 255 /").Levels(60, 3.0, 140, overall, strength)
  18.  
  19.  mt_merge(input, smoothed, ringingmask)
  20.  
  21. }
  22.  
  23. function FastLineDarkenMOD( clip c, int "strength", int "luma_cap", int "threshold", int "thinning")
  24. {
  25. ## parameters ##
  26. str     = string(default(strength, 48) /128.)
  27. lum     = string(default(luma_cap, 191))
  28. thr     = string(default(threshold, 4))
  29. thinning = default(thinning,24)
  30. thn     = string(thinning /16.)
  31.  
  32. ## filtering ##
  33. exin    = c.mt_expand().mt_inpand()
  34. diff    = mt_lutxy(c,exin,yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x",u=2, v=2)
  35. linemask= mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +").mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
  36. thick   = mt_lutxy(c, exin, yexpr="y "+lum+" < y "+lum+" ? x "+thr+" + > x y "+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x",u=2, v=2)
  37. thin    = mt_lutxy(c.mt_expand(U=2,V=2),diff,yexpr="x y 127 - "+str+" 1 + * +",u=2, v=2)
  38.  
  39. return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=2,v=2)
  40. }
  41.  
  42.  
  43. # Src
  44. DirectShowSource("F:\Umi ga Kikoeru (BD Remux).mkv")
  45.  
  46. # Denoise/Dering
  47. RemoveGrain(17)
  48. KNLMeansCL(a=4,s=3,h=2.5)
  49. HQDering()
  50.  
  51. # Stab & Crop
  52. Crop(0,22,0,-22)
  53.  
  54. # Levels & Color correction
  55. ColorYUV(off_u=0,off_v=-1.4)
  56. SmoothTweak(0,1.1,0.95)
  57. AutoAdjust()
  58.  
  59. # Sharpening
  60. #FastLineDarkenMOD()
  61. #MAA2()
  62.  
  63. # Testing only!
  64. Trim(34000,34200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement