Log in

View Full Version : can multiple frames be processed once and the result be reused?


E-Male
22nd March 2005, 08:40
ok, i hope i can put the question into understandable english:

simple example:
avg_5_to_10(clip) replaces the frames 5,6,7,8,9&10 by the average of 5,6,7,8,9&10

to do this i'd have to write the plug-in in a way that does the averaging of the 6 frames 6 times (once per frame)
but this would be a waste of cpu time, because it's 6 times the same

could i somehow do the calculation only once and use the result for all 6 frames

thx

IanB
22nd March 2005, 12:54
E-Male,

If you don't want to get into heavy internalsavg_5_to_10()
FreezeFrame(5, 10, 5)Will ultimatly have the effect I think you want, assuming the cache is doing it's job.

Or

In your filter it would be possible to define a PVideoFrame class variable, env->NewVideoFrame() to get an instance the first time it's needed, fill in the contents and return that same frame each time it's GetFrame()'d for.

Have a look at the source for BlankClip() and ColorBars() they build the contents in the constructor and return that same frame every time. Close to what I think you want.

IanB

E-Male
15th April 2005, 10:43
finally had a chance to look at it
colorbars is much more inspireing than i thought :)
it'll help getting started with this for sure

thx a lot
and sorry replying so late