[FFmpeg-devel] libavcodec: inter thread signaling

Anoop Bhagyanath bhagyanath.anoop at gmail.com
Tue Feb 28 20:35:14 CET 2012

thank you guys for replying fast

i did a few tests on this frame level multi-threading support
implemented in libavcodec/pthread.c. on a machine with 2 cores, 3 decoding
threads are
created. while decoding a HD mp4 file  -

*i found that, all 3 decoding threads waits for a considerable amount of
time on progress_cond, ie waiting
 for progress of other threads (from one example test - out of a total
decoding time of
 44sec, thread1 waits for 10sec, thread2 12sec and thread3 also 12sec). i
am sure we have
 quite sometime there, wherein both the cores are not utilized fully. ie
cases when only one
 thread is running, whereas the ideal case is when we always have 2 active
running threads.
 i spawned an additional monitoring thread, which basically tells me how
many points in time,
 the number of active running threads is < num_cores. and the number was a
lot. but i do not
 have time measurement for this yet.

*my point is "can we not have a dynamic thread management,
 which basically looks at the number of active threads and spawns a new
thread everytime it
 finds num_active_threads < num_cores. but with this new thread, we have to
make sure that
 we give it an entity(frame or slice, frame in this case ), which can be
definitely decoded and
 references can be stored so that any future frames depending on this frame
need not wait
 anymore". i am sure people would have thought about this earlier and i am
keen to hear
 suggestions from you guys regarding this.

sorry for making it so long. i really could not have described this in
lesser sentences.

thank you,

On Tue, Feb 28, 2012 at 7:31 AM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de>wrote:

> On 27 Feb 2012, at 17:45, Andrey Utkin <andrey.krieger.utkin at gmail.com>
> wrote:
> > 2012/2/27 Anoop Bhagyanath <bhagyanath.anoop at gmail.com>:
> >>
> >> *when a decoding thread needs some data from another frame(basically
> >> another decoding thread), it awaits the
> >>  progress of that thread. but on what basis this other decoding thread
> know
> >> that someone is waiting for the data
> >>  from him/her.
> >
> > I think it does not know, and does not need to know.
> To make this more clear: each decoding thread stores its progress in the
> frame it decodes.
> It is completely irrelevant to it if anyone needs that information right
> at that moment or not.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list