Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AntiAlias(clip orig,int "th_luma",int "th_chroma",float "sx",float "sy",string "type",int "aath",float "sharpness") {
- # >Requirements: MaskTools, SangNom
- # By SpikeSpiegel, Didée, mf, scharfis_barin and Soulhunter.
- # (Shamelessly) Edited by "Bloax" for a slight increase in speed, ~30 FPS at SetMtMode(2) @ 640x480 before, 59-60 now.
- # \ On a Intel Core2 (Duo) E8600 @ 3.8 GHz. Speed without MtMode, ~15 Fps vs. ~30.
- # \\ Also tuned it for game aliasing. (Used a recording of DooM for tweaking.)
- # \\\ And rewrote the instructions (and changed the name), for some reason.
- # This one is faster (twice so) than the grotesque "Motion Edition" of mine. ;)
- # Enjoy!
- # A wild Long Read ambushes you!
- # Long Read uses TL;DR
- # It was super effective!
- # You fainted! ;p
- # "th_luma" and "th_chroma" Are the thresholds for detection. The lower they are, the more edges the script catches.
- # "th_luma" Is the threshold for luma edges and "th_chroma" is well, the threshold for color edges! [/ignorance]
- # "type" Is the matrix used for edge detection. Previously "Sobel" was the default, which only detected high-contrast edges.
- # Now I replaced it with "laplace", which seems smoother (and causes less visible aliasing).
- # "aath" Is the anti-aliasing strenght. The default value should be fine.
- # Set it too low, and you'll get a blocky image (due to initial upscaling to reduce the aliasing).
- # Too high and well, nothing really. 4096 Seems to look pretty much like 64.
- # "sx" And "sy" are the scaling multipliers (..BilinearResize(m4(ox>>*sx<<)..).
- # Set it too low, and the SangNom artifacts start showing up. Too high, and it starts getting blocky. (Upscaling, again.)
- # Though it all depends on the source, for highly aliased and thick images higher values may be better.
- # Games with their tiny aliasing, however. Benefit from lower values. Don't go below 1 though! ;)
- # Note: This is the biggest factor in speed.
- # "sharpness" Defines the final sharpness of the /antialiasing/ once it gets scaled down again.
- # Set it too low, and things get a bit smeared (bad for text). Too high, and well, the antialiasing is pretty much lost.
- # Do note that "sharpness" is just the "p" value of GaussResize. :-)
- th_luma = Default(th_luma, 9)
- th_chroma = Default(th_chroma, 9)
- type = Default(type, "laplace")
- aath = Default(aath, 64)
- ox = orig.width
- oy = orig.height
- sx = Default(sx, 1.25)
- sy = Default(sy, 1.25)
- sharpness = Default(sharpness, 66)
- clp = orig.IsYV12() ? orig : orig.ConvertToYV12()
- a=clp
- b=clp.BilinearResize(m4(ox*sx),m4(oy*sy)).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath) \
- .GaussResize(ox,oy,p=sharpness)
- c=clp.EdgeMask(th_luma,th_luma,th_chroma,th_chroma,type)
- MaskedMerge(a,b,c)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement