[FFmpeg-devel] SOC Qualifiction tasks

Andreas Öman andreas
Fri Mar 14 20:20:45 CET 2008


hi,

Uoti Urpala wrote:
> On Fri, 2008-03-14 at 18:56 +0100, Andreas ?man wrote:
>> * Asynchronous decoding (I.e. decoding frames even when the caller
>>    is not currently in 'avcodec_decode_video()').
>>    Of course this must be fully hidden from the caller POV.
> 
> You can't hide it from the caller. Normally the caller gives the frame
> data and expects full results before the call returns. With that API
> there is nothing to decode when the caller is not currently in
> avcodec_decode_video(). For asynchronous decoding you need a different
> API that allows the caller to queue frames in advance.

I was under the impression that '*got_picture_ptr' would be zero in the
case when the decoder can not (yet) deliver a complete picture.
So it will just be zero the first few calls to avcodec_decode_video().
But perhaps I'm missing something.

>> * Add/Benchmark low level synchronization primitives.
>>    I'm thinking of using SFENCE, MWAIT and MONITOR on x86 for
>>    synchronization. In particular I think it would be useful when
>>    waiting for a particular MB to be completed in a reference (not
>>    yet fully decoded) frame. Ought to be much faster than pthread_
>>    -stuff.
> 
> Do you really need to make the synchronization so finegrained that
> custom synchronization primitives would help? If you're calling pthread
> routines so often that their overhead is significant you'll probably
> waste a lot of CPU on synchronization using any custom routines too.

Perhaps not, but using SFENCE to enforce ordered writes to memory
might be useful in order to achieve weakly ordered synchronization:

Like this:

CPU1:
  {
    decode_horizontal_line_of_mbs(frame, y);
    SFENCE;
    frame->line_completed = y;
    y++;
  }

CPU2: (reference frame is currently decoded by CPU1)

   mc_comp() {
     while(reference_mb.y >= frame->line_completed) {
      go_wait(frame, reference_mb.y);
     }
     read_from_block();
   }

Without at ability to do ordered stores this will not work without
mutexes to enforce synchronization.

The MWAIT and MONITOR we can do without though I guess.





More information about the ffmpeg-devel mailing list