Quote:
Originally Posted by redfordxx
This testclip crashes both MeGui and AvsPMod
Code:
r1=BlankClip(pixel_type="YV12")
r2=BlankClip(pixel_type="YV12",color=$dddddd)
r1=r1.ScriptClip("Subtitle(String(LumaDifference(r1,r2)))")
r1
|
That's because the 'r1' used in the LumaDifference() is evaluated at
run-time and refers to the value at the end of the outer script. This sets up a loop in the run-time filter chain since r1 is the result of the ScriptClip() call - leading to ScriptClip requesting a frame from itself, an infinite recursion.
In the second example, r1 is not reassigned, so still has its original value when LumaDifference is evaluated.
See
http://avisynth.org/mediawiki/The_sc...untime_scripts.
This is an example of what I call the 'variable binding problem' and was one of the motivations for GRunT.
Using GRunT, the problem is avoided by writing
Code:
r1=r1.ScriptClip("Subtitle(String(LumaDifference(r1,r2)))", args="r1")
which ensures the binding of r1 is done at compile-time, ie its value
at that point in the script is used.
EDIT: But actually, for this example, you don't need to use r1 inside the run-time script, since it is also the
input to ScriptClip and hence is available inside as 'last':
Code:
r1=r1.ScriptClip("Subtitle(String(LumaDifference(last,r2)))")