[FFmpeg-devel] [RFC] threading API
Michael Niedermayer
michaelni
Tue Oct 6 13:52:47 CEST 2009
On Tue, Oct 06, 2009 at 09:17:30AM +0200, Reimar D?ffinger wrote:
> On Tue, Oct 06, 2009 at 09:01:15AM +0200, Reimar D?ffinger wrote:
> > The later is only a very minor optimization, and if a API change should
> > be avoided by all means, the former can be achieved also by adding to
> > AVCodecContext a set_thread_number callback, that if set is executed
> > each time before the main worker function with the same void *arg, i.e.
> > void (*set_thread_number)(struct AVCodecContext *c, void *arg, int thread)
> >
> > So, what are the opinions? Other ideas?
>
> Actually, a better idea: add a
> void *(get_worker_arg)(struct AVCodecContext *c, void *arg_array, int arg_size,
> int arg_elem_size, int jobnr, int threadnr)
> where the arg_ stuff matches with the avctx->execute (arg2, count, size)
> arguments.
> The default implementation would then be
> default_get_worker_arg:
> return (char*)arg_array + jobnr*arg_elem_size;
> whereas dnxhdenc would use something like
> DNXHDContext *c = ((DNXHDContext **)arg_array)[threadnr];
> c->start_slice = jobnr;
> return c;
I see no reason why we ever should do
return (char*)arg_array + jobnr*arg_elem_size
its always better to reuse contexts
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091006/d5136430/attachment.pgp>
More information about the ffmpeg-devel
mailing list