## ## SharpTools by mf ## ## Contains sharpening filters and filters using sharpening techniques. ## ## Usage: Import("SharpTools-v0.1.avs") ## ## New in v0.3 (0.2 was internal test): chroma processing for SharpResize ^__^. ## function SharpResize(clip input, int width, int height, int "xstren", int "xthresh", \ int "ssw", int "ssh", bool "chroma") { ## ## SharpResize ## Resizes while trying to maintain sharpness. ## ## Usage: SharpResize(640, 480) ## ## Parameters: xstren = Default(xstren, 255) # xsharpening strength, 0-255 xthresh = Default(xthresh, 255) # xsharpening threshold, 0-255 ssw = Default(ssw, 4) # supersample factor horizontally, 0-inf ssh = Default(ssh, 4) # supersample factor vertically, 0-inf chroma = Default(chroma, true) # chroma processing on/off ## input.ConvertToYV12() input2 = last input2.GreyScale() LanczosResize(width*ssw, height*ssh) XSharpen(xstren, xthresh) LanczosResize(width, height) y = last input2.UToY() LanczosResize(width*ssw/2, height*ssh/2) XSharpen(xstren, xthresh) LanczosResize(width/2, height/2) u = last input2.VToY() LanczosResize(width*ssw/2, height*ssh/2) XSharpen(xstren, xthresh) LanczosResize(width/2, height/2) v = last input2.UToY() LanczosResize(width/2, height/2) u2 = last input2.VToY() LanczosResize(width/2, height/2) v2 = last fullproc = YToUV(u, v, y) lumaonly = YToUV(u2, v2, y) return chroma ? fullproc : lumaonly } function SSXSharpen(clip input, int "ssw", int "ssh", int "xstren", int "xthresh") { ## ## SSXSharpen ## Sharpens the picture using supersampling techniques. ## ## Usage: SSXSharpen() ## ## Parameters: ssw = Default(ssw, 4) # supersample factor horizontally, 0-inf ssh = Default(ssh, 4) # supersample factor vertically, 0-inf xstren = Default(xstren, 255) # xsharpening strength, 0-255 xthresh = Default(xthresh, 255) # xsharpening threshold, 0-255 ## input.LanczosResize(input.width*ssw, input.height*ssh) XSharpen(xstren, xthresh) LanczosResize(input.width, input.height) }