Advertisement
torchlight

MinBlurMod

Mar 30th, 2014
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* MinBlurMod - slight modification of MinBlur
  2. (original: http://avisynth.nl/index.php/MinBlur)
  3.  
  4. This has RGTools, RedAverage and Dither tools as dependencies. This is (mostly)
  5. identical to the original, but using a median of three clips instead of a
  6. two-input LUT. The wt parameter allows tweaking how much to blend in the blurred
  7. result; using a negative value would have a sharpening effect instead.
  8. */
  9.  
  10. function MinBlurMod(clip clp, int r, int "uv", float "wt")
  11. {
  12. uv   = default(uv,3)
  13. wt   = default(wt,1.0)
  14. uv2  = (uv==2) ? 1 : uv
  15. rg4  = (uv==3) ? 4 : -1
  16. rg11 = (uv==3) ? 11 : -1
  17. rg20 = (uv==3) ? 20 : -1
  18. medf = (uv==3) ? 1 : -200
  19.  
  20. RG11c = (r==1) ? clp.removegrain(11,rg11)
  21.  \    : (r==2) ? clp.removegrain(11,rg11).removegrain(20,rg20)
  22.  \    :          clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20)
  23. RG4c  = (r==1) ? clp.removegrain(4,rg4)
  24.  \    : (r==2) ? clp.medianblur(2,2*medf,2*medf)
  25.  \    :          clp.medianblur(3,3*medf,3*medf)
  26.  
  27. interleave(clp,rg11c,rg4c).rgtools_clense().selectevery(3,1)
  28.  
  29. (wt==1.0) ? last : raveragew(clp,1-wt,last,wt,lsb_out=true).ditherpost(mode=6)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement