Log in

View Full Version : New very slow FFT denoiser


Pages : 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15 16 17

DarkFoon
24th March 2006, 08:04
using the new FFTW DLL on pentium 4 2.4GHz FFT3D seems a little faster than the older one using the script from zyrill (except I modified it to use FFT3D not FFTGPU, because the latter crashes on my computer).

by the way zyrill, good work! it's a high quality script! I use it on my TV captures. It makes animation really look good. (Live action looks a little over filtered, but I think I know how to fix that)
here's the one I'm using:
Motion = depanestimate(fftw=true)

DepanInterleave(data=Motion)
YToUV(FFT3Dfilter(sigma=3, plane=1, bw=32, bh=32, sharpen=.25).UToY,\
FFT3Dfilter(sigma=3, plane=2, bw=32, bh=32, sharpen=.25).VToY,\
FFT3Dfilter(sigma=2, plane=0, bw=32, bh=32, sharpen=.25))
YToUV(FFT3Dfilter(sigma=3, plane=1, bw=4, bh=4, sharpen=.25).UToY,\
FFT3Dfilter(sigma=3, plane=2, bw=4, bh=4, sharpen=.25).VToY,\
FFT3Dfilter(sigma=2, plane=0, bw=4, bh=4, sharpen=.25))
SelectEvery(3,1)

AI
27th March 2006, 02:42
DarkFoon
you read my post?
http://forum.doom9.org/showthread.php?p=791552#post791552
note: CPU version have ""plane=3" - use both U and V" too

DarkFoon
27th March 2006, 06:48
yes AI, I did see your post.
But I don't quite understand what you mean with your examples. I tried some of them, and I didn't see any difference. It may be because I don't really understand how DePan works.

AI
27th March 2006, 08:35
1) now better use MergeChroma then YtoUV, becouse now GPU and CPU version have "plane=3" - use both U and V

2) You know "triangle Pascal"?
1
11
121
1331
14641
...
if we use temporal filter with matrix [121],
then we use filter 2 pass = we have use 1 pass with matrix [14641]
i.e. temporal filters with many passes - "swell" in temporal...
i.e. if you use DePanInterleave you need use "Last=2" and "Next=2" or more
Or use several DePanInterleave

I can't explain better. Becose my English is very bad.

DarkNite
27th March 2006, 23:19
I understood what you were saying well enough to use it. Thank you for the pointer. That saves me hours of trial and error, and possibly a few grey hairs. ;)

Alain2
28th March 2006, 11:13
I think I understand as well, but to be sure, is it possible to post the full script from zyrill or DarkFoon translated the hints AI gave, that would be also the fastest? (not sure what is better between longer temporal compensated frames playing with prev/next or several applications of ff3dfilter)

Also is it really an issue to apply the 2 fft3d at once, the idea being to cancel out the ring edge effects of using only one fft3d instance with a fixed grid (blocks) dimensions?

Here is what I am doing:
Motion = DePanEstimate(fftw=True)
DePanInterleave(data=Motion)
MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=48, bh=48, sharpen=.5),
\ FFT3Dgpu(sigma=3, plane=3, bt=3, bw=48, bh=48, sharpen=.5))
MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=4, bh=4, sharpen=.5),
\ FFT3Dgpu(sigma=3, plane=3, bt=3, bw=4, bh=4, sharpen=.5))
SelectEvery(3,1)
DeHalo_alpha()

DarkFoon
14th April 2006, 16:45
fast and good are oxymorons.
It's not as good (quality wise) as AI's method, is it?

Fizick
14th April 2006, 18:25
BTW, here is my "to do" list:
"DeHalo" option.

Alain2
14th April 2006, 19:21
Show me what is you call AI's method if you think what I'm doing is incorrect..
Anyway, I am not using this filter chain, tried it as written by zyrill or me, and the result is bad (way too much smoothing, no improvement on the ringing)

AI
15th April 2006, 17:02
You have two temporal filters between DePanInterleave and SelectEvery

First:MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=48, bh=48, sharpen=.5),
\ FFT3Dgpu(sigma=3, plane=3, bt=3, bw=48, bh=48, sharpen=.5))second:MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=4, bh=4, sharpen=.5),
\ FFT3Dgpu(sigma=3, plane=3, bt=3, bw=4, bh=4, sharpen=.5))

i.e. for simply look this script:DePanInterleave(data=Motion)
FFT3Dfilter()
FFT3Dgpu()
SelectEvery(3,1)1) AVISynth ask frame from SelectEvery
2) SelectEvery ask medium frame from FFT3Dgpu
3) FFT3dgpu ask 3 frames (compensate.prev,curr,compensate
.next) from FFT3dfilter
4) FFT3dfilter filtred not only medium frame,
but every frames (compensate.prev,curr,compensate
.next)
---------------or--------------------
after DePanInterleave we have order frames:
curr(n-1),next(n-1),prev(n),curr(n),next(n),prev(n+1),curr(n+1)

prev(n) = compensate prev.frame to current
next(n) = compensate next.frame to current

we have 3 fft3dfilters:
1) prev'(n)=fft3filter(next(n-1),prev(n),curr(n))
2) curr'(n)=fft3filter(prev(n),curr(n),next(n)) #right
3) next'(n)=fft3filter(curr(n),next(n),prev(n+1))

curr''(n)=fft3gpu(prev'(n),curr'(n),next'(n)) #after SelectEvery we have only this frame

AI
30th May 2006, 11:07
Fizick
you can add aviable GPUFFTW (http://gamma.cs.unc.edu/GPUFFTW/download.html) on your filters?

Fizick
30th May 2006, 20:47
May be later, when it will support 2D and ATI.
Thanks for link.

krieger2005
8th July 2006, 13:21
Hi Fizick,

i wounder why you don't add a "up-size" option to fft. Since you get get the frequencies of the blocks, why not upscaling at the same time. The Results should look good on texture...

Fizick
9th September 2006, 20:12
Released version 1.9.1. Summary changes:
- added dehalo options;
- corrected sharpen mode;
- re-enabled SSE optimization for degrid=0;
- added SSE optimization for bt=3,-1 with degrid>0 (faster by 15%)
- added SSE optimization for bt=4 with degrid>0 (faster by 30%).

v1.9.2 with bt=5 is in beta stage

Pookie
10th September 2006, 03:12
Thank you very much, Fizick :D

http://amazingsounds.iespana.es/applause5.wav

elguaxo
16th September 2006, 19:32
The SSE optimizations are great! Now 2 questions. corrected sharpen mode
What was corrected?

2nd. I really like having a dehalo feature. After denoising and sharpening I saw halos many times. The readme says:
dehalo - halo removal strength (float>0, default=50)
Is dehalo activated by default?

foxyshadis
16th September 2006, 19:54
Oh, a new halo remover, how cool. I'll have to test it out. Is it possible to separate it from the rest of the functionality, eg, sigma=0 and sharpen=0 but dehalo=100? Or is dehalo then automatically disabled?

Fizick
16th September 2006, 19:55
1st. I do not remember, what was corrected. :)

2nd. Thanks, it is documentation bug. default dehalo=0

elguaxo
16th September 2006, 21:04
:thanks:

And thanks again for the speed optimizations. I am already enjoying the SSE optimization for bt=3 :D

netrex
17th September 2006, 05:32
Thanks for this :) Been looking around a lot for something that does a good job without blurring it too much. The one I tried before this blurred it a lot and took 11 hours for an hour of footage :P this take 3 :)

:thanks:

Caroliano
24th September 2006, 21:04
I had trouble finding the lastest FFT3DFilter for downloading. The right page seems to be http://avisynth.org.ru/fft3dfilter/fft3dfilter.html but the first google hit was http://www.avisynth.org/fizick/fft3dfilter/fft3dfilter.html

This page is not updated since Version 1.8.5 - 4 December 2005.... Why that? Why it was not deleted?

G_M_C
24th September 2006, 21:59
I had trouble finding the lastest FFT3DFilter for downloading. The right page seems to be http://avisynth.org.ru/fft3dfilter/fft3dfilter.html but the first google hit was http://www.avisynth.org/fizick/fft3dfilter/fft3dfilter.html

This page is not updated since Version 1.8.5 - 4 December 2005.... Why that? Why it was not deleted?

Pssst: If you still need a new version .... look 3 posts up @ fizick's signature. He's got the adress to his new page in his sig ;)

Bh4i
15th October 2006, 16:54
Are there any clues this filter might run extra slow on a Core2Duo?? (E6600)

Thunderbolt8
7th December 2006, 03:03
does this filter also work with medui/x264 as well as it does with xvid/divx (different settings to make for that ?)

this is said to be a spatial-temporal filter, but in megui I can only set the option direct spatial, direct temporal or direct auto (for x264). which option would fit best fot that filter here, direct temporal ?

foxyshadis
7th December 2006, 13:39
That has absolutely nothing to do with filtering or denoising, that's a b-frame decision mode. The --nr parameter of x264 is a very simple form of fft filtering though.

To use fft3dfilter in megui, or any custom avisynth filters, you should use the avisynth script creator.

