[FFmpeg-devel] [PATCH 2/3] lavfi: add a generic API for buffer queues.

Nicolas George nicolas.george at normalesup.org
Sun May 20 21:23:55 CEST 2012

Le nonidi 9 floréal, an CCXX, Michael Niedermayer a écrit :
> i suggest & (FF_BUFQUEUE_SIZE-1) and only allowing powers of 2
> the & should be much faster than a %

I made sure that the arguments are unsigned, so any half-decent compiler can
optimize the % to a & if the base is a power of 2. I checked that at least
gcc is a half-decent compiler. And I added a comment that powers of 2 are to
be preferred.

> a av_assert() could be used here to detect tries to take out of an
> empty queue


> otherwise LGTM as long as theres no plan to use this between 2 threads

Added a comment about that, along with some doxy.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120520/5f7d1d0f/attachment.asc>

More information about the ffmpeg-devel mailing list