# aSharp

## Übersicht

Autor: MarcFD
Version: 0.95
Download: http://ziquash.chez.tiscali.fr/
Kategorie: Schärfe/Weichzeichner
Anforderungen: YV12 Farbraum

## Description

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])
T=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)