Advertisement
mirkosp

WarpDeRing

Nov 15th, 2013
742
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # WarpDeRing v1.0 by mirkosp
  2. #
  3. #   Uses aWarpSharp2's flattening to clean out ringing/smaller halos,
  4. #   then runs some masks to preserve the edges and avoid the thinning.
  5. #   This is nothing really new but it kind of just works, so eh.
  6. #   Calling the filter more times in a row is probably more effective than toying with the parameters.
  7. #   Only really tested out with a DVD, probably only works as intended on SD sources.
  8. #   For HD, it might need some more mt_expand() in the owarp clip (I don't think, though).
  9. #   Oh, and it's for newer and minor stuff, like downscaled HD sources released only on DVD and so on.
  10. #   Don't expect this to work on Trigun. Or, well, I guess it could work, but... you know the deal.
  11. #
  12. # strength is the warpsharpening depth, so higher values nail more things
  13. # tmax and tmin work out the hysteresis mask for the final masking pass
  14. #
  15. # Requirements:
  16. #
  17. #   awarpsharp2 http://forum.doom9.org/showthread.php?t=147285
  18. #   mt_masktools https://github.com/tp7/masktools
  19. #   nnedi3 http://web.missouri.edu/~kes25c/
  20. #   fillmargins http://www.avisynth.nl/users/warpenterprises/
  21. #
  22.  
  23. function warpdering(clip c, int "strength", int "tmax", int "tmin") {
  24. strength = default(strength,6)
  25. tmax = default(tmax,10)
  26. tmin = default(tmin,7)
  27. c
  28. addborders(4,4,4,4)
  29. fillmargins(4,4,4,4)
  30. warp = awarp4(nnedi3_rpow2(rfactor=2).nnedi3_rpow2(rfactor=2),asobel(thresh=255).ablur(),depth=strength)
  31. owarp = mt_merge(last,warp,tedgemask(valon=-1).mt_expand().mt_expand().mt_expand().mt_expand().mt_expand().blur(1),true,u=3,v=3)
  32. mt_merge(owarp,last,mt_hysteresis(tedgemask(threshy=tmax),tedgemask(threshy=tmin)).blur(1),true,u=3,v=3)
  33. crop(4,4,-4,-4)
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement