PDA

View Full Version : Some shimmering after SmartDecimating animation ...


absinthe
16th September 2004, 18:17
I've made an XviD from a DVD of early 80's American animation. DVD2AVIdg reported it as "Interlaced," so I extracted with "No field order." But on scrolling through the d2v file, I could discern a definite 2:3 pattern with 3 solid frames and 2 interlaced frames.

I used the SmartDecimate filter, being sure to get the field order correct.

The result was quite good: a 23.976 video with virtually identical time length that plays very smoothly.

However, I notice a frequent "shimmering" effect that is rather disturbing to the eye. It seems to happen on sequences of frames with no movement. I checked "Cartoon Mode" in my XviD configuration, but I don't think this has anything to do with the codec because I can see the shimmer just playing the .avs file in Vdub.

Could I maybe have chosen a better filter for IVTC'ing?

Here's a 2.6 MB sample (http://home.carolina.rr.com/absharpe/shimmer_sample.avi). You can see the shimmer effect 2 or 3 times in this short sample. Watch the color white.

thx,

-abs

Bogalvator
16th September 2004, 21:12
Try setting the 'tel' option slightly higher - eg 0.6:

smartdecimate(tel=0.6)

Chainmax
17th September 2004, 05:21
Maybe it's because SmartDecimate can't handle YV12 colorspace (according to scharfis_brain in this thread (http://forum.doom9.org/showthread.php?s=&threadid=81834&highlight=smartdecimate+yv12))

Mug Funky
17th September 2004, 09:00
no, it's because of how smartdecimate works. it gets confused on near-static scenes no matter what you set "tel" to (though set this higher just for the hell of it anyway).

you need to replace the "bob" parameter with a smartbobbed clip.

here's how i do it (not sure if this is ideal, but it works on what i have, so...)


function DoubleTelecide(clip c, bool "post")
{
post = default(post,true)
order = (c.getparity==true)? 1 : 0

odd = (post==true)? c.doubleweave().selectodd().telecide(order=order,guide=1,hints=true).kerneldeint(order=0,threshold=3) :
\ c.doubleweave().selectodd().telecide(order=1-order,guide=1,post=0)

even = (post==true)? c.telecide(order=order,guide=1,hints=true).kerneldeint(order=1,threshold=3) :
\ c.telecide(order=order,guide=1,post=0)

return interleave(even,odd)
}

mpeg2source("blah.d2v")

b=last.doubletelecide()
c.smartdecimate(24,60,bob=b)


this will feed smartdecimate with a telecide-bobbed clip, so if smartdecimate matching fails, telecide will catch it, and if telecide fails, kerneldeint will catch it (this will happen on an orphaned field).

absinthe
17th September 2004, 14:00
Well before I read Mug Funky's in-depth reply, I encoded again with the 'tel' parameter cranked on up to 0.75. After a quick scan back through known problem areas, I don't see the shimmer anymore in places where it definitely was before. So that's excellent!

But I'll have to take a closer look at it. It's 2 hours and 20 minutes long, so it'll take me a while to review. And I might just try encoding again with your function, Mug Funky, and in any case I'll definitely jot it down for future use.

(Kind of ironic as I'm encoding School House Rock ... "conjunction, junction, what's your func-tion?")

Thanks!

-abs

scharfis_brain
17th September 2004, 15:20
here, I want to present an always flicker-free solution:

loadplugin("D:\x\dgdecode.dll")
loadplugin("D:\x\fdecimate.dll")
loadplugin("D:\x\tdeint.dll")
loadplugin("D:\x\decomb511.dll")

function matchbob(clip c, int "combth", bool "show")
{
show = default(show, false)
global cth = default(combth,6)

ord = c.getparity() ? 1 : 0
odd = c.doubleweave().selectodd().telecide(order=1-ord,post=0)
even = c.telecide(order=ord,post=0)
tel = interleave(even,odd).duplicateframe(0)

analyse = tel.greyscale()

tel = show ? tel.subtitle("fieldmatched") : tel

bobbed = c.TDeint(mode=1, order=ord, mthreshL=8, mthreshC=6,type=2,mtnmode=1)
bobbed = show ? bobbed.subtitle("bobbed") : bobbed

conditionalfilter(analyse,tel,bobbed,"iscombed(cth)","==","false")
}

mpeg2source("video.d2v")

matchbob()

fdecimate(rate=23.976,threshold=1.0,metrics=false)

it is (mostly) stable on weird patterns, always tries to get the most information possible out of orphaned fields (those ones are blown up to full frame size)
it is (mostly) shimmer-free
it properly handles YV12 (no errors found up to now)
it is slow :)

Mug Funky
17th September 2004, 16:53
it'd be awesome if tdeint took telecide hints...

scharfis_brain
17th September 2004, 17:02
it'd be awesome if tdeint took telecide hints...

I never found this hinting being useful, cause orphaned fields are deinterlaced strictly on either the odd or the even field, so there is only a 50:50 chance, to get an orphaned field shown as fullframe.

with matchbob() you'll always get the orphaned field correctly deinterlaced, while other telecined parts are still untouched.

also telecide tends to knock out orphaned fields (it replaces them with a neighboring, matching field)

absinthe
17th September 2004, 19:02
Hey Mug Funky,

I'm no genius at scripting, but is there a typo in the last line of
your above script?

c.smartdecimate(24,60,bob=b)

I'm wondering if that shouldn't be c=smartdecimate(24,60 ... etc. AviSynth tells me that it doesn't know what "c" means.

But then again, when I change it to "c=" my flick is still at 29.970.

-abs

Bogalvator
19th September 2004, 00:46
Yes, it's a typo.

You can either set

c=mpeg2source("....") rather than mpeg2source("...")

or just use

smartdecimate(...) rather than c.smartdecimate

absinthe
19th September 2004, 06:44
Okay. Cool. :)

Now when I use MF's function, I actually see a shimmer in some scenes ... in fact, I almost seem to have gotten a better result with plain old "SmartDecimate(tel=0.75)." But then, that could just be because the computer is too slow to process it in real time (maybe the artifact would not be present after full encoding).

I want to try scharfis_brain's script, but I don't get where those plugins are coming from (i.e. dgdecode, fdecimate, tdeint, decomb511). They're not at the WarpEnterprises page.

Where can I grab 'em? :confused:

thx,

-abs

scharfis_brain
19th September 2004, 09:34
decomb5xx.dll & fdecimate & dgdecode.dll (alias mpeg2dec3.dll) you can get from neuron2.net

for tdeint.dll visit tricticals new motion-adaptive-deinterlacer thread in avisynth-developement.

Mug Funky
21st September 2004, 07:58
oh, there's still shimmering with that script (after my typo was fixed...)?

hmm. i haven't tested it on many samples, so that my be so (perhaps there's a field order mixup with the doubletelecide or something?).

if you could post a sample that messes up i'd appreciate it :)

[edit]

oh, by the way, Absinthe: MF is a different person... call me mug if you want (or adrian...)

absinthe
23rd September 2004, 18:24
Originally posted by Mug Funky
oh, there's still shimmering with that script (after my typo was fixed...)?

hmm. i haven't tested it on many samples, so that my be so (perhaps there's a field order mixup with the doubletelecide or something?).

if you could post a sample that messes up i'd appreciate it :)

[edit]

oh, by the way, Absinthe: MF is a different person... call me mug if you want (or adrian...)

Oh hi! Sorry Mug, I haven't checked back here in a few days.

Yeah, oddly enough I got a better result with plain 'smartdecimate(tel=0.75)' than with either your script or scharfis's. Don't know why, but I finalized the encode and got rid of all my samples.

But I'll be glad to reencode some more samples ... but I only have about 5 MB of personal web space for files. Can you recommend some online 'free' file-storage site ... preferably one that doesn't require personal info or bomb you with ads? (if there is such a beast out there) :D

-abs

Mug Funky
24th September 2004, 16:58
if you've got a decent internet connection, you could just install apache and use your hard disk. that's what i do for big files.

caveats:

- only works while computer is on (obviously)
- you'll have to annoy lots of people online, asking them to check if a download is working or not
- half the time the download wont work :)

i wish i could use my Gmail account as webspace...