Go to the documentation of this file.
26 #ifndef AVCODEC_PUT_BITS_H
27 #define AVCODEC_PUT_BITS_H
39 #define AV_WBBUF AV_WB64
40 #define AV_WLBUF AV_WL64
43 #define AV_WBBUF AV_WB32
44 #define AV_WLBUF AV_WL32
64 if (buffer_size < 0) {
70 s->buf_end =
s->buf + buffer_size;
81 return (
s->buf_ptr -
s->buf) * 8 +
BUF_BITS -
s->bit_left;
91 return s->buf_ptr -
s->buf;
101 return s->buf_ptr -
s->buf + ((
BUF_BITS -
s->bit_left + (round_up ? 7 : 0)) >> 3);
116 s->buf_end =
buffer + buffer_size;
117 s->buf_ptr =
buffer + (
s->buf_ptr -
s->buf);
126 return (
s->buf_end -
s->buf_ptr) * 8 -
BUF_BITS +
s->bit_left;
136 return s->buf_end -
s->buf_ptr - ((
BUF_BITS -
s->bit_left + (round_up ? 7 : 0)) >> 3);
144 #ifndef BITSTREAM_WRITER_LE
146 s->bit_buf <<=
s->bit_left;
150 #ifdef BITSTREAM_WRITER_LE
151 *
s->buf_ptr++ =
s->bit_buf;
167 *
s->buf_ptr++ =
s->bit_buf;
175 #ifdef BITSTREAM_WRITER_LE
176 #define ff_put_string ff_put_string_unsupported_here
177 #define ff_copy_bits ff_copy_bits_unsupported_here
186 int terminate_string);
201 bit_buf =
s->bit_buf;
202 bit_left =
s->bit_left;
205 #ifdef BITSTREAM_WRITER_LE
208 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
215 bit_buf =
value >> bit_left;
221 bit_buf = (bit_buf << n) |
value;
224 bit_buf <<= bit_left;
225 bit_buf |=
value >> (n - bit_left);
226 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
238 s->bit_buf = bit_buf;
239 s->bit_left = bit_left;
259 bit_buf =
s->bit_buf;
260 bit_left =
s->bit_left;
264 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
271 bit_buf =
value >> bit_left;
276 s->bit_buf = bit_buf;
277 s->bit_left = bit_left;
300 bit_buf =
s->bit_buf;
301 bit_left =
s->bit_left;
303 #ifdef BITSTREAM_WRITER_LE
305 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
312 bit_buf = (uint64_t)
value >> bit_left;
314 bit_buf = (uint64_t)bit_buf << bit_left;
316 if (
s->buf_end -
s->buf_ptr >=
sizeof(
BitBuf)) {
326 s->bit_buf = bit_buf;
327 s->bit_left = bit_left;
342 uint32_t lo =
value & 0xffffffff;
343 uint32_t hi =
value >> 32;
344 #ifdef BITSTREAM_WRITER_LE
352 uint32_t lo =
value & 0xffffffff;
353 uint32_t hi =
value >> 32;
354 #ifdef BITSTREAM_WRITER_LE
406 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_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)