Log in

View Full Version : new script: "funkyDeint"


Mug Funky
24th October 2003, 18:38
hey all. i've been playing with this for a while now... i call it "funkyDeint".

it basically does field differencing as well as frame differencing when deciding what to deinterlace. the advantage of this is that horizontal lines wont be wrongly deinterlaced, and artifacts like rainbows will be left alone (this is probably not an advantage..).

the actual deinterlacing is done by tomsmocomp, so you'll need that to run my script.

only other thing you need is undot() which i threw in there after testing it on grainy footage.

feel free to improve on it and maybe spin some ideas off it.

WORD OF WARNING: SLOW!

that's right... i don't like the way tomsmocomp's vertical filter moves everything one half-pel, so i did my own with generalconvolution. i then ran a "counter-convolution" which re-sharpens (minus any combing:)) this means RGB conversions. you can comment out these lines if you wish.

the link:

http://www.sharemation.com/mugfunky/funkydeint.avs

usage:


import("c:\avisynth_dir_here\plugins\funkydeint.avs")
avisource("whatever.avi")

funkydeint()



limitations:

colourspace should be either yuy2 or yv12 (preferably yuy2)


there's also a "funkybob()" mode that outputs twice the number of frames, basically interleaving 2 funkydeint's together for different fields. this may only work in yuy2, as it involves cropping by an odd number (then adding the line on later).


have fun people!

[edit]

i'm off to get some sleep. busy day's capturing to do tomorrow (and a busy night's partying).

[update]

changed funkybob() so it now doubles the framerate. sure would like to learn C and make a plugin out of this so it's not so annoyingly slow. funkybob is quite useful for un-blending old PAL telecines where it's just a video camera pointed at a screen, and you can see frames overlap in some fields.

omer123
24th October 2003, 21:57
[B]quote:the actual deinterlacing is done by tomsmocomp, so you'll need that to run my script.

how do i get this ?

Mug Funky
25th October 2003, 07:28
think there's a links page to avisynth filters about...

here.

http://www.avisynth.org/users/warpenterprises/

there's pretty much everything you need here. also, you'll need avisynth 2.5 or higher (i use YV12 colourspace).

get "undot" too.

good luck

lamer_de
16th January 2004, 17:10
Thanks. A pretty usefull "filter" :)

Is it possible to eliminate some of those colourspace conversions, now that "layer" supports yuy/yv12? Sorry, I know next to nothing about masking techniqes/field orders and your script is in most parts beyond me ^_^

CU,
lamer_de

mf
16th January 2004, 17:19
Is it my fault that I can't make any sense of what this thing does? :D

Mug Funky
22nd January 2004, 18:32
eep. i didn't see this thread float back up...

if you have the jan 15th binary, then use this one... no colourspace conversions AT ALL! WEEEEE!

(btw, Ebichu is so fresh. love that show)

i can't be bothered uploading the file, so just paste this over it :)


function FunkyDeInt (clip c, bool "post") {

post = default(post,true)

c3=c.horizontalreduceby2() # make it run a little faster...

c2=subtract(c3.bob().selecteven(), c3.bob().selectodd()).greyscale() # detect combs
c2=subtract(c2,c2.deleteframe(0)) # reject "comblike" things

c2=overlay(c2,c2.levels(0,1,255,255,0),mode="lighten") # flip dark bits to light bits
c2=c2.undot().levels(129,1,143,0,255).pointresize(c.width,c.height) # make the mask useful :)

overlay(c, c.tomsmocomp(0,5,0), mask=c2) # overlay deinterlaced onto original using interlace mask

last = (post == true) ? last.blur(0,1).blur(0,-1) : last # post process if enabled

converttoyv12() # redundant :)

}


function FunkyBob(clip c, bool "post") {

post = default(post,true)

c3=c.horizontalreduceby2()

c2=subtract(c3.bob().selecteven(), c3.bob().selectodd()).greyscale()
c2=subtract(c2,c2.deleteframe(0))

c2=overlay(c2,c2.levels(0,1,255,255,0),mode="lighten")
c2=c2.undot().levels(130,1,133,0,255).pointresize(c.width,c.height)

tmcOdd=c.tomsmocomp(0,6,0)
tmcEven=c.separatefields().selectodd().tomsmocomp(0,-1,0)

odd = overlay(c, tmcodd, mask=c2)
even = overlay(c, tmceven, mask=c2)

interleave(odd,even)

last = (post == true) ? last.blur(0,1).blur(0,-1) : last

converttoyv12()
}


this has changed some since last post... bits of it are in TMCbob i think...