Log in

View Full Version : Defaults for "Levels" filter


Cyberia
2nd June 2004, 22:36
The default values for the Levels filter are not listed in the doc. Beside correcting that oversight, could someone tell me what they are?

I'm guessing they are:
Levels(0, 1, 255, 0, 255)

Wilbert
2nd June 2004, 22:57
Why do you think is has default values?

From levels.cpp:


AVSValue __cdecl Levels::Create(AVSValue args, void*, IScriptEnvironment* env)
{
return new Levels( args[0].AsClip(), args[1].AsInt(), args[2].AsFloat(), args[3].AsInt(),
args[4].AsInt(), args[5].AsInt(), args[6].AsBool(true), env );
}


Only the coring argument has a default value (ie true).

Cyberia
3rd June 2004, 00:19
Well, it's good practice to have them. "Tweak" has them, by default they do nothing.

stickboy
3rd June 2004, 04:04
If you want optional arguments, you can write a wrapper function for it (http://www.avisynth.org/index.php?page=Wrapper).

If you want to know what combination of values would do nothing, then yes, Levels(0, 1.0, 255, 0, 255) should be a no-op.

Cyberia
7th June 2004, 00:22
Sorry to complain again, but I just realized that the Levels doc also does not specify the range of acceptable values.

Anyone know what THOSE are?

This should definately be documented.

Wilbert
7th June 2004, 00:28
They should be

0 < gamma <= 10
0 <= input/output <= 255

I don't think these bounds are checked in AviSynth. I will update the docs :)

sh0dan
7th June 2004, 13:30
Min/max has no problems being out-of-bounds - it might even be helpful - it could act as a contrast filter that way.

There is math that limits the range to end in 0-255 or 16-235 on the final output. Gamma is checked, and must be >0, otherwise an error is thrown.