Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 2017.03.31 1st release
- # abcxyz with high bit support, need masktools 2.2.5 or up in avs26 and avs+
- function abcxyz(clip input, float "rad", float "ss", float "yrad")
- {
- rad = default(rad, 3.0) # radius for halo removal
- yrad = default(yrad, rad)
- ss = default(ss, 1.5) # radius for supersampling / ss=1.0 -> no supersampling
- ssispmt = Findstr(VersionString(), "AviSynth+") != 0 && Findstr(VersionString(), "r1576") == 0
- sislumaonly = ssispmt ? input.isy() : VersionNumber() < 2.6 ? true : input.isy8()
- clp = sislumaonly ? input : ssispmt ? input.converttoy() : input.converttoy8()
- ox = clp.width()
- oy = clp.height()
- x = clp.bicubicresize(abcxyz_m4(ox/rad),abcxyz_m4(oy/yrad)).bicubicresize(ox,oy,1,0)
- y = VersionNumber() < 2.6 ? mt_lutxy(clp,x,"x 8 + y < x 8 + x 24 - y > x 24 - y ? ? x y - abs * x 32 x y - abs - * + 32 /",U=2,V=2)
- \ : mt_lutxy(clp,x,"x 8 scalef + y < x 8 scalef + x 24 scalef - y > x 24 scalef - y ? ? x y - abs * x 32 scalef x y - abs - * + 32 scalef /",U=2,V=2)
- z1 = ss==1.0 ? repair(clp,y,1) : nop()
- maxbig = ss!=1.0 ? y.mt_expand().bicubicresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop()
- minbig = ss!=1.0 ? y.mt_inpand().bicubicresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop()
- z2 = ss!=1.0 ? clp.lanczosresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop()
- z2 = ss!=1.0 ? z2.mt_logic(maxbig,"min",U=2,V=2).mt_logic(minbig,"max",U=2,V=2).lanczosresize(ox,oy) : nop()
- z2 = ss!=1.0 ? sislumaonly ? z2 : ssispmt ? CombinePlanes(z2,input,planes="YUV",sample_clip=input) : ytouv(input.utoy8(),input.vtoy8(),z2) : nop()
- return( (ss==1.0) ? z1 : z2 )
- }
- function abcxyz_m4(float x) {
- nx=VersionNumber() < 2.6 ? x<16?16:int(round(x/4.0)*4) : round(x)
- return(nx)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement