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