View Full Version : Avisynth-sCript: SecDeInt


krieger2005
10th February 2005, 15:50
Hi,

i will present you a script for Avisynth for DeInterlacing, with wich i had very good results:
function SecDeInt(clip c, int "ord", int "thres", int "weight", bool "mask"){
thres=default(thres,2)
weight=default(weight,6)
ord=default(ord,1)
mask=default(mask,false)
c

#a1=KernelDeInt(order=ord, sharp=true)
a1=TomsMoComp(ord,30,0)
#a2=SangNom(ord,10)
a2=KernelDeInt(order=ord, sharp=true)

b=a1.KernelDeInt(order=1, sharp=true, threshold=thres)
c=a1.KernelDeInt(order=0, sharp=true, threshold=thres)

E="x y - abs "+string(weight)+" > 255 0 ?"
d=YV12LUTxy(b,c,YExpr=E, VExpr=E, UExpr=E, Y=3,U=3,V=3).inflate
ret=MaskedMerge(a1, a2,d,Y=3,U=3,V=3)

mask ? d : ret
}

Usage: SecDeInt
ord=1 -> TFF, 0 -> BFF
thres=0..X -> this should be cleared with the "mask=true" option
weight -> lower values will produce more blendpoints where "a2" will be blended in (so this is the artefact-factor), so if you have deinterlacing-Artefacts lower weight.
mask -> show you, which parts were blended

I use this funktion, when KernelDeInt and still FildDeinterlace produce deinterlacing artefacts. However, this function use twice KernelDeInt, once TomsMoComp and once Sangnom, so it is slow...

Try it and let me know what do you think about it. Maybe there are suggestions how to improve this function?

greets
krieger2005

Didée
10th February 2005, 16:16
Before having tried out: Yeah, it's much too fast. Replace sangnom with lsresize, and everything is good. :)

BTW, the script as posted does not use sangnom ;)

krieger2005
10th February 2005, 18:10
I tried some different options and and don't took aspekt to that, what i have written before. The Script how it is right now is more acurate to edges (because Kerneldeint make Edges look very fine and not blocky) but can maybe not remove all artefacts (my test right now). But there are still less artifacts as with one deinterlacer alone... Maybe the script can be imporved... I tried it with my "hard-to-interlace" movies...

Valky
10th February 2005, 21:16
I did get some very good results with this. My source is PAL DV.

However I just tried with the script you pasted (fieldorder changed) and like Didee said it doesn't use sangnom. Is it suppose to take out commentmarks out before sangnom so it uses a2 too or are they there just as alternative?

Basically you should use one a1 (tomsmocomp or kerneldeint) and one a2 (sangnom or kerneldeint) ?


I tried with sangnom too and it was about three times slower. And I liked the results better without sangnom.

krieger2005
10th February 2005, 23:23
The comments are just alternate possibilities. I tried now just an other combination:
a1=AutoDeInt
a2=KernelDeInt(order=ord, sharp=true)

Usefull to know for Autodeint:
"You have to force field order before AutoDeint(eg.AssumeTFF/AssumeBFF), because this filter doesn't have argument on field order."


Since AutoDeInt produce (sometimes/mostly) ugly edges and KernelDeInt not and the subtract of KernelDeInt(order=1/0) deliver mostly fine edges in the end the overlay of this both produce a very good result. I tried it with a weight of 5. Just replace a1 and a2 with the above one...

@Didée: What does lsresize make? I saw, that it do a supersampling but so slow... heavy slow... However, i tried something (because i don't know if it were a joke or not) like "SeparateFields.SelectEven.lsresize.LanczosResize(width,height)" and get not so good results. Lines were "step-like", so this is very slow and NOT very good...

Didée
11th February 2005, 09:21
lsresize is a "MarcFD implementation" of EDI upsizing, fixed to a 2x upscale. As usual for the author's work, you need to call Sherlock Holmes to get any infos about it.

I don't like it too much, because occasionally it still makes false guesses on the interpolation side -
- but when the talk is about speed in general, I _love_ to mention this filter :D