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 using RemoveGrain.
- # > 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. :))
- # Update: sx And sy are actually the main factors in terms of clarity. (Overall sharpness of the image.)
- # The higher they are, the less intrusive the antialiasing becomes. Speed goes down by a bit though.
- thrl = Default(thrl, 10) # Luma threshold for the masks.
- thrc = Default(thrc, 10) # Chroma threshold for the masks. (Color)
- ox = orig.width
- oy = orig.height
- sx = Default(sx, 1.3) # Update: Don't set these on 1, it'll eliminate the antialiasing.
- sy = Default(sx, 0.8) # Settings them too low will result in both artifacts and major loss of detail. Too high and the filter is going to be (pretty) slow.
- #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!
- #Gaussresize replaced with BilinearResize. (Speed!)
- 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=19).RemoveGrain(mode=9).RemoveGrain(mode=19).BilinearResize(ox,oy).RemoveGrain(mode=19)
- e=clp.EdgeMask(round(thrl/6),thrl,round(thrc/5),thrc,mode).Inflate().RemoveGrain(mode=4).Deflate()
- f=MaskedMerge(a,c,e) # I'll probably be messing around with those.
- MaskedMerge(a,f,e)
- # The stuff below ended up as a bad experiment.
- #h=e.Invert() # This seems to clarify things outside the edges a bit. At the prize of about 3.8% worth of FPS. Worth it though.
- #MaskedMerge(g,a,h) # Uses the above mask to do it's dirty business.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement