Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function binarymerge(clip a,clip b,clip mask,int "y",int "u",int "v",string "chroma")
- {
- aa = mt_logic(mask,a,mode="andn",y=y,u=u,v=v,chroma=chroma)
- bb = mt_logic(mask,b,mode="and",y=y,u=u,v=v,chroma=chroma)
- mt_logic(aa,bb,mode="or",y=y,u=u,v=v,chroma=chroma)
- }
- function logic16(clip a,clip b,string "mode",int "y",int "u",int "v",string "chroma")
- {
- al = a.dither_get_lsb()
- ah = a.dither_get_msb()
- bl = b.dither_get_lsb()
- bh = b.dither_get_msb()
- h = mt_logic(ah,bh,mode=mode,y=y,u=u,v=v,chroma=chroma)
- l = mt_logic(al,bl,mode=mode,y=y,u=u,v=v,chroma=chroma)
- ma = mt_lutxy(ah,bh,"x y < 255 0 ?",y=y,u=u,v=v,chroma=chroma)
- mb = mt_lutxy(ah,bh,"x y > 255 0 ?",y=y,u=u,v=v,chroma=chroma)
- l = (mode == "min") ? l.binarymerge(al,ma,y=y,u=u,v=v,chroma=chroma).binarymerge(bl,mb,y=y,u=u,v=v,chroma=chroma) \
- : l.binarymerge(al,mb,y=y,u=u,v=v,chroma=chroma).binarymerge(bl,ma,y=y,u=u,v=v,chroma=chroma)
- return (mode == "min" || mode == "max") ? stackvertical(h,l) : mt_logic(a,b,mode=mode,y=y,u=u,v=v,chroma=chroma)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement