41 |
* * |
* * |
42 |
* Revision history: * |
* Revision history: * |
43 |
* * |
* * |
44 |
|
* 01.05.2002 added BVOP support to BitstreamWriteVopHeader |
45 |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
46 |
* 26.03.2002 interlacing support * |
* 26.03.2002 interlacing support * |
47 |
* 03.03.2002 qmatrix writing * |
* 03.03.2002 qmatrix writing * |
684 |
const MBParam * pParam, |
const MBParam * pParam, |
685 |
const FRAMEINFO * frame) |
const FRAMEINFO * frame) |
686 |
{ |
{ |
687 |
|
#ifdef BFRAMES |
688 |
|
uint32_t i; |
689 |
|
#endif |
690 |
BitstreamPad(bs); |
BitstreamPad(bs); |
691 |
BitstreamPutBits(bs, VOP_START_CODE, 32); |
BitstreamPutBits(bs, VOP_START_CODE, 32); |
692 |
|
|
693 |
BitstreamPutBits(bs, frame->coding_type, 2); |
BitstreamPutBits(bs, frame->coding_type, 2); |
694 |
|
|
695 |
// time_base = 0 write n x PutBit(1), PutBit(0) |
// time_base = 0 write n x PutBit(1), PutBit(0) |
696 |
|
#ifdef BFRAMES |
697 |
|
for (i = 0; i < frame->seconds; i++) |
698 |
|
{ |
699 |
|
BitstreamPutBit(bs, 1); |
700 |
|
} |
701 |
|
BitstreamPutBit(bs, 0); |
702 |
|
#else |
703 |
BitstreamPutBits(bs, 0, 1); |
BitstreamPutBits(bs, 0, 1); |
704 |
|
#endif |
705 |
|
|
706 |
WRITE_MARKER(); |
WRITE_MARKER(); |
707 |
|
|
708 |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
709 |
|
#ifdef BFRAMES |
710 |
|
BitstreamPutBits(bs, frame->ticks, 5); |
711 |
|
dprintf("[%i:%i] %c\n", frame->seconds, frame->ticks, frame->coding_type == I_VOP ? 'I' : frame->coding_type == P_VOP ? 'P' : 'B'); |
712 |
|
#else |
713 |
BitstreamPutBits(bs, 1, 1); |
BitstreamPutBits(bs, 1, 1); |
714 |
|
#endif |
715 |
|
|
716 |
WRITE_MARKER(); |
WRITE_MARKER(); |
717 |
|
|
731 |
BitstreamPutBits(bs, frame->quant, 5); // quantizer |
BitstreamPutBits(bs, frame->quant, 5); // quantizer |
732 |
|
|
733 |
if (frame->coding_type != I_VOP) |
if (frame->coding_type != I_VOP) |
734 |
BitstreamPutBits(bs, frame->fcode, 3); // fixed_code = [1,4] |
BitstreamPutBits(bs, frame->fcode, 3); // forward_fixed_code |
735 |
|
|
736 |
|
if (frame->coding_type == B_VOP) |
737 |
|
BitstreamPutBits(bs, frame->bcode, 3); // backward_fixed_code |
738 |
|
|
739 |
} |
} |