Thunderbolt8
7th December 2006, 15:42
yes, I insert them with avisynth of course and add options there, but you basically say that the options of direct auto, temporal etc. has nothing to do with the filters ?
what about the megui deblocking, which is -2 -1 by default, does this have any effect when using filters via scripts, or will only the options for the filters entered in the script take place and the rest is ignored ?

foxyshadis
7th December 2006, 17:50
Again, that has nothing to do with the filtering whatsoever. Those are both options used by x264 to encode the video. The only part of megui that touches avisynth is the avisynth script creator, while the settings accessed from the "config" button on the main panel are all x264 options.

x264 deblocking will not preprocess video, it only sets how much deblocking is done on the encoded output; if the source is already blocky, it needs to be fixed first, or that'll get encoded into the new video.

Thunderbolt8
8th December 2006, 15:45
I got a problem with that filter now, when clicking on preview in megui, a message keeps saying: "avisynth script error: fft3dfilter: cannot load fftw3.dll !"
I have the fftw3.dll in the same directory as the filter files are (avisynth\plugins) and also in windows\system(32) directory, but it still doesnt work :S

Pookie
8th December 2006, 19:01
Take it OUT of the same folder as fft3dfilter.dll. Keep the copy in c:\windows\system32.

Thunderbolt8
8th December 2006, 21:11
did now, but when I enter the command for it (e.g. FFT3DFilter(bt=-1, sharpen=0.7)) and then press preview I get an error message, saying like theres something wrong with the colour matrix (megui colour correction) line "ColorMatrix(hints=true)". when I remove this line, then its fine. but its strange, since colourmatrix also works on that file without the fft3dfilter command, why cant it work together with it ?

foxyshadis
9th December 2006, 08:22
Colormatrix(hints=true) has to come before fft3dfilter. In fact, it has to be the first filter after DGDecode. If not, the hints will be destroyed, and you'll have to sort out the color matrices manually. (Not fun.)

Fizick
15th January 2007, 19:19
Released FFT3Dfilter v1.9.2 with mode bt=5

Fizick
17th January 2007, 21:31
Full silense...

O.K., next attempt:
Released version 2.1.0 with internal multi-thread support (Core duo, trio, quadro et cetera)
please test

TheBashar
17th January 2007, 22:09
I won't get to try it out for a couple weeks, but rather than silence, I thought I'd say, "Thank you!". I have an AMD X2. I guess it will be able to take advantage of the multithreaded support too. But regardless, thanks!

Pookie
17th January 2007, 22:15
More motivation to buy a Duo Core. :D Thanks, Fizick.

Single thread: bench: utime=283.656s

2Threads: bench: utime=270.657s

tsp
18th January 2007, 00:31
preliminary test with 1000 frames 720x576 YV12 source
Virtualdub->Run video analysis pass
fft3dfilter():
70 sec
fft3dfilter(ncpu=2):
65 sec (7% faster)
mt("fft3dfilter()")
53 sec (24% faster)

this is with an opteron 165 at 2.4 GHz 2.5 GB memory

Fizick
18th January 2007, 19:37
So, it is works :)

Moitah
18th January 2007, 23:30
500 frames 720x480 YUY2 (from HuffYUV AVI), Core 2 Duo E6600, FFT3DFilter is the only filter in this script.

FFT3DFilter(plane=4, ow=16, oh=16, sigma=4, sharpen=0.3): 79.498 seconds
CPU: http://www.moitah.net/misc/fft3dncpu1.png

FFT3DFilter(plane=4, ow=16, oh=16, sigma=4, sharpen=0.3, ncpu=2): 71.382 seconds
CPU: http://www.moitah.net/misc/fft3dncpu2.png

10% faster

tsp
19th January 2007, 11:31
42000 frames with fft3dfilter(ncpu=2) seems stable to me :)

Serbianboss
19th January 2007, 20:04
Source DV avi, yuy2, 1500 frames

with fft3dfilter(sigma=4,interlaced=true) 2.30

with fft3d filter(sigma=4,interlaced=true,ncpu=2) 2.17

AMD X2 3800

AI
20th January 2007, 10:30
So, it is works :)
Probably need pipes in filter core, but not in dll-FFTWv3 (only)

anaqim
26th January 2007, 16:20
I suppose this fits in this thread.

I have been reading up, testing etc etc on how TTF3Dfilter & TTF3DGPU work (you know the drill).

My general objective is easy but high quality converts from DVDs to x264 and i'd like your comments on the setup i've settled for so far as I am new to AVSynth scripting and the TTF3D filter:

1) I re-author a DVD losslessly using DVD Shrink choosing the audio and the subtitle tracks i require (the basic stuff)

2) I use StaxRip for processing and encoding the video with the following settings:

2.1) The scripting:

a. (MPEG2Source("%source_file%",info=3).colormatrix(hints=true,threads=2))
b. Crop borders (manual check also)
c. Resize Very Sharp (Lancosz4Resize) (also rezise resolution usually to 720x)
d. FFT3Dfilter with the following script:

Motion=DepanEstimate(trust=2.5, fftw=true)
DepanInterleave(data=Motion)
YToUV(FFT3Dfilter(sigma=3,plane=1,bw=32,bh=32,wintype=2,degrid=1,ncpu=2).UToY,\
FFT3Dfilter(sigma=3,plane=2,bw=32,bh=32,wintype=2,degrid=1,ncpu=2).VToY,\
FFT3Dfilter(sigma=2,plane=0,bw=32,bh=32,wintype=2,degrid=1,ncpu=2))
YToUV(FFT3Dfilter(sigma=3,plane=1,bw=4,bh=4,wintype=2,degrid=1,ncpu=2).UToY,\
FFT3Dfilter(sigma=3,plane=2,bw=4,bh=4,wintype=2,degrid=1,ncpu=2).VToY,\
FFT3Dfilter(sigma=2,plane=0,bw=4,bh=4,wintype=2,degrid=1,ncpu=2))
SelectEvery(3,1)

Note1! I am using Wintype 2 as anyway the second small frame run should remove any potential Ringing

Note2! This is basicaly Zyrill's slightly modified script

Note3!I tryed adding both a Deen() filter as well as using Sharpen=0.3 with TTF3Dfilter but Deen dont visually mean any improvement in this script and also Sharpen is a waste due to the very sharpen resize (i see no visual point to sharpen more, it will just degrade the video).

2.2) The x264 encoder:

Basically all settings maxed out with the more important ones being:

Single Pass Quality
Quality 22
B-Frames 16
Ref Frames 5
Loop Filter on with Alpha/Beta settings -1/-1
Direct mode Spatial
Mixed Refs
Adaptive B-Frames
Cabac
Motion Estimate Method Multi-Hex
Subpixel Motion Estimation 7 (best)
Trellis 2 (Always)
Using Sharktooths excellent custom matrix eqm_avc_hr.cfg

2.3) Audio Subtitles and Container

Here I use Matroska (MKV) as container which supports the ripped subtitles for easy access (ripped using VSRip)

Audio is encoded either in stereo or 5.1 depending on source and in AAC quality 0.2 which is excellent and small in size.

3) Results are of course rather slow encodes (3-6 fps) but the quality and the file sizes are lovely :o)


Thank you for reading and any hints/comments are appreciated :o)

Anaqim

digitalone
26th January 2007, 23:33
thx for this plugin Fizick. i am using StaxRip for processing & encoding video. when i add FFT3D plugin i get following message..

Unsupported Colorspace: x264 requires YV12 input.

SS: http://maxupload.com/img/67E7326B.jpg

i've written a sample script from your manual but the message still persists.

loadplugin("fft3dfilter.dll")
YToUV(fft3dfilter(sigma=3, plane=1).UToY,\
fft3dfilter(sigma=3, plane=2).VToY,\
fft3dfilter(sigma=2, plane=0))

am i missing something?

tsp
26th January 2007, 23:36
add converttoyv12() to the end of the script

anaqim
26th January 2007, 23:42
He is using StaxRip. It makes a difference. I usually get that message every time something is wrong in the script. It is not about adding what tsp suggests though im sure thats how it works if you use another GUI.

The mistake is probably that you wrote "loadplugin("fft3dfilter.dll")"

You do not have to load plugins in StaxRip, provided you put them in the default AviSynth Plugins directory. Since your line doesnt contain a complete path I assume this is the case.

See my post above yours for tips on how to use this with StaxRip (which i am using too)

Good luck!

Anaqim

foxyshadis
27th January 2007, 03:38
You'll also find that

fft3dfilter(sigma=3,plane=3)
fft3dfilter(sigma=2,plane=0)

is a little faster and a little easier to understand & manage. Although if you're not going to be editing often it's not a big deal.

digitalone
27th January 2007, 09:19
@Anaqim: thx for your help mate..but the problem was something else..the file "depan.dll" was missing...now it's working fine. also, i wanted to ask certain questions regarding the parameters u've set in StaxRip. pls check ur inbox.

@foxyshadis: ok mate..i'll try your suggestion. also, i wanted your opinion on setting up Levels. i'll PM you about it. thx. :)

anaqim
27th January 2007, 15:48
Question from Digitalone!


