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. |
|
|
Thread Tools | Search this Thread | Display Modes |
31st October 2004, 17:03 | #1 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
MoComped deinterlace... don't know why i didn't think of this approach before.
just had a flash of inspiration. it's obvious, really.
the main problem with making a motion compensated deinterlacer with MVtools is you need a good bob to start with, and if you work just with separated fields, the compensation screws up the half-pixel offset that odd and even fields have. so... i wondered what would happen if i motion-compensated field-separated video, but got my vectors from a bob? the result is pretty good! to make things smoother, i've use forward and backward compensation and mixed them together. it runs surprisingly fast. however... there's no protection from bad matches at this very early stage (this can be added pretty easily, but i can't be arsed doing it now - i want this script's concept tested first). also, chroma doesn't get compensated at the moment (i've just used MVcompensate as is). this could be added as well, or you could do it manually by using my script on 3 clips, Y, U, and V. here's the script: Code:
function MVbob(clip c) { order=(c.getparity==true)? 1:0 bobd=c.kernelbob(order=order).verticalreduceby2() fields=c.separatefields() mvf=bobd.mvanalyse(sx=4,sy=4,pel=1,isb=false) mvb=bobd.mvanalyse(sx=4,sy=4,pel=1,isb=true) even1=c.separatefields().selecteven() odd1a=fields.mvcompensate(mvf).selecteven() odd1b=fields.mvcompensate(mvb).selecteven() odd1=mergeluma(odd1a,odd1b,0.5).mergechroma(odd1b,0.5) even2=c.separatefields().selectodd() odd2a=fields.mvcompensate(mvf).selectodd() odd2b=fields.mvcompensate(mvb).selectodd() odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd1b,0.5) even=interleave(even1,odd1).weave() odd=interleave(even2,odd2).weave() interleave(even,odd) } [edit] hehe... this thing eats camera pans for breakfast! all it needs is a few kinks ironed out and it'll be rocking.
__________________
sucking the life out of your videos since 2004 Last edited by Mug Funky; 31st October 2004 at 17:09. |
31st October 2004, 18:20 | #2 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
wow!
this thing is really cool! and it is fast! but it suffers from mvtools lacking sub-pixel accuracy. manao? will this feature be included in one of the future versions? could it be combined with this experimental global-motion-compensated deinterlacer? Code:
avisource("doom9.avi").assumetff() bob() showframenumber(scroll=true) i=converttoyv12() m=depanestimate(i,zoommax=1,improve=false,pixaspect=0.94) i.DePanInterleave(data=m,pixaspect=0.94,prev=1,next=0) separatefields() selectevery(8,0,3,5,6) weave() stackhorizontal(last.subtitle("depan-bob"),i.subtitle("bob()"))
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
31st October 2004, 19:01 | #3 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
I played with mug funky's mvbob() a little bit, and found how to add some little subpixel accuracy:
Code:
function MVbob1(clip c) { order=(c.getparity==true)? 1:0 bobd=c.kernelbob(order=order,threshold=8).verticalreduceby2().lanczos4resize(c.width,c.height) fields=c.separatefields().tomsmocomp(-1,-1,0) mvf=bobd.mvanalyse(sx=4,sy=4,pel=1,isb=false,lambda=2000) mvb=bobd.mvanalyse(sx=4,sy=4,pel=1,isb=true,lambda=2000) even1=c.separatefields().selecteven() odd1a=fields.mvcompensate(mvf).selecteven() odd1b=fields.mvcompensate(mvb).selecteven() odd1=mergeluma(odd1a,odd1b,0.5).mergechroma(odd1b,0.5) even2=c.separatefields().selectodd() odd2a=fields.mvcompensate(mvf).selectodd() odd2b=fields.mvcompensate(mvb).selectodd() odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd1b,0.5) even=interleave(even1,odd1.separatefields().selecteven()).weave() odd=interleave(even2,odd2.separatefields().selectodd()).weave() interleave(even,odd) } first I tried a pure kernelbob, but its jaggy output made the MC going worse. so I decided using verticalreduceby2.lanczos4 this mvbob1 has the downside, that small movements tend to produce slight bobbing, but the overall quality is better, cause now its has the double pixel accuracy.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
31st October 2004, 19:05 | #4 | Link |
Registered User
Join Date: Jan 2002
Location: France
Posts: 2,856
|
Yes, I plan to make a release tomorrow, and half pixel search will be working correctly. I'll disable the motion interpolators ( I'm currently rewriting it, because they were more than a mess ). It just misses the documentation right now.
However, you'll need to change the syntax a little. |
31st October 2004, 23:30 | #5 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
thanks, scharfi... the idea was frighteningly obvious, no? i initially tried using dumb bob, but this would hit unmoving areas. leak's optimised kernelbob is almost as fast and doesn't suffer from that.
now what's needed is some sanity-checking in it. this will involve masking, and will probably slow it down a fair amount. right now it isn't so good with scenechanges, and as you say suffers from lack of subpel accuracy (though if you're downscaling the output it isn't really a big deal). manao: thanks again for MVtools, masktools, etc. it's scary how useful these tools are [edit] scharfi: if you're upscaling, you should probably make the blocksize 8 to avoid too much jumping around of the vectors.
__________________
sucking the life out of your videos since 2004 Last edited by Mug Funky; 31st October 2004 at 23:34. |
1st November 2004, 11:18 | #7 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
didn't see much difference...
considering i want to wrap this thing in masks to stop false-matches coming through, i chose kernelbob for a tradeoff between speed and accuracy on static areas (the dumb-bob shimmer gets confused with motion, so we can't be having that).
__________________
sucking the life out of your videos since 2004 |
1st November 2004, 17:43 | #9 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
well, i haven't noticed... maybe it's a chroma thing? the output is sufficient for this script, and it's definitely fast enough
any bugs on the bob stage will be outshone by artefacting in the deinterlace. (though now manao's released a new MVtools i can go down to half-pel).
__________________
sucking the life out of your videos since 2004 |
1st November 2004, 17:45 | #10 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
No intention to be penetrant, but the method reminds me a little of a comment in this thread:
Quote:
BTW, what about working on double-height fields and reducing 'em afterwards, instead of VerticalReduce'ing the bobbed clip? I'm under the impression MVanalyse's results get better with increasing framesize.
__________________
- 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!) |
|
1st November 2004, 17:51 | #11 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
TW, what about working on double-height fields and reducing 'em afterwards, instead of VerticalReduce'ing the bobbed clip? I'm under the impression MVanalyse's results get better with increasing framesize.
ermmm.... Did you read my 2nd post of this thread? (verticalreduceby2() afterwards will only blur and return vertically mis-aligned fields)
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
1st November 2004, 18:49 | #12 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
ermmm ...
Did you read my post carefully enough. I spoke of reducing the double-heighted fields. This wording leaves room - and so it was intended - for an arbitrary operation. I did not speak of applying VerticalReduceBy2() on them ... But now I realize I just did it again. I dared to speak about deinterlacing. Heaven help, when will I finally learn to seal my mouth on this topic
__________________
- 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!) |
1st November 2004, 19:49 | #13 | Link | |
ffdshow/AviSynth wrangler
Join Date: Feb 2003
Location: Austria
Posts: 2,441
|
Quote:
So, no, it's not neccessarily a bug. np: Faction - And Not Very Transparent (Intelligent Toys 2) |
|
2nd November 2004, 15:32 | #14 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
aaaah, i remember reading that post, didee... must have sunk into the bottom of my mind and jumped out again
still, the script's out there, so it's all good. feel free to hack at it (it really needs some kind of protection against blocking). the half-pel search of the latest MVtools helps it quite a lot - near-horizontal lines are less wibbly. Leak: good to hear there's no bug. i certainly never saw a difference, but i may have missed something because the frames were going by so much quicker with your version
__________________
sucking the life out of your videos since 2004 |
2nd November 2004, 17:36 | #15 | Link | |
ffdshow/AviSynth wrangler
Join Date: Feb 2003
Location: Austria
Posts: 2,441
|
Quote:
Well, you could consider it a bug as without the AssumeFrameBased you can't really use SeparateFields on the output, but as I said, some people thought it should work that way, so I kept it. np: Triola - Neuland (Im Fünftonraum) |
|
2nd November 2004, 18:02 | #16 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
exept of some minor glitches with heavy, non estimateable motion, this mvbob() rocks.
here are some sample images: http://home.arcor.de/scharfis_brain/...doublweave.jpg http://home.arcor.de/scharfis_brain/...-kernelbob.jpg http://home.arcor.de/scharfis_brain/mvbob/038-mvbob.jpg http://home.arcor.de/scharfis_brain/...oubleweave.jpg http://home.arcor.de/scharfis_brain/...-kernelbob.jpg http://home.arcor.de/scharfis_brain/mvbob/674-mvbob.jpg I additionally included a weaved image to show the amount of interlacing.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
2nd November 2004, 23:11 | #18 | Link |
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,653
|
just place selecteven() after calling mvbob1()
this little function Mug Funky gave us, is able to make interlaced video looking more like it has been filmed as progressive
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
3rd November 2004, 04:14 | #20 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
scharfi: i was hoping you'd try it out on that clip it's a pretty good benchmark for deinterlacers.
could it possibly be uploaded somewhere? i suppose anything with pans and stuff would work. [edit] MVcompensate's syntax has changed, and kinda broken my script (it stores compensation off the original clip now in it's default mode). here's an updated one. using blksize=4 and pel=2 makes things very slow, but quite delicious Code:
function MVbob(clip c,int "blksize", int "pel", int "lambda") { order=(c.getparity==true)? 1:0 blksize=default(blksize,8) scd=(blksize==8)? 300 : round(300/4) pel=default(pel,1) lambda=(blksize==8)? default(lambda,2000) : default(lambda,1000) bobd=c.kernelbob(order=order).verticalreduceby2() fields=c.separatefields() mvf=bobd.mvanalyse(blksize=blksize,pel=pel,isb=false,compensate=false) mvb=bobd.mvanalyse(blksize=blksize,pel=pel,isb=true,compensate=false) even1=c.separatefields().selecteven() odd1a=fields.mvcompensate(mvf,mode=1,thscd1=scd).selecteven() odd1b=fields.mvcompensate(mvb,mode=1,thscd1=scd).selecteven() odd1=mergeluma(odd1a,odd1b,0.5).mergechroma(odd1b,0.5) even2=c.separatefields().selectodd() odd2a=fields.mvcompensate(mvf,mode=1,thscd1=scd).selectodd() odd2b=fields.mvcompensate(mvb,mode=1,thscd1=scd).selectodd() odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd1b,0.5) even=interleave(even1,odd1).weave() odd=interleave(even2,odd2).weave() interleave(even,odd) } "blksize" is the same as the new blksize parm in Mvtools. default 8, but 4 will give nice results at slower speed. "lambda" is a kind of "vector cleaner". it increases the vector field coherence, thus reducing stray vectors. default works okay. it must be doubled for 4x4 blocks i find (or should it be quadrupled? it doesn't have enough of and effect to really worry).
__________________
sucking the life out of your videos since 2004 Last edited by Mug Funky; 3rd November 2004 at 04:27. |
|
|