[FFmpeg-devel] [PATCH 2/3] avcodec/put_bits: Add rebase_put_bits()

Michael Niedermayer michaelni at gmx.at
Mon Sep 29 13:08:05 CEST 2014


On Mon, Sep 29, 2014 at 10:04:04AM +0200, Benoit Fouet wrote:
> 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.

fixed


> 
> > + * @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.

applied

thanks

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

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140929/b0c4611f/attachment.asc>


More information about the ffmpeg-devel mailing list