View Full Version : MoComped deinterlace... don't know why i didn't think of this approach before.
Mug Funky
31st October 2004, 17:03
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:
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)
}
hopefully this can give some other people ideas on how to prevent errors leaking through, because as it is now, this script should not be used if you want a good result :)
[edit]
hehe... this thing eats camera pans for breakfast! all it needs is a few kinks ironed out and it'll be rocking.
scharfis_brain
31st October 2004, 18:20
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?
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()"))
scharfis_brain
31st October 2004, 19:01
I played with mug funky's mvbob() a little bit, and found how to add some little subpixel accuracy:
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)
}
it works with edge-directed upsampled fields now
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.
Manao
31st October 2004, 19:05
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.
Mug Funky
31st October 2004, 23:30
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.
Chainmax
1st November 2004, 00:27
Have you tried using TDeint's bobber instead?
Mug Funky
1st November 2004, 11:18
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).
Chainmax
1st November 2004, 16:55
Didn't Leak say some time ago that his KernelBob had a bug?
Mug Funky
1st November 2004, 17:43
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).
Didée
1st November 2004, 17:45
:D No intention to be penetrant, but the method reminds me a little of a comment in this (http://forum.doom9.org/showthread.php?s=&threadid=81430) thread:
Originally posted by Didée, 2 months ago
What about te following:
Generally:
- Make a *soft* bob, e.g. TMCbob with "line averaging" active
- calculate fw & bw vectors
- selecteven/selectodd those vector clips
- apply MVCompensate to the original top/bottom field sequences, using those "decimated" vector clips, producing fw and/or bw compensated fields
- try and see if those can be used as-is, or if averaging fw(n-1) with bw(n+1) is better, or ...
Basically, here it is a problem that the vectors are created on a bobbed source with lack of vertical information, thus making the vertical coordinates of the vectors unprecise.
However, using a soft bobber should already dim the problem down. Additionally, one could try either of the following:
- Take the soft-bobbed clip, reduce its height by 2, then calculate the vectors
- Take the soft-bobbed clip, sharpen it vertically, calculate the vectors, apply ^^above procedure on the fields with point-resized doubled height, and reduce them again afterwards
... or something similar.
Vertical precision *might* be a problem, but it should be possible to make it minor enough. The vector lenghts, however, would be correct.
I suppose it could work. Or someone tell me why it obviously can't work.
As long as the idea survives ;)
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.
scharfis_brain
1st November 2004, 17:51
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)
Didée
1st November 2004, 18:49
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 :D
Leak
1st November 2004, 19:49
Originally posted by Chainmax
Didn't Leak say some time ago that his KernelBob had a bug?
Well, I'm not doing an AssumeFrameBased at the end, which makes it different from Scharfis_Brain's original KernelBob, but after some discussion it turned out to rather be a feature than a bug, and if you like the old behaviour you can just add the AssumeFrameBased after KernelBob and it'll act the same.
So, no, it's not neccessarily a bug. :)
np: Faction - And Not Very Transparent (Intelligent Toys 2)
Mug Funky
2nd November 2004, 15:32
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 :)
Leak
2nd November 2004, 17:36
Originally posted by Mug Funky
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 :)
*g*
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)
scharfis_brain
2nd November 2004, 18:02
exept of some minor glitches with heavy, non estimateable motion, this mvbob() rocks.
here are some sample images:
http://home.arcor.de/scharfis_brain/mvbob/038-doublweave.jpg
http://home.arcor.de/scharfis_brain/mvbob/038-kernelbob.jpg
http://home.arcor.de/scharfis_brain/mvbob/038-mvbob.jpg
http://home.arcor.de/scharfis_brain/mvbob/674-doubleweave.jpg
http://home.arcor.de/scharfis_brain/mvbob/674-kernelbob.jpg
http://home.arcor.de/scharfis_brain/mvbob/674-mvbob.jpg
I additionally included a weaved image to show the amount of interlacing.
morsa
2nd November 2004, 23:01
could this be adapted to output 25 fps for Pal and 30 for NTSC ?
May be I'm really lost.....Scharfis.....!!
scharfis_brain
2nd November 2004, 23:11
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 :)
joshbm
3rd November 2004, 01:14
@scharfis_brain:
I've tried mvbob1() and it appears to give very rigid looking output. While mvbob() works quite nicely. Any ideas?
Regards,
Josh
Mug Funky
3rd November 2004, 04:14
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 :)
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)
}
"pel" is the same as MVanalyse's pel. either 1 or 2, for fullpel and halfpel respectively.
"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).
scharfis_brain
3rd November 2004, 16:38
@joshbm: my interpretation of MugFunky's mvbob() currently is limited to TFF-video.
If you work with BFF-Video, you need to place doubleweave().selectodd() before calling mvbob1()
@MugFunky: I'll try the new version with the changed mvtools-syntax.
(I was too lazy to implement this myself, I was sure, you would do it :) )
I also have an Idea in mind to detect and knock out artifacts caused by motion compensation.
currently, you estimate motion using the half-sized bobbed clip and compensate motion on the bare fields.
to detect artifacts, one will need to compensate the bobbed clip, too (fwd AND bwd)
than compare the compensated frames to the original frame.
if the deviation is bigger than an certain threshold, one has to use the bobbed pixels instead of the mocomped ones for such detected areas.
I'll try to script such a detection. but do not count on my sucsess.
The things I tested so far showed, that mocomping introduces a lot of noise the the subtraction, so detection may hard to realize.
I do not have enough space available for that clip anymore.
PM me, if you want to get it transferred using another way.
It is about 20MB 640x480@29.97 fps YUY2-MJPEG-avi.
I found it somewhere here on the forums, but don't know anymore where it was.
This clip is my all-purpose-testclip. Because it:
- is interlaced
- has static parts with max. vertical detail
- has rainbowing (to confuse deinterlacers)
- has some little grain (try to denoise it without smearing the low contrasted background!)
- has loooong smooth camera-pans
- has a rapid zoom
- has clear defined diagonals (visualize edge directed interpolation)
- is NTSC (searching for a good way to make crisp & smooth PAL out of it)
Maybe I'll try to setup another account for hosting it.
scharfis_brain
3rd November 2004, 20:55
for those, who don't trust in static images.
here is a sample video:
http://home.arcor.de/scharfis_brain/mvbob/doom9-mv-vs-krnl.avi
( left side == mvbob() ; right side == kernelbob() )
and here is the unprocessed video:
http://home.arcor.de/scharfis_brain/mvbob/doom9.avi
(deactivated, because else my 1GB/Month-Traffic limit is reached tomorrow, and we are just at the beginning of November!)
acrespo
4th November 2004, 06:37
I have tried on anime source and there are some interlaced artifacts with latest version of MVBob. Is MVBob recomend to anime or only to real image?
Mug Funky
4th November 2004, 08:04
eek... i didn't get round to saying "you shouldn't use this on anime", but i guess i probably should have.
anime doesn't have "real" motion in the same way video does, so motion-compensation will artefact heavily on it.
if you like you can use it as a pre-processor for another deinterlacer, so long as it hits the right fields (the non-comped ones, not the mocomped ones). it's not much of a solution.
for anime i recommend Tdeint, personally (or simple IVTC, but Tdeint handles both).
scharfis_brain
4th November 2004, 20:28
@Mug Funky: had you been able masking out mismatched areas?
all my tests so far show, that it will be a hard job to do so.
chroma-compensation currently seems to be broken...
It is really important to get the chroma compensated, too (of course with the same vectors as lume is compensated!)
This will be needed to create a good detection, cause luma-only masking will not catch all mismatches.
scharfis_brain
4th November 2004, 20:44
there is an copy & paste error in mvbob!
you all need to correct this line:
odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd2b,0.5)
then chroma looks better in the odd frames!
Mug Funky
5th November 2004, 13:53
thanks, scharfi :)
i knew if anyone found bugs, it'd be you (and i was kinda counting on it).
yeah, thinking about error detection, it's going to be a little tricky with the whole half-pixel offset stuff. perhaps keep the full-size bob handy and check it against that?
scharfis_brain
5th November 2004, 14:31
fullsize checking is a very bad idea, cause it would detect the jaggyness of kerneldeint!
I prefer the half-size checking:
complete untested idea to check for errors, I had on my way home:
bob=c.kernelbob(order=order).verticalreduceby2()
...motion-analysis...
bobf=bob.mvcompensate(mvf)
bobb=bob.mvcompensate(mvb)
fwdmask=interleave(bob,bobf).motionmask(...).selecteven/odd ?
bwdmask=interleave(bob,bobb).motionmask(...).selecteven/odd ?
Fizick
5th November 2004, 22:52
Sorry for offtopic, but anybody can translate word "bob" to English? Is it some abbreviation B... O... B... ?
scharfis_brain
5th November 2004, 22:58
please fill in the form with the word "bobbing" here:
http://www.thefreedictionary.com/
Mug Funky
6th November 2004, 05:08
hehe... that's an intricacy of english. "bob" is usually a person's name (typically your uncle's, though in my case it was my grandfather :)).
full rate dumb deinterlace is nicknamed "bob" because the picture bobs up and down (sort of in the sense "bobbing along").
joshbm
6th November 2004, 06:27
I've tested it and wow it's great! Hopefully you guys can resolve the chroma issue. Once it is fixed it will be my main bobber!
Thanks guys,
Josh
scharfis_brain
6th November 2004, 14:32
function MVbob(clip c,int "blksize", int "pel", int "lambda", int "thy", int "thc", int "bobth", bool "predenoise")
{
#disable all scene detection, because it is self-correcting
sc=255
# luma and chroma thresholds for correcting false detected motion
thy=default(thy,20)
thc=default(thc,10)
# threshold of kerneldeint
bobth=default(bobth,8)
#denoise the video for kerneldeint (better static areas for noisy video)
predenoise=default(predenoise,false)
blksize=default(blksize,8)
scd=(blksize==8)? 300 : round(300/4)
pel=default(pel,2)
#I decided lambda=0 being better, cause it stupidly trys to catch everything. errors are corrected afterwards.
lambda=default(lambda,0)
order=(c.getparity==true)? 1:0
bobx=predenoise ? c.temporalsoften(2,5,7) : c
bobx=bobx.kernelbob(order=order,threshold=bobth)
bobd=bobx.verticalreduceby2().lanczos4resize(c.width,c.height)
fields=c.separatefields().tomsmocomp(-1,-1,0)
fields1=fields
mvf=bobd.mvanalyse(blksize=blksize,pel=pel,isb=false,compensate=false)
mvb=bobd.mvanalyse(blksize=blksize,pel=pel,isb=true,compensate=false)
bobdf=bobd.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
bobdb=bobd.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
difff=interleave(bobdf,bobd).motionmask(thy1=thy,thy2=thy,thc1=thc,thc2=thc,thSD=sc).selectodd()
diffb=interleave(bobdb,bobd).motionmask(thy1=thy,thy2=thy,thc1=thc,thc2=thc,thSD=sc).selectodd()
diff=logic(difff,diffb,"OR")
even1=c.separatefields().selecteven()
odd1a=fields.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
odd1a=maskedmerge(odd1a,fields1,difff,y=3,u=3,v=3).selecteven()
odd1b=fields.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
odd1b=maskedmerge(odd1b,fields1,diffb,y=3,u=3,v=3).selecteven()
odd1=mergeluma(odd1a,odd1b,0.5).mergechroma(odd1b,0.5)
odd1=(order==1) ? odd1.separatefields().selecteven() : odd1.separatefields().selectodd()
even2=c.separatefields().selectodd()
odd2a=fields.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
odd2a=maskedmerge(odd2a,fields1,difff,y=3,u=3,v=3).selectodd()
odd2b=fields.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
odd2b=maskedmerge(odd2b,fields1,diffb,y=3,u=3,v=3).selectodd()
odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd2b,0.5)
odd2=(order==1) ? odd2.separatefields().selectodd() : odd2.separatefields().selecteven()
even=interleave(even1,odd1)
even=even.weave()
odd=interleave(even2,odd2)
odd=odd.weave()
analysis=maskedmerge(bobx,diff,diff,y=3,u=3,v=3)
interleave(even,odd)
#stackhorizontal(last,analysis).converttoyuy2().bilinearresize(1280,height)
}
this is my first release of a full motion compensated fullframerate deinterlacer with correction of false matched motion.
there are a lot of things to improve:
- a much nicer error-replacement is needed
it curerently is stupid replacing with folled blending of bwd&fwd clip.
there must be a decision:
if only on clip (bwd or fwd) has errors on a certain pixel, return only the clip with the good pixel, instead of leaving the good clip as it is, repleace the other clip with some interpolated stuff and afterwards blend both together.
- I'll try if I can use another motionmasking, than kdeints internal one. it is far to sensible to noise.
- re-structurize the script
it has some naming issues, introduced by muf funky (odd isn't always odd and even not always even...)
I found, that a lambda of 0 gives the best motion estimation (especially for low contrastened areas!)
joshbm
6th November 2004, 17:51
I get "Script error: motion mask does not have a named argument "thy1" (line 69).
I have the latest MVTools as well as MaskTools.
[fixed] lol.. Kind of weird but I capitalized it to thY1. It worked like a charm.
PS- This thing works awesome!
Regards,
Josh
Manao
6th November 2004, 20:59
Kind of weird but I capitalized it to thY1. It worked like a charmWhat ? it shouldn't happen, avisynth is case insensitive.
joshbm
7th November 2004, 02:23
I know, but it worked lol...
Maybe some character was incorrect, but it worked like a charm.
Regards,
Josh
scharfis_brain
7th November 2004, 11:07
another version:
- improved motion detection
- improved mismatch-replacement
function MVbob(clip c,int "blksize", int "pel", int "lambda", int "thy", int "thc", int "bobth", bool "predenoise", bool "showmask")
{
#Helper functions:
function tmcstupid(clip c)
{ input=c.converttoyuy2(interlaced=true).separatefields.tomsmocomp(1,-1,0)
a = getparity(input) ? input.selectodd : input.selecteven
b = getparity(input) ? input.selecteven : input.selectodd
a=stackvertical(a.crop(0,0,0,1-a.height),a.crop(0,0,0,-1))
output = getparity(input) ? interleave(b,a) : interleave(a,b)
output.assumeframebased().converttoyv12()
}
#disable all scene detection, because it is self-correcting
sc=255
showmask=default(showmask,false)
# luma and chroma thresholds for correcting false detected motion
thy=default(thy,20)
thc=default(thc,10)
# threshold of kerneldeint
bobth=default(bobth,8)
#denoise the video for kerneldeint (better static areas for noisy video)
predenoise=default(predenoise,false)
blksize=default(blksize,4)
scd=(blksize==8)? 300 : round(300/4)
pel=default(pel,2)
#I decided lambda=0 being better, cause it stupidly trys to catch everything. errors are corrected afterwards.
lambda=default(lambda,0)
#determine clip Fieldorder
order=(c.getparity==true)? 1:0
# create clip for motion analysis and hole-filling
bobx=predenoise ? c.temporalsoften(2,5,7) : c
bobx=bobx.kernelbob(order=order,threshold=bobth).undot()
bobd=bobx.verticalreduceby2()
#bobd=bobd.lanczos4resize(bobx.width,bobx.height)
bobd=bobd.tomsmocomp(-1,-1,0).undot()
# create clip for motion compensation
fields=c.tmcstupid().undot()
# define clip for hole filling
fields1=bobx
# create motion vectors
mvf=bobd.mvanalyse(blksize=blksize,pel=pel,isb=false,compensate=false,search=3,searchparam=10)
mvb=bobd.mvanalyse(blksize=blksize,pel=pel,isb=true, compensate=false,search=3,searchparam=10)
# detect mismatched areas of motion compensation
bobdf=bobd.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
bobdb=bobd.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
difff=interleave(bobdf,bobd).motionmask(thy1=thy,thy2=thy,thc1=thc,thc2=thc,thSD=sc).selectodd()
diffb=interleave(bobdb,bobd).motionmask(thy1=thy,thy2=thy,thc1=thc,thc2=thc,thSD=sc).selectodd()
diff=logic(difff,diffb,"OR")
# do the deinterlacing
even1=c.separatefields().selecteven()
odd1a=fields.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
odd1a=maskedmerge(odd1a,fields1,difff,y=3,u=3,v=3).selecteven()
odd1b=fields.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
odd1b=maskedmerge(odd1b,fields1,diffb,y=3,u=3,v=3).selecteven()
odd1=mergeluma(odd1a,odd1b,0.5).mergechroma(odd1b,0.5)
odd1=(order==1) ? odd1.separatefields().selecteven() : odd1.separatefields().selectodd()
even2=c.separatefields().selectodd()
odd2a=fields.mvcompensate(mvf,mode=1,thscd1=scd,thSCD2=sc)
odd2a=maskedmerge(odd2a,fields1,difff,y=3,u=3,v=3).selectodd()
odd2b=fields.mvcompensate(mvb,mode=1,thscd1=scd,thSCD2=sc)
odd2b=maskedmerge(odd2b,fields1,diffb,y=3,u=3,v=3).selectodd()
odd2=mergeluma(odd2a,odd2b,0.5).mergechroma(odd2b,0.5)
odd2=(order==1) ? odd2.separatefields().selectodd() : odd2.separatefields().selecteven()
even=interleave(even1,odd1)
even=even.weave()
odd=interleave(even2,odd2)
odd=odd.weave()
# output
interleave(even,odd)
analysis=maskedmerge(last.levels(0,1,255,0,200),diff,diff,y=3,u=3,v=3)
showmask ? analysis : last
}
usage: generally just mvbob()
but if static areas are flickering (logos, subtitles etc.)
one need to raise bobth and/or set predenoise to true.
if motion errors appear (small dot-like holes) one need to lower the bobth.
thy (luma) and thc (chroma) are used for artifact prevention from mvtools.
the lower those values, the more artifacts are catched, but the more detail as well.
blksize, pel and lambda should be clear.
within mvbob() I am currently using ,search=3,searchparam=10
it makes a better compensation, but is painly slow.
you may want to delete ,search=3,searchparam=10 from both line for better speed...
malkion
11th November 2004, 02:05
scharfis, I keep getting kernelbob does not have a named arguement "order"... with the last mvbob() script.
could you help?
Leak
11th November 2004, 10:20
Originally posted by malkion
scharfis, I keep getting kernelbob does not have a named arguement "order"... with the last mvbob() script.
What version of KernelDeint are you using? If you're using one of scharfis_brain's scripted versions, you might want to take a look here:
http://forum.doom9.org/showthread.php?s=&threadid=81322
This version definitely has an order parameter... :)
malkion
12th November 2004, 00:42
Thanks Leak...
I did find the problem when I had the time. It's my KernelBob function. I don't have the right version.
line 42 in MvBob
bobx=bobx.kernelbob(order=order,threshold=bobth).undot()
my KernelBob (most likely too outdated) has no such call in it...
function kernelbob(clip a, int "th",bool "mask")
{ mask=default(mask,false)
th=default(th,5)
ord = getparity(a) ? 1 : 0
f=a.kerneldeint(order=ord, sharp=true, twoway=false, threshold=th,map=mask)
e=a.separatefields.trim(1,0).weave.kerneldeint(order=1-ord, sharp=true, twoway=false, threshold=th,map=mask)
interleave(f,e).assumeframebased
}
you see? only mask and th values... Can someone post the latest KernelBob while I searches for it? Thanks.
(error msg in vdub)
kernelbob does not have a named argument "order"
[edit]
ok, fixed. Kernelbob found in kerneldeint.dll :D
zeus163
12th November 2004, 01:54
OK, first I have to say, that I'm a cut and paste script writer. Now that I have that off my chest, I'm trying to get MVbob working. I first found out that I needed to upgrade my kerneldeint, which I did. Then I got an undot error and went and found that. Next, I got a tomsmocomp error. I went and got that and put it in. But now I get I get this error: "Script error: motion mask does not have a named argument "thy1" (line 60). I see that joshbm had this error and tried his fix, but that didn't work for me by capitalizing the "Y" in thy. Searching for "thy" obviously produced too many results. I'm sure there is something I'm overlooking, but I don't know what it is.
TIA
malkion
12th November 2004, 02:01
motion mask uses masktools.dll
MaskTool 1.5.4 (http://jourdan.madism.org/~manao/MaskTools-v1.5.4.zip)
Mug Funky
12th November 2004, 02:07
hmmm... to be honest i just got home and haven't had a chance to try out Scharfi's latest effort, but i'm thinking maybe you don't have an up-to-date masktools?
there's a thread in avisynth development that will have the latest version in it (if you've got a HyperThreading enabled P4, then read the thread carefully...).
http://forum.doom9.org/showthread.php?s=&threadid=82435&perpage=20&pagenumber=2
download the one with the binarize fix... it's the latest. get the second one below it if you have a HT P4.
zeus163
12th November 2004, 04:06
Thanks guys! Got back from $0.50 taco night and there was my answer. I got it going now. Woo-hoo!
Now to try it on some small clips.
Socio
19th January 2005, 02:27
balazer,
I believe file atachments have to be approved by the admin before they show up on this forum.
Guest
19th January 2005, 02:40
Originally posted by Socio
balazer,
I believe file atachments have to be approved by the admin before they show up on this forum. Done.
Socio
19th January 2005, 03:17
I have tried this script with three versions of MvTools and always get the same error:
Script error" mvanalyse does not have a named argument "compensate"
Edit:
I think I found the problem had to change a couple "compensate" 's to "mvcompensate" in the script.
Nope that did not fix it, now I get
Script error" mvanalyse does not have a named argument "mvcompensate"
if I try MVCompensate I get:
Script error" mvanalyse does not have a named argument "MVCompensate"
Figured it out!
I had to edit out "compensate=false" from these two lines in the script and it worked!
# create motion vectors
mvf=bobd.mvanalyse(blksize=blksize,pel=pel,isb=false,compensate=false,search=3,searchparam=10)
mvb=bobd.mvanalyse(blksize=blksize,pel=pel,isb=true, compensate=false,search=3,searchparam=10)
Ultra freaking slow though, 2936 frames est time 3hrs 55 minutes!
balazer
19th January 2005, 05:20
You were right about the problem. Corrected here:
I've tried scharfis_brain's MVBob and found it to be, simply, the best de-interlacer I've ever seen or used. It's amazing. I almost forget that I'm watching an interlaced source. Here is the original post, with usage instructions:
http://forum.doom9.org/showthread.php?s=&threadid=84725&perpage=20&pagenumber=2#post566854
I've assembled all the required parts here, hoping that it will be easier for people to use. If you put all the required AVISynth plugin DLLs in your plugins folder and enable auto-loading, you won't have to load any plugins explicitly.
http://www.avisynth.org/AviSynthPlugins
Attached is scharfis_brain's MVBob, modified to reflect a change in the function name of LeakKernelDeint. Rename it to MVBob.avsi and put it in your plugins folder.
These are the other parts you'll need:
UnDot v0.0.1.1 and TomsMoComp v0.0.1.7 :
http://www.trbarry.com/
or
http://www.avisynth.org/warpenterprises/
MVTools 0.9.8.5 and MaskTools 1.5.6:
http://manao4.free.fr/
or
http://forum.doom9.org/showthread.php?s=&threadid=67232&highlight=mvtools
LeakKernelDeint 1.5.3:
http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/LeakKernelDeint/
or
http://forum.doom9.org/showthread.php?s=&threadid=81322&highlight=leak+kerneldeint
To use MVBob you'll want to make sure that you have the clip's field parity set correctly before you pass the clip to MVBob. (follow the instructions in the KernelDeint readme)
I've encoded several clips and placed them online. They are just the finished product - not before & after or side-by-side comparisons.
http://www.eecs.umich.edu/~balazer/mmb_media/
Valky
19th January 2005, 14:16
Originally posted by balazer
You were right about the problem. Corrected here:
I've tried scharfis_brain's MVBob and found it to be, simply, the best de-interlacer I've ever seen or used. It's amazing. I almost forget that I'm watching an interlaced source. Here is the original post, with usage instructions:
http://forum.doom9.org/showthread.php?s=&threadid=84725&perpage=20&pagenumber=2#post566854
I've assembled all the required parts here, hoping that it will be easier for people to use. If you put all the required AVISynth plugin DLLs in your plugins folder and enable auto-loading, you won't have to load any plugins explicitly.
http://www.avisynth.org/AviSynthPlugins
Attached is scharfis_brain's MVBob, modified to reflect a change in the function name of LeakKernelDeint. Rename it to MVBob.avsi and put it in your plugins folder.
These are the other parts you'll need:
UnDot v0.0.1.1 and TomsMoComp v0.0.1.7 :
http://www.trbarry.com/
or
http://www.avisynth.org/warpenterprises/
MVTools 0.9.8.5 and MaskTools 1.5.6:
http://manao4.free.fr/
or
http://forum.doom9.org/showthread.php?s=&threadid=67232&highlight=mvtools
LeakKernelDeint 1.5.3:
http://gast3.ssw.uni-linz.ac.at/~kp/AviSynth/LeakKernelDeint/
or
http://forum.doom9.org/showthread.php?s=&threadid=81322&highlight=leak+kerneldeint
To use MVBob you'll want to make sure that you have the clip's field parity set correctly before you pass the clip to MVBob. (follow the instructions in the KernelDeint readme)
I've encoded several clips and placed them online. They are just the finished product - not before & after or side-by-side comparisons.
http://www.eecs.umich.edu/~balazer/mmb_media/
"There is no function called "kernelbob" on line 42"
Is this error somehow related to changes in kerneldeint, since I have downloaded all the tools you mentioned?
bobx=bobx.kernelbob(order=order,threshold=bobth).undot()
Btw, your video clips looked REALLY nice on your website (I watched that 93mb clip with flag and some stadium audience)
balazer
19th January 2005, 18:07
The kernelbob problem is fixed in the version of MVBob that I attached. We'll have to wait for the mods to approve the new attachment.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.