Log in

View Full Version : mvbob() calls eedibob() leaving maxd undefined


nibbles
6th October 2006, 21:49
I've seen several threads in the forums that show a call to mvbob (http://home.arcor.de/scharfis_brain/mvbob/mvbob.rar) with no arguments like this:


AssumeTFF()
mvbob()



mvbob will set a bunch of default values because none were set. Here's one:

BobType = Default(Type, 3)



Eventually it calls SecureBob() with that BobType:

Bobbed = Input.SecureBob(Threshold = BobTh, Type=BobType, Length=Length)



SecureBob, if Type=3, then calls EEDIBob with no arguments:

(Type == 3) ? Input.EEDIBob() :\



But EEDIBob() never sets a default maxd and calls EEDI2 like this:

Function EEDIbob(clip Input, int "maxd")
{
#GetParity(Input) ? Input.SeparateFields().EEDI2(Field = 3, maxd = maxd, pp = 0, estr = 0, dstr = 0, mthresh = 0, vthresh = 0, lthresh = 0) : Input.SeparateFields().EEDI2(Field = 2, maxd = maxd, pp = 0, estr = 0, dstr = 0, mthresh = 0, vthresh = 0, lthresh = 0)
GetParity(Input) ? Input.SeparateFields().EEDI2(Field = 3, maxd = maxd) : Input.SeparateFields().EEDI2(Field = 2, maxd = maxd)

AssumeFrameBased()
GetParity(Input) ? AssumeTFF() : AssumeBFF()
}


How does this work if maxd is undefined? There is no error.
Also is it better to use mvbob with the supplied plugins rather
than some updated ones?

Thanks, nibbles

scharfis_brain
7th October 2006, 07:33
1) Function EEDIbob(clip Input, int "maxd")
maxd is in quotation marks setting it as an optional variable (see AVISynth doc).
if maxd isn't given to EEDIbob the EEDI2 internal default value is used.

2) use the suplied plugins. some newer plugins caused lower quality.
using the old plugins shouldn't be a problem at all, cause you can extarct mvbob into its own archive.

foxyshadis
7th October 2006, 08:38
No, without maxd=default(maxd,???) it's a bug, because you still reference it outside eedi2 (ie, in script). Either it's required or it has to be set with default().

scharfis_brain
7th October 2006, 11:37
maxd is an optional parameter of eedi2().
also maxd is an optinal parameter of eedibob().
So I can leave both undefined without problems.
It's not a bug. It's a feature.

This avoids to use default(blah, x) over and over.

Didée
7th October 2006, 16:20
Hey, this is an interesting finding! I was about to say exactly the same as foxy - since internally there is a function call where the input parameter is used ("maxd = maxd" - BTW, personally I dislike using same names for variables of different hierarchy level...), I thought this would have to bail out if the parameter is not specified.

Where does this "smartness" come from? Avisynth is told to call "function(parameter=xx)", and if it finds that "xx" actually is not defined, then it thinks "ok, so lets drop the unavailable parts, and just call function(). "


As a 'feature' this might be handy ... but strictly seen, this is a rather sloppy behaviour, IMO.

foxyshadis
7th October 2006, 17:27
Bizarre. I never thought it would work until I tried it. I wonder what other hidden nuances there are to avisynth's parser.

IanB
9th October 2006, 06:07
All script variables are AVSValue objects internally. An AVSValue with a type of 'v' is known as "undefined". When a filter or function is invoked an array of AVSValues is passed that matches the type parameter spec string. Any arguments that are optional that were not declared have the matching AVSValue object set to type 'v'. Copying and assigning type 'v' AVSValues is perfectly normal.

Inside filters code like if (args[0].Defined()) .... illustrates the concept. In Avisynth scripts the Defined(var) and Default(x, d) similarly illustrate the same concept. And the reserved variable Nop can be used to dummy up an "undefined" variable.

So any undefined dummy arguments to script functions can quite transparently be assigned to the actual arguments of an inner filter or function call. If they are not optional then you get the appropriate script error message about missing arguments. If they optional then the inner filter or function see an undefined argument.