Well, since we both tend to defend our opinions with long explanations
, I though it would be nice to save some time with a real experiment; I thus present NewScriptClip, a concept-check filter to see who is finally right on this issue (attached).
I have also made a test with a modified (again) version of our reccuring test pattern, see below:
Code:
LoadPlugin("newscriptclip.dll")
# 100 frames black + 100 white, to give predictable luma
BlankClip(100, pixel_type="YV12")+BlankClip(100, pixel_type="YV12", color=color_white)
NewScriptClip("""
SubTitle(String(current_frame), y=10)
""")
Trim(50, 149)
NewScriptClip("""
f1 = current_frame
a1 = AverageLuma() # OK
f2 = current_frame
a2 = AverageLuma() # gives wrong value
f3 = current_frame
SubTitle("a1="+string(a1)+" a2="+string(a2), y=30) # shows a1 != a2
SubTitle(String(f1)+","+String(f2)+","+String(f3), y=50)
""")
to verify that you are right
and I was wrong (but I don;t care for this; its nice to be wrong when stating that something is costly to do
), at least about the feasibility of correcting this issue.
It remains to verify - because this is a very fresh alpha and in this part of the world is late at night and I won't do any testing till half a day at least - that the modded ScriptClip behaves correctly in normal situations (
don't set show=true though; the implementation of this is a stub). A llitle help from the rest of the Avisynth community would be highly appreciated
.
PS: If the modded implementation is proved to behave correctly in all respects, then IMO making current_frame a global would not be a problem to do.