Log in

View Full Version : can't use smartdecimate in a function?


Mug Funky
26th August 2004, 14:23
hi. i'm currently playing with using telecide as a fallback option for smartdecimate, so i needn't do bobbing at all on film material.

i've got something that works in a script, but when i put it in an external function, i get access violations after 3 frames... when i comment out smartdecimate all is well, and if i use the same code in script, all is well.

is this a C plugin thing, and are there workarounds for it?

by the way, here's the code in case anyone's interested :)


loadCplugin("c:\mediatools\avisynth 2.5\Cplugins\SmartDecimate.dll")

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

post = default(post,true)

order = (c.getparity==true)? 1 : 0

odd = (post==true)? c.doubleweave().selectodd().telecide(order=order,guide=1,hints=true).kerneldeint(order=0,threshold=3) :
\ c.doubleweave().selectodd().telecide(order=1-order,guide=1,post=0)

even = (post==true)? c.doubleweave().selecteven().telecide(order=order,guide=1,hints=true).kerneldeint(order=1,threshold=3) :
\ c.doubleweave().selecteven().telecide(order=order,guide=1,post=0)

return interleave(even,odd)

}

function IVTCboy(clip c, int "num", int "den", bool "post")
{

num = default(num,24)
den = default(den,60)
post = default(post,false)

b=c.doubletelecide(post=post)
c.smartdecimate(num,den,bob=b)

}

scharfis_brain
26th August 2004, 15:39
make all variables, you give to smartdecimate global, and it will work.

I nearly lost all my hair before I figured out that issue...

EDIT:

doubleweave().selecteven() is a NOP, so delete it.

Mug Funky
27th August 2004, 06:59
ah, cool. tanks for that.

hmm. and i should've guessed the doubleweave.selecteven thing... whoops.

[edit]

hmmm... globals lead to nastiness if i call the function twice in one script. is it possible to modify smartdecimate so it can work with locals?