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 7th September 2010, 19:30   #1  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,578
Move FFT3D outside MT routine in a preanalyzed MDegrain

I'm using the following:

PHP Code:
LoadPlugin("D:\eseguibili\media\dgdecnv\x64 binaries\DGDecodeNV.dll")
DGSource("whatever.dgi")

MT("""
src = last
preNR = src.FFT3DFilter( sigma=16 )
preNR_super = preNR.MSuper(pel=2, sharp=1)
src_super   = src.MSuper(pel=2, sharp=1, levels=1)
backward_vec3 = MAnalyse(preNR_super, isb = true,  delta = 3, blksize=16, overlap=8)
backward_vec2 = MAnalyse(preNR_super, isb = true,  delta = 2, blksize=16, overlap=8)
backward_vec1 = MAnalyse(preNR_super, isb = true,  delta = 1, blksize=16, overlap=8)
forward_vec1  = MAnalyse(preNR_super, isb = false, delta = 1, blksize=16, overlap=8)
forward_vec2  = MAnalyse(preNR_super, isb = false, delta = 2, blksize=16, overlap=8)
forward_vec3  = MAnalyse(preNR_super, isb = false, delta = 3, blksize=16, overlap=8)
src.MDegrain3(src_super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=600)
"""
,threads=4overlap=8splitvertical=false
to clean some grain infested clips.

I have tried to use FFT3DGPU to increase performance but it is not possible to use it AFAIK inside a MT routine without artifacts.

I have tried different line swapping and moving but I can't create a working script with FFT3DGPU or FFT3DFilter outside MT. Any idea?

Thanks
__________________
@turment on Telegram

Last edited by tormento; 7th September 2010 at 19:34.
tormento is offline   Reply With Quote
Old 7th September 2010, 20:57   #2  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
PHP Code:
LoadPlugin("D:\eseguibili\media\dgdecnv\x64 binaries\DGDecodeNV.dll")
DGSource("whatever.dgi")

interleavelastlast.FFT3DFiltersigma=16 ) )

MT("""
src = last.selecteven()
preNR = last.selectodd()
preNR_super = preNR.MSuper(pel=2, sharp=1)
src_super   = src.MSuper(pel=2, sharp=1, levels=1)
backward_vec3 = MAnalyse(preNR_super, isb = true,  delta = 3, blksize=16, overlap=8)
backward_vec2 = MAnalyse(preNR_super, isb = true,  delta = 2, blksize=16, overlap=8)
backward_vec1 = MAnalyse(preNR_super, isb = true,  delta = 1, blksize=16, overlap=8)
forward_vec1  = MAnalyse(preNR_super, isb = false, delta = 1, blksize=16, overlap=8)
forward_vec2  = MAnalyse(preNR_super, isb = false, delta = 2, blksize=16, overlap=8)
forward_vec3  = MAnalyse(preNR_super, isb = false, delta = 3, blksize=16, overlap=8)
src.MDegrain3(src_super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=600)
"""
,threads=4overlap=8splitvertical=false
You probably need better tweaking for FFT's setup (temporal filtering), as well as MDegrain (thSAD seems way to high, given the fact that it's referring to a pre-cleaned(!!) analyse clip).
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 7th September 2010, 22:29   #3  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,578
Quote:
Originally Posted by Didée View Post
You probably need better tweaking for FFT's setup (temporal filtering), as well as MDegrain (thSAD seems way to high, given the fact that it's referring to a pre-cleaned(!!) analyse clip).
Thanks for your bit of wisdom. As far as I understood from the standard MVTools docs, the precleaned clip was used for the motion vectors only and the real degrain work was done by MDegrain.

Perhaps my idea of understanding is a bit overestimated.

Any idea for better results? As you may perceive by reading my few threads, I am looking for the holy grail of degraining... The culprits are BD such as The hurt locker, 300 and so.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 7th September 2010, 23:43   #4  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Quote:
Originally Posted by tormento View Post
As far as I understood from the standard MVTools docs, the precleaned clip was used for the motion vectors only and the real degrain work was done by MDegrain.
That's correct. But you also need to keep in mind that the SAD values are not re-calculated by MDegrain. It just used the SAD values that are stored in the vector stream. And since the motion search has been done on a clip that's virtually free of noise/grain (at least it should, theoretically, due to the prefiltering), the resulting SAD values are rather low, and MDegrain should use a rather low value for thSAD, not a high value.

Quote:
Any idea for better results? As you may perceive by reading my few threads, I am looking for the holy grail of degraining
Historically, most people that have searched the holy grail have been deceased in the meantime. And no one has heard of any success.

There's no particular idea for better results ... the story is quite simple: on very noisy sources, the noise (or some of its side-effects) are disturbing the motion search. Hence, you need to set up the prefiltering so that the disturbing aspects are eliminated. The question isn't ultimately how light or how heavy the prefilter should be. The question is how specifically the prefilter can elimiate the specific characteristic that is disturbing the motion search.

As a general rule of thumb, temporal filtering is more important than spatial filtering. A grainy no-motion area should be really calm and steady after the prefilter. If motionless spots still show fluctuations, then MAnalyse might consider those fluctuations as motion. Which is exactly what the whole process tries to avoid in the first place. A spatial filter is quite unlikely to remove inter-frame flicker. That's the domain of temporal filters. (A pity that you can't separate spatial and temporal "strength" in FFT3DFilter. With tnlmeans that is possible, but quite a bit slower.)
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 8th September 2010, 06:13   #5  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,578
You gave me a nice and witty reply, as always, thanks.

But now, Didée, how should I modify that script? How a good filter should be used to clean the area to be vectorized?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 8th September 2010, 06:22   #6  |  Link
elguaxo
Registered User
 
elguaxo's Avatar
 
Join Date: Jun 2006
Posts: 260
Quote:
Originally Posted by Didée View Post
PHP Code:
interleavelastlast.FFT3DFiltersigma=16 ) )

MT("""
src = last.selecteven()
preNR = last.selectodd() 
Nice trick!
__________________
Doom10
elguaxo is offline   Reply With Quote
Old 8th September 2010, 07:29   #7  |  Link
dansrfe
Registered User
 
Join Date: Jan 2009
Posts: 1,210
Brilliant. I love the effects of adding a weak fft3dfilter line for the preNR and the last.selecteven();last.selectodd() trick. Excellent explanation as usual Didée.
dansrfe is offline   Reply With Quote
Old 8th September 2010, 13:30   #8  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,578
Mmm... I tried to use the interleaved script, both with FFT3DFilter (even with ncpu set) and FFT3DGPU, and it's ways slower than my original one. I must suppose my only way to go "multithreaded" is to split the movie in different parts and run different MEGUI workers on them.
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 8th September 2010, 15:10   #9  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
That's quite possible. You asked how to get FFT3D outside the MT statement, I showed a solution. But I didn't claim that it would be any faster.

Vanilla FFT3DFilter works quite well with both MT() and SetMTMode(). If looking at just Avisynth, having FFT3D inside MT is likely to be faster than having it outside. And FFT3DGPU can indeed become a bottleneck ... when the remaining (multithreaded) script is fast enough, FFT3DGPU sometimes is just too slow.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 8th September 2010, 19:32   #10  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,578
Yep, you are correct, as always =P Ever tried to split a video in various ranges and parallelize encoding? Any caveat?
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 8th September 2010, 20:22   #11  |  Link
Nephilis
--preset WTF!
 
Join Date: Feb 2009
Posts: 86
.....

Last edited by Nephilis; 8th September 2010 at 20:24. Reason: ...
Nephilis 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 14:51.


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