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