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 23rd November 2004, 19:28   #1  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
New very slow FFT denoiser

I make experimental very slow FFT denoiser.
FFT3DFilter - 3D Frequency Domain filter-denoiser

FFT3DFilter uses Fast Fourier Transform method for frequency selecting an removing.

The algorithm is based on the 3D IIR/3D Frequency Domain Filter from:
MOTION PICTURE RESTORATION. by Anil Christopher Kokaram. Ph.D. Thesis. May 1993.
http://www.mee.tcd.ie/~ack/papers/a4ackphd.ps.gz



It is a spatial-temporal (3D) filter, and works as follows:

1) get 3 frames (previous, current, and next);
2) divide every frame to small overlapped blocks;
3) get frequency spectrum by windowed forward 3D FFT transform of every block of 3 frames;
4) reduce weak frequencies (with small power spectral density) by optimal Wiener filter with some given noise value;
5) make inverse 3D FFT transform of cleaned spectrum for every block;
6) do windowed summation of cleaned overlapped blocks to output frame.

Features:
1. Works only in YV12 color format.
2. Directly works with progressive clips. For interlaced sources, probably you must use SeparateFields etc.
3. Tested with Avisynth 2.55.
4. Uses fast external FFTW library version 3 (http://www.fftw.org)
as Windows binary DLL (compiled with gcc under MinGW by Alessio Massaro),
which support for threads and have AMD K7 (3dNow!) support in addition to SSE/SSE2.
It may be downloaded from ftp://ftp.fftw.org/pub/fftw/fftw3win32mingw.zip
You MUST put FFTW3.DLL file from this package to some directory in path (for example, C:\WINNT).
Filter will NOT work without it!
5. It is slooow!

EDIT: New versions are not so slow now and have some other features and restrictions. See updated doc included with filter!
I do not want to change this first post by historical reasons
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 22nd November 2005 at 22:49.
Fizick is offline   Reply With Quote
Old 23rd November 2004, 21:57   #2  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Sounds nice, but for some reason I cant download it...


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 23rd November 2004, 23:28   #3  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
link fixed
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 23rd November 2004, 23:57   #4  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Question...

Smaller blocks should give better results, no ???


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 24th November 2004, 00:42   #5  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
blocks are overlapped, so in theory there shouldn't be much difference?

small blocks might give less spatial smearing (what's the image equivalent of pre-echo?).

i gotta try this filter now

[edit]

on large values of sigma, on bw=bh=16, i get a strange screen pattern. increasing the blocksize to something large fixes it.

interesting filter. it removes a lot of the subtle crap in a picture. also seems to stabilize edges somewhat. too large values of sigma cause ringing, of course.
__________________
sucking the life out of your videos since 2004

Last edited by Mug Funky; 24th November 2004 at 00:52.
Mug Funky is offline   Reply With Quote
Old 24th November 2004, 01:07   #6  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by Mug Funky

On large values of sigma, on bw=bh=16, i get a strange screen pattern...
Looks it like a grate/grid or so ???

Guess I got the same effect...


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 24th November 2004, 03:31   #7  |  Link
SirCanealot
Aspiring l33tz0rz0rz0r...
 
Join Date: Mar 2003
Location: London, England
Posts: 88
I was going to try, but the link seems to be down again
Is it just me?
__________________
SirCanealot

And they shall know no fear....
SirCanealot is offline   Reply With Quote
Old 24th November 2004, 16:14   #8  |  Link
hampel
Registered User
 
Join Date: Nov 2004
Posts: 2
Can you please post the link to the filter plugin and to the 3dFFT dll again? The current FTP address requires a password authentification :-/

The principle sounds good to me, at least in music restoration FFT filtering is the only proper way to do the job - and the same method should give superior results, although finding the right FFT filter parameters is mostly a painstakingly time-consuming job, and the results of a slight overprocessing are received as "very artificial" by the human eye, so conservative settings are a must.

Bernard (having done a lot of FFT filtering on "pictures" of particle physics detectors, but with hardware DSP solutions of the first generation in 1994)
hampel is offline   Reply With Quote
Old 25th November 2004, 23:21   #9  |  Link
708145
Professional Lemming
 
708145's Avatar
 
Join Date: Dec 2003
Location: Stuttgart, Germany
Posts: 359
Quote:
Originally posted by Soulhunter
Question...
Smaller blocks should give better results, no ???
WIMNI, larger blocks give higher precision to the fft, thus better decision about what is unneccessary.

bis besser,
Tobias
__________________
projects page: ELDER, SmoothD, etc.
708145 is offline   Reply With Quote
Old 26th November 2004, 01:15   #10  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Quote:
Originally posted by 708145

WIMNI, larger blocks give higher precision to the fft, thus better decision about what is unnecessary.
Interesting, thanks for the info...


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 28th November 2004, 18:33   #11  |  Link
oledoe
Registered User
 
Join Date: Oct 2001
Posts: 15
Great filter

I've been looking for a filter to get the best possible results on a very noisy CATV signal, with lots of noise in the Y channel.
This is by far the best one I have found.
Thanks!
oledoe is offline   Reply With Quote
Old 30th November 2004, 23:58   #12  |  Link
morsa
the dumbest
 
Join Date: Oct 2002
Location: Malvinas
Posts: 494
Yes, it is real good, I tried it on a noisy DV source and I made miracles.Removed all the noise keeping perfect quality.
YOU DID IT AGAIN, FIZICK!!!!!!!
morsa is offline   Reply With Quote
Old 3rd December 2004, 11:09   #13  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
Quote:
WIMNI, larger blocks give higher precision to the fft, thus better decision about what is unneccessary.
actually, it's a trade-off between spatial (transient in audio) accuracy and frequency accuracy. this is why (good) audio codecs based on frequency transforms will have 2 or more block-lengths. short blocks for sharp transients (where time is more important than freq, like percussion, applause, impulses) and long blocks (where freq is more important than time, like highly tonal instruments, etc).

in images, at least with this filter, larger blocks give more severe ringing. seeing as human eyes are less discerning than ears as far as frequency goes, i'd say it's safe to use smaller blocks and keep the edges happy
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 3rd December 2004, 11:39   #14  |  Link
Soulhunter
Bored...
 
Soulhunter's Avatar
 
Join Date: Apr 2003
Location: Unknown
Posts: 2,812
Would a variable block-size improve this filter ???


Bye
__________________

Visit my IRC channel
Soulhunter is offline   Reply With Quote
Old 3rd December 2004, 12:28   #15  |  Link
708145
Professional Lemming
 
708145's Avatar
 
Join Date: Dec 2003
Location: Stuttgart, Germany
Posts: 359
Thanks for your explanation Mug Funky.

What about correlating the results of smaller and larger blocks? If, like in audio, there are only so many things happening at the same time (per block) then use small blocks to determine where and correlate with the result of larger blocks to get more exact frequencies.

Is the above nonsense?

bis besser,
Tobias
__________________
projects page: ELDER, SmoothD, etc.
708145 is offline   Reply With Quote
Old 3rd December 2004, 16:42   #16  |  Link
krieger2005
Registered User
 
krieger2005's Avatar
 
Join Date: Oct 2003
Location: Germany
Posts: 377
Does someone noticed, that the border on the right and at the bottom where not proceeded by the filter, when the last block (in the image) is smaller that the block needed by the filter... I use then Addborders(0,0,X,X).FFT...().crop(0,0,-X,-X)
krieger2005 is offline   Reply With Quote
Old 3rd December 2004, 16:57   #17  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
@ tobias:

i'm not sure how useful that would be, but then Fizick is the programmer, not me

i've also noticed that larger blocks require smaller values of sigma. i guess this makes sense, as the larger the FFT, the lower the energy of each measured frequency.

i've been playing with 64x64, and that seems to be giving nice results.

using varying block sizes sounds interesting though - it could be used to allow higher denoising but protect the edges. but i think if we're going that far, we should be using a wavelet-based denoiser like Vague.

i'm liking the results this filter gives. definitely worth the wait

@ krieger2005:

cool. i'll try that, as i just noticed the problem i suppose a small wrapper function could be made that adds borders to pad the input clip out to the nearest mod(blocksize) number, then crop after.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 3rd December 2004, 17:49   #18  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
I release version 0.2
Add BETA parameter to low ringing

beta - noise margin (float?1.0, default=1.0 for no noise left)
control noise amount left in the restoration, max filter noise attenuation = (beta-1)/beta

(see Kokaram doc for detail).


I also know about border feature
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 3rd December 2004 at 19:29.
Fizick is offline   Reply With Quote
Old 20th December 2004, 06:36   #19  |  Link
DarkFoon
Awakened to video Dec2003
 
DarkFoon's Avatar
 
Join Date: Dec 2003
Location: US West
Posts: 191
A few ideas...

I was wondering what you guys would think if this filter had control over the temporal filtering. So that it could be user defined,
for example:
temp=<value>
where <value> could be,
-n, where it only processes previous N number of frames (and current)
0, temporal off
n, where it does previous and future N number of frames. i.e if N = 2, then it would do 2 previous frames and 2 future frames, greatly slowing it all down, of course.

I like the filter, but the reason I suggest this is because my experiences with big or small values of sigma and bh/bw, I get horrible ghosting on my anime images (they're rather grainy CATV captures from live broadcast). Perhaps this filter is bad for anime? I know that temporal is a strong point of this filter, however, there are situations where temporal filtering can be undesireable.

I also thought that if there was a parameter to make the filter run all three planes (or a combination thereof) with only one filter instance in the script. I think this would be good because the user could, for example, turn off temporal and turn on all three planes and there would be no gain/loss in filter speed; it would still be processing three planes, but all within the same frame, as opposed to the current way things are.

let me know what you guys think of all this.
By the way, I like the idea of dynamic block sizing. The arguments for dynamic block sizing are compelling.
__________________
Mac killed my inner-child

My Quant Matrices:
Caerulea
For MPEG-2 DVD Destination Anime

Simple Lo
General Purpose MPEG-2 (tested with anime only)
DarkFoon is offline   Reply With Quote
Old 20th December 2004, 08:05   #20  |  Link
morsa
the dumbest
 
Join Date: Oct 2002
Location: Malvinas
Posts: 494
My experience has been fantastic using this filter!!!
Complete noise removal with a lot of subtle details preversed at the same time!!

I use it with its default values, just changing sigma on color planes. (red higher than Y and blue higher than red..)
after it I just add a little temporal and ready..
morsa 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 12:49.


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