Log in

View Full Version : Motion Compensated Sharpening


Pages : [1] 2

rkalwaitis
4th March 2010, 12:02
I was hoping that someone could please help me find a motion compensated script similar to the process that is used in MC_Spuds.

Thanks

Didée
4th March 2010, 13:00
Such can be found in several scripts - TGMC has something like that, MC_Spuds has (borrowed from dunno-where), TemporalDegrain has, ...

Some "basic" scripts to demonstrate the general principle ...

Basic script, variant#1: "spatial sharpen, temporally limited".

source = whatever
sup = source.MSuper(pel=2,sharp=2)
bv1 = sup.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bc1 = source.MCompensate(sup,bv1,thSAD=500)
fc1 = source.MCompensate(sup,fv1,thSAD=500)
max = mt_logic(bc1,fc1,"max").mt_logic(source,"max")
min = mt_logic(bc1,fc1,"min").mt_logic(source,"min")
sharp1 = source.sharpen(1).mergechroma(last) # chroma sharpen usually is unadvantageous

sharp1.mt_clamp(max,min,0,0,U=2,V=2) edit: corrected vector naming: "bv" -> "bv1"



Basic script, variant#1a: "spatial sharpen, temporally limited, using median-sharpen for more headroom on temporal limiting"

source = whatever
sharp0 = source.mt_adddiff(mt_makediff(source,source.removegrain(4)),U=2,V=2) # "median sharpen" (won't create halos on its own, IF the source is halo-free)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bc1 = source.MCompensate(sup2,bv1,thSAD=500) # using the super clip from the median-sharpener, to provide
fc1 = source.MCompensate(sup2,fv1,thSAD=500) # more headroom for the limiting process
max = mt_logic(bc1,fc1,"max").mt_logic(source,"max")
min = mt_logic(bc1,fc1,"min").mt_logic(source,"min")
sharp1 = source.sharpen(1).mergechroma(last) # chroma sharpen usually is unadvantageous

sharp1.mt_clamp(max,min,0,0,U=2,V=2) edit: corrected vector naming: "bv" -> "bv1"




Basic script, variant#2: "spatial sharpen, temporally averaged"

source = whatever
sharp0 = source.sharpen(1).mergechroma(source)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bv2 = sup1.MAnalyse(isb=true, delta=2, [more params to liking], ...)
fv2 = sup1.MAnalyse(isb=false,delta=2, [more params to liking], ...)

source.MDegrain2(sup2,bv1,fv1,bv2,fv2)

Note that the MDegrain has "source" as 1st input, not "sharp0". The idea is to use sharpening only in areas where the motion estimation found good matches. In places where no good motion-match was found, it's probably better to not use sharpening. If you want to be more aggressive with sharpening, type "sharp0.Mdegrain2(...)" there.

This method still does *denoise* the source on the way, more or less. May be wished, or it may be not. If denoising is not wished, adapt the script to use the sharp-difference instead:


Basic script, variant#2a: "spatial sharpen, temporally averaged, without denoising"

source = whatever
sharp0 = source.sharpen(1)
sharpD = mt_makediff(source,sharp0)
zeroD = sharpD.mt_lut("x",Y=-128)

sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharpD.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bv2 = sup1.MAnalyse(isb=true, delta=2, [more params to liking], ...)
fv2 = sup1.MAnalyse(isb=false,delta=2, [more params to liking], ...)

zeroD.MDegrain2(sup2,bv1,fv1,bv2,fv2)

source.mt_makediff(last,U=2,V=2)
This code does "no sharpen on bad motion-match" in the same way. For the aggressive variant, type "sharpD.MDegrain2(...)".

Hope there are no errors due to the hurry of typing ... if you find some, do speak.

rkalwaitis
4th March 2010, 13:20
Thanks Didee,

Please forgive this question, but in example 1, how do I calculate or determine the min and the max.

Didée
4th March 2010, 13:54
No problem, you're welcome. But let me point out these scripts really do only show the "barebone principle". For optimal results, things probably should be done a bit more artistic. E.g., none of those basics does care for "oversharpening" (halo creation).