Hey,

First of all thx for your help mate. I wanted to discuss a few parameters u've set for StaxRip scripting & x264.

Scripting:

you've called FFT3DFilter twice using BW/BH=32 & 4 respectively. how much impact does it make on quality? since FFT3D is slow i was wondering if calling the routine once was sufficient enough.

x264:

shouldn't B-Frame value set to 3 and ref. frames set to 10 be good enough? coz we are checking "Adaptive" option so that x264 can decide best number of B-Frames to use.

and finally, how can i use sharktooth's custom matrix with StaxRip?

looking forward to your reply. thx mate.

Rgds,
digitalone


My Reply!


Hi Mate,

Im quite new to scripting too though I have been encoding for some time but yes you are right. The script is very very slow and I guess at some point you have to set a limit at how slow you want to go :o) My initial tests show an encoding time of around 20 hours.

The idea of the script as I understand it is to first sharpen using larger blocks and a little tougher conditions (sigma) than during the 2nd run. The reason for the second run is to deal with the ringing effect using mini blocks with settings 1 step looser than the image has already been processed. This way only "newly created" ringing should be affected. Yes it works but its just oh so slow.

There is an alternative I am testing right now which is a little faster and which is based on a similar idea. This is the script:

Motion=DepanEstimate(trust=2.5, fftw=true)
DepanInterleave(data=Motion)
FFT3DGPU(sigma=1.5,plane=4,bw=16,bh=16,wintype=2,degrid=1,bt=4).Deen("c3d",1,3,3,25)
SelectEvery(3,1)

The results are similar to the first though not equalily good. Remember we are basically talking details i bet noone will even notice when casualy watching a movie. This script uses relatively small blocks and the try to even out the artifacts using deen (dont ask me about the deen syntax cause i didnt make these settings)

Getting back to the idea of not exaggarating I am also currently trying this one which is again somewhat faster and which I think will be my script until I get a super computer. Even with this one it will take me around 7-8 hours to code a movie.

Motion=DepanEstimate(trust=2.5, fftw=true)
DepanInterleave(data=Motion)
FFT3DGPU(sigma=2,plane=4,wintype=1,degrid=1,bt=4)
SelectEvery(3,1)

Using wintype=1 and degrid=1 as well as default frame sizes (32) I hope to deal with artfacts without exaggerating the loss of speed.


About bframes, most will say that 3 bframes and 5 ref frames are enough. My tests shows that adaptive use of bframes works so if you set it to 5, 10 or 16 probably dont matter but I prefer not to limit the encoder so I use 16.

About ref frames, i am not quite sure what to believe. Peple use and report different things. The answer to my recent post about this was that ref frames over 8 can give uneven results and that trellis is not for single pass encodes. Yet Sharktooth's best profile uses 16 ref frames and full trellis for single pass encodes. So again, my tests show that using 16 does influence both filesize and encoding time. Ultimately, its your choice.

Note about bframe, fro a long time i used 5 bframes and 5 ref frames which seems to be a good choice if you dont want to hit 16.

Here is a link to Sharktooths post regarding his builds and his EQM AVC-HR custom matrix (see his signature) which does inclrease the bitrate quite alot but also works well in preventing blocks. With it I use deblock settings -2/-1

http://forum.doom9.org/showthread.php?s=&threadid=89979

Good luck!

Anaqim

foxyshadis
28th January 2007, 01:10
@Anaqim: thx for your help mate..but the problem was something else..the file "depan.dll" was missing...now it's working fine. also, i wanted to ask certain questions regarding the parameters u've set in StaxRip. pls check ur inbox.

@foxyshadis: ok mate..i'll try your suggestion. also, i wanted your opinion on setting up Levels. i'll PM you about it. thx. :)

I think the best thing to do is to load up AVSp and play with levels (or curves if you're adventurous) until you find something satisfying. I don't really have a clue what the proper levels should be, I just go with what looks decent if I'm ever in need.

Levels([<"Min",0,255,0>],[<"gamma", 0.1, 10, 1.00>],[<"Max",0,255,255>],0,255,false)

You can't play with gamma through a slider yet, because it can't do fractional sliders, but feel free to try moving it.

Alain2
28th January 2007, 01:27
You can't play with gamma through a slider yet, because it can't do fractional sliders, but feel free to try moving it.
I read that from you before and forgot to answer.. If you do levels(16,[<"gamma", 0, 10, 1.00>],235,16,235) for instance, the slider values are adjustable to 0.01 precision for instance ; is that what you meant or something else ? (btw for qwerpoi it would be good maybe to extend the modulo (%) that we can specify to decimal numbers like 0.05)