Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fix_qtec_drawing( clip c ) {
- function linemask( clip c, int "blur", int "thresh", int "str" )
- {
- blur=default(blur,5)
- thresh=default(thresh,4)
- str=default(str,16)
- mt_lutxy(c,c.binomialblur(blur,u=1,v=1),"x "+string(thresh)+" + y < y x - "+string(str)+" * 0 ?")
- }
- function YAHR2( clip clp, int "warpdepth" )
- {# Y'et A'nother H'alo R'educing script
- warpdepth=default(warpdepth,32)
- b1 = clp.minblur(2,2).removegrain(11,-1)
- b1D = mt_makediff(clp,b1)
- w1 = clp.aWarpSharp2(depth=warpdepth,blur=2,chroma=1)
- w1b1 = w1.minblur(2,1).removegrain(11,-1)
- w1b1D = mt_makediff(w1,w1b1)
- DD = b1D.repair(w1b1D,13,-1)
- DD2 = mt_makediff(b1D,DD)
- clp.mt_makediff(DD2,U=2,V=2)
- }
- function YAHRmask(clip c, int "expand", int "warpdepth")
- {
- c
- expand=default(expand,5)
- warpdepth=default(warpdepth,32)
- vEdge=mt_lutxy(mt_expand.mt_expand,"x y - abs 8 - 7 <<")
- mt_merge(yahr2(warpdepth),\
- vEdge.binomialblur(expand*2,u=1,v=1).mt_lut("x 16 *").mt_logic(vEdge.removegrain(12,-1).mt_invert,"min"),\
- u=2,v=2)
- }
- c
- m=linemask()
- # select dark blurs near line joints and corners
- m2=m.binomialblur(1,u=1,v=1).mt_lut("x 16 *").binomialblur(1,u=1,v=1).mt_lut("x 200 - 4 *").mt_logic(m.mt_invert,"min").removegrain(12,-1).mt_lut("x 64 - 4 *").tmaskcleaner(10).mt_expand.mt_expand.mt_logic(m.mt_expand,"max").removegrain(20,-1).removegrain(20,-1)
- # lighten them
- vBlur=binomialblur(2,u=1,v=1)
- mt_merge(mt_lutxy(vBlur,"y x < x x y - 32 * + x ?"),m2,u=1,v=1).mt_clamp(binomialblur(10,u=1,v=1),last,100,0)
- # separate close lines
- debilinear(960,540).nnedi3_rpow2(2,cshift="spline36resize")
- # darken whites near line corners and joints
- mt_merge(mt_lutxy(binomialblur(4,u=1,v=1),"y x < x y - 4 / y + x ?"),m.mt_expand.mt_expand.binomialblur(3,u=1,v=1),u=1,v=1)
- dehalo_alpha_mt_y8(3,3,0,1).mt_merge(last,m2,u=1,v=1) #don't make inter-line joints and corners darker
- yahrmask
- mt_merge(blankclip(last,160,90,color_yuv=$808080).addgrainC(100,constant=true,0).bicubicresize(width,height).mt_lut("x 128 - 255 * 128 +").mt_adddiff(last),m,u=1,v=1).mt_clamp(last,vBlur,0,50,u=1,v=1)
- aasw
- mt_merge(c,mt_lut("255 x 64 - 0 max 256 128 - / 3 ^ 256 * -").mt_inpand.tmaskcleaner(300).mt_expand.mt_expand.mt_expand.mt_expand.binomialblur(3,u=1,v=1),u=1,v=1)
- mergechroma(c)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement