View Single Post
Old 4th August 2009, 07:02   #6  |  Link
D'zzy
paint it red
 
D'zzy's Avatar
 
Join Date: Jul 2009
Posts: 19
Gavino has pointed me to this, and now I understand it better how a script works. (Thanks, Gavino!)

How about this script:
Code:
DGSource() #Source has no sound. #[1]

R1=imagesource("%03d.png", 904, 911, fps=last.framerate, pixel_type="rgb32").converttoyv12() #[2]
R2=imagesource("%04d.png", 5163, 5163, fps=last.framerate, pixel_type="rgb32").converttoyv12() #[3]

trim(0,903) ++ R1 ++ trim(912,5162) ++ R2 ++ trim(5164,0)#[4]
Let me describe how I understand it:

When a frame is called, [4] is requested, and [4] will request something according to the called frame number:
If the called frame is in range [0,903], then [4] requests it from [1].
If the called frame is in range [904,911], then [4] requests it from [2]; and only for frames in this range is imagesource() for R1 is run.
If the called frame is in range [912,5162], then [4] requests it from [1].
If the called frame is in range [5163,5163], then [4] requests it from [3]; and only for frames in this range is imagesource() for R2 is run.
If the called frame is in range [5164,0], then [4] requests it from [1].


If this theory is true, then the "range" is determined prior to all the requests above. How is this done? Maybe imagesource() is called just for the frame-number part for this "range"? Sounds unlikely... [But it is good because in this way, only one instance of imagesource() is running at a time.]

Another assumption:

R1, R2 brings one instance of imagesource() each, as soon as the script is loaded. Hence, 2 instances of imagesource() are running at the same time, throughout the whole run of the script. This requires more memory I think. Or maybe imagesource() just takes too little memory to be an issue?



In my current script, there're R1,R2, ..., R7 and the script is running without crash. That's fine. Well, I just need to make it clear

BTW, is there a plugin that shows how much memory each function takes in a script?

I've also come up with another way of doing frame replacement from external images:

Code:
DGSource() #Source has no sound.

#Renamed images to 000.png 001.png ... 011.png
R=imagesource("%03d.png", 000, 011, fps=last.framerate, pixel_type="rgb32").converttoyv12()
RemapFrames(mappings="
[904 911] [0 7]
5163 8
[5400 5402] [9 11]", sourceClip=R)
How is this compared to the R1,R2 solution? (memory-wise)

Hey, anybody tested the samples already? Your advice is always appreciated!

Last edited by D'zzy; 4th August 2009 at 07:32.
D'zzy is offline   Reply With Quote