Advertisement
torchlight

16-bit mt_logic

Feb 28th, 2015
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function binarymerge(clip a,clip b,clip mask,int "y",int "u",int "v",string "chroma")
  2. {
  3.     aa = mt_logic(mask,a,mode="andn",y=y,u=u,v=v,chroma=chroma)
  4.     bb = mt_logic(mask,b,mode="and",y=y,u=u,v=v,chroma=chroma)
  5.     mt_logic(aa,bb,mode="or",y=y,u=u,v=v,chroma=chroma)
  6. }
  7.  
  8. function logic16(clip a,clip b,string "mode",int "y",int "u",int "v",string "chroma")
  9. {
  10.     al = a.dither_get_lsb()
  11.     ah = a.dither_get_msb()
  12.     bl = b.dither_get_lsb()
  13.     bh = b.dither_get_msb()
  14.     h = mt_logic(ah,bh,mode=mode,y=y,u=u,v=v,chroma=chroma)
  15.     l = mt_logic(al,bl,mode=mode,y=y,u=u,v=v,chroma=chroma)
  16.     ma = mt_lutxy(ah,bh,"x y < 255 0 ?",y=y,u=u,v=v,chroma=chroma)
  17.     mb = mt_lutxy(ah,bh,"x y > 255 0 ?",y=y,u=u,v=v,chroma=chroma)
  18.     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) \
  19.                         : l.binarymerge(al,mb,y=y,u=u,v=v,chroma=chroma).binarymerge(bl,ma,y=y,u=u,v=v,chroma=chroma)
  20.     return (mode == "min" || mode == "max") ? stackvertical(h,l) : mt_logic(a,b,mode=mode,y=y,u=u,v=v,chroma=chroma)
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement