Go to the documentation of this file.
26 #ifndef AVCODEC_PUT_BITS_H
27 #define AVCODEC_PUT_BITS_H
40 #define AV_WBBUF AV_WB64
41 #define AV_WLBUF AV_WL64
44 #define AV_WBBUF AV_WB32
45 #define AV_WLBUF AV_WL32
65 if (buffer_size < 0) {
71 s->buf_end =
s->buf + buffer_size;
82 return (
s->buf_ptr -
s->buf) * 8 +
BUF_BITS -
s->bit_left;
92 return s->buf_ptr -
s->buf;
102 return s->buf_ptr -
s->buf + ((
BUF_BITS -
s->bit_left + (round_up ? 7 : 0)) >> 3);
117 s->buf_end =
buffer + buffer_size;
118 s->buf_ptr =
buffer + (
s->buf_ptr -
s->buf);
127 return (
s->buf_end -
s->buf_ptr) * 8 -
BUF_BITS +
s->bit_left;
137 return s->buf_end -
s->buf_ptr - ((
BUF_BITS -
s->bit_left + (round_up ? 7 : 0)) >> 3);
145 #ifndef BITSTREAM_WRITER_LE
147 s->bit_buf <<=
s->bit_left;
151 #ifdef BITSTREAM_WRITER_LE
152 *
s->buf_ptr++ =
s->bit_buf;
168 *
s->buf_ptr++ =
s->bit_buf;
176 #ifdef BITSTREAM_WRITER_LE
177 #define ff_put_string ff_put_string_unsupported_here
178 #define ff_copy_bits ff_copy_bits_unsupported_here
187 int terminate_string);
202 bit_buf =
s->bit_buf;
203 bit_left =
s->bit_left;
206 #ifdef BITSTREAM_WRITER_LE
209 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
216 bit_buf =
value >> bit_left;
222 bit_buf = (bit_buf << n) |
value;
225 bit_buf <<= bit_left;
226 bit_buf |=
value >> (n - bit_left);
227 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
239 s->bit_buf = bit_buf;
240 s->bit_left = bit_left;
260 bit_buf =
s->bit_buf;
261 bit_left =
s->bit_left;
265 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
272 bit_buf =
value >> bit_left;
277 s->bit_buf = bit_buf;
278 s->bit_left = bit_left;
301 bit_buf =
s->bit_buf;
302 bit_left =
s->bit_left;
304 #ifdef BITSTREAM_WRITER_LE
306 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
313 bit_buf = (uint64_t)
value >> bit_left;
315 bit_buf = (uint64_t)bit_buf << bit_left;
317 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
327 s->bit_buf = bit_buf;
328 s->bit_left = bit_left;
343 uint32_t lo =
value & 0xffffffff;
344 uint32_t hi =
value >> 32;
345 #ifdef BITSTREAM_WRITER_LE
353 uint32_t lo =
value & 0xffffffff;
354 uint32_t hi =
value >> 32;
355 #ifdef BITSTREAM_WRITER_LE
414 s->buf_end =
s->buf +
size;
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
Write exactly 32 bits into a bitstream.
static void align_put_bits(PutBitContext *s)
Pad the bitstream with zeros up to the next byte boundary.
static int put_bytes_output(const PutBitContext *s)
static void put_sbits(PutBitContext *pb, int n, int32_t value)
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
Put the string string in the bitstream.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
static const int BUF_BITS
static void put_bits64(PutBitContext *s, int n, uint64_t value)
Write up to 64 bits into a bitstream.
static int put_bytes_count(const PutBitContext *s, int round_up)
void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
Copy the content of src to the bitstream.
static int put_bits_left(PutBitContext *s)
static int put_bytes_left(const PutBitContext *s, int round_up)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void rebase_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Rebase the bit writer onto a reallocated buffer.
static void skip_put_bits(PutBitContext *s, int n)
Skip the given number of bits.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static void flush_put_bits_le(PutBitContext *s)
static void put_sbits63(PutBitContext *pb, int n, int64_t value)
static void put_bits(PutBitContext *s, int n, BitBuf value)
Write up to 31 bits into a bitstream.
static void set_put_bits_buffer_size(PutBitContext *s, int size)
Change the end of the buffer.
static void put_bits_no_assert(PutBitContext *s, int n, BitBuf value)
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
static int put_bits_count(PutBitContext *s)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
static uint8_t * put_bits_ptr(PutBitContext *s)
Return the pointer to the byte where the bitstream writer will put the next bit.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
static void skip_put_bytes(PutBitContext *s, int n)
Skip the given number of bytes.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static void put_bits_le(PutBitContext *s, int n, BitBuf value)