[XviD-devel] Home Theatre profile hardware compatibility
Giorgio Menaguale
g.menaguale at tiscali.it
Thu Jun 1 19:35:35 CEST 2006
Hi,
I have used version 1.2 (20060513 cvs snapshot).
I have used "Home Theatre PAL" profile and single pass constant bitrate or
twopass encoding
Giorgio
--- bitstream156.c 2006-06-01 07:22:08.203125000 +0200
+++ bitstream.c 2006-05-31 07:23:30.906250000 +0200
@@ -1073,10 +1073,18 @@
int vol_ver_id = 1;
int vol_type_ind = VIDOBJLAY_TYPE_SIMPLE;
int vol_profile = pParam->profile;
+ unsigned long bitrate; /* (unit=400 bps) */
+ unsigned long buffer_size; /* (unit=16384 bits) */
+ unsigned long occupancy; /* (unit=64 bits) */
+
+
if ( (pParam->vol_flags & XVID_VOL_QUARTERPEL) ||
- (pParam->vol_flags & XVID_VOL_GMC))
+ (pParam->vol_flags & XVID_VOL_GMC) ||
+ /* Added for compatibility with Divx bitstream */
+ (pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {
vol_ver_id = 2;
+ }
if ((pParam->vol_flags &
(XVID_VOL_MPEGQUANT|XVID_VOL_QUARTERPEL|XVID_VOL_GMC|XVID_VOL_INTERLACING))
||
pParam->max_bframes>0) {
@@ -1110,6 +1118,9 @@
}
/* Write the VOS header */
+
+ /* Added for compatibility with Divx bitstream */
+ if (!(pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {
BitstreamPutBits(bs, VISOBJSEQ_START_CODE, 32);
BitstreamPutBits(bs, vol_profile, 8); /* profile_and_level_indication */
@@ -1125,6 +1136,8 @@
/* video object_start_code & vo_id */
BitstreamPadAlways(bs); /* next_start_code() */
+ }
+
BitstreamPutBits(bs, VIDOBJ_START_CODE|(vo_id&0x5), 32);
/* video_object_layer_start_code & vol_id */
@@ -1158,7 +1171,31 @@
{
BitstreamPutBit(bs, 1); /* low_delay */
}
+ /* Added for compatibility with Divx bitstream */
+ if (!(pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {
BitstreamPutBit(bs, 0); /* vbv_parameters (0=not given) */
+ } else
+ {
+ BitstreamPutBit(bs, 1); /* vbv_parameters */
+
+ bitrate=12135; /* (unit=400 bps) */
+ buffer_size=192; /* (unit=16384 bits) */
+ occupancy=36864; /* (unit=64 bits) */
+
+ BitstreamPutBits(bs, bitrate >> 15, 15);
+ WRITE_MARKER();
+ BitstreamPutBits(bs, bitrate & 0x7fff, 15);
+ WRITE_MARKER();
+
+ BitstreamPutBits(bs, buffer_size >> 3, 15);
+ WRITE_MARKER();
+ BitstreamPutBits(bs, buffer_size & 0x7, 3);
+
+ BitstreamPutBits(bs, occupancy >> 15, 11);
+ WRITE_MARKER();
+ BitstreamPutBits(bs, occupancy & 0x7fff, 15);
+ WRITE_MARKER();
+ }
BitstreamPutBits(bs, 0, 2); /* video_object_layer_shape (0=rectangular) */
@@ -1174,7 +1211,8 @@
WRITE_MARKER();
- if (pParam->fincr>0) {
+ /* Added for compatibility with Divx bitstream */
+ if ((pParam->fincr>0)&& !(pParam->global_flags &
XVID_GLOBAL_DIVX5_USERDATA)) {
BitstreamPutBit(bs, 1); /* fixed_vop_rate = 1 */
BitstreamPutBits(bs, pParam->fincr, MAX(log2bin(pParam->fbase-1),1)); /*
fixed_vop_time_increment */
}else{
@@ -1249,7 +1287,7 @@
BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
if (pParam->max_bframes > 0 && (pParam->global_flags &
XVID_GLOBAL_PACKED))
BitstreamPutBits(bs, 'p', 8);
- }
+ } else /* Added for compatibility with Divx bitstream */
/* xvid id */
{
More information about the XviD-devel
mailing list