[FFmpeg-devel] [PATCH 2/3] avcodec/put_bits: Add rebase_put_bits()
Benoit Fouet
benoit.fouet at free.fr
Mon Sep 29 10:04:04 CEST 2014
Hi,
----- Mail original -----
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
> libavcodec/put_bits.h | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
> index 8081fb9..f16d04a 100644
> --- a/libavcodec/put_bits.h
> +++ b/libavcodec/put_bits.h
> @@ -63,6 +63,23 @@ static inline void init_put_bits(PutBitContext *s,
> uint8_t *buffer,
> }
>
> /**
> + * Rebase the bit writer onto a reallocted buffer.
> + *
>
reallocated
Also, IMHO, it should be mentioned that the new buffer has to be larger than the previous one.
> + * @param buffer the buffer where to put bits
> + * @param buffer_size the size in bytes of buffer
> + */
> +static inline void rebase_put_bits(PutBitContext *s, uint8_t
> *buffer,
> + int buffer_size)
> +{
> + av_assert0(8*buffer_size > s->size_in_bits);
> +
> + s->buf_end = buffer + buffer_size;
> + s->buf_ptr = buffer + (s->buf_ptr - s->buf);
> + s->buf = buffer;
> + s->size_in_bits = 8 * buffer_size;
> +}
> +
> +/**
> * @return the total number of bits written to the bitstream.
> */
> static inline int put_bits_count(PutBitContext *s)
>
LGTM otherwise.
--
Ben
More information about the ffmpeg-devel
mailing list