SHOW:
|
|
- or go back to the newest paste.
1 | - | # 2017.03.05 1st release |
1 | + | # 2017.03.31 1st release |
2 | - | # abcxyz with high bit support, need masktools 2.2.4 or up in avs26 and avs+ |
2 | + | # abcxyz with high bit support, need masktools 2.2.5 or up in avs26 and avs+ |
3 | ||
4 | function abcxyz(clip input, float "rad", float "ss", float "yrad") | |
5 | { | |
6 | rad = default(rad, 3.0) # radius for halo removal | |
7 | yrad = default(yrad, rad) | |
8 | ss = default(ss, 1.5) # radius for supersampling / ss=1.0 -> no supersampling | |
9 | ||
10 | ssispmt = Findstr(VersionString(), "AviSynth+") != 0 && Findstr(VersionString(), "r1576") == 0 | |
11 | ||
12 | sislumaonly = ssispmt ? input.isy() : VersionNumber() < 2.6 ? true : input.isy8() | |
13 | ||
14 | clp = sislumaonly ? input : ssispmt ? input.converttoy() : input.converttoy8() | |
15 | ||
16 | ox = clp.width() | |
17 | oy = clp.height() | |
18 | ||
19 | x = clp.bicubicresize(abcxyz_m4(ox/rad),abcxyz_m4(oy/yrad)).bicubicresize(ox,oy,1,0) | |
20 | 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) | |
21 | - | \ : mt_lutxy(clp,x,"x 8 #F + y < x 8 #F + x 24 #F - y > x 24 #F - y ? ? x y - abs * x 32 #F x y - abs - * + 32 #F /",U=2,V=2) |
21 | + | \ : 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) |
22 | z1 = ss==1.0 ? repair(clp,y,1) : nop() | |
23 | maxbig = ss!=1.0 ? y.mt_expand().bicubicresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop() | |
24 | minbig = ss!=1.0 ? y.mt_inpand().bicubicresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop() | |
25 | z2 = ss!=1.0 ? clp.lanczosresize(abcxyz_m4(ox*ss),abcxyz_m4(oy*ss)) : nop() | |
26 | 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() | |
27 | z2 = ss!=1.0 ? sislumaonly ? z2 : ssispmt ? CombinePlanes(z2,input,planes="YUV",sample_clip=input) : ytouv(input.utoy8(),input.vtoy8(),z2) : nop() | |
28 | ||
29 | return( (ss==1.0) ? z1 : z2 ) | |
30 | } | |
31 | ||
32 | function abcxyz_m4(float x) { | |
33 | nx=VersionNumber() < 2.6 ? x<16?16:int(round(x/4.0)*4) : round(x) | |
34 | return(nx) | |
35 | } |