fvisagie
22nd June 2014, 15:45
Hi All,
There seems to be rather more to the evaluation sequence of runtime filters than the "bottom to top" mentioned at The script execution model/Scope and lifetime of variables (http://avisynth.nl/index.php/The_script_execution_model/Scope_and_lifetime_of_variables).
Here,
sequence = ""
BlankClip(length=2, width=160, height=60, color=$000000)
FrameEvaluate("""sequence = sequence + "d"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "c"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "e"""", show=false, after_frame=true)
FrameEvaluate("""sequence = sequence + "f"""", show=false, after_frame=true)
clip1 = last
BlankClip(length=2, width=160, height=60, color=$FFFFFF)
FrameEvaluate("""sequence = sequence + "h"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "g"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "i"""", show=false, after_frame=true)
FrameEvaluate("""sequence = sequence + "j"""", show=false, after_frame=true)
clip2 = last
clip1.Dissolve(clip2, 1)
FrameEvaluate("""sequence = sequence + "b"""", show=false, after_frame=false)
FrameEvaluate("""sequence = "a"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "k"""", show=false, after_frame=true)
ScriptClip("""
sequence = sequence + "l"
Subtitle(sequence)
""", show=false, after_frame=true)
the sequence of events for e.g. the second frame is abcdefghij.
http://forum.doom9.org/attachment.php?attachmentid=14250&stc=1&d=1403448205
That seems to indicate that:
for runtime filters with after_frame = false, the runtime filters of a particular filter graph node are executed in the opposite sequence to which they appear in the script (i.e. bottom to top as stated),
for runtime filters with after_frame = true, the runtime filters of a particular filter graph node are executed in the sequence in which they appear in the script,
any runtime filters of the final output node with after_frame = false are executed before those of intermediate nodes,
any runtime filters of the final output node with after_frame = true are executed after those of intermediate nodes,
intermediate nodes have their runtime filters executed in the sequence in which the nodes appear in the script filter graph.
EDIT: incorrect - see subsequent posts.
A subtle implication of the last point is that all runtime filters for a particular intermediate node are evaluated before other nodes later in the script filter graph have their runtime filters evaluated. One unwelcome consequence of that is that runtime code of intermediate nodes cannot determine the nodes' positions in the filter graph - using the nodes' after_frame=false code to increment a node counter for their after_frame=true code to query won't produce the desired result.
This is what I think is going on here, but any corrections and improvements are welcome!
Cheers,
Francois
There seems to be rather more to the evaluation sequence of runtime filters than the "bottom to top" mentioned at The script execution model/Scope and lifetime of variables (http://avisynth.nl/index.php/The_script_execution_model/Scope_and_lifetime_of_variables).
Here,
sequence = ""
BlankClip(length=2, width=160, height=60, color=$000000)
FrameEvaluate("""sequence = sequence + "d"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "c"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "e"""", show=false, after_frame=true)
FrameEvaluate("""sequence = sequence + "f"""", show=false, after_frame=true)
clip1 = last
BlankClip(length=2, width=160, height=60, color=$FFFFFF)
FrameEvaluate("""sequence = sequence + "h"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "g"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "i"""", show=false, after_frame=true)
FrameEvaluate("""sequence = sequence + "j"""", show=false, after_frame=true)
clip2 = last
clip1.Dissolve(clip2, 1)
FrameEvaluate("""sequence = sequence + "b"""", show=false, after_frame=false)
FrameEvaluate("""sequence = "a"""", show=false, after_frame=false)
FrameEvaluate("""sequence = sequence + "k"""", show=false, after_frame=true)
ScriptClip("""
sequence = sequence + "l"
Subtitle(sequence)
""", show=false, after_frame=true)
the sequence of events for e.g. the second frame is abcdefghij.
http://forum.doom9.org/attachment.php?attachmentid=14250&stc=1&d=1403448205
That seems to indicate that:
for runtime filters with after_frame = false, the runtime filters of a particular filter graph node are executed in the opposite sequence to which they appear in the script (i.e. bottom to top as stated),
for runtime filters with after_frame = true, the runtime filters of a particular filter graph node are executed in the sequence in which they appear in the script,
any runtime filters of the final output node with after_frame = false are executed before those of intermediate nodes,
any runtime filters of the final output node with after_frame = true are executed after those of intermediate nodes,
intermediate nodes have their runtime filters executed in the sequence in which the nodes appear in the script filter graph.
EDIT: incorrect - see subsequent posts.
A subtle implication of the last point is that all runtime filters for a particular intermediate node are evaluated before other nodes later in the script filter graph have their runtime filters evaluated. One unwelcome consequence of that is that runtime code of intermediate nodes cannot determine the nodes' positions in the filter graph - using the nodes' after_frame=false code to increment a node counter for their after_frame=true code to query won't produce the desired result.
This is what I think is going on here, but any corrections and improvements are welcome!
Cheers,
Francois