[FFmpeg-devel] LIBMPEG2_BITSTREAM_READER vs. golomb.h

Måns Rullgård mans
Mon Jul 14 15:30:35 CEST 2008


Michael Niedermayer wrote:
> On Mon, Jul 14, 2008 at 04:28:03AM +0100, M?ns Rullg?rd wrote:
>> Michael Niedermayer <michaelni at gmx.at> writes:
>>
>> > On Mon, Jul 14, 2008 at 12:02:47AM +0100, M?ns Rullg?rd wrote:
>> >> 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).
>> >
>> > try:
>> > @@ -64,10 +63,12 @@
>> >
>> >          return ff_ue_golomb_vlc_code[buf];
>> >      }else{
>> > -        log= 2*av_log2(buf) - 31;
>> > -        buf>>= log;
>> > +        log= 31 - av_log2(buf);
>>
>> Doesn't this still assume that the 1 bit is somewhere in the bit
>> cache?  That won't be the case if there are more than 16 leading
>> zeros.
>
> Which syntax element of H.264 may have more than 16 leading zeros?

I don't know, but I don't know that there isn't one either.  Besides,
exp-golomb coding is used in other places than H.264.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list