On Fri, Jul 17, 2020 at 09:41:19PM +0200, Steinar H. Gunderson wrote:
> Preparatory patch for making the bit buffer different size on different
> platforms; make a typedef and make all the hardcoded sizes into expressions
> deriving from this size.
> 
> No functional change; generated assembler is near-identical.
> ---
>  libavcodec/put_bits.h | 95 +++++++++++++++++++++++--------------------
>  1 file changed, 52 insertions(+), 43 deletions(-)
[...]

> @@ -346,8 +352,8 @@ static inline void skip_put_bytes(PutBitContext *s, int n)
>  static inline void skip_put_bits(PutBitContext *s, int n)
>  {
>      s->bit_left -= n;
> -    s->buf_ptr  -= 4 * (s->bit_left >> 5);
> -    s->bit_left &= 31;
> +    s->buf_ptr  -= sizeof(BitBuf) * ((unsigned)s->bit_left / BUF_BITS);
> +    s->bit_left &= (BUF_BITS - 1);
>  }
>  
>  /**
> @@ -357,9 +363,12 @@ static inline void skip_put_bits(PutBitContext *s, int n)
>   */
>  static inline void set_put_bits_buffer_size(PutBitContext *s, int size)
>  {
> -    av_assert0(size <= INT_MAX/8 - 32);
> +    av_assert0(size <= INT_MAX/8 - BUF_BITS);

this from libavcodec/mpegvideo_enc.c 
            set_put_bits_buffer_size(&s->pb, 
FFMIN(s->thread_context[i]->pb.buf_end - s->pb.buf, INT_MAX/8-32));
needs to be updated too

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

I have often repented speaking, but never of holding my tongue.
-- Xenocrates

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to