41 |
* * |
* * |
42 |
* Revision history: * |
* Revision history: * |
43 |
* * |
* * |
44 |
* 01.05.2002 added BVOP support to BitstreamWriteVopHeader |
* 08.05.2002 add low_delay support for B_VOP decode * |
45 |
|
* MinChen <chenm001@163.com> * |
46 |
|
* 06.05.2002 low_delay * |
47 |
|
* 06.05.2002 fixed fincr/fbase error * |
48 |
|
* 01.05.2002 added BVOP support to BitstreamWriteVopHeader * |
49 |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
50 |
* 26.03.2002 interlacing support * |
* 26.03.2002 interlacing support * |
51 |
* 03.03.2002 qmatrix writing * |
* 03.03.2002 qmatrix writing * |
62 |
#include "../quant/quant_matrix.h" |
#include "../quant/quant_matrix.h" |
63 |
|
|
64 |
|
|
65 |
static int __inline log2bin(int value) |
static uint32_t __inline log2bin(uint32_t value) |
66 |
{ |
{ |
67 |
/* Changed by Chenm001 */ |
/* Changed by Chenm001 */ |
68 |
#ifndef WIN32 |
#ifndef WIN32 |
226 |
{ |
{ |
227 |
DEBUG("+ vol_control_parameters"); |
DEBUG("+ vol_control_parameters"); |
228 |
BitstreamSkip(bs, 2); // chroma_format |
BitstreamSkip(bs, 2); // chroma_format |
229 |
BitstreamSkip(bs, 1); // low_delay |
dec->low_delay=BitstreamGetBit(bs); // low_delay |
230 |
if (BitstreamGetBit(bs)) // vbv_parameters |
if (BitstreamGetBit(bs)) // vbv_parameters |
231 |
{ |
{ |
232 |
DEBUG("+ vbv_parameters"); |
DEBUG("+ vbv_parameters"); |
563 |
} |
} |
564 |
} |
} |
565 |
|
|
566 |
*quant = BitstreamGetBits(bs, dec->quant_bits); // vop_quant |
if((*quant = BitstreamGetBits(bs, dec->quant_bits)) < 1) // vop_quant |
567 |
|
*quant = 1; |
568 |
|
|
569 |
//DEBUG1("quant", *quant); |
//DEBUG1("quant", *quant); |
570 |
|
|
571 |
if (coding_type != I_VOP) |
if (coding_type != I_VOP) |
645 |
BitstreamPutBits(bs, 0, 8); // video_object_type_indication |
BitstreamPutBits(bs, 0, 8); // video_object_type_indication |
646 |
BitstreamPutBit(bs, 0); // is_object_layer_identified (0=not given) |
BitstreamPutBit(bs, 0); // is_object_layer_identified (0=not given) |
647 |
BitstreamPutBits(bs, 1, 4); // aspect_ratio_info (1=1:1) |
BitstreamPutBits(bs, 1, 4); // aspect_ratio_info (1=1:1) |
648 |
BitstreamPutBit(bs, 0); // vol_control_parameters (0=not given) |
|
649 |
|
#ifdef BFRAMES |
650 |
|
if (pParam->max_bframes > 0) |
651 |
|
{ |
652 |
|
dprintf("low_delay=1"); |
653 |
|
BitstreamPutBit(bs, 1); // vol_control_parameters |
654 |
|
BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" |
655 |
|
BitstreamPutBit(bs, 0); // low_delay |
656 |
|
BitstreamPutBit(bs, 0); // vbv_parameters (0=not given) |
657 |
|
} |
658 |
|
else |
659 |
|
#endif |
660 |
|
{ |
661 |
|
BitstreamPutBits(bs, 0, 1); // vol_control_parameters (0=not given) |
662 |
|
} |
663 |
|
|
664 |
|
|
665 |
BitstreamPutBits(bs, 0, 2); // video_object_layer_shape (0=rectangular) |
BitstreamPutBits(bs, 0, 2); // video_object_layer_shape (0=rectangular) |
666 |
|
|
667 |
WRITE_MARKER(); |
WRITE_MARKER(); |
671 |
25fps res=25 inc=1 |
25fps res=25 inc=1 |
672 |
29.97fps res=30000 inc=1001 |
29.97fps res=30000 inc=1001 |
673 |
*/ |
*/ |
674 |
|
#ifdef BFRAMES |
675 |
|
BitstreamPutBits(bs, pParam->fbase, 16); |
676 |
|
#else |
677 |
BitstreamPutBits(bs, 2, 16); |
BitstreamPutBits(bs, 2, 16); |
678 |
|
#endif |
679 |
|
|
680 |
WRITE_MARKER(); |
WRITE_MARKER(); |
681 |
|
|
757 |
|
|
758 |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
759 |
#ifdef BFRAMES |
#ifdef BFRAMES |
760 |
BitstreamPutBits(bs, frame->ticks, 5); |
BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase)); |
761 |
dprintf("[%i:%i] %c\n", frame->seconds, frame->ticks, frame->coding_type == I_VOP ? 'I' : frame->coding_type == P_VOP ? 'P' : 'B'); |
dprintf("[%i:%i] %c\n", frame->seconds, frame->ticks, frame->coding_type == I_VOP ? 'I' : frame->coding_type == P_VOP ? 'P' : 'B'); |
762 |
#else |
#else |
763 |
BitstreamPutBits(bs, 1, 1); |
BitstreamPutBits(bs, 1, 1); |
767 |
|
|
768 |
BitstreamPutBits(bs, 1, 1); // vop_coded |
BitstreamPutBits(bs, 1, 1); // vop_coded |
769 |
|
|
770 |
if (frame->coding_type != I_VOP) |
if (frame->coding_type == P_VOP) |
771 |
BitstreamPutBits(bs, frame->rounding_type, 1); |
BitstreamPutBits(bs, frame->rounding_type, 1); |
772 |
|
|
773 |
BitstreamPutBits(bs, 0, 3); // intra_dc_vlc_threshold |
BitstreamPutBits(bs, 0, 3); // intra_dc_vlc_threshold |