Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 3rd July 2003, 20:31   #1  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
VagueDenoiser 0.35.1: a 2D Wavelet denoiser/smoother

A 2D wavelet denoiser/smoother.

It transforms each plane into the wavelet domain, then apply one kind of thresholding on the obtained coefficients, to reduce data that should be noise. With a low threshold you'll erase noise, whereas with higher threshold, you'll smooth the picture. It's somewhat effective against blocking too. Judge it by yourself

Grab it on my site or on Kurosu site

See the proper documentation into the package on how to exactly use it.

Required:
Avisynth 2.52
YV12/YUY2 colorspace

[Edited]
Removed obsolete things


Last edited by Wilbert; 10th July 2004 at 23:59.
Lefungus is offline   Reply With Quote
Old 3rd July 2003, 22:13   #2  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 432
Re: VagueDenoiser 0.1: Wavelet based denoiser

Quote:
Originally posted by Lefungus
To be updated soon, Fastsymmlet8 seems to give good results for deblocking ( don't ask me why )
Because Symlets are approximately symetric (d'oh) and Daubechies wavelets aren't?

*acts as if he really knew what he was talking of*

Anyway, that's a very good start (awaited in its results by many user), and indeed there can be many things to expect from the update. Is the method used now somehow linked to "waveshrink" (ie zeroing of too small coefficients) ?

Last edited by Kurosu; 3rd July 2003 at 22:15.
Kurosu is offline   Reply With Quote
Old 3rd July 2003, 22:38   #3  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
OK, i've removed the bug
Now symmlet works again

it's quite slow though

For low filtering, begin at 0.5
strong filtering at 1-2

The method i use is soft thresholding, ie same as waveshrink it seems
All coefficients under the threshold are zeroed and those above are reduced to limit artefacts.
Lefungus is offline   Reply With Quote
Old 4th July 2003, 12:06   #4  |  Link
d'Oursse
Mushroomeur
 
Join Date: Jun 2003
Location: Mushrooms of Paris Town
Posts: 267
hello,

i wanted to try your plugin but it requires libmmd.dll. I think it is the library that comes from the intel compiler. Am I right ?

Another possibillity is that you compile statically your plugin.

thanks !
d'Oursse is offline   Reply With Quote
Old 4th July 2003, 12:34   #5  |  Link
Dreassica
Registered User
 
Join Date: May 2002
Posts: 384
U replaced the old dll with the new one yet? Cuz i am still getting a garbled picture when using the FastSymmlet8 routine (1).
Dreassica is offline   Reply With Quote
Old 4th July 2003, 15:14   #6  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Updated to v 0.12

-Precisions problems corrected
-The dll shouldn't need any other dll
-Symmlet8 supported

The source is also released, free.
I have indeed used Daniel Lemire code, the original file is included with the package.

Next step would be to implement other wavelets like Haar and also include other colorspaces.
Lefungus is offline   Reply With Quote
Old 4th July 2003, 16:04   #7  |  Link
SILICON
Registered User
 
Join Date: Jun 2002
Location: Spain
Posts: 153
What is the Difference between VagueDenoiser and NIc's DCT filter?

Both make DCT and zeroed coefficients under one threshold.
SILICON is offline   Reply With Quote
Old 4th July 2003, 16:58   #8  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 432
The biggest difference (and I assume that's the reason why this filter is good at smoothing blocking artifacts) I see is rather the DCT is done locally, on a 8x8 block with no regard to neighbours in the image, while DWT operates on a whole image at once. Therefore, this introduces in the case of DCT discontinity problems on the 8x8 block' borders.

But maybe Lefungus has chosen an intermediate solution , though processing times are a hint that he's transforming a whole planar (plane?) at once.

Quote:
So, what about to code Haar wavelet and verify if it is even better?(just kidding)

Actually, it is because symlet8 have 8 vanishing moments. DB4 have only 4. The smoothness of wavelet reconstruction increases with the number of vanishing moments.
Indeed, Haar has only one moment and doesn't have such a good result. Though I would have though wavelets with more than 3 vanishing moments (ie whose recontructed data is at least Cē and therefore should smooth out all blocking artifacts) would have been sufficient, hence it wouldn't explain such a difference between the 2 used in this case.

Anyway, this gives me ideas for detecting other kinds of noise...

[edit]
Another approach, that tries to identify the part of the decomposition that is due to blocking.

Last edited by Kurosu; 4th July 2003 at 17:10.
Kurosu is offline   Reply With Quote
Old 4th July 2003, 17:55   #9  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Properties of wavelets transformations allow them to be used on the whole picture, so that's what i've done. That's one of the strong point of this filter, i think.

I've played with it a bit, some kind of distorsion appear when the threshold is too high, like vertical or horizontal bars. I'll experiment with hard-thresholding to see if it change anything. But for denoising/smoothing purposes, a better way than thresholds should be found.

In the end i'd like to have a multi-purpose wavelet filter, any help would be appreciated
Lefungus is offline   Reply With Quote
Old 4th July 2003, 18:10   #10  |  Link
Acaila
Retired
 
Acaila's Avatar
 
Join Date: Jan 2002
Location: Netherlands
Posts: 1,529
Quote:
I've played with it a bit, some kind of distorsion appear when the threshold is too high, like vertical or horizontal bars.
Zeroing high frequencies will create ringing artifacts near edges (can easily be seen when you encode a video/image with a low bitrate), is this the kind of artifacts you are refering to? If so then maybe weighting the threshold based on the frequency could reduce this, i.e. a higher threshold for low frequencies and a lower threshold for high frequencies.

Just a thought.
Acaila is offline   Reply With Quote
Old 4th July 2003, 18:51   #11  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Unfortunately, if i have understood correctly wavelets, left coefficients are not low frequencies and high coefficients, high frequencies like in DCT domain. So it's more complex.

Anyway it may be interesting to scale/reduce coefficients instead of zeroing them.
Lefungus is offline   Reply With Quote
Old 4th July 2003, 19:10   #12  |  Link
Kurosu
Registered User
 
Join Date: Sep 2002
Location: France
Posts: 432
It seems to me it's more a result like
Kurosu is offline   Reply With Quote
Old 4th July 2003, 21:36   #13  |  Link
MfA
Registered User
 
Join Date: Mar 2002
Posts: 1,075
As far as ringing is concerned the cause is the Gibb's phenomenon same as with DCT, no changes there.

The horizontal/vertical lines however are not ringing, just typical artifacts of these kinds of denoisers ... I dont really know the cause, but my guess it has to do with the isotropic nature of the basis functions and the aliasing inherent in critically sampled transforms.

Using (pseudo) translation invariant transforms usually helps a lot (in fact with the undecimated wavelet transform for instance you can just use hard thresholding without having to suffer the usual artifacts). By their very nature these transforms have to be expansive though, so the coefficients will outnumber the pixels ... bringing with it higher memory and computation requirements.
MfA is offline   Reply With Quote
Old 6th July 2003, 17:24   #14  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Version updated to 0.2: lots of changes included, lots of wavelets implemented (15!)
a little faster
See the first post for more informations

There are no artifacts anymore when you select an high threshold, the picture is just highly smoothed
And you can finally select the number of steps, so Haar wavelet with 3 steps should be faster than Antonini with 8 steps.

Sometimes you can have a wrong picture, it means you've used too much steps, so reduce it until it works again.

now i just need to test all this
Lefungus is offline   Reply With Quote
Old 6th July 2003, 17:35   #15  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
In my first tests Brislawn2 wavelet seems to give really good results

[Edited]

On Ghost In The Shell movie, i'm trying this :

VagueDenoiser(threshold=2.5,wavelet=7,method=1,nsteps=4)

It smooths blocks nicely, reduce interlaced artefacts, but still keep details and edges. And noise is killed


Last edited by Lefungus; 6th July 2003 at 19:21.
Lefungus is offline   Reply With Quote
Old 6th July 2003, 20:09   #16  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
I think i will make some presets like convolution3d.
It definitely seems that the Brislawn 2 function gives the best results. At least it was on my own tests, both on an anime (GITS) and and a movie (Brotherhood of the wolves)

Speed isn't so bad after all, with 6 nsteps on a 640x256 movie, it's ~20 fps on my p4 2.4GHz

So here are my findings:

For a high quality movie:

Code:
VagueDenoiser(threshold=0.75,wavelet=7,method=1,nsteps=6)
Threshold can be increased up to 1/1.25, even 2 but you may lose fine details, it's visible a little on skins for example.

For a high quality anime:

Code:
VagueDenoiser(threshold=2,wavelet=7,method=1,nsteps=6)
Some may find 2 a little too strong.

On these movies, i've put VagueDenoiser before resizing, if you put it after, you may need to decrease the threshold.

Now i'll seek bad quality movies/anime and try to enhance them
Lefungus is offline   Reply With Quote
Old 6th July 2003, 22:44   #17  |  Link
lamer_de
Member
 
lamer_de's Avatar
 
Join Date: Dec 2001
Location: somewhere far beyond
Posts: 270
k, here's a short test result:

Code:
avisource("M:\UM Raws\um7.avi",false)
Levels(0,1.000,236,0,255)
VagueDenoiser(threshold=4,wavelet=7,method=1,nsteps=4)
Using Athlon XP 1700+, Avisynth 2.5.2, VDubMod 1.4.13 build14328. I'm encoding to lossless VBLE in YV12 at 2fps with the script above (The levels is just in there cause the source is to dark for my eyes). The same script without VagueDenoiser gives me around 30 fps. The source is an Anime, 640x480, which has some slightly visible blocks in ultra-high motion scenes, only ringing in the rest of the episode. Lower thresholds gave the same speed, but almost no visible difference. With this high threshold, the blocks got slightly smoothed out (but were still visble). Ringing wasn't touched at all in my eyes.

The speed/visible quality gain is too low for me to put this filter in use.

The smoothing effect was better on a lq real life footage video full of blocks, but BlindPP delivers better results with more speed imho (If you have to work with such horrible sources full of blocks)


CU,
lamer_de
lamer_de is offline   Reply With Quote
Old 7th July 2003, 11:57   #18  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Well, it's not really designed to remove blocks but noise instead. Maybe it'll be possible later with a fine analysis of the wavelet domain. Wavelets open many possibilities, i've just tried the most simple one.

Anyway, any tests are welcome.

About speed, you're right, it's not usable yet to rip, too much slow. I only use it under vdub now, doing comparisons. i guess what i really need is a fast asm-optimized dwt transform like xvid has for DCT. Now it's pure C code full of memory leaks so that doesn't help !

i'll try to improve it, but don't expect much from me on the speed side.
Lefungus is offline   Reply With Quote
Old 7th July 2003, 13:49   #19  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
There are (fortunately) several ways of optimizing this routine - some that springs to mind.

Edit: Silly me hadn't seen you had already done 1) in 0.2 - I'm leaving it there for understanding.

1) Use floats instead of double. There seem to be (unused?) routines that already does this. It would make assembler optimization possible, and enable better cache efficiency. I don't know if the precision is good enough - Lefungus - what do you say?

2) Assembler int -> float -> int conversion. Since we have a large array this is fairly trivial. I havne't looked at the access patterns in the transform, but it might be a good idea to actually do the conversion there.

3) SSE / SSE2 transforms. This should be able to at least double the speed of the transform/inv transform. Not that trivial, but probably this is where the biggest gain can be found with the current algorithms. Unfortunately none of my current CPU's support SSE, so I might have to get a new MB first.

4) The Intel C++ compiler should be able to squezze out some percent more performance.

If you would try out implementing 1), I wouldn't mind doing 2) and 3).
4) Can be tried now, if anyone has the compiler, and knows how to use it.

We should probably move further dev. talk to the dev. forum.

Edit 2: Did some profiling - the results are here.
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 7th July 2003 at 14:43.
sh0dan is offline   Reply With Quote
Old 7th July 2003, 17:36   #20  |  Link
Lefungus
Registered User
 
Lefungus's Avatar
 
Join Date: Apr 2002
Location: Bretagne
Posts: 192
Version upgraded to 0.21
-The filter doesn't require SSE anymore
-Some improvements from Shodan and Bidoche increase performances up to 30%
Lefungus is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.