Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AntiAliasRG(clip orig,float "sx", float "sy",string "mode",int "thrl",int "thrc",float "sharpness") {
- # Fast, dull antialiasing. Expect updates/tweaking in the future. No guarantees though. (Lazy, lazy me!)
- # > Requirements: MaskTools, RemoveGrain(SSE3).dll
- # By Bloax, based on the "Antialiasing" script (stealing parts of ;)), authors of which are; SpikeSpiegel, Didée, mf, scharfis_brain and Soulhunter.
- # Note: This script is pretty weak, so tough edges (huge, curved ones) end up looking plain blurred.
- # Though if said source is downscaled, everything looks alright. (More or less better than just downsized.)
- # It is to be noted that this script loses to the SangNom ones in slightly aliased cases. (Eg. Warcraft 3: The Frozen Throne title screen.)
- # Though for eliminating tons of aliasing in a noisy game (Eg. Doom), this is certainly better than the usual SangNom ones.
- # Due to the fact that it doesn't smoothen out the noise to abstract shapes, and instead eliminates it. (RemoveGrain. :))
- thrl = Default(thrl, 8) # Luma threshold for the masks.
- thrc = Default(thrc, 8) # Chroma threshold for the masks. (Color)
- ox = orig.width
- oy = orig.height
- sx = Default(sx, 0.75) # Potential artifact reduction (supersampling), except here I use it to speed the RemoveGrain performance up. :-)
- sy = Default(sx, 0.75) # Though the resizing may or may not eliminate that gain. Again, expect tweaking.
- sharpness = Default(sharpness,(31.25*((sx+sy)/2))) # The sharpness for upscaling of the downscaled clip. Keep low, or else we're going to see some edgy artifacts!
- mode = Default(mode, "laplace") # Kernel for detecting edges, I prefer this one.
- clp = orig.IsYV12() ? orig : orig.ConvertToYV12() # Is the source in YV12? If not, convert to it. (Shameless ripoff!)
- ##############
- a=clp
- b=clp.BilinearResize(m4(ox*sx),m4(oy*sy))
- c=b.RemoveGrain(mode=9).GaussResize(ox,oy,p=sharpness)
- d=b.RemoveGrain(mode=1).GaussResize(ox,oy,p=sharpness)
- e=clp.MotionMask(thrl,thrl,thrc,thrc,128)
- f=clp.EdgeMask(thrl,thrl,thrc,thrc,mode).Inflate() # Expanding (?) the mask to get smoother edges. (?Perhaps a slight median filter needed?)
- g=MaskedMerge(a,c,e) # I'll probably be messing aroudn with those.
- h=MaskedMerge(a,d,f)
- i=MaskedMerge(g,h,f)
- j=MaskedMerge(a,i,f)
- q=f.Invert().Deflate().Deflate() # This seems to clarify things outside the edges a bit. At the prize of about 3.8% worth of FPS. Worth it though.
- MaskedMerge(j,a,q) # Uses the above mask to do it's dirty business.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement