View Full Version : Motion compensation without degraining
moviefan
7th January 2009, 22:07
Hi guys,
I wonder, whether there is a way to stabilize dithering, so something like MDegrain2 (or so) without degraining. I want to achieve a better compressibility without losing to much detail. Is this possible and if yes how?
Regards,
moviefan
Sagekilla
7th January 2009, 23:02
If you want to stabilize dithering, you can try something like TemporalSoften() with a low strength.
Other idea: Degrain, then Soothe()
moviefan
7th January 2009, 23:05
Does Soothe keep the temporal stableness but lowers the degraining? Basically what SeeSaw does without the sharpening?
Sagekilla
8th January 2009, 03:08
Hm, sorry I meant TemporalSoothe(). You'd need the temporal flavor for it to work across multiple frames. It may or may not work for you. But I do know that when I used TemporalSoften() before, that I managed to get it to stabilize grain while not actually reducing it a lot.
The perfect filter for a situation like this would be something like a (working) version of Dark Shikari's GrainOptimizer. Good idea, didn't work for whatever reason though.
Dark Shikari
8th January 2009, 03:36
Hm, sorry I meant TemporalSoothe(). You'd need the temporal flavor for it to work across multiple frames. It may or may not work for you. But I do know that when I used TemporalSoften() before, that I managed to get it to stabilize grain while not actually reducing it a lot.
The perfect filter for a situation like this would be something like a (working) version of Dark Shikari's GrainOptimizer. Good idea, didn't work for whatever reason though.Now that I'm much more knowledgeable in the ways of video than when I wrote that, I'd say the proper way to do it would be to do motion compensation--do denoising--and then re-insert the noise that you removed, except only insert the noise from the previous frame.
Sagekilla
8th January 2009, 03:51
Or in this case if he's adding dithering he can use the dithered clip as the one that needs "denoising," then add that noise back in again.
Terka
8th January 2009, 11:31
Now that I'm much more knowledgeable in the ways of video than when I wrote that, I'd say the proper way to do it would be to do motion compensation--do denoising--and then re-insert the noise that you removed, except only insert the noise from the previous frame.?
dont understand, could you please explain?
*.mp4 guy
8th January 2009, 12:25
The simplest way to do this would be to frequency limit both the dither, and the mocomped denoising, you limit the dither to very high frequency X, with filter Y, then you limit the degraining effect to very high frequency X with filter Y, almost foolproof, for most dvd's, as good as perfect. overhead is dependent on how good you want the FIR filter to be, usually it would be very small compared to the motion compensated denoising.
or you could have it like this:
a = source
b = a.dither
c = b.mvdenoise
d = absolute difference of a and b
e = difference between a and c
f = e limited to in absolute terms to values less the or equal to d
final = a plus f
I know they aren't very readable, but its the best I could do. Both are very similar in idea, they are basically frequency and spatial domain counterparts.
Sagekilla
8th January 2009, 16:17
a = last
b = a.AddGrain(30)
super = b.MSuper(pel=2)
bvec = super.MAnalyse(isb=true, blksize=8, overlap=4)
fvec = super.MAnalyse(isb=false, blksize=8, overlap=4)
c = b.MDegrain1(super, bvec, fvec)
d = mt_makediff(a,b,U=3,V=3)
e = mt_makediff(a,c,U=3,V=3)
f = mt_lutxy(e, d, "x 128 - abs y 128 - abs <= x y ?", U=3, V=3)
final = mt_adddiff(a,f)
I get the feeling this is wrong but I was interested enough to give it a shot (first time trying to doing anything with masks ;))
LaTo
8th January 2009, 17:09
I think that "f" is false, try replacing with this:
f = mt_lutxy(e, d, "x 128 - abs y 128 - abs <= x y ?", U=3, V=3)
buletti
8th January 2009, 19:09
I don't get the first 2 steps of the processing, maybe someone with more insights could explain:
When b = a.AddGrain(30) and c = b.MDegrain1(super, bvec, fvec) then c = a.AddGrain(30).MDegrain1(super, bvec, fvec)
So, what's the benefit of adding grain and then removing it immediately? Seems like an expensive nop() to me.
I think that "f" is false, try replacing with this:
f = mt_lutxy(e, d, "x 128 - abs y 128 - abs <= x y ?", U=3, V=3)
Oh, I wish there was a function to reverse reverse polish notation :D
LaTo
8th January 2009, 21:13
Oh, I wish there was a function to reverse reverse polish notation :D
abs(x-128) <= abs(y-128) ? x : y :D
Sagekilla
8th January 2009, 22:02
What? No where in there am I doing a:
a = source
b = a.AddGrain()
c = b.MDegrain1()
c = a.AddGrain().MDegrain1()
It's more or less finding a (more) stable grain pattern through the middle portion of the code then adding that into the source. If you just add in noise or dither, it'll be different for each frame. This tries to find something common and add it in across all frames. It's still going to vary, but A LOT less.
*.mp4 guy
9th January 2009, 23:07
I don't think that script is correct, but reverse polish notation gives me a headache, so I can't be sure what exactly thats doing. If people actually want this for some reason, I'll try to put something together.
Sagekilla
9th January 2009, 23:45
Updated the script with the correct version (abs(x-128) <= abs(y-128) ? x : y) Should work properly now.
moviefan
11th January 2009, 22:35
How come that my picture is extremely grainy now when I apply the filter?? :rolleyes:
Sagekilla
12th January 2009, 01:41
D'oh. Check the script again, moviefan. I accidentally copy pasted the wrong line, that was my fault.
Also, adjust AddGrain() to taste, or use whatever it is you're trying to do (if dithering, then gradfunkmirror to taste)
moviefan
13th January 2009, 20:28
The picture is still very grainy (more than the source) and not stable at all...
Sagekilla
14th January 2009, 04:44
Were you trying to add motion compensated dither before? (s.t. the dither stays fairly constant) If that's what it is, you should be using gradfunkmirror() insntead of AddGrain().
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.