Code:
function antialiasing(clip orig,int "th_luma",int "th_croma",string "type",int "aath") {
# "th_luma" & "th_croma" are the edge detection thres.: lower values=more edges filtered
# "type" is the matrix used for edge detection: with "sobel" (default) only the
# hi-contrast edges, where artefacts are more noticeable, are filtered. If you want
# to test other matrices, read the MaskTools Guide for more info.
# "aath" = anti-aliasing strenght (default should be fine)
th_luma = Default(th_luma, 20)
th_croma = Default(th_croma, 20)
type = Default(type, "sobel")
aath = Default(aath, 48)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2
clp = orig.IsYV12() ? orig : orig.ConvertToYV12()
a=clp
b=clp.Lanczos4Resize(dx,dy).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath) \
.LanczosResize(ox,oy)
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c)
}
Hi!
This filter is meant for good quality clips with soft antialiasing (like DVs);
thanks to MaskTools' functions, a strong AA-filter (Sangnom) is applied only where it's needed without producing artefacts typical of this filter.
Requires:
-MaskTools
-SangNom
Let me know what do you think about it!
P.S. Thanks to Didée, mf, scharfis_brain and Soulhunter (in alphabetical order) for their help!
EDIT1: Ooops! Now, with Lanczos4Resize instead of PointResize, there's no definition loss nor artefacts.
...and now SangNom's config. is aviable
EDIT2: Credits
EDIT3: Fixed a typo, erased a useless option, more info added.