PDA

View Full Version : Need a guide in deinterlace job


Valeron
17th April 2004, 16:03
I have tried out some deinterlace filter to do deinterlace job for some NTSC interlaced DVD.Such as kerneldeint 1.4 and decomb 5.11.But I always set the threshold to 0 in order to completely deinterlace some clip.
Cause with the default threshold value,comb still can be seen in certain fast motion scence.But I wonder if so strong deinterlacing will do harm to the filtered video quality?Will it make details lost?

Is there a scientist or correct way to measure a good threshold value can both do a completely deinterlace job for my DVD and maintain the original quality?

One more question,which deinterlace filter I should choose??
Kerneldeint or decomb or any other suggestion?
What's the different between these two filters?

Thanks

Mug Funky
17th April 2004, 16:51
deinterlacing will halve the vertical resolution of the source.

if you're simply de-interlacing, and not bobbing (ie, giving each field it's own frame, then doubling the rate), you can mitigate this a fair amount.

tomsmocomp is another one to look at, as is sangnom. and there are a plethora of home-brewed combinations of all the above. these are good as they mask out non-moving areas and only deinterlace the moving parts. they run very slowly usually, and have varying strong points (some offer no residual combs at the cost of a slight blur, some offer sharp deinterlacing at the cost of small orphan pixels, and some leave combs behind).

i'll post my current favourite in a minute when i clean it up a tad.

zettai
17th April 2004, 20:14
I'd be very interested in your script mug funky - I've been trying out all kinds of bobber and sangnom equivalents by you mf and s-b over the last few days just for comparison sakes.

Mug Funky
17th April 2004, 20:34
here's the current incarnation.


function McComb (clip c, int "cut", int "rolloff")
{
cut=default(cut,1)
rolloff=default(rolloff,cut+16)
c=c.converttoyv12(interlaced=true)
overlay(c.doubleweave().selectodd(),c,mode="difference").limiter()
yv12convolution(horizontal="1",vertical="1,-2,1,",Y=3,U=0,V=0,usemmx=true)
gauss(8).levels(cut,1,rolloff,0,255,coring=false)
}

function testbob (clip c, int "cut", int "rolloff", bool "post", bool "halfy")
{
cut=default(cut,1)
rolloff=default(rolloff,cut+16)
post=default(post,false)
halfy = default(halfy,true)

c2 = (halfy==true)? c.horizontalreduceby2() : c
#cbob = (getparity(c)==true)? interleave(c.tomsmocomp(1,5,0),c.tomsmocomp(0,5,0)) : interleave(c.tomsmocomp(0,5,0),c.tomsmocomp(1,5,0)) # getparity==true means TFF
cbob = (getparity(c)==true)? interleave(c.sangnom(1),c.sangnom(0)) : interleave(c.sangnom(0),c.sangnom(1))
cbob = (post==true)? cbob.yv12convolution(horizontal="1",vertical="1,2,1,",Y=3,U=3,V=3,usemmx=true) : cbob
overlay(c.doublerate(),cbob,mask=mcComb(c2.doubleweave(),cut,rolloff)
\.pointresize(c.width,c.height))
}

function gauss (clip c,int "radius",bool "conv",int "precision") {

radius=default(radius,4)
conv=default(conv,false)
precision=default(precision,8)
mul=int(pow(2,precision))

Function siney(string s,int stop,int len,int mul)
{
eqn = string(round(mul*pow(sin(pi*stop/len),2)))
#(stop == 0) ? s : eqn + "," + siney(s,stop-1,len)
return (stop == 0) ? s : siney(s,stop-1,len,mul) + "," + eqn
}

matrix=siney("",radius*2,radius*2,mul)
matrix=matrix.midstr(2,(matrix.strlen()-3))

(conv==false)?c.bilinearresize(4*(c.width/(radius*2)),4*(c.height/(radius*2)))
\.bicubicresize(c.width,c.height,1,0):
\c.yv12convolution(horizontal=matrix,vertical=matrix,Y=3,U=3,V=3,usemmx=true)

}



there's a lot there that i use in other scripts too (gauss is a favourite of mine for fast large radius blurrins).

to make this work you need sangnom, tomsmocomp and masktools (latest is recommended)

usage: testbob(cut=<int>, rolloff=<int>, post=<boolean>), halfy=<boolean>)

cut = cutoff for noise floor. keep this low, default works good

rolloff = gradual blend of deinterlaced into interlaced. set too high and you'll get combs. set too low and there _may_ be slight salt-n-pepper artifacts, and an over-excess of deinterlaced bits. default is great for anime, but is too comb-y for video, where about 3 is a good value.

post = do a 1 pixel blur (both up and down) on the deinterlaced part. only useful if you un-comment the line that enables tomsmocomp, and it's best to ignore that.

halfy = reduce mask-making clip's width by 2. quick hack to increase speed that doesn't appear to affect quality. default is on.


examples:

avisource("some_interlaced_anime_with_field_blends.avi")
testbob()
unblend()
changefps(25)

or:

avisource("slightly_noisy_DV_footage.avi")
testbob(cut=1,rolloff=10)

denoiser_of_choice(blah=10, blahblah=256)

zettai
17th April 2004, 22:32
doublerate() ?