41 |
* * |
* * |
42 |
* Revision history: * |
* Revision history: * |
43 |
* * |
* * |
44 |
|
* 28.06.2002 added check_resync_marker() * |
45 |
* 14.04.2002 bframe encoding * |
* 14.04.2002 bframe encoding * |
46 |
* 08.03.2002 initial version; isibaar * |
* 08.03.2002 initial version; isibaar * |
47 |
* * |
* * |
572 |
* decoding stuff starts here * |
* decoding stuff starts here * |
573 |
***************************************************************/ |
***************************************************************/ |
574 |
|
|
575 |
|
|
576 |
|
void |
577 |
|
skip_stuffing(Bitstream *bs) |
578 |
|
{ |
579 |
|
while (BitstreamShowBits(bs, 9) == 1) |
580 |
|
BitstreamSkip(bs, 9); |
581 |
|
} |
582 |
|
|
583 |
|
|
584 |
|
|
585 |
|
// for IVOP addbits == 0 |
586 |
|
// for PVOP addbits == fcode - 1 |
587 |
|
// for BVOP addbits == max(fcode,bcode) - 1 |
588 |
|
// returns true or false |
589 |
|
int |
590 |
|
check_resync_marker(Bitstream * bs, int addbits) |
591 |
|
{ |
592 |
|
uint32_t nbits; |
593 |
|
uint32_t code; |
594 |
|
uint32_t nbitsresyncmarker = NUMBITS_VP_RESYNC_MARKER + addbits; |
595 |
|
|
596 |
|
nbits = BitstreamNumBitsToByteAlign(bs); |
597 |
|
code = BitstreamShowBits(bs, nbits); |
598 |
|
|
599 |
|
if (code == (((uint32_t)1 << (nbits - 1)) - 1)) |
600 |
|
{ |
601 |
|
return BitstreamShowBitsFromByteAlign(bs, nbitsresyncmarker) == RESYNC_MARKER; |
602 |
|
} |
603 |
|
|
604 |
|
return 0; |
605 |
|
} |
606 |
|
|
607 |
|
|
608 |
|
|
609 |
int |
int |
610 |
get_mcbpc_intra(Bitstream * bs) |
get_mcbpc_intra(Bitstream * bs) |
611 |
{ |
{ |
612 |
|
|
613 |
uint32_t index; |
uint32_t index; |
614 |
|
|
615 |
while ((index = BitstreamShowBits(bs, 9)) == 1) |
index = BitstreamShowBits(bs, 9); |
|
BitstreamSkip(bs, 9); |
|
|
|
|
616 |
index >>= 3; |
index >>= 3; |
617 |
|
|
618 |
BitstreamSkip(bs, mcbpc_intra_table[index].len); |
BitstreamSkip(bs, mcbpc_intra_table[index].len); |
627 |
|
|
628 |
uint32_t index; |
uint32_t index; |
629 |
|
|
630 |
while ((index = CLIP(BitstreamShowBits(bs, 9), 256)) == 1) |
index = CLIP(BitstreamShowBits(bs, 9), 256); |
|
BitstreamSkip(bs, 9); |
|
631 |
|
|
632 |
BitstreamSkip(bs, mcbpc_inter_table[index].len); |
BitstreamSkip(bs, mcbpc_inter_table[index].len); |
633 |
|
|