View Single Post
Old 4th April 2011, 00:29   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
I don't yet fully understand how your code is designed to work, but are you sure the recursion bottoms out?
Basically, the recursion occurs in the functions StabilizeClockwise and StabilizeCounterclockwise:
Quote:
Originally Posted by Mini-Me View Post
Code:
function StabilizeClockwise(clip currentandedgeswoven)
{ ...
	# If current is not the best, recurse again using the best
	return GScriptClip(currentandedgeswoven, """
		return AverageLuma(currentandedgeswoven) == AverageLuma(bestandedgeswoven) ? currentandedgeswoven \
		: StabilizeClockwise(currentandedgeswoven)
		""", args = "currentandedgeswoven, bestandedgeswoven", local = True)
}
Perhaps it should be using bestandedgeswoven on the recursive call?

Quote:
According to Gavino's GRunT thread, you should be able to call runtime functions within user functions called by runtime functions
What you are doing is slightly different, in that you are calling (G)ScriptClip itself recursively. I think this should work, but perhaps it's inefficient and unnecessary. Because of the ability to call runtime functions (eg AverageLuma) directly from a user function, you don't need to wrap the inner call inside ScriptClip or ConditionalFilter, as long as the function itself is called inside ScriptClip. But that would involve a redesign of your outer level function so that ScriptClip is called only once and all the recursion takes place inside it.
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 4th April 2011 at 00:32.
Gavino is offline   Reply With Quote