Hi, 2011/12/15 Måns Rullgård <[email protected]>
> "Ronald S. Bultje" <[email protected]> writes: > > > From: "Ronald S. Bultje" <[email protected]> > > > > Based on work (for GCI) by Aneesh Dogra <[email protected]>, and > > inspired by patch in Chromium by Chris Evans <[email protected]>. > > > > When turned on, H264/CAVLC gets ~15% (CVPCMNL1_SVA_C.264) slower for > > ultra-high-bitrate files, or ~2.5% (CVFI1_SVA_C.264) for lower-bitrate > > files. Other codecs are affected to a lesser extent because they are > > less optimized; e.g., VC-1 slows down by less than 1% (all on x86). > > The patch generated 3 extra instructions (cmp, cmovae and mov) per > > call to get_bits(). > > --- > > configure | 2 ++ > > libavcodec/get_bits.h | 48 > ++++++++++++++++++++++++++++++++++++++++++++++-- > > libavcodec/wmavoice.c | 2 ++ > > 3 files changed, 50 insertions(+), 2 deletions(-) > > > > diff --git a/configure b/configure > > index b3af2e9..056f409 100755 > > --- a/configure > > +++ b/configure > > @@ -113,6 +113,7 @@ Configuration options: > > --disable-dxva2 disable DXVA2 code > > --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger > binary) > > --enable-hardcoded-tables use hardcoded tables instead of runtime > generation > > + --disable-safe-bitstream-reader disable buffer boundary checking in > bitreaders (faster, but may crash) > > --enable-memalign-hack emulate memalign, interferes with memory > debuggers > > --disable-everything disable all components listed below > > --disable-encoder=NAME disable encoder NAME > > The help output should list the flag needed to change the default. As > written, it gives the impression it is on by default. > > > @@ -144,7 +164,13 @@ for examples see get_bits, show_bits, skip_bits, > get_vlc > > # endif > > > > // FIXME name? > > +#if UNCHECKED_BITSTREAM_READER > > # define SKIP_COUNTER(name, gb, num) name##_index += (num) > > +#else > > +# define SKIP_COUNTER(name, gb, num) name##_index = \ > > + (gb)->size_in_bits_plus1 - name##_index < (num) ? \ > > + (gb)->size_in_bits_plus1 : name##_index + (num) > > +#endif > > Thinking more carefully about it, this addition is overflow-safe since > the skip amount must be small and we require end padding. Your old > version with FFMIN(size, index + num) is thus safe here after all, > should it result in better code. Thinking about it, I don't think that's right. Padding can't overflow size of int of buffersize in bytes, but size_in_bits is - well - in bits, so if bits is MAXINT, then the addition can overflow even though the size of the padded buffer is (1<<28) + padding_size. (Does that make sense?) Ronald
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
