[FFmpeg-devel] [RFC] Replace the bitstream reader

Michael Niedermayer michael at niedermayer.cc
Sun Nov 24 15:59:42 EET 2019


On Sun, Nov 24, 2019 at 11:35:51AM +0100, alexandrahajkova at post.cz wrote:
> Hello,
> 
> I'd like to add the bitstream reader I wrote a few years ago. It
>   would replace the original get_bits.h
> 
> The new bitstream reader is
> written to be easier to use, more consistent and to be easier to
> follow. It is better documented  and is consistent with the
> bytestream reader naming.
> 
> Some of bitstream.h functions replaces several ones from get_bits.h at once:
> bitstream_read() reads bits from the 0-32 range and replaces:
> get_bits()
> get_bits_long()
> get_bitsz()
> 
> bitstream_peek() replaces:
> show_bits()
> show_bits_long()
> show_bits1()
> 
> bitstream_skip() replaces:
> skip_bits1()
> skip_bits()
> skip_bits_long()
> 
> 
> My bitstream reader is faster in most cases but may get slower on some 
> arches 
> 
> 
> and codec types. I did some benchmarks and for example on x86_64, 64-bit 
> (Intel Core
> 
> i3-2120, 3.30GHz)
> I saw no speed regressions for HEVC and x264 and some speed ups for
> OPUS, AAC, DCA,
> SVQ3. PRORES was even 11 % faster.
> 
> 
[...]
> 
> Is such an idea interesting?
> Any suggestions or the improvements are welcome.

In addition to what carl and paul said,

if you can make any (speed relevant) code faster, (by switching the reader
or other) then thats a good thing (unless theres some disproportional
other disadvantage).
Similarly if you can make some code cleaner without speed loss that too
would be welcome.
For example, maybe one or more of the _bits1 functions could be dropped with 
no speed loss. I never tried that ...

About the documentation of the existing code. If someone tells me where the
bitreader is poorly documented (it no doubt is at some places). I am happy
to improve the documentation. I know the "old" bitreader quite well so its
easy for me to document better

Thanks

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20191124/84e02751/attachment.sig>


More information about the ffmpeg-devel mailing list