[FFmpeg-cvslog] avcodec/put_bits: Add rebase_put_bits()
Michael Niedermayer
git at videolan.org
Mon Sep 29 15:23:23 CEST 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Sep 29 05:42:24 2014 +0200| [cf32181b70116309b3a33c8f6bf017a0d0a33089] | committer: Michael Niedermayer
avcodec/put_bits: Add rebase_put_bits()
Reviewed-by: Benoit Fouet <benoit.fouet at free.fr>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cf32181b70116309b3a33c8f6bf017a0d0a33089
---
libavcodec/put_bits.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 8081fb9..8858caa 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -63,6 +63,24 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer,
}
/**
+ * Rebase the bit writer onto a reallocated buffer.
+ *
+ * @param buffer the buffer where to put bits
+ * @param buffer_size the size in bytes of buffer,
+ * must be larger than the previous size
+ */
+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)
More information about the ffmpeg-cvslog
mailing list