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 | Display Modes |
|
|
#21 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
@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.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#22 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
for those, who don't trust in static images.
here is a sample video: http://home.arcor.de/scharfis_brain/...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!)
__________________
Don't forget the 'c'! Don't PM me for technical support, please. Last edited by scharfis_brain; 4th November 2004 at 20:33. |
|
|
|
|
|
#23 | Link |
|
Brazilian Anime Ripper
Join Date: Nov 2001
Location: Brazil
Posts: 233
|
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?
__________________
Capture cards: Compro VideoMate Gold+ (Philips SAA7134 based) (not active) Hauppauge PVR 150MCE (not active) ATI TV Wonder Elite (active) |
|
|
|
|
|
#24 | Link |
|
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,270
|
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).
__________________
interlace... right or wrong, just deal with it. |
|
|
|
|
|
#25 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
@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.
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#26 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
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!
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#27 | Link |
|
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,270
|
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?
__________________
interlace... right or wrong, just deal with it. |
|
|
|
|
|
#28 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
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 ?
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#29 | Link |
|
AviSynth plugger
Join Date: Nov 2003
Location: Russia
Posts: 2,126
|
Sorry for offtopic, but anybody can translate word "bob" to English? Is it some abbreviation B... O... B... ?
__________________
My Avisynth plugins are now at http://avisynth.org.ru I usually do not provide a technical support in private messages. |
|
|
|
|
|
#30 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
please fill in the form with the word "bobbing" here:
http://www.thefreedictionary.com/
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#31 | Link |
|
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,270
|
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").
__________________
interlace... right or wrong, just deal with it. |
|
|
|
|
|
#33 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
Code:
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)
}
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!)
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#34 | Link |
|
Registered User
Join Date: Jun 2003
Location: Land of the Noobs & the Home of the Brave
Posts: 349
|
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 Last edited by joshbm; 6th November 2004 at 17:57. |
|
|
|
|
|
#37 | Link |
|
brainless
Join Date: Mar 2003
Location: Germany
Posts: 3,510
|
another version:
- improved motion detection - improved mismatch-replacement Code:
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
}
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...
__________________
Don't forget the 'c'! Don't PM me for technical support, please. |
|
|
|
|
|
#39 | Link | |
|
ffdshow/AviSynth wrangler
Join Date: Feb 2003
Location: Austria
Posts: 2,437
|
Quote:
http://forum.doom9.org/showthread.php?s=&threadid=81322 This version definitely has an order parameter...
|
|
|
|
|
|
|
#40 | Link |
|
Registered User
Join Date: Feb 2004
Posts: 156
|
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
Last edited by malkion; 12th November 2004 at 01:13. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|