[Ffmpeg-devel] Re: [Ffmpeg-cvslog] r7570 - trunk/libavutil/fifo.c

Roman Shaposhnik rvs
Fri Jan 19 04:19:23 CET 2007


On Fri, 2007-01-19 at 03:48 +0100, Michael Niedermayer wrote:
> Hi
> On Thu, Jan 18, 2007 at 04:41:21PM -0800, Roman Shaposhnik wrote:
> [...]
> > 
> > > the extra if() also should disapear for av_fifo_read() if its inlined
> > > and the body of the while loop will be executed just once normally
> > > and rarely twice, but never more often then twice
> > > 
> > > do you know of any specific places in libav* where there are so many
> > > calls to av_fifo_*read() that this could matter?
> > 
> >   Nope. All I care about is av_fifo_peek() ;-)
> attached patch removes it and makes your code about 35% faster ;)

  Well, I had it coming ;-)

  Now, the only problem I have with your approach is that you're
exposing the guts of a Fifo implementation and that doesn't seem
right to my OO-self. After all, that's what av_fifo_peek()
was introduced for anyway. 

> and i suspect it can be made even faster, of course this is not possible
> with a av_fifo_peek like system

  You're right. However, I suspect that the most dramatic way of
speeding it up would be to iterate over the fifo itself and shuffle
at the frame level. We might also benefit from a precomputed reversed
shuffling table (but most probably it wouldn't really matter since 
it all fits into the cache anyway). I think it'll be the best
of both worlds -- one wouldn't have to expose the guts yet the speed
up will be there as well.

  Thoughts ?


More information about the ffmpeg-devel mailing list