41 |
* * |
* * |
42 |
* Revision history: * |
* Revision history: * |
43 |
* * |
* * |
44 |
|
* 20.05.2002 added BitstreamWriteUserData * |
45 |
* 19.06.2002 Fix a little bug in use custom quant matrix * |
* 19.06.2002 Fix a little bug in use custom quant matrix * |
46 |
* MinChen <chenm001@163.com> * |
* MinChen <chenm001@163.com> * |
47 |
* 08.05.2002 add low_delay support for B_VOP decode * |
* 08.05.2002 add low_delay support for B_VOP decode * |
617 |
|
|
618 |
#ifdef BFRAMES |
#ifdef BFRAMES |
619 |
if (pParam->max_bframes > 0) { |
if (pParam->max_bframes > 0) { |
620 |
dprintf("low_delay=1"); |
DPRINTF("low_delay=1"); |
621 |
BitstreamPutBit(bs, 1); // vol_control_parameters |
BitstreamPutBit(bs, 1); // vol_control_parameters |
622 |
BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" |
BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" |
623 |
BitstreamPutBit(bs, 0); // low_delay |
BitstreamPutBit(bs, 0); // low_delay |
697 |
void |
void |
698 |
BitstreamWriteVopHeader(Bitstream * const bs, |
BitstreamWriteVopHeader(Bitstream * const bs, |
699 |
const MBParam * pParam, |
const MBParam * pParam, |
700 |
const FRAMEINFO * frame) |
const FRAMEINFO * frame, |
701 |
|
int vop_coded) |
702 |
{ |
{ |
703 |
#ifdef BFRAMES |
#ifdef BFRAMES |
704 |
uint32_t i; |
uint32_t i; |
723 |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
724 |
#ifdef BFRAMES |
#ifdef BFRAMES |
725 |
BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase)); |
BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase)); |
726 |
dprintf("[%i:%i] %c\n", frame->seconds, frame->ticks, |
DPRINTF("[%i:%i] %c\n", frame->seconds, frame->ticks, |
727 |
frame->coding_type == I_VOP ? 'I' : frame->coding_type == |
frame->coding_type == I_VOP ? 'I' : frame->coding_type == |
728 |
P_VOP ? 'P' : 'B'); |
P_VOP ? 'P' : 'B'); |
729 |
#else |
#else |
732 |
|
|
733 |
WRITE_MARKER(); |
WRITE_MARKER(); |
734 |
|
|
735 |
|
if (!vop_coded) { |
736 |
|
BitstreamPutBits(bs, 0, 1); |
737 |
|
return; |
738 |
|
} |
739 |
|
|
740 |
BitstreamPutBits(bs, 1, 1); // vop_coded |
BitstreamPutBits(bs, 1, 1); // vop_coded |
741 |
|
|
742 |
if (frame->coding_type == P_VOP) |
if (frame->coding_type == P_VOP) |
758 |
BitstreamPutBits(bs, frame->bcode, 3); // backward_fixed_code |
BitstreamPutBits(bs, frame->bcode, 3); // backward_fixed_code |
759 |
|
|
760 |
} |
} |
761 |
|
|
762 |
|
|
763 |
|
void |
764 |
|
BitstreamWriteUserData(Bitstream * const bs, |
765 |
|
uint8_t * data, |
766 |
|
const int length) |
767 |
|
{ |
768 |
|
int i; |
769 |
|
|
770 |
|
BitstreamPad(bs); |
771 |
|
BitstreamPutBits(bs, USERDATA_START_CODE, 32); |
772 |
|
|
773 |
|
for (i = 0; i < length; i++) { |
774 |
|
BitstreamPutBits(bs, data[i], 8); |
775 |
|
} |
776 |
|
|
777 |
|
} |