[FFmpeg-devel] LIBMPEG2_BITSTREAM_READER vs. golomb.h

Måns Rullgård mans
Mon Jul 14 01:02:47 CEST 2008

I just spent some time bug-hunting, only to discover that the
exp-golomb functions in golomb.h do not work with
LIBMPEG2_BITSTREAM_READER.  This is because they rely on more than the
promised 17 bits to be available after an UPDATE_CACHE() call.

To avoid future mishaps, I was thinking of adding a preprocessor check
to golomb.h (I'm too lazy to try to make it work).  What exactly is
the requirement here?  The code seems to assume 32 bits are available,
even though ALT_BITSTREAM_READER only promises 25 bits.  Clearly,
those 25 bits are sufficient for actual data.  Briefly looking at the
H.264 spec, I can't find any mention of a maximum length for
exp-golomb codes.  Did I miss something, or is there really no limit?

This is all annoying because LIBMPEG2_BITSTREAM_READER is slightly
faster on ARM.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list