View Full Version : YPlane Functions
lisztfr9
11th November 2012, 21:36
Hi,
I get an "invalid arguments" error for YPlaneMin here :
http://avisynth.org/mediawiki/Internal_functions/Runtime_functions
Examples:
# a simple per-frame normalizer to [16..235], CCIR, range
Levels(YPlaneMin(), 1.0, YPlaneMax(), 16, 235)
I tried also something like :
o2 = o2.Scriptclip("a = YPlaneMin()" + chr(13) + chr(10) + \
"b = YPlaneMax()" + \
"Levels(o2, a, 1.0, b, 16, 235)" )
It makes Avsp crashs...
So how to make this working ? Thanks, L
Didée
11th November 2012, 21:47
It's a runtime function. Please consult Avisynth documentation for details.
scriptclip( "Levels(YPlaneMin(), 1.0, YPlaneMax(), 16, 235)" )
lisztfr9
11th November 2012, 22:34
Ok i mixed up everything...
Gavino
11th November 2012, 22:48
I tried also something like :
o2 = o2.Scriptclip("a = YPlaneMin()" + chr(13) + chr(10) + \
"b = YPlaneMax()" + \
"Levels(o2, a, 1.0, b, 16, 235)" )
It makes Avsp crashs...
This looks similar to Didée's solution, but your script contains a subtle bug which causes the crash.
The variable o2 used in the call to Levels is evaluated at run-time (see here (http://avisynth.org/mediawiki/The_script_execution_model/Scope_and_lifetime_of_variables#Runtime_scripts)), so at that point (because of the assignment o2=o2.ScriptClip(...)) it refers to the result of the ScriptClip filter.
This sets up a loop in the filter graph where the output of ScriptClip (via Levels) is derived from itself.
So when Avisynth tries to fetch a frame from the graph, an infinite recursion occurs - bang! :eek:
Your script could have been written like this:
o2 = o2.Scriptclip("
a = YPlaneMin()
b = YPlaneMax()
Levels(a, 1.0, b, 16, 235)" )
Here Levels() uses the implicit input 'last', which, because of the way ScriptClip works, will be the original value of o2 (the input to ScriptClip).
Note that you don't need to use chr(10), etc, either - you can just a multi-line string literal instead.
lisztfr9
11th November 2012, 23:17
@Gavino
Thanks a lot ! Also i tried to write a Scriptclip command like a string passed to a string variable. I didn't always do that, i was close to your solution except the crucial point you underlined here... !
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.