# VagueDenoiser

## Übersicht

Autor: Lefungus
Version: 0.28.0
Download: http://perso.wanadoo.fr/reservoir/avisynth.html
Kategorie: Räumlicher Weichzeichner
Anforderungen:YV12 oder YUY2 Farbformat

# VagueDenoiser: Wavelet Denoiser for Avisynth 2.5+
(v0.28.0)

## 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 wavelet from Brislawn tutorial. (Brislawn 10/10)

## Examples Usage of VagueDenoiser filter:

(all the avisynth script lines here are only exemples)

### Some settings Lefungus (comments on Qian's thresholding to come) likes:

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

VagueDenoiser(threshold=0.8,method=1,nsteps=6,chroma= true)

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

VagueDenoiser(threshold=1.5,method=1,nsteps=6,chroma=true)

` For seeing how much wavelet information is discarded (luma plane only, use UtoY() otherwise).
`

VagueDenoiser(<...>,chroma=false,debug=true)

`

## Syntax of VagueDenoiser filter:

### VagueDenoiser:

`VagueDenoiser(int "threshold" int "method", int "nsteps", bool "chroma", bool "debug")`

threshold: a float >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.

method: -1 to 1 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 : Pseudo-adaptative thresholding. Scale input threshold depending on local wavelet data (local = wavelet decomposition level).

3 : Qian's thresholding. Scales or nullifies coefficients - intermediary between (more) soft and (less) hard thresholding.

nsteps: 1<int<8

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)

chroma: true or false

chroma=true enable Chroma filtering. It is slower but give better results

debug: true or false

Deactivates the inverse transform and normalize coefficients for direct display.

interlaced: true or false

Try to process separately fields of a YV12 clip (will be ignored in other cases).

## History and download:

v 0.12 First Release

- Precision problems corrected, 0 for threshold is now lossless.

v 0.13

- Hard thresholding method enabled.
- Cosmetic changes.
- Avisynth parameters changed.

v 0.2

- Implemented many new wavelet filters, thanks to the wavelet transform coder construction kit.
  look at http://www.geoffdavis.net/ for more informations.
- Implemented nsteps parameter, that allow you to use n steps in the selected wavelet tranform.
- Some nsteps values could produce unvalid results, reducing this value generally solve the problem.
- Little optimizations from Shodan and Bidoche.

v 0.22

- YUY2 colorspace support.
- Optionnal chroma filtering, (chroma=true/false).
- Cosmetic changes, code cleaned.
- Html documentation.

v 0.23

- Code cleaned, filters class removed.
- Better parameters for compilation. Should really works on every cpu now.
- Removed all filters except Brislawn 10/10, so filter parameter has been removed.(it's like filter=7).
- A little speed increase (3-5fps on a 640x256 frame with nsteps=6).

V0.24

- Another speed increase, some critical loops unrolled (To infinity and beyond!)

V0.241

- height and width must be mod4, added errors messages if not
- Cleaned include thanks to Kurosu

V0.242

- Removed restrictions on width/height, fixed bugs
- Some improvements from Kurosu

V0.243

- Code cleaned

V0.25

- Little speed increase (due to some little profiles and vectorizations)
- added defaults
- added a visual.net compiled dll for compatibility purposes. This dll is slower

V0.26 (Kurosu)

- Merged (C++ frenzy) all assembly parts from Kurosu's version into one dll
- Hence, speed increase
- Undone previous vectorization optimizations
- All improvements are available for YV12 only

V0.26.1 (Kurosu)

- Merge from Sh0dan on copy
- Cleaner and safer management from Bidoche
- Fixed a crash that may have affected P4 users (Athlons with SSE support weren't affected as 3DNow! code, being the fatest, is always selected).
- Added debug output and NOOP threshold method (for debug purpose)

V0.27.0 (Kurosu)

- Continued integration and added framework for Haar wavelet (still not functionnal, deactivated)
- All optimizations proposed by Sh0dan, ARDA and Bidoche
- Some registers reuse (AMD-64 gonna rock) for some more speed (5%)
- Added Qian thresholding

V0.27.1 (Kurosu)

- Fixed YUY2 mode
- Added RGB24 and RGB32 mode
- The 3 above modes are unlikely to get any speed optimization

V0.28.0 (Kurosu)

- Fixed all modes to properly process what needs to be processed (small speedup)
- Unrolled float2byte conversion, little speed-up
- Added interlaced (see option with that name) support to YV12 colorspace
- Workspace compatible with ICL7. dll isn't compiled in that mode for legal reasons (I don't own ICL)
- Decteted a major slowdown for MOD64 width. Avoid them, as applying this filter before resizing might be faster in fact (particularly true for widths of 512)

## 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. :)
- Geoff Davis, author of the wavelet transform coder construction kit.
- Lefungus, VagueDenoiser's creator.
- Kurosu, code reorganization and optimizations.

## Code Distribution :

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

## Contact :

You can e-mail Lefungus for most suggestion, bug report, feature request, or whatever.
Optimization matters are Kurosu's matters.

Goto http://forum.doom9.org for support.

Yet it should be obvious, you can reach me here: kurosu (at) inforezo (dot) org