With script#1, halos are a lesser problem. The problem rather is that you'll only get very little sharpening, due to the pretty strong constraint. For getting more effect, it's needed to provide more "headroom" that the sharpening can expand into. (I quite like median-sharpening for that task, but the available possibilities are countless.)

With script#2/2a, the sharpening can create halos quite easily, so in order to avoid that issue, the basic sharpening process should be more sophisticated than just "sharpen(1)".
But just replacing sharpen() with LimitedSharpen() isn't a too brilliant idea either - LS/F probably is too weak for that. Something in the spirit of SeeSaw's sharpening, used on a slightly pre-blurred input, is what often works good.


It's like it always is: the basic principle is not very hard. But tweaking it so that it works as good as possible in practice, and in as many different situations as possible - that's the harder task.
(And that's also why I find myself quite often just making a whole new script from scratch for any given source, rather then trying to come up with can-do-everything multi-purpose scripts, using two hundred different parameters, which most people wouldn't use anyway...)


Edit: just saw your edit - oh, there's a mistake in script#1. The min+max need also the current frame into account, of course! Script corrected.

rkalwaitis
4th March 2010, 14:23
Thanks again, I understand that they are the bare bones, and to be honest that is what I was looking for. It helps me to understand the process better. Im gonna play with the toys you gave me. I dont know why I was thinking that a motion compensated sharpening would be more capable of fending of haloing. I must be motion compensated because I usually am the culprit of the artifacts.

Thanks again

Didée
4th March 2010, 18:03
I have added script variant "1a", as an example for how to give more sharpening headroom via a median-sharpener.

Also cleared the syntax of variant#1 - the usage of "last" in two places was a bit muddy, "source" is more clear in syntax/logic.

rkalwaitis
4th March 2010, 18:53
Thanks alot Didee, Im all over it after I finish taking care of the kids. Cool flickr gallery :)

rkalwaitis
5th March 2010, 11:02
Didee does it make sense to compensate more than one frame forward and one frame backward when attempting the sharpening? Variant 2a worked well.

Undead Sega
5th March 2010, 17:22
wow there's such thing as Motion Compensated Sharpening? i dreamt of this and was thinking of mentioning it but was abit afraid of being tampered down for such silliness :D but this is quite suprising to me. May i ask how does this differ to other conventional sharpeners out there?

Didée
5th March 2010, 17:42
What I have showed is traditional spatial sharpen, plus motion-compensated postprocessing.

You shouldn't "dream" of things just because it "sounds so cooool". Do you want to have a motion-compensated "trim()" filter? Or perhaps a neural network that performs "AddBorders()"?

Before getting all too excited about funky terminology, it's always better to understand what it's supposed to mean (or to do). ;)

Dogway
6th March 2010, 05:33
This is interesting, but why not make it motion-compensated contrasharpening? :D

scharfis_brain
6th March 2010, 09:50
maybe with motion compensated sharpening he meant a motion compensated temporal sharpener, which effectively will enhance grain and noise?
(it is the opposite of a temporal smoother (denoiser))

Soulhunter
6th March 2010, 13:05
So, sorta like UnSmooth back then?

Didée
6th March 2010, 13:06
maybe with motion compensated sharpening he meant a motion compensated temporal sharpener
Experience has told that people oftentimes just do not know what they mean when saying "motion compensated sharpen".

... which effectively will enhance grain and noise?
(it is the opposite of a temporal smoother (denoiser))
Exactly that. In theory, you would use a "mocomp temporal sharpen" principle when trying to squeeze additional information out of the "subpixel level". But in practice, you'll just enhance noise that way.


This is interesting, but why not make it motion-compensated contrasharpening? :D
Contra-sharpening implies that anything has been removed from the source beforehand.
And ... the basic principle is already included, namely in script#1. http://www.cosgan.de/images/smilie/froehlich/a050.gif

Nephilis
11th March 2010, 12:26
<< Basic script, variant#2: "spatial sharpen, temporally averaged" >> is the real deal. I use it since Didée posted it in another thread.. With SeeSaaw it works like a charm ;)

Greetz fly out to Didée :)

rkalwaitis
11th March 2010, 21:22
Nephilis, could you please post your seesaw script so I can see how you use variant#2. Thanks. I like the first script with mdegrain2. MP4.Guy also has a MedSharp that he is working on that is interesting. Its one of the newer posts. You should check it out.

http://forum.doom9.org/showthread.php?t=153201

Vitaliy Gorbatenko
12th March 2010, 06:14
Nephilis: Post a complete script, please!

Undead Sega
26th March 2010, 23:46
sample images by any chance? :D

Nightshiver
28th March 2010, 00:34
source = whatever
sharp0 = source.sharpen(1).mergechroma(source)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bv2 = sup1.MAnalyse(isb=true, delta=2, [more params to liking], ...)
fv2 = sup1.MAnalyse(isb=false,delta=2, [more params to liking], ...)

b = source.MDegrain2(sup2,bv1,fv1,bv2,fv2)

a = last
SeeSaw(a, b, whatever settings you want)

Or, if going along with Didee's way of repacing Sharpen() with SeeSaw(), I think it would look something like this:


source = whatever
sharp0 = source.SeeSaw(whatever settings you want).mergechroma(source)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bv2 = sup1.MAnalyse(isb=true, delta=2, [more params to liking], ...)
fv2 = sup1.MAnalyse(isb=false,delta=2, [more params to liking], ...)

source.MDegrain2(sup2,bv1,fv1,bv2,fv2)

Dogway
28th March 2010, 10:21
How can I wrap it into a function?

Didée
28th March 2010, 13:40
By wrapping

function WastedPower(clip whatever) { whatever

... posted code ...
... posted code ...

}

around it.

However, note the suggested function name.:) - When you just blindly put SeeSaw as sharpener in there, a big amount of SS's sharpening power is wasted. The least thing that should be done is to deactivate soothing for script#2. For script#1, the advice is "don't use because poor."

Dogway
29th March 2010, 00:26
by "whatever" do I reference an state where I want to sharp from? (usually before denoising). But when doing it normally I bring back all the denoised artefacts.

Didée
29th March 2010, 00:43
:script:

Dogway
29th March 2010, 00:53
abcdeclip=last
Mdegrain()
MCContra(clip)

FUNCTION MCContra(clip clip)
{
sharps = clip.minblur(1,1).SeeSaw()
sharpD = mt_makediff(clip,sharps)
zeroD = sharpD.mt_lut("x",Y=-128)

sup1 = clip.MSuper(pel=2,sharp=2)
sup2 = sharpD.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb = true, delta = 1, blksize=8, overlap=4, search=3, searchparam=4)
fv1 = sup1.MAnalyse(isb = false, delta = 1, blksize=8, overlap=4, search=3, searchparam=4)
bv2 = sup1.MAnalyse(isb = true, delta = 2, blksize=8, overlap=4, search=3, searchparam=4)
fv2 = sup1.MAnalyse(isb = false, delta = 2, blksize=8, overlap=4, search=3, searchparam=4)

zeroD.MDegrain2(sup2,bv1,fv1,bv2,fv2)

clip.mt_makediff(last,U=2,V=2)

RETURN (last)
}

Didée
29th March 2010, 01:58
Technically, that script is kosher.

If that script does what you think it would do, that I can't tell. E.g., it doesn't fit to do I reference an state where I want to sharp from? (usually before denoising)
With your script as posted, you have a standard

source |--> {denoise} |--> {sharpen} --> result

filter chain, just that {sharpen} is a little more complicated than usual. (And btw may even introduce some minimal additional denoising, due to your usage of MinBlur, the difference of which you have included in the "sharpD" difference.)
If that's the intention, then it's correct.

However, if the intention was to do

/--> {sharpen} \
source | |--> result
\--> {denoise} /

then it's not correct.

I don't read minds, and don't know what you want to do. - Do you? :)

Dogway
29th March 2010, 02:25
I see the point, in the contrasharpening function you are denoising in the same step, I only thought it was there for masking tasks not real denoising. Now I understand how it works, thank you

Nephilis
31st March 2010, 14:24
When you just blindly put SeeSaw as sharpener in there, a big amount of SS's sharpening power is wasted. The least thing that should be done is to deactivate soothing for script#2. For script#1, the advice is "don't use because poor."

Exactly..As "Lord of the MaskTools" said at least the internal Temporal Soothe (=SootheT) function of SeeSaw sould be deactivated. (According to me Spatial smoothing by RemoveGrain sould be deactivated, too (for quality sources))
When the advantage (and computational effort) of MVTools is taken, then Soothe() is useless and reduce the effect of sharpen process in vain..
Also again as Didée before said;
MDegrain2(source) -> "take a bowling ball. hold it in the air!"
MDegrain2(source).Soothe() "take three bowling balls. juggle!" :D:D:D

SilaSurfer
12th December 2010, 19:04
Hello Didée.

Nice presentation with those. I started using MvDegrain1\2\3 for denoising and I'm very impressed. So how can I use MC sharpening and denoising with Mvdegrain1\2\3 at the same time?

Didée
12th December 2010, 19:41
Hello Didée.

Nice presentation with those. I started using MvDegrain1\2\3 for denoising and I'm very impressed. So how can I use MC sharpening and denoising with Mvdegrain1\2\3 at the same time?

Already posted. That's "variant#2".


Basic script, variant#2: "spatial sharpen, temporally averaged"

source = whatever
sharp0 = source.sharpen(1).mergechroma(source) # a simple sharpening example
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bv1 = sup1.MAnalyse(isb=true, delta=1, [more params to liking], ...)
fv1 = sup1.MAnalyse(isb=false,delta=1, [more params to liking], ...)
bv2 = sup1.MAnalyse(isb=true, delta=2, [more params to liking], ...)
fv2 = sup1.MAnalyse(isb=false,delta=2, [more params to liking], ...)
bv3 = sup1.MAnalyse(isb=true, delta=3, [more params to liking], ...)
fv3 = sup1.MAnalyse(isb=false,delta=3, [more params to liking], ...)

source.MDegrain1/2/3(sup2,bv1,fv1,bv2,fv2,bv3,fv3)

SilaSurfer
14th December 2010, 16:53
Sunday was a hard day for me you know work, work, work, wasn't really focused, sorry my bad. Thank you Didée for your colorfull presentation. One more question if I may using Seesaw I should use it in this manner

Seesaw(ssx=1.00, ssy=1.00, sootheT=off, other paramaters tweakable)
not using supersampling and Soothing?

Nephilis
16th December 2010, 12:47
- Do not use SootheT and SootheS
- You can use SuperSampling if you wish, but seesaw doesnt need SS urgently as LSF needs
- Do not use seesaw as usual. I mean do not define a denoised clip.

SilaSurfer
18th December 2010, 19:56
Thanks Nephilis for the info

I tried it like this

source = last
sharp0 = source.Seesaw(nrlimit=0, nrlimit2=0, sstr=2.0, sootheT=0, sootheS=0, Slimit=50, Sdamplo=29, Spower=1, SdampHi=35).mergechroma(source)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)
bvec1 = sup1.MAnalyse(isb = true, delta = 1, overlap=4, chroma=true, truemotion=true)
fvec1 = sup1.MAnalyse(isb = false, delta = 1, overlap=4, chroma=true, truemotion=true)
bvec2 = sup1.MAnalyse(isb = true, delta = 2, overlap=4, chroma=true, truemotion=true)
fvec2 = sup1.MAnalyse(isb = false, delta = 2, overlap=4, chroma=true, truemotion=true)
source.MDegrain2(sup2,bvec1,fvec1,bvec2,fvec2, thSAD=400, plane=4)

and got outstanding results.

Vitaliy Gorbatenko
20th December 2010, 11:34
plane = 4 is not needed, since this is the default. The result is really good!
Added your code to killer function by default. http://www.mediafire.com/?4brfxqv4905jre6

SilaSurfer
20th December 2010, 19:41
Yeah I saw that was a default.

Um well thank you for adding that code to your function "Killer", but I think those setting should be tweaked a bit more. That just came out of my head and I tried it. Result oversharpening:D, it looks good while previewing avs script but after encoding I got some minor "ringing" on small objects so the above settings are too aggressive for good Dvd sources at least, because Mdegrain takes a lot of noise away but keeps everything that isn't noise like details. I'm very impressed with motion compensation of Mdegrain1/2/3. Much less ringing and haloing even with higher strengths for sharpening, compared using a sharpener on its own. So tweak it a bit more, it depends on the source.

Didée
20th December 2010, 20:07
... Result oversharpening, it looks good while previewing avs script but after encoding I got some minor "ringing" on small objects so the above settings are too aggressive for good Dvd sources at least
Of course it strongly depends on the actual source - however I wouldn't call those SeeSaw settings "too strong", but rather "badly balanced". SeeSaw per default tries to strongly enhance the weak (where some detail might appear out of the blue), and only weakly enhance the strong (where you'll mostly get nothing but oversharpening anyway). However, this behaviour is kicked down the drain when the user sets Spower=1. :p

I tried your settings on a TV cap and on an average DVD source, and found that weak textures don't get much enhancement, but already prominent spots got over-prominent. That's not what SeeSaw should be.

Try that script with sth like
Seesaw(nrlimit=0, nrlimit2=99, bias=49, sstr=1.24, Spower=3, Szp=12, Sdamplo=4, SdampHi=19, Slimit=99, sootheT=0, sootheS=0)

Of course, if the source contains haloing/ringing already from the start - !even if only minor! - then this needs additional prefiltering. Else, SeeSaw will sharpen the source artifacts without mercy! :D

SilaSurfer
20th December 2010, 21:50
Hello profesor with a good sense of humor ;) Didée nice to hear from you again.

I know those settings are not good, then again it was always hard to tweak the SeeSaw. Ringing is not present in the source it was me with all of that oversharpening and Xvid encoding. :D I'm still learning, going to try the settings you posted. Thanks

Vitaliy Gorbatenko
21st December 2010, 06:12
I updated the script. Now you can use an external filter, which like the best.
ref=last
[some code]
Killer(3, calm=0, ref=ref, sharpfilter="sharpen(1).sharpen(1)")
or
Killer(3, calm=0, ref=ref, oversharp=false)
or
Killer(3, calm=0, ref=ref)#default sharper

get here: http://www.mediafire.com/?is40rni6n9jvh1b

PS: Ref parameter is optional. It can be used as an analog function Calm.

SilaSurfer
7th January 2011, 18:06
Hello Didée

Settings for SeeSaw were awasome thank you for helping me out. I need some help, and I know you're the man with knowledge. ;) I found this script on the forum got great results for removing Mpeg2 blocks

source = last

backward_vec2 = source.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
backward_vec1 = source.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
forward_vec1 = source.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
forward_vec2 = source.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1, truemotion=true)
mask = mvmask(kind=1, vectors=forward_vec1).UtoY().spline36resize(source resolution)#its very important that this line matches the resolution you are feeding the script with
smooth = source.degrainmedian(mode=3).fft3dgpu(bw=16, bh=16, bt=3, sigma=4, plane=0)
source2 = maskedmerge(source, smooth, mask)

source3 = source2.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=2)
source3.gradfun2db(1.5)

and I wanted to modify it to work with Mvtools2 and your variant 2 of MC sharpening you know the one that still denoises :p. I tried it but I'm getting "Invalid arguments to function Mmask"

source = last
sharp0 = source.seesaw(whatever settings).mergechroma(source)
sup1 = source.MSuper(pel=2,sharp=2)
sup2 = sharp0.MSuper(pel=2,sharp=2,levels=1)

backward_vec2 = sup1.MAnalyse(isb = true, delta = 2, overlap=4, truemotion=true)
backward_vec1 = sup1.MAnalyse(isb = true, delta = 1, overlap=4, truemotion=true)
forward_vec1 = sup1.MAnalyse(isb = false, delta = 1, overlap=4, truemotion=true)
forward_vec2 = sup1.MAnalyse(isb = false, delta = 2, overlap=4, truemotion=true)
mask = Mmask(vectors=foward_vec1, kind=1).UtoY().spline36resize(source resolution)
smooth = sup1.degrainmedian(mode=3).fft3dgpu(bw=16, bh=16, bt=3, sigma=4, plane=0)
source2 = maskedmerge(sup1, smooth, mask)

source3 = source2.MDegrain2(sup2, backward_vec2, forward_vec2, backward_vec1,forward_vec1, thSAD=400)
source3.gradfun2db(1.5)

I don't know if I'm doing it right, I hope you understand I'm still learning about Mvtools1 & 2. Wish you all the best. Thanks in advance

Didée
7th January 2011, 18:33
That's a bit difficult. Your script has two errors, those are easy - the vector clip in MMask should be unnamed, and you shouldn't apply degrainmadian to a 'super'clip:D, but rather to a normal image clip.
The problem is the general methodology. These two filtering methods don't lend easily to a seamless integration. It's a puzzle that can be put together in several ways, the question is which ways make the most sense. Intuitively, it seems that the sharpening only should be done after the "deblocking" has been performed (surely you don't want to sharpen any of the "blocky" features).

*off for script fiddling*

BTW, there are a few things about mp4guy's script that make me wonder.
1) Why did he write "spline36resize(source resolution)", which makes the whole script non-functional, when you just need to write "spline36resize(source.width,source.height)"? A bit unclear.
2) The point of the script is to use filtering where MVTools detects motion. But if there is motion, then both filters DegrainMedian and FFt3D are in danger to produce motion artifacts. Those are spatio-temporal filters, and temporal filtering is likey to fail when there is motion. Even more so, since the source most likely will show blocking when there is some "major" motion, i.e. objects a/o scenery are moving by a big amount, not only a few pixels. Maybe switchhing to pure spatial filtering would be more appropriate.

SilaSurfer
7th January 2011, 18:46
That's a bit difficult. Your script has two errors, those are easy - the vector clip in MMask should be unnamed, and you shouldn't apply degrainmadian to a 'super'clip:D, but rather to a normal image clip.
The problem is the general methodology. These two filtering methods don't lend easily to a seamless integration. It's a puzzle that can be put together in several ways, the question is which ways make the most sense. Intuitively, it seems that the sharpening only should be done after the "deblocking" has been performed (surely you don't want to sharpen any of the "blocky" features).

*off for script fiddling*

Thank You very much.


BTW, there are a few things about mp4guy's script that make me wonder.
1) Why did he write "spline36resize(source resolution)", which makes the whole script non-functional, when you just need to write "spline36resize(source.width,source.height)"? A bit unclear.
2) The point of the script is to use filtering where MVTools detects motion. But if there is motion, then both filters DegrainMedian and FFt3D are in danger to produce motion artifacts. Those are spatio-temporal filters, and temporal filtering is likey to fail when there is motion. Even more so, since the source most likely will show blocking when there is some "major" motion, i.e. objects a/o scenery are moving by a big amount, not only a few pixels. Maybe switchhing to pure spatial filtering would be more appropriate.

So something like VagueDenoiser would be more convenient? I'm going to test it out with Mp4guys original script. Thanks again

Didée
7th January 2011, 18:52
This seems reasonable: (in theory, I didn't actually try it yet)

method = "careful" # "aggressive" #

source = last
source_super = source.MSuper(pel=2,sharp=2)
backward_vec2 = source_super.MAnalyse(isb=true, delta=2, overlap=4, truemotion=true)
backward_vec1 = source_super.MAnalyse(isb=true, delta=1, overlap=4, truemotion=true)
forward_vec1 = source_super.MAnalyse(isb=false, delta=1, overlap=4, truemotion=true)
forward_vec2 = source_super.MAnalyse(isb=false, delta=2, overlap=4, truemotion=true)
momask = mmask(source, forward_vec1, kind=1).UtoY().spline36resize(source.width,source.height)
smooth = source.degrainmedian(mode=3).fft3dgpu(bw=16, bh=16, bt=3, sigma=4, plane=0)
source2 = mt_merge(source, smooth, momask)
sharp0 = source2.seesaw(sootheT=0) # put your SeeSaw settings here
sharp0_sup = sharp0.MSuper(pel=2,sharp=2,levels=1)
source3 = (method=="careful")
\ ? source2.MDegrain2(sharp0_sup,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
\ : sharp0.MDegrain2(sharp0_sup,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
source3.gradfun2db(1.5)

SilaSurfer
10th January 2011, 19:37
Thank You Didée.

The script works, tried it. I just need your comments on using just FFt3dgpu(bt=1) or Dfftest(tbsize=1) which are spatial only modes of those two filters instead of DGmedian/FFt3dgpu in temporal mode.

Terka
11th January 2011, 15:49
what about temporal sharpening? with spatial limiting.

Didée
11th January 2011, 15:58
what about temporal sharpening? with spatial limiting.
Oh, yeah!

o=last
ts=o.temporalsoften(1,255,0,25,2)

o.mt_adddiff(mt_makediff(o,ts),U=2,V=2).repair(o,1,0)

Oh, crap! :D

SilaSurfer
12th January 2011, 15:39
Didée

You probably didn't understand me. I found good reviews for Dfttest not only for denoising but deblocking too. It has a setting for only spatial filtering with tbsize=1 since you think that temporal filtering is not suited in this case. I just needed your opinion on using it instead DGmedian\FFt3dgpu combo!:p Thnk you in advance.

method = "careful" # "aggressive" #

source = last
source_super = source.MSuper(pel=2,sharp=2)
backward_vec2 = source_super.MAnalyse(isb=true, delta=2, overlap=4, truemotion=true)
backward_vec1 = source_super.MAnalyse(isb=true, delta=1, overlap=4, truemotion=true)
forward_vec1 = source_super.MAnalyse(isb=false, delta=1, overlap=4, truemotion=true)
forward_vec2 = source_super.MAnalyse(isb=false, delta=2, overlap=4, truemotion=true)
momask = mmask(source, forward_vec1, kind=1).UtoY().spline36resize(source.width,source.height)
smooth = source.Dfttest(tbsize=1, other params)
source2 = mt_merge(source, smooth, momask)
sharp0 = source2.seesaw(sootheT=0) # put your SeeSaw settings here
sharp0_sup = sharp0.MSuper(pel=2,sharp=2,levels=1)
source3 = (method=="careful")
\ ? source2.MDegrain2(sharp0_sup,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
\ : sharp0.MDegrain2(sharp0_sup,backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
source3.gradfun2db(1.5)

Didée
12th January 2011, 17:46
Seriously - your best bet is to try both ways, and compare.

In a lengthy treatise about the what's and whatnot's and maybe's and butthen's, the final conclusion would be: IT DEPENDS. ;)

SilaSurfer
12th January 2011, 19:36
Thanks for your response. I'm going to try both ways. The source in mind are Lotr Trilogy SEE Dvds. I think those are a good candidates for the job.

zee944
14th January 2011, 18:10
Didée, does any of these scripts (I mean *.mp4 guy's or yours) cause smearing? Or enhance smearing when there's already some on the source? I'm testing all the time and sometimes I see a little, sometimes I don't.

Didée
14th January 2011, 22:38
*mp4guy has not posted in this thread.

Basically, any MVTools-script can cause sideffects in places where MVTools finds something that it shouldn't. Of the scripts posted in this thread, those that work only on the sharp-difference are rather unlikely to cause visible smearing. Those that simultaneously do sharpen+denoise are more likely to cause it.

Nothing of this is comes as a surprise. MVTools is good, but far from being failsafe. The only failsafe filter is - no filter.

zee944
15th January 2011, 10:03
I meant the script for removing MPEG-2 blocks in post #38, which you modified in post #41, the very last scripts discussed. I think it was originally *.mp4 guy's. So these can cause smearing. Thanks.