On Tue, 2009-01-06 at 21:34 +0000, Andrew Church wrote:
> >If I understood correctly, you're worried about the need to do a full
> >copy of a frame when it's cloned, given this new model, am I right?
>
> Not just for cloned frames, but for every frame in the resulting stream.
> Under the basic model I'm thinking of, intermediate processors (like
> filters) will allocate a new frame buffer for every frame they produce,
> disposing of every frame they receive once they're done with it. In the
> pathological no-op case, the filter code would look like
>
> FrameBuffer *outframe = framebuffer_get(); // from framebuffer pool
> outframe->frame_num = my_frame_num++;
> memcpy(outframe->data, inframe->data, inframe->data_size);
> framebuffer_free(inframe); // probably done by the function wrapper
> // (as I suggested before) to avoid code
> // duplication in all the filters
>
> which is an obvious waste of time compared to the zero-copy method.
Ok, understood, but why we can't just continue doing
while (have_frames(MY_POOL_ID)) {
FrameBuffer *frame = framebuffer_get(MY_POOL_ID);
do_some_processing(frame);
frame->id = my_frame_num++;
framebuffer_put(frame, NEXT_POOL_ID); // the frame->status switch is
// actually done here
}
like we already do?
(our current code is not that different, see for example
frame_threads.c , and vframe_reserve/vframe_push_next and their
implementation)
In a nutshell, why can't just pass away the old frame recycling it?
I mean, from the POW of a given processing state, disposing a frame can
be seen just as putting the frame into NULL (or any else) pool and
forget about it.
Of course things changes slightly for cloned frames.
Bests,
--
Francesco Romani // Ikitt
http://fromani.exit1.org ::: transcode homepage
http://tcforge.berlios.de ::: transcode experimental forge