Advertisement
torchlight

awarpsharp2 16-bit wrapper

Jul 5th, 2014
338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* awarpsharp2 16-bit wrapper (supports 16-bit 4:4:4 too)
  2. Note: This needs Avisynth+, because Avisynth+ has this really revolutionary thing called an "if" statement. I gave up trying to write it using only ?:.
  3. */
  4.  
  5. function warpsharp16(clip c,int "thresh",int "blur",int "type",int "depth",int "chroma")
  6. {
  7. chroma=default(chroma,4)
  8. msb=c.Dither_get_msb()
  9. emc=msb.aSobel(thresh=thresh,chroma=select(chroma,1,1,1,3,1,5,1)).aBlur(blur=blur,type=type,chroma=select(chroma,1,1,1,3,1,5,1))
  10. warped=msb.aWarp(emc,depth=depth,chroma=chroma)
  11. if(msb.IsYV24()&&chroma!=1)
  12. {#awarpsharp2 breaks on YV24 (probably also on YV16 but who uses that)
  13. uv=interleave(msb.utoy8(),msb.vtoy8()).converttoyv12()
  14. emcuv=(chroma==4||chroma==6)?uv.aSobel(thresh=thresh,chroma=1).aBlur(blur=blur,type=type,chroma=1):interleave(emc,emc)
  15. warpeduv=uv.aWarp(emcuv,depth=depth,chroma=1)
  16. warped=ytouv(warpeduv.selecteven(),warpeduv.selectodd(),warped)
  17. }
  18. mtuv=chroma>3?3:chroma
  19. return dither_add16(c,mt_makediff(warped,msb,chroma=(chroma<=2?"ignore":"process")).Dither_convert_8_to_16(),u=mtuv,v=mtuv,dif=true)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement