133 |
|
|
134 |
void BitstreamWriteVolHeader(Bitstream * const bs, |
void BitstreamWriteVolHeader(Bitstream * const bs, |
135 |
const MBParam * pParam, |
const MBParam * pParam, |
136 |
const FRAMEINFO * frame); |
const FRAMEINFO * const frame); |
137 |
|
|
138 |
void BitstreamWriteVopHeader(Bitstream * const bs, |
void BitstreamWriteVopHeader(Bitstream * const bs, |
139 |
const MBParam * pParam, |
const MBParam * pParam, |
140 |
const FRAMEINFO * frame, |
const FRAMEINFO * const frame, |
141 |
int vop_coded); |
int vop_coded); |
142 |
|
|
143 |
void BitstreamWriteUserData(Bitstream * const bs, |
void BitstreamWriteUserData(Bitstream * const bs, |
337 |
} |
} |
338 |
|
|
339 |
|
|
|
/* pad bitstream to the next byte boundary */ |
|
|
|
|
|
static void __inline |
|
|
BitstreamPad(Bitstream * const bs) |
|
|
{ |
|
|
uint32_t remainder = bs->pos % 8; |
|
|
|
|
|
if (remainder) { |
|
|
BitstreamForward(bs, 8 - remainder); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
340 |
/* read n bits from bitstream */ |
/* read n bits from bitstream */ |
341 |
|
|
342 |
static uint32_t __inline |
static uint32_t __inline |
399 |
} |
} |
400 |
} |
} |
401 |
|
|
402 |
|
|
403 |
|
static const int stuffing_codes[8] = |
404 |
|
{ |
405 |
|
/* nbits stuffing code */ |
406 |
|
0, /* 1 0 */ |
407 |
|
1, /* 2 01 */ |
408 |
|
3, /* 3 011 */ |
409 |
|
7, /* 4 0111 */ |
410 |
|
0xf, /* 5 01111 */ |
411 |
|
0x1f, /* 6 011111 */ |
412 |
|
0x3f, /* 7 0111111 */ |
413 |
|
0x7f, /* 8 01111111 */ |
414 |
|
}; |
415 |
|
|
416 |
|
/* pad bitstream to the next byte boundary */ |
417 |
|
|
418 |
|
static void __inline |
419 |
|
BitstreamPad(Bitstream * const bs) |
420 |
|
{ |
421 |
|
int bits = 8 - (bs->pos % 8); |
422 |
|
if (bits < 8) |
423 |
|
{ |
424 |
|
BitstreamPutBits(bs, stuffing_codes[bits - 1], bits); |
425 |
|
} |
426 |
|
} |
427 |
|
|
428 |
|
|
429 |
|
/* pad bitstream to the next byte boundary |
430 |
|
alway pad: even if currently at the byte boundary */ |
431 |
|
|
432 |
|
static void __inline |
433 |
|
BitstreamPadAlways(Bitstream * const bs) |
434 |
|
{ |
435 |
|
int bits = 8 - (bs->pos % 8); |
436 |
|
BitstreamPutBits(bs, stuffing_codes[bits - 1], bits); |
437 |
|
} |
438 |
|
|
439 |
|
|
440 |
#endif /* _BITSTREAM_H_ */ |
#endif /* _BITSTREAM_H_ */ |