Quote:
Originally Posted by Dogway
I updated the code a bit, mostly nesting functions, do you think this is better for RAM optimization?
|
It can be in some cases. Nested function calls do not save anything
per se, but if you have filters that are only used on a conditional branch, it can help to avoid calling them unnecessarily outside the condition. (But filters like Trim use very little memory anyway.)
Quote:
Also I want to automatically detect alpha so I can remove the alpha parameter.
As theres are no clip properties associated to alpha evaluation, I try to compare the result from the average of ShowAlpha to White, if false then it has alpha.
Problem here is Im getting errors ("Invalid arguments")when I try AverageLuma, I think because some the ISSE requeriments:
AverageLuma(ShowAlpha(logo0a,"YV12")) == float(HexValue("FFFFFF"))
|
The immediate problem here is that AverageLuma is not a clip property, but a
frame property, so you can only use it inside a
run-time filter such as ScriptClip.
However, you can't reliably detect the presence of alpha by looking at single frames - you would need to check the whole clip for the existence of some frames with AverageLuma not equal to zero or 255 ($ff, not $ffffff). Too complicated to be worth doing, I think.