## asharp : adaptive sharpenning filter for Avisynth 2.5

(v0.95)

### Warning - YV12 inside !!

This filter is designed for Avisynth 2.5
It would work only with Avisynth 2.5 or greater

### What it does:

basically, this filter is a very common unsharp mask, simply because unsharp
mask is the most pleasant sharpenning technique for my eyes ^^
but i've added 3 simple ideas i had about sharpening :
- adaptive thresholding to avoid noise enhancement
- block adaptive sharpenning to avoid DCT block edges enhancement
- block based adaptive thresholding to avoid DCT block edges enhancement
it's optimised for quality, not speed. but... i love speed ^^
so i've added very optimised MMX/ISSE code.
it's working in YV12 colorspace, and on luma only
(chroma sharpenning seems to only introduce artifacts)

### Usage of asharp :

First, add the following line in your .avs script :
`
LoadPlugin("asharp.dll") # because Avisynth 2.5 doesn't support Autoloading yet
`
To do simple unsharp masking with a strength of 2x :
`
asharp(2,0)
`
To try some adaptive sharpenning :
`
asharp(2,4)
`
Suggestion for divx anime decoding :
`
asharp(2.5,4.5,0.25,hqbf=true)
`

### Syntax :

`asharp(float "T", float "D", float "B", bool "hqbf")`
T : unsharp masking threshold. 0 will do nothing. (value clamped to [nothing=0..32])

1 is like 32 with ffdsow/Vdub unsharp mask filter, it'll enhance contrast 1x
default is T=2

D : adaptive sharpenning strength. (value clamped to [disabled=0..16])

set to 0 to disable
if D>0, adaptive thresholding is enabled.
the threshold is adapted for each pixel (bigger for edges)
if adaptive sharpenning is enabled, T acts like a maximum.
default is D=4

B : block adaptive sharpenning. (value clamped to [disabled=0..4])

set to a negative value to disable.
if B>=0, block adaptive sharpenning is enabled.
it acts very simply, by lowering the threshold around DCT-blocks edges.
if you use it, avoid any non mod8 cropping between the decoder and asharp.
(it works only wit adaptive sharpenning, when D>0)
default is B=-1 (disabled)

hqbf : high quality block filtering. (aka block based adaptive thresholding.)

it was painfull to implement in SIMD, but i love it.
try with and without on a blocky video, and you'll understand why ^^
it works only with adaptive thresholding.
default is false (disabled)

### History :

v 0.95 (09.11.02)

- fixed some bugs
- added mmx compatibility
- first GPL source release

### Code Distribution :

This is a free sofware distribued under the terms of the GNU-GPL v2
To get the source code, there's a separated rar archive on my site

### Contact :

Don't even doubt of e-mailing me for any suggestion :-), bug report :-(,
feature request :D, or whatever else :-P.
I hope you'll find this prog useful ! (i do...)

Last update 27 nov 2002 @ 20h15 GMT by MarcFD