Advertisement
Guest User

AntiAliasHQ (First version)

a guest
Dec 8th, 2011
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. function AntiAliasHQ(clip clp,int "thr",int "aa",bool "sharpen",float "sharp") {
  2. # Another antialiasing script by, you guessed it - Bloax.
  3. # I doubt this one's really usable for much, but I'll just go ahead and post it -
  4. # Since it 'bypasses' a SangNom issue hackily, and combines it with RemoveGrain mode 21.
  5.  
  6. # It's also pretty fast. No supersampling for you though!
  7. # But overall, it doesn't really "smooth" much, it does kill jaggies quite nicely though. (Game footage, anyone?)
  8.  
  9. # Requirements: RemoveGrain, RedAverage.dll (You can google it), SangNom, MaskTools2
  10.  
  11. # "thr" Is the threshold for detecting edges, higher values INCREASE the amount of edges found.
  12. # It's operating in Pow2, so be careful about the values. (6 is 64, while 8 is >256< :P) [/basicmath]
  13. # > Seems like lower values are softer. Lower values sharpen more though, whilst higher sharpen less.
  14. # Due to the fact that when more edges are "detected", there's less overall space in the inverse edge mask.
  15. # Which is what the sharpening is limited to.
  16.  
  17. # "aa" Is a silly little value for SangNom, I have no idea about what it does above 48-64.
  18. # "sharpen" Controls whenever there's internal (non-edge) sharpening, and "sharp" controls the strength.
  19.  
  20. # Enjoy!
  21.  
  22. thr = Default(thr, 5)
  23. aa = Default(aa, 1024)
  24. sharpen = Default(sharpen, true)
  25. sharp = Default(sharp, 0.33)
  26.  
  27. thrval = Pow(2,thr)
  28.  
  29. clp2 = IsYV12(clp) ? clp : clp.ConvertToYV12() # Don't we love to copy this? :-)
  30.  
  31. edges=RAverageW(clp2,thrval,clp2.RemoveGrain(19,-1),thrval*-1,mode=4,u=0,v=0,bias=-128)
  32. edgemsk=RAverageW(edges,-1,mode=8,u=0,v=0,bias=255) # Inverse edge mask, for removing SangNom weirdness outside edges.
  33. aa1=clp2.SangNom(0,aa)
  34. msk1=RAverageW(clp2,64,aa1,-64,mode=4,u=0,v=0,bias=-128)
  35. invmsk1=RAverageW(msk1,-1,mode=8,u=0,v=0,bias=255)
  36. aa2=clp2.SangNom(1,aa)
  37. merge=RMerge(aa1,aa2,invmsk1.Mt_Inpand().Mt_Deflate().Mt_Inflate(),mode=255)
  38. clean=sharpen ? RMerge(merge,clp2.Sharpen(sharp),edgemsk.RemoveGrain(21,-1).Mt_Deflate(),mode=255) : RMerge(merge,clp2,edgemsk.RemoveGrain(21,-1).Mt_Deflate(),mode=255)
  39. RMerge(clean,clean.RemoveGrain(21),edges,mode=255)
  40. }
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement