[FFmpeg-cvslog] r15595 - trunk/libavcodec/aac_parser.c

Uoti Urpala uoti.urpala
Tue Dec 2 02:35:02 CET 2008

On Tue, 2008-12-02 at 01:59 +0100, Michael Niedermayer wrote:
> On Tue, Dec 02, 2008 at 02:40:02AM +0200, Uoti Urpala wrote:
> > static inline unsigned int working_get_bits(uint64_t state, int *remaining, n)
> > {
> >     *remaining -= n;
> >     return (state >> *remaining) & (1 << n) - 1;
> > }
> > 
> > I didn't test whether that really works, but it shouldn't need anything
> > more complex (and you can use the same function for skip_bits). It
> > should also be faster than using the bitstream reader machinery.
> You can implement your idea above within the bitstream reader framework
> if you think its that fast.

I meant faster in this use, not necessarily as a general bitstream
reader. Here "state" can already be in a register and little
initialization is required. The current code requires more
initialization, and does a memory write followed by different-sized
reads of the same bytes in the bitstream reader.

> if this or your variant is faster depends probably on the compilers optimizer
> and the relative speed of shifts and & on the CPU

I'd expect my variant to be faster on 64-bit at least. On 32-bit it
would depend more on the optimizer (I think my variant should be easier
to optimize, but if the compiler does a bad job it could make a bigger
mess out of the 64-bit arithmetic).

More information about the ffmpeg-cvslog mailing list