41 |
* * |
* * |
42 |
* Revision history: * |
* Revision history: * |
43 |
* * |
* * |
44 |
* 01.05.2002 added BVOP support to BitstreamWriteVopHeader |
* 06.05.2002 low_delay * |
45 |
|
* 06.05.2002 fixed fincr/fbase error * |
46 |
|
* 01.05.2002 added BVOP support to BitstreamWriteVopHeader * |
47 |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
* 15.04.2002 rewrite log2bin use asm386 By MinChen <chenm001@163.com> * |
48 |
* 26.03.2002 interlacing support * |
* 26.03.2002 interlacing support * |
49 |
* 03.03.2002 qmatrix writing * |
* 03.03.2002 qmatrix writing * |
60 |
#include "../quant/quant_matrix.h" |
#include "../quant/quant_matrix.h" |
61 |
|
|
62 |
|
|
63 |
static int __inline log2bin(int value) |
static uint32_t __inline log2bin(uint32_t value) |
64 |
{ |
{ |
65 |
/* Changed by Chenm001 */ |
/* Changed by Chenm001 */ |
66 |
#ifndef WIN32 |
#ifndef WIN32 |
643 |
BitstreamPutBits(bs, 0, 8); // video_object_type_indication |
BitstreamPutBits(bs, 0, 8); // video_object_type_indication |
644 |
BitstreamPutBit(bs, 0); // is_object_layer_identified (0=not given) |
BitstreamPutBit(bs, 0); // is_object_layer_identified (0=not given) |
645 |
BitstreamPutBits(bs, 1, 4); // aspect_ratio_info (1=1:1) |
BitstreamPutBits(bs, 1, 4); // aspect_ratio_info (1=1:1) |
646 |
BitstreamPutBit(bs, 0); // vol_control_parameters (0=not given) |
|
647 |
|
#ifdef BFRAMES |
648 |
|
if (pParam->max_bframes > 0) |
649 |
|
{ |
650 |
|
dprintf("low_delay=1"); |
651 |
|
BitstreamPutBit(bs, 1); // vol_control_parameters |
652 |
|
BitstreamPutBits(bs, 1, 2); // chroma_format 1="4:2:0" |
653 |
|
BitstreamPutBit(bs, 0); // low_delay |
654 |
|
BitstreamPutBit(bs, 0); // vbv_parameters (0=not given) |
655 |
|
} |
656 |
|
else |
657 |
|
#endif |
658 |
|
{ |
659 |
|
BitstreamPutBits(bs, 0, 1); // vol_control_parameters (0=not given) |
660 |
|
} |
661 |
|
|
662 |
|
|
663 |
BitstreamPutBits(bs, 0, 2); // video_object_layer_shape (0=rectangular) |
BitstreamPutBits(bs, 0, 2); // video_object_layer_shape (0=rectangular) |
664 |
|
|
665 |
WRITE_MARKER(); |
WRITE_MARKER(); |
669 |
25fps res=25 inc=1 |
25fps res=25 inc=1 |
670 |
29.97fps res=30000 inc=1001 |
29.97fps res=30000 inc=1001 |
671 |
*/ |
*/ |
672 |
|
#ifdef BFRAMES |
673 |
|
BitstreamPutBits(bs, pParam->fbase, 16); |
674 |
|
#else |
675 |
BitstreamPutBits(bs, 2, 16); |
BitstreamPutBits(bs, 2, 16); |
676 |
|
#endif |
677 |
|
|
678 |
WRITE_MARKER(); |
WRITE_MARKER(); |
679 |
|
|
755 |
|
|
756 |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
// time_increment: value=nth_of_sec, nbits = log2(resolution) |
757 |
#ifdef BFRAMES |
#ifdef BFRAMES |
758 |
BitstreamPutBits(bs, frame->ticks, 5); |
BitstreamPutBits(bs, frame->ticks, log2bin(pParam->fbase)); |
759 |
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'); |
760 |
#else |
#else |
761 |
BitstreamPutBits(bs, 1, 1); |
BitstreamPutBits(bs, 1, 1); |
765 |
|
|
766 |
BitstreamPutBits(bs, 1, 1); // vop_coded |
BitstreamPutBits(bs, 1, 1); // vop_coded |
767 |
|
|
768 |
if (frame->coding_type != I_VOP) |
if (frame->coding_type == P_VOP) |
769 |
BitstreamPutBits(bs, frame->rounding_type, 1); |
BitstreamPutBits(bs, frame->rounding_type, 1); |
770 |
|
|
771 |
BitstreamPutBits(bs, 0, 3); // intra_dc_vlc_threshold |
BitstreamPutBits(bs, 0, 3); // intra_dc_vlc_threshold |