Revision 43d7c611 libavcodec/put_bits.h

View differences:

libavcodec/put_bits.h
136 136
 */
137 137
void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
138 138

  
139
/**
140
 * Write up to 31 bits into a bitstream.
141
 * Use put_bits32 to write 32 bits.
142
 */
139 143
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
140 144
#ifndef ALT_BITSTREAM_WRITER
141 145
{
......
143 147
    int bit_left;
144 148

  
145 149
    //    printf("put_bits=%d %x\n", n, value);
146
    assert(n == 32 || value < (1U << n));
150
    assert(n <= 31 && value < (1U << n));
147 151

  
148 152
    bit_buf = s->bit_buf;
149 153
    bit_left = s->bit_left;
......
260 264
}
261 265

  
262 266
/**
267
 * Write exactly 32 bits into a bitstream
268
 */
269
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
270
{
271
    int lo = value & 0xffff;
272
    int hi = value >> 16;
273
#ifdef ALT_BITSTREAM_WRITER_LE
274
    put_bits(s, 16, lo);
275
    put_bits(s, 16, hi);
276
#else
277
    put_bits(s, 16, hi);
278
    put_bits(s, 16, lo);
279
#endif
280
}
281

  
282
/**
263 283
 * Returns the pointer to the byte where the bitstream writer will put
264 284
 * the next bit.
265 285
 */

Also available in: Unified diff