On 10/06/16 09:41, Anton Khirnov wrote:
> Quoting Diego Biurrun (2016-06-09 17:11:44)
>> From: Alexandra Hájková <[email protected]>
>>
>> The new bit reader features a simpler API and an implementation without
>> stacks of nested macros. Performance is the same or better, especially
>> for mezzanine formats and 64-bit platforms.
>> ---
>> Changelog | 1 +
>> libavcodec/bitstream.h | 380
>> +++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 381 insertions(+)
>> create mode 100644 libavcodec/bitstream.h
>>
>> diff --git a/Changelog b/Changelog
>> index a2a9d46..6977397 100644
>> --- a/Changelog
>> +++ b/Changelog
>> @@ -57,6 +57,7 @@ version <next>:
>> - Generic OpenMAX IL encoder with support for Raspberry Pi
>> - MMAL-accelerated MPEG-2 and VC-1 decoding
>> - G.729 raw demuxer
>> +- new bitstream reading framework
>>
>>
>> version 11:
>> diff --git a/libavcodec/bitstream.h b/libavcodec/bitstream.h
>> new file mode 100644
>> index 0000000..539b721
>> --- /dev/null
>> +++ b/libavcodec/bitstream.h
>> +static inline void refill_64(BitstreamContext *bc)
>> +{
>> + if (av_unlikely(bc->ptr >= bc->buffer_end || !bc->buffer))
>
> Why should the second condition ever be true?
!bc->buffer
can go away indeed.
>> +/* Read MPEG-1 dc-style VLC (sign bit + mantissa with no MSB).
>> + * If MSB not set it is negative. */
>> +static inline int bitstream_read_xbits(BitstreamContext *bc, unsigned
>> length)
>> +{
>> + int32_t cache = bitstream_peek(bc, 32);
>> + int sign = ~cache >> 31;
>> + skip_remaining(bc, length);
>
> This used to be bitstream_skip() in the previous versions of the patch.
> It is not immediately obvious to me why the change is correct.
> Same for read_vlc().
bitstream_skip is a skip_remaining + a refill.
bitstream_peek is guarantees you do not have to refill (again).
lu
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel