View Full Version : MVDegrain5 to MDegrain5. Possible?
tormento
15th September 2010, 20:19
function Scripted_MVDegrain5(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD", int "idx")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 8 )
ovlp = default( overlap, 0 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
idx = default( idx, 11 )
bvec5 = clp.MVAnalyse(isb=true, delta=5,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
bvec4 = clp.MVAnalyse(isb=true, delta=4,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
bvec3 = clp.MVAnalyse(isb=true, delta=3,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
bvec2 = clp.MVAnalyse(isb=true, delta=2,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
bvec1 = clp.MVAnalyse(isb=true, delta=1,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
fvec1 = clp.MVAnalyse(isb=false,delta=1,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
fvec2 = clp.MVAnalyse(isb=false,delta=2,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
fvec3 = clp.MVAnalyse(isb=false,delta=3,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
fvec4 = clp.MVAnalyse(isb=false,delta=4,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
fvec5 = clp.MVAnalyse(isb=false,delta=5,truemotion=tm,pel=pel,sharp=shrp,blksize=bs,overlap=ovlp,idx=idx)
mvdg3 = clp.MVDegrain3(bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD,idx=idx)
mvdg5 = mvdg3.MVDegrain2(bvec4,fvec4,bvec5,fvec5,thSAD=thSAD,idx=idx)
\ .Merge(mvdg3, 0.455) # correct weightings (hopefully)
return( mvdg5 )
}
This is what I found lurking in the forum. But it is old and don't know if it is writable with newer MVTools2. Do you think it could worth the job?
Motenai Yoda
15th September 2010, 21:10
function Scripted_MDegrain5(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 8 )
ovlp = default( overlap, 0 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
super = clp.MSuper(pel=pel,sharp=shrp)
bvec5 = super.MAnalyse(isb=true, delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true, delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
bvec3 = super.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = mdg3.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
\ .Merge(mdg3, 0.455) # correct weightings (hopefully)
return( mdg5 )
}
But I think that yet mdegrain3/mvdegrain3 is a waste of time...
for almost all content mdegrain2 work right...
also imho this script is wrong, the analysis should be done on the clip that is filtered
this makes the analysis on a clip that is filtered mdegrain3 and then passed to mdegrain2.
a code like function Scripted_MDegrain5(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 8 )
ovlp = default( overlap, 0 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
super = clp.MSuper(pel=pel,sharp=shrp)
bvec3 = super.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
bvec5 = super.MAnalyse(isb=true,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = clp.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
\ .Merge(mdg3, 0.455) # correct weightings (hopefully)
return( mdg5 )
}
Didée
15th September 2010, 21:44
also imho this script is wrong, the analysis should be done on the clip that is filtered
There is no absolute "right" or "wrong". However, in the spirit of MVTools' Mdegrain1/2/3, my script is more right, and yours is more wrong. :p
In MDegrain1/2/3, all wing frames are treated equally. Same in the posted script: all 5 pairs of wingframes work at same conditions, and at the same time, in parallel.
Your suggestion does a chained denoising: first do a MDegrain3, and after that comes another instance of MDegrain2. (i.e. MDG2 is denoising what already has been denoised by MDG3.)
There's nothing "wrong" with your suggestion. It's just another variant of processing ... a more convoluted one. In contrast, the original script is a straightforward extension from MDegrain1/2/3 to 5 frames. It is more close to the basic idea.
Oh, one thing there is: with that suggested chained processing, you should kick out the "merge(0.455)" completely, because it not really makes sense anymore. The 2nd Mdegrain already is the end result.
Motenai Yoda
15th September 2010, 22:54
the second mdegrain work about frame ±4 and ±5 only the analisis is post posted...
if I knew it was a your script had no doubt about
edit now i've reanalyzed the struct and should this be that i wanted code respect of your script...
mdg5 = clp.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
\ .Merge(mdg3, 0.455) # correct weightings (hopefully)
tormento
16th September 2010, 00:34
Guys, I needed a MVTools2 version of the script I posted, i.e. using MVDegrain2/3 instead of MDegrain2/3, not a philosophy discussion ;)
Motenai Yoda
16th September 2010, 02:15
The first script that I previously posted
tormento
16th September 2010, 06:13
The first script that I previously posted
It still uses MVTools1, not v2.
Motenai Yoda
16th September 2010, 11:19
-.-" no comment.
Didée
16th September 2010, 11:44
Yeah ... tormento, look closer! The very first script in the very first post of Motenai Yoda is the straightforward port to MVTools2.
Now, after switching the base clip for the 2nd MDegrain back to the original source, it's a different story. ;) - But still, there are some points to mention:
There is still some "uneven-ness" going on. First, if we say that motion search on the original is more "rough", and motion search on a predenoised clip is more "fine", then we have the fact that 3+3 vectors are searched "rough", and 2+2 vectors are searched "fine". This could be swapped easily. Also, it's the "nearby" frames that are searched rough, and the more far away frames are searched fine. Should it be like that, or would it be better the other way round? One could argue for both.
Lastly: the vectors obtained from a predenoised clip inherently have a lower SAD, and therefore will get a higher relative weight in the end result. In effect this means that you have a MDG5 where frames 4/5 get a higher weighting than frames 1/2/3. Should it be like that? From the guts, it feels like it should be the other way round.
I'd probably organize it like this:
source
super1 => vec4, vec5
MDG2(super1, vec4,vec5)
super2 => vec1, vec2, vec3
MDG3(super1, vec1,vec2,vec3)
Merge
tormento
16th September 2010, 17:26
Sorry, men, sorry both of you. I "misread" M with MV and viceversa. Motenai I beg your pardon, thanks for the time you gave me.
I'll try the script and give some comments about the results ASAP.
Wow, what a filthy day. (Yeah, could be rainy too.)
Didée, to modify the order, should I simply reorder the script or something deeper is needed?
I am asking this MDegrain5 as I am finding some limits with the simple MDegrain3..
tormento
17th September 2010, 10:54
I'd probably organize it like this:
source
super1 => vec4, vec5
MDG2(super1, vec4,vec5)
super2 => vec1, vec2, vec3
MDG3(super1, vec1,vec2,vec3)
Merge
Sorry but I can't "write down" what you proposed. Super creates a multilevel (hierarchical scaled) frames data. How can super1 and super2 be different, given the same clip? And why would you apply MDG to super instead of clip?
Didée
17th September 2010, 11:20
Things get a bit confusing here. I was referring to the alternate way suggested by Motenai Yoda:
also imho this script is wrong, the analysis should be done on the clip that is filtered
this makes the analysis on a clip that is filtered mdegrain3 and then passed to mdegrain2.
However, the according script (2nd script in his 1st post above) does not do what this quote describes. Perhaps related to the post being edited, I don't remember.
Anyway, the script for that quasi-code I posted would go like so:
[...]
super = clp.MSuper(pel=pel,sharp=shrp)
bvec5 = super.MAnalyse(isb=true, delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true, delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg2 = clp.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
super2 = mdg2.MSuper(pel=pel,sharp=shrp)
bvec3 = super2.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super2.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super2.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super2.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super2.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super2.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = mdg3.Merge(mdg2, 0.4) # There is no "fully correct" weighting for this operation. Only close.
* * *
Another thing I tried yesterday: Blow up to 9 frames, but use only full-pel precision to keep reasonable speed. (Hope is that the plentitude of used neighbors will compensate for the missing subpel precision.)
o = last
bs = 16
super = o.MSuper(pel=1, sharp=1)
bv9 = MAnalyse(super, isb = true, delta = 9, blksize=bs,overlap=bs/2)
bv8 = MAnalyse(super, isb = true, delta = 8, blksize=bs,overlap=bs/2)
bv7 = MAnalyse(super, isb = true, delta = 7, blksize=bs,overlap=bs/2)
bv6 = MAnalyse(super, isb = true, delta = 6, blksize=bs,overlap=bs/2)
bv5 = MAnalyse(super, isb = true, delta = 5, blksize=bs,overlap=bs/2)
bv4 = MAnalyse(super, isb = true, delta = 4, blksize=bs,overlap=bs/2)
bv3 = MAnalyse(super, isb = true, delta = 3, blksize=bs,overlap=bs/2)
bv2 = MAnalyse(super, isb = true, delta = 2, blksize=bs,overlap=bs/2)
bv1 = MAnalyse(super, isb = true, delta = 1, blksize=bs,overlap=bs/2)
fv1 = MAnalyse(super, isb = false, delta = 1, blksize=bs,overlap=bs/2)
fv2 = MAnalyse(super, isb = false, delta = 2, blksize=bs,overlap=bs/2)
fv3 = MAnalyse(super, isb = false, delta = 3, blksize=bs,overlap=bs/2)
fv4 = MAnalyse(super, isb = false, delta = 4, blksize=bs,overlap=bs/2)
fv5 = MAnalyse(super, isb = false, delta = 5, blksize=bs,overlap=bs/2)
fv6 = MAnalyse(super, isb = false, delta = 6, blksize=bs,overlap=bs/2)
fv7 = MAnalyse(super, isb = false, delta = 7, blksize=bs,overlap=bs/2)
fv8 = MAnalyse(super, isb = false, delta = 8, blksize=bs,overlap=bs/2)
fv9 = MAnalyse(super, isb = false, delta = 9, blksize=bs,overlap=bs/2)
dg123 = o.MDegrain3(super, bv1,fv1,bv2,fv2,bv3,fv3, thsad=440)
dg456 = o.MDegrain3(super, bv4,fv4,bv5,fv5,bv6,fv6, thsad=400)
dg789 = o.MDegrain3(super, bv7,fv7,bv8,fv8,bv9,fv9, thsad=360)
Average( dg123, 1./3., dg456, 1./3., dg789, 1./3.)
Looks insane, but runs at a still reasonable speed. And it crunches a big lot of grain.
tormento
17th September 2010, 13:34
Err... Average is the mg262 plugin or something else?
Didée
17th September 2010, 13:45
Yes. Average_24Oct05.dll is the latest.
If you can't find quickly, then merge(dg456,dg789).merge(dg123,0.3334) is also okay.
Motenai Yoda
17th September 2010, 13:58
16/12/07 is the lastest for me...
or Mt_lutxyz(dg123, dg456, dg789,"x 3 / y 3 / + z 3 / +")
tormento
17th September 2010, 14:15
Thanks, both. I'll try the merge way, as it works on x64.
Edit: even Mt_lutxyz has a x64 version. I'll try both.
tormento
17th September 2010, 14:37
In the meantime, I encoded a very bad mpeg2 1080p source of Highlander. Grany as hell.
I tried both of your scripts, the Motenai:
function MDegrain5(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 16 )
ovlp = default( overlap, 8 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
super = clp.MSuper(pel=pel,sharp=shrp)
bvec5 = super.MAnalyse(isb=true, delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true, delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
bvec3 = super.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = mdg3.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
\ .Merge(mdg3, 0.455) # correct weightings (hopefully)
return( mdg5 )
}
LoadPlugin("D:\eseguibili\media\dgdecnv\x64\DGDecodeNV.dll")
DGSource("E:\in\1_56 Highlander - L'ultimo immortale\highlander.dgi")
MT("""MDegrain5(truemotion=true, pel=2, blksize=16, overlap=8, thSAD=600)""",threads=4, overlap=8)
CompTest(1)
and the Motenai-Didee:
function MDegrain5D(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 16 )
ovlp = default( overlap, 8 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
super = clp.MSuper(pel=pel,sharp=shrp)
bvec5 = super.MAnalyse(isb=true, delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true, delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg2 = clp.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
super2 = mdg2.MSuper(pel=pel,sharp=shrp)
bvec3 = super2.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super2.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super2.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super2.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super2.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super2.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = mdg3.Merge(mdg2, 0.4) # There is no "fully correct" weighting for this operation. Only close.
return( mdg5 )
}
LoadPlugin("D:\eseguibili\media\dgdecnv\x64\DGDecodeNV.dll")
DGSource("E:\in\1_56 Highlander - L'ultimo immortale\highlander.dgi")
MT("""MDegrain5D(truemotion=true, pel=2, blksize=16, overlap=8, thSAD=600)""",threads=4, overlap=8)
CompTest(1)
Here are the results. The first (http://www.mediafire.com/?x26drejy8b700yb)gave me 2,37 FPS, the second (http://www.mediafire.com/?9myc05b1lq3xf5f)1,17.
Tell me which you prefer more and if the time loss worth the quality gain.
Didée
17th September 2010, 17:02
Well ... of those two files, the one with 10% higher bitrate looks 10% better to me. :)
The point with the MVTools-Toolbox is: you put all ingredients in a big pot, stir well, and get something that works. And you can get a countless number of different things out of it ... depending on how long or short you stir, how fast or how slow you stir, ...
It would be rather easy (except for time needed for typing) to come up with 10 or 20 or 30 different "variants of MDegrain". Each one different, and all of them will look quite similar.
Wanna try 30 different scripts? :D
(Hhmm.. a randomizer-script would come handy, to randomly mix-up script parts....)
In any case ... full HD resolution is a really different thing than SD resolution. The meaning of "spatial relation" is quite different on HD. It can easily happen that a script that "works good" on SD videos does work not-so-good on HD video.
(A spatial "detail killer" on SD might do little-to-nothing on HD ... MVTools has limited vector range with pel=2, which is a much bigger shortcoming on HD than on SD, etc.pp....)
tormento
18th September 2010, 08:57
You are telling me that there should be a different MVTools fof HD?
tormento
20th September 2010, 20:33
Believe it or not I am trying the MDegrain9 ;) I'll report ASAP..
tormento
22nd September 2010, 10:45
Ok, I have done lot and intensive tests with the 2nd Motenai script and I must admit it gives very interesting results. For less grainy or probematic sources I use the SMDegrain function from Caroliano.
Now, I'd like to know, is it possible to create a generic MDegrainN like the SMDegrain but with an arbitrary number of frame references, i.e. a SMDegrainN? It could be very handy..
Motenai Yoda
22nd September 2010, 16:22
u can use the "if" ternary operator , the vectors's clip that isn't request isn't processed...
ie
# MDegrain's auto-call function maked by Motenai Yoda
# Requires MVtools2 by Fizick http://avisynth.org.ru/mvtools/mvtools2.html
#
# Use:
#
# MDenoisers(clip c, int "Type", int "Strength", int "par", bool "Corrected", bool "Interlaced")
#
# Type means the type of MDegrain (1= MDegrain1, 2= MDegrain2, 3= MDegrain3, different= none); default 1
#
# Interlaced applies, when true, a filtering for interlaced source (don't deinterlace anything) ; defaults false
#
# Strength means thsad, the "strength" of MDegrain; default 150
#
# Par applies an upsample to par 1:1 when it's different from 0; (default 0)
# the possibily values are (other values do only two spline36resize()):
# 1 Pal 4/3 Itu, 2 Pal 4/3, 3 Pal 16/9 Itu, 4 Pal 16/9
# 5 Ntsc 4/3 Itu, 6 Ntsc 4/3, 7 Ntsc 16/9 Itu, 8 Ntsc 16/9
# 9 HorizontalPardv 1080i
#
# Corrected returns, when true, video with the corrected aspect to par 1:1, also returns video with the source aspect; default false
#
function MVDenoisers(clip c, int "Type", int "Strength", int "par", bool "Corrected", bool "Interlaced")
{
Type=default (Type, 1)
Interlaced=default (Interlaced, false)
Strength=default (Strength, 150)
Par=default (Par, 0)
Corrected=default (Corrected , false)
HorizontalPar= Par==1 ? (128.0/117.0)*(767.0/768.0) : Par==2 ? (16.0/15.0) : Par==3 ? (512.0/351.0)*(767.0/768.0) : Par==4 ? (64.0/45.0) : Par==7 ? (5760.0/4739.0) : Par==8 ? (32.0/27.0)*(767.0/768.0) : Par==9 ? (4.0/3.0) : 1
VerticalPar= Par==5 ? (4739.0/4320.0)*(768.0/767.0) : Par==6 ? (9.0/8.0) : 1
k=(Interlaced)? 2 : 1
last=c
(Interlaced) ? AssumeTFF().separatefields : last
(Par!=0) ? spline36resize(2*round((width*HorizontalPar)/2.0),2*round((height*VerticalPar)/2.0)) : last
super = MSuper()
backward_vec3 = MAnalyse(super, isb = true, delta = 3*k, overlap=4)
forward_vec3 = MAnalyse(super, isb = false, delta = 3*k, overlap=4)
backward_vec2 = MAnalyse(super, isb = true, delta = 2*k, overlap=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1*k, overlap=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1*k, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2*k, overlap=4)
forward_vec3 = MAnalyse(super, isb = false, delta = 3*k, overlap=4)
(type==3) ? MDegrain3(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,backward_vec3,forward_vec3,thSAD=Strength) : (type==2)? MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=Strength) : (type==1) ? MDegrain1(super, backward_vec1,forward_vec1,thSAD=Strength) : last
(Interlaced) ? weave : last
(!Corrected) ? (Par!=0) ? spline36resize(c.width,c.height) : last : last
}
tormento
22nd September 2010, 22:53
Whew... I hoped something easier... Why spline32resize?
Vitaliy Gorbatenko
23rd September 2010, 07:15
I'm made some changes in to killer script (degrain 5/9), but don't know how much correctly this changes is..
function Killer(clip source, int temporal, clip "ref", int "calm", int "blksize", int "overlap", int "sharp", int "thSAD", bool "RefineMotion", int "limit", int "search", int "dct")
{ # Motion compensated denoiser for progressive source clip with prefiltering for strength and repair for de-artefacting
# Uses MVTools2, ReduceFlicker and RemoveGrain/Repair
blksize = default(blksize,16) # blksize value (4, 8 or 16)
overlap = default(overlap,blksize/2) # overlap value (0 to half blksize)
sharp = default(sharp,2) # 0=bilinear softest, 1=bicubic, 2=Wiener sharpest
thSAD = default(thSAD,300) # higher risks motion ghosting and swimming, lower risks blotchy denoising
RefineMotion = default(RefineMotion,true) # true means MRecalculate will be used to improve motion vectors
limit = default(limit, 255) # Limits maximum change of a pixel. Default means no limit
ref = default(ref, source) # Reference clip
calm = default(calm, 1) # use calm() for predenoising as default
dct = default(dct, 5) # SATD вместо SAD для яркости
search = default(search, 5) # поиск Нечетными мульти шестиугольниками (UMH), параметр searchparam определяет диапазон. (подобно x264).
halfblksize = blksize/2 # MRecalculate works with half block size
halfoverlap = overlap/2 # Halve the overlap to suit the halved block size
halfthSAD = thSAD/2 # MRecalculate uses a more strict thSAD, which defaults to 150 (half of function's default of 300)
source = source.assumeframebased() # MSuper pel=2 is faster with this
# Prefilter the clip
calm=(calm==1) ? ref.KillerCalm(): ref
calm_super = calm.MSuper(pel=2, hpad=blksize, vpad=blksize, sharp=sharp)
source_super = source.MSuper(pel=2, hpad=blksize, vpad=blksize, sharp=sharp,levels=1)
recalculate = calm.MSuper(pel=2, hpad=blksize, vpad=blksize, sharp=sharp,levels=1)
bv9 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 9, overlap=overlap, dct=dct, search=search)
bv9 = RefineMotion ? MRecalculate(recalculate, bv9, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv9
bv8 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 8, overlap=overlap, dct=dct, search=search)
bv8 = RefineMotion ? MRecalculate(recalculate, bv8, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv8
bv7 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 7, overlap=overlap, dct=dct, search=search)
bv7 = RefineMotion ? MRecalculate(recalculate, bv7, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv7
bv6 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 6, overlap=overlap, dct=dct, search=search)
bv6 = RefineMotion ? MRecalculate(recalculate, bv6, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv6
bv5 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 5, overlap=overlap, dct=dct, search=search)
bv5 = RefineMotion ? MRecalculate(recalculate, bv5, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv5
bv4 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 4, overlap=overlap, dct=dct, search=search)
bv4 = RefineMotion ? MRecalculate(recalculate, bv4, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv4
bv3 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 3, overlap=overlap, dct=dct, search=search)
bv3 = RefineMotion ? MRecalculate(recalculate, bv3, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv3
bv2 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 2, overlap=overlap, dct=dct, search=search)
bv2 = RefineMotion ? MRecalculate(recalculate, bv2, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv2
bv1 = MAnalyse(calm_super, blksize=blksize, isb = true, delta = 1, overlap=overlap, dct=dct, search=search)
bv1 = RefineMotion ? MRecalculate(recalculate, bv1, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : bv1
fv1 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 1, overlap=overlap, dct=dct, search=search)
fv1 = RefineMotion ? MRecalculate(recalculate, fv1, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv1
fv2 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 2, overlap=overlap, dct=dct, search=search)
fv2 = RefineMotion ? MRecalculate(recalculate, fv2, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv2
fv3 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 3, overlap=overlap, dct=dct, search=search)
fv3 = RefineMotion ? MRecalculate(recalculate, fv3, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv3
fv4 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 4, overlap=overlap, dct=dct, search=search)
fv4 = RefineMotion ? MRecalculate(recalculate, fv4, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv4
fv5 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 5, overlap=overlap, dct=dct, search=search)
fv5 = RefineMotion ? MRecalculate(recalculate, fv5, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv5
fv6 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 6, overlap=overlap, dct=dct, search=search)
fv6 = RefineMotion ? MRecalculate(recalculate, fv6, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv6
fv7 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 7, overlap=overlap, dct=dct, search=search)
fv7 = RefineMotion ? MRecalculate(recalculate, fv7, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv7
fv8 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 8, overlap=overlap, dct=dct, search=search)
fv8 = RefineMotion ? MRecalculate(recalculate, fv8, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv8
fv9 = MAnalyse(calm_super, blksize=blksize, isb = false, delta = 9, overlap=overlap, dct=dct, search=search)
fv9 = RefineMotion ? MRecalculate(recalculate, fv9, blksize=halfblksize, overlap=halfoverlap, thSAD=halfthSAD, search=search) : fv9
temporal == 9 ? Eval("""
dg123 = source.MDegrain3(source_super, bv1,fv1,bv2,fv2,bv3,fv3, thSAD=thSAD+thSAD/10, limit=limit)
dg456 = source.MDegrain3(source_super, bv4,fv4,bv5,fv5,bv6,fv6, thSAD=thSAD, limit=limit)
dg789 = source.MDegrain3(source_super, bv7,fv7,bv8,fv8,bv9,fv9, thSAD=thSAD-thSAD/10, limit=limit)
#
# Average( dg123, 1./3., dg456, 1./3., dg789, 1./3.)
#OR
# merge(dg456,dg789).merge(dg123,0.3334)
#OR
Mt_lutxyz(dg123, dg456, dg789,"x 3 / y 3 / + z 3 / +")
#
""") :\
temporal == 5 ? Eval("""
mdg3 = source.MDegrain3(source_super,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=thSAD, limit=limit)
mdg3.MDegrain2(source_super,bv4,fv4,bv5,fv5,thSAD=thSAD, limit=limit)
\ .Merge(mdg3, 0.455) # correct weightings (hopefully)
""") :\
temporal == 3 ? MDegrain3(source, source_super, bv1, fv1, bv2, fv2, bv3, fv3, thSAD=thSAD, limit=limit) :\
temporal == 2 ? MDegrain2(source, source_super, bv1, fv1, bv2, fv2, thSAD=thSAD, limit=limit) :\
MDegrain1(source, source_super, bv1, fv1, thSAD=thSAD, limit=limit)
repair(source,mode=17)
}
function KillerCalm (clip ref)
{
calm = ref.reduceflicker(strength=3,aggressive=true)
calm = calm.repair(ref,mode=1)
calm = calm.removegrain(mode = 17)
calm = calm.removegrain(mode = 17)
calm = calm.removegrain(mode = 17)
return calm
}
Yobbo
23rd September 2010, 09:20
How do you use this (with defaults for starters!), Vitaliy?
Killer()?
Killer(temporal=5)?
I get "invalid arguments" error!?
Vitaliy Gorbatenko
23rd September 2010, 09:59
Killer(5) or Killer(9) or Killer(1) or Killer(2) or Killer(3) =D
Example:
ref=last
LSFmod(ss_x=1.5, ss_y=1.5, smode=3, strength=125, overshoot=1, undershoot=1)#FastLineDarkenMOD(strength=75, thinning=0)
#
Killer(3, ref=ref, calm=0)
matfra
9th February 2011, 13:36
Im using this script.
function MDegrain5(clip clp, bool "truemotion", int "pel", int "blksize", int "overlap", int "sharp", int "thSAD")
{
tm = default( truemotion, true )
pel = default( pel, 2 )
bs = default( blksize, 16 )
ovlp = default( overlap, 8 )
shrp = default( sharp, 1 )
thSAD = default( thSAD, 400 )
super = clp.MSuper(pel=pel,sharp=shrp)
bvec5 = super.MAnalyse(isb=true, delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
bvec4 = super.MAnalyse(isb=true, delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec4 = super.MAnalyse(isb=false,delta=4,truemotion=tm,blksize=bs,overlap=ovlp)
fvec5 = super.MAnalyse(isb=false,delta=5,truemotion=tm,blksize=bs,overlap=ovlp)
mdg2 = clp.MDegrain2(super,bvec4,fvec4,bvec5,fvec5,thSAD=thSAD)
super2 = mdg2.MSuper(pel=pel,sharp=shrp)
bvec3 = super2.MAnalyse(isb=true, delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
bvec2 = super2.MAnalyse(isb=true, delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
bvec1 = super2.MAnalyse(isb=true, delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec1 = super2.MAnalyse(isb=false,delta=1,truemotion=tm,blksize=bs,overlap=ovlp)
fvec2 = super2.MAnalyse(isb=false,delta=2,truemotion=tm,blksize=bs,overlap=ovlp)
fvec3 = super2.MAnalyse(isb=false,delta=3,truemotion=tm,blksize=bs,overlap=ovlp)
mdg3 = clp.MDegrain3(super,bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=thSAD)
mdg5 = mdg3.Merge(mdg2, 0.4) # There is no "fully correct" weighting for this operation. Only close.
return( mdg5 )
}
It can clean a lot of noise in old crappy VHS movie. But im wondering is it better to use a Mdegrain2 with a high thSAD setting or a Mdegrain5 with the defauld thSAD.
Also, is there a way to run Mdegrain in MT mode.
Didée
9th February 2011, 14:05
Most likely, the question is not so much how big the "X" for MDegrainX should be, or how big the thSAD. The problem probably is that the source's noise is misleading the motion estimation. The key is to use a pre-filtered clip for the motion analysis.
matfra
10th February 2011, 13:22
Most likely, the question is not so much how big the "X" for MDegrainX should be, or how big the thSAD. The problem probably is that the source's noise is misleading the motion estimation. The key is to use a pre-filtered clip for the motion analysis.
What kind of pre-filtered clip you are talking about. Lets take this example. A Interlaced Noisy clip. If I get it right, by a pre-filtred clip you mean applying a small Mdegrain2 then the deint ?
henryho_hk
11th February 2011, 08:25
I think even degrainmedian() will do.
Nephilis
11th February 2011, 10:50
What kind of pre-filtered clip you are talking about. Lets take this example. A Interlaced Noisy clip. If I get it right, by a pre-filtred clip you mean applying a small Mdegrain2 then the deint ?
No, you should always apply first deinterlacing filter before other filters even cropping.
Take a look here (http://forum.doom9.org/showthread.php?t=145753)
if you have a interlaced source then you can add Didée' script in the second post, a seperatefields() and weave() or a preferred deinterlacer
I think even degrainmedian() will do.
No, not exactly. A strong prefiltering is needed to better motion vector detection process. (especially for grainy sources)
SilaSurfer
11th February 2011, 14:57
No, not exactly. A strong prefiltering is needed to better motion vector detection process. (especially for grainy sources)
Depends. I found that even sources with light grain where one would use Mdegrain1 can inherit bad characheristics that will cause nightmare for ME of Mdegrain.
Vitaliy Gorbatenko
14th February 2011, 07:27
How good to use NLMeansCL for pre-filtered clip?
Nephilis
14th February 2011, 11:03
I prefer spatial denoisers for prefiltering and NLMeansCL is a very good choise for this IMHO ;)
Didée
14th February 2011, 11:44
Don't make such generalisations! This, again, is highly dependent on the source's characteristics.
A spatial filter will "only" reduce local SADs, but it will help only little (or nothing at all) with temporal fluctuations.
A temporal filter is more "dangerous" by nature, but is really necessary when the source has "strong" noise/grain (and therefore a rather high amount of temporal fluctuations).
Prefiltering(spatial) - baby filter, suited for sources with so little noise that you don't need all this effort to start with. :rolleyes:
Prefiltering(temporal) - the tool for man's man. ;)
henryho_hk
14th February 2011, 13:02
No, not exactly. A strong prefiltering is needed to better motion vector detection process. (especially for grainy sources)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
Nephilis
14th February 2011, 15:06
Don't make such generalisations! This, again, is highly dependent on the source's characteristics.
A spatial filter will "only" reduce local SADs, but it will help only little (or nothing at all) with temporal fluctuations.
A temporal filter is more "dangerous" by nature, but is really necessary when the source has "strong" noise/grain (and therefore a rather high amount of temporal fluctuations).
Prefiltering(spatial) - baby filter, suited for sources with so little noise that you don't need all this effort to start with. :rolleyes:
Prefiltering(temporal) - the tool for man's man. ;)
In your scripts you used usually FFT3DFilter as denoiser to prefiltering. Why did you not ever use a temporal denoiser to prefiltering in your scripts? (i'm just curious only)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
DeGrainMedian(limitY=255,limitUV=255,mode=0,interlaced=true)
Yeah, you can use 1000xRemoveGrain(1) or 1000xUndot() too :)
Didée
14th February 2011, 15:27
a) Because FFT3DFilter is spatio-temporal.
b) Because FFT3DFilter is a good allrounder. Hence less danger people come whining "yoscriptdoesnogood4me".
Vitaliy Gorbatenko
15th February 2011, 09:38
I do not like temporal filtering because at 99.9% in the result video presents a ghosts.
But I'm not very confident at the expense of FFT3DFilter filter .
Nephilis
15th February 2011, 14:26
XXXsource("source")
src = last
PreNR = NLMeansCL(src, {with_appropriate_settings} )
PreNR_super = MSuper(PreNR, pel=2, sharp=2)
src_super = MSuper(src, pel=2, sharp=2, levels=1)
bv1 = MAnalyse(PreNR_super, blksize=8, isb = true, delta = 1, overlap=4)
bv2 = MAnalyse(PreNR_super, blksize=8, isb = true, delta = 2, overlap=4)
fv1 = MAnalyse(PreNR_super, blksize=8, isb = false, delta = 1, overlap=4)
fv2 = MAnalyse(PreNR_super, blksize=8, isb = false, delta = 2, overlap=4)
NR = MDegrain2(src,src_super,bv1,fv1,bv2,fv2,thSAD=?,thSADC=?) # or preferred MDeGrainX
Vitaliy Gorbatenko,
Try this script, i think you will achieve a good result..
Didée
15th February 2011, 14:58
Try with these two samples: (~2 MB each)
"B5_snip3" - http://www.mediafire.com/?ngob2i5x9epxl5i
"B5_snip2" - http://www.mediafire.com/?vk408nn3vveldeb
I doubt you'll have much success with spatial prefiltering. Especially when using "high quality" settings - like small blksize, elaborative search parameters, ...
The goal of denoising (degraining) is: get snip3 death calm, while in snip2 NOT loosing the texture on Mollari's forehead when he's turning his head.
snip3 shows up if MVTools' motion analysis is irritated by the grain. (A primitive temporalsoften(2,15,15,25,2) does good work on the background. temporalsoften(4,...) is death stable. When the result of MDegrain is not fully stable, this means that the motion-vectors treat the noise as motion.)
To get fully successful degraining on snip3, you need temporal prefiltering for Manalyse() ...
... and snip2 shows up if the prefiltering is too aggressive. (killing delicate shadings, so that Manalyse cannot find correct motion in those parts anymore.)
Vitaliy Gorbatenko
16th February 2011, 06:01
I have no doubt that the temporary stabilization of the more effective. But how to overcome the ghosts appearing in this case almost completely unavoidable?
Nephilis
16th February 2011, 13:49
B5_snip2.avi encoded with script #1 ( and XviD q=1 )
http://www.mediafire.com/?erak86s6f7t5cr1
Script#1
SetMemoryMax(1024)
MPEG2Source("D:\B5_snip2.d2v",info=3)
Colormatrix(hints=true)
Spline36Resize(720,400)
MT("""
src = last
PreNR = NLMeansCL(src,h=4.0,plane=4)
PreNR_super= MSuper(PreNR,hpad=4,vpad=4,pel=2,sharp=2)
src_super = MSuper(src ,hpad=4,vpad=4,pel=2,sharp=2,levels=1)
bwv1 = MAnalyse(PreNR_super, blksize=8, search=5, isb=true, delta=1, overlap=4, truemotion=true, lambda=1000)
fwv1 = MAnalyse(PreNR_super, blksize=8, search=5, isb=false, delta=1, overlap=4, truemotion=true, lambda=1000)
bwv2 = MAnalyse(PreNR_super, blksize=8, search=5, isb=true, delta=2, overlap=4, truemotion=true, lambda=1000)
fwv2 = MAnalyse(PreNR_super, blksize=8, search=5, isb=false, delta=2, overlap=4, truemotion=true, lambda=1000)
NR = MDegrain2(src,src_super,bwv1,fwv1,bwv2,fwv2,thSAD=150,thSADC=125)
shrp = SeeSaw(src,NR,NRlimit=8,NRlimit2=9,Sstr=0.5,Slimit=5,Spower=4,SdampLo=6,SdampHi=48,Szp=16,bias=80,\
sootheT=0,sootheS=0,ssx=1.0,ssy=1.0)
Return (shrp)
""",threads=4)
B5_snip3.avi encoded with script #2 ( and XviD q=1 )
http://www.mediafire.com/?3k8ufdm8mdam5xq
Script#2
SetMemoryMax(1024)
MPEG2Source("D:\B5_snip3.d2v",info=3)
Colormatrix(hints=true)
Spline36Resize(720,400)
MT("""
src = last
PreNR = NLMeansCL(src,h=8.0,plane=4)
PreNR_super= MSuper(PreNR,hpad=4,vpad=4,pel=2,sharp=2)
src_super = MSuper(src ,hpad=4,vpad=4,pel=2,sharp=2,levels=1)
bwv1 = MAnalyse(PreNR_super, blksize=8, search=5, isb=true, delta=1, overlap=4, truemotion=true, lambda=1000)
fwv1 = MAnalyse(PreNR_super, blksize=8, search=5, isb=false, delta=1, overlap=4, truemotion=true, lambda=1000)
bwv2 = MAnalyse(PreNR_super, blksize=8, search=5, isb=true, delta=2, overlap=4, truemotion=true, lambda=1000)
fwv2 = MAnalyse(PreNR_super, blksize=8, search=5, isb=false, delta=2, overlap=4, truemotion=true, lambda=1000)
NR1 = MDegrain2(src,src_super,bwv1,fwv1,bwv2,fwv2,thSAD=200,thSADC=150)
NR2 = NLMeansCL(NR1,h=0.4,plane=4)
shrp = SeeSaw(src,NR2,NRlimit=8,NRlimit2=9,Sstr=0.5,Slimit=5,Spower=4,SdampLo=6,SdampHi=48,Szp=16,bias=80,\
sootheT=0,sootheS=0,ssx=1.0,ssy=1.0)
Return (shrp)
""",threads=4)
Didée
16th February 2011, 14:02
Not bad, but ... there's substantial flicker left over in #3. And processing "individually tweaked" for each scene is inpractical. B5 has 5 seasons à 22 episodes. Assume one episode has one hundred different scenes ... tweaking eleven thousand scenes manually? No ... not sure if I live long enough to finish that.:p - One magic bullet for all. ;)
Nephilis
16th February 2011, 14:15
Achieving a perfect result may be impossible for such this crappy sources. But for example to back up Blu-Ray sources , you can achieve very good results with this scripts..
Didée
16th February 2011, 14:49
"such crappy" is the normal case for the combination (DVD/mpeg2) + (strong grain). Have you seen the DVD release of "300"? It's ... an experience. :D
OTOH, with good BR sources you can have spectacular results indeed. Take e.g. Vidoq ... use MDegrain256 with thSAD=1 (one), and the denoising is perfect. :p
Removing baby noise is so easy. :rolleyes:
SilaSurfer
16th February 2011, 16:51
Didée
From Lotr-Fotr (here we go again) :D. I'm not reencoding it, just learning and testing with samples from diffrent DVD sources on how to do better Prefiltering for Manalyse.
With what you suggested in another thread, calmed it down but not enough in my opinion.
Code:
MinBlur(1)
FluxSmoothT().merge(last,0.251)
sbr()
Sample Untouched M2V:
http://www.mediafire.com/?jhwogxw44943ovw
I think FFt3dFilter with higher sigma4 value would be good in this case. This scene inherits more temporal fluctuations, then other scenes in the movie.
Didée
17th February 2011, 00:00
@Nephilis - this' a bit closer to what MC-processing can do:
http://www.mediafire.com/download.php?hsclg7sm53x47ba
To be somewhat comparative, I used same/similar Xvid settings as you did: same matrix, only P-frames, constant quant 1. Result is sharper (a bit), has much less noise left over, and comes out at about the same bitrate, despite having 44% more resolution (no downsize). :)
Here, the magic bullet of pre-processing is - to do a rough partial MC-compensation already for the prefiltering stage. :eek:
o = last
low = o.bicubicresize(72,56).bicubicresize(216,168,1,0).bicubicresize(720,576,1,0)
ld = mt_lutxy(o,low,"x y < x 1 - x y > x 1 + x ? ?",U=2,V=2)
sup0 = o.msuper(pel=1)
bv1 = sup0.manalyse(isb=true, truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv1 = sup0.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bc1 = o.mcompensate(sup0,bv1)
fc1 = o.mcompensate(sup0,fv1)
interleave(o.selectevery(1,-2),fc1,ld,bc1,o.selectevery(1,2))
search = removegrain(4,0).Flux5framesT(15).selectevery(5,2).removegrain(11) # Flux(15) is pretty high, but hey ... it's quite some grain that needs to be catched.
BTW, it is fully intentional that the 5-frames temporal window uses only 2 MC-compensated frames instead of 4. The temporal filter is median-based, and using only 2 compensated frames together with 2 not-compensated frames gives a higher probability for the worst-cases: if in static areas the MC engine gets misleaded by the noise, then only 2 frames are affected, while 3 frames are not affected. Similar in motion areas: if moving fine shadings get caught by the prefilter, then it's only 2 such frames that get into the mix, while the remaining 3 are not affected.
It's no hard science, and there are still chances that it "fails". But overall, it seems to improve indeed.
@ SilaSurfer: right ^above^ there's something to try. ;)
Vitaliy Gorbatenko
17th February 2011, 06:29
In the video, with a stable high brightness gives a good result, but on a dark video produced a ghosts. At a flickering produced artifacts from the motion compensation.
cretindesalpes
17th February 2011, 09:15
ld = mt_lutxy(o,low,"x y < x 1 - x y > x 1 + x ? ?",U=2,V=2)
What is the exact purpose of this line? If I understand correctly, it amplifies high spatial frequencies, right? Is it because you are assuming that the noise is purely temporal in static areas, and this is an opportunity to amplify textures, while getting the noise completely removed by the Flux5?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.