VagueDenoiser

Wavelet denoiser plugin for Avisynth 2.5x

What it does

This is a Wavelet based Denoiser.
Basically, it transforms each frame from the video input into the wavelet domain, using various wavelet filters. Then it applies some filtering to the obtained coefficients. It does an inverse wavelet transform after. Due to wavelet properties, it should gives a nice smoothed result, and reduced noise, without blurring picture features. This wavelet transform could be done on each plane of the colorspace. This filter uses a wavelets from Brislawn tutorial.

Syntax of VagueDenoiser filter

VagueDenoiser (clip, int "threshold", int "method", int "nsteps", float "chromaT", bool "debug", bool "interlaced", int "wavelet", bool "Wiener", float "wratio", integer "percent", clip "auxclip")

Parameters:

threshold: a float (default=0)
    Filtering strength. The higher, the more filtered the clip will be. Hard thresholding can use a higher threshold than Soft thresholding before the clip looks overfiltered.
    If set < 0, then luminosity denoising will be disabled 
    If set = 0, then threshold is estimated automatically (adaptive)

method: -1 to 3 (default=3)
    The filtering method the filter will use.
    -1 : No thresholding (debug purpose)
    0 : Hard Thresholding. All values under the threshold will be zeroed.
    1 : Soft Thresholding. All values under the threshold will be zeroed. All values above will be reduced by the threshold.
    2 : Adaptive thresholding (NormalSrink method). Scale input threshold depending on local wavelet data (local = wavelet decomposition subband level).
    3 : Qian's (garrote) thresholding. Scales or nullifies coefficients - intermediary between (more) soft and (less) hard thresholding.
    4 : Uniformly smooth shrinking function.

nsteps: (default=4)
    Number of times, the wavelet will decompose the picture. High values can be slower but results will be better.
    Suggested values are 3-6.
    Picture can't be decomposed beyond a particular point (typically, 8 for a 640x480 frame - as 2^9 = 512 > 480)

chromaT: a float (default=-1)
    Set threshold value for Chroma filtering. It is slower but give better results
    If set < 0, then Chroma denoising will be disabled (default mode)
    If set = 0, then threshold is estimated automatically (adaptive)

debug: true or false
    Deactivates the inverse transform for direct display (but not normalize coefficients now).
    Also enables output for Debugview utility

interlaced: true or false (default=false)
    Try to process separately fields clip.

wavelet: an integer (default=1)
    Select wavelet type:
    1 - Cohen-Daubechies-Feauveau 9/7 - popular, probably the best
    2 - Brislawn 10/10 (sharp, used as only in all previous versions from 0.23 to 0.29)
    3 - Villasenor-Belzer-Liao 6/10 

Wiener: true or false (default=false)
    Activates WienerChop two-pass denoising mode for strong denoising with high threshold (slow).
    First pass is noise estimation by transform with first wavelet (different from selected wavelet) with selected settings,
    the second pass is optimal Wiener denoising with second (selected) wavelet.
    Second wavelet 1 is used with first (estimation) wavelet 3, 
    Second wavelet 2 is used with first (estimation) wavelet 1, 
    Second wavelet 3 is used with first (estimation) wavelet 1. 

wratio: a float (default=0.5)
    Noise std deviation value for Wiener denoising as relative ratio to threshold value.

percent: an integer from 0 to 100 (default=85)
    Partial of full denoising (limited coefficients shrinking).

auxclip: auxiliary clip for first pass of Wiener mode (default=none, source)
    Prefiltered source clip, preferably with temporal or spatial-temporal filter (such as DeGrainMedian) for best denoising and artifacts suppression.

Examples Usage of VagueDenoiser filter

(all the avisynth script lines here are only examples)

Some settings Lefungus (sometime) liked

For light filtering on a movie. (medium->threshold=1-1.5; strong->threshold=2-3)

VagueDenoiser(threshold=0.8, method=1, nsteps=6, chromaT=0.8)

For light filtering on an anime. (medium->threshold=2; strong->threshold=4)

VagueDenoiser(threshold=1.5, method=1, nsteps=6, chromaT=2.0)

Quian's thresholding is preferred method as the more similar to optimal (Bayesian).

Some strong (but slow) settings by Fizick

For strong filtering (with a high threshold) on a noisy interlaced analog video. In this case, the "small drop" artifactes is likely appear, especially for hard thresholding (Quian mode is optimal). This is because of fast decimated wavelet transform usage, as wee as "hot" pixels pulses. Use optinmal Wiener fiter. Firstly make poewr density estimation for signal and noise in firdt wavlet basis  Then use another wavelet basis (almost uncorrelared) for filtering, i.e. weak value decreasing (using previuusly made estimation). In addition, decrease the "hot pixel" influence by median temporal prefiltering (undot, degrainmedian), and use the result as auxiliary clip for noise estimation. This aux clip can be strongly filtered since we do not use it as input for Vaguedenoiser. (By the way, we get not strictly spatial smoothing now). See example (slow):

LoadPlugin("vaguedenoiser.dll")
LoadPlugin("degrainmedian.dll")
avisource("input.avi")
aux=DeGrainMedian(mode=0, limity=7, interlaced=true)
VagueDenoiser(threshold=7, auxclip=aux, interlaced=true, wiener=true)

History and download

Credits

* Everyone at Doom9.org for their counsels.
* MarcFD for his mpegdec3 html documentation. This html is the same but with modified contents.
* Lefungus for his VagueDenoiser html documentatiion. This html is the same but with modified contents. :)
* Kurosu for his VagueDenoiser html documentatiion. This html is the same but with modified contents. :-) (but partially reformated now)
* Geoff Davis, author of the wavelet transform coder construction kit.
* Lefungus, VagueDenoiser's creator.
* Kurosu, code reorganization and optimizations.
* Fizick, some code deorganization and deoptimizations. :-)

Code Distribution

This is a free sofware distribued under the terms of the GNU-GPL v2 

Please consider to make some donation to be registered user.

Contact

You can e-mail Lefungus to: lefungus (at) altern (dot) org for most suggestions, bug report, feature request, or whatever.
Lefungus web page: http://perso.wanadoo.fr/reservoir/avisynth.html
Optimization matters are Kurosu's matters.
Yet it should be obvious, you may reach Kurosu here: kurosu (at) inforezo (dot) org
Fizick is not responsible for anything, but usually strives for perfection :)
Fizick is accessible at: bag (at) hotmail (dot) ru, and his web page with latest versions must be at: http://bag.hotmail.ru or its mirror.

Goto http://forum.doom9.org/showthread.php?s=&threadid=56871 for support.


Download

DOWNLOAD VagueDenoiser v.0.35.1