View Single Post
Old 26th September 2008, 11:23   #11  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
OK, I should have realised you meant that, having seen similar code in MRestore.

The variables in your example don't need to be global, as they are at the outer script-level scope (and hence persistent). But of course, if you need to see them in functions called from within the ScriptClip, they would have to be global (or passed as parameters).

If you are using GRunT, the example could also be written as
Code:
ScriptClip(last, """
prev = AverageLuma(-1)
curr = AverageLuma()
next = AverageLuma(1)
...outputclip...
""")
which would be slightly faster than the standard ScriptClip, though clearly still slower than your optimisation.
(As you know, the disadvantage of the optimised version is that it does not support seeking, since it relies on linear access.)
Gavino is offline   Reply With Quote