[XviD-devel] vbv patch
peter ross
suxen_drol at hotmail.com
Sat Feb 12 02:47:43 CET 2005
gday,
divxnetworks has advised the our current dxn profiles do not conform to
their latest
certification standard, and should be modificied to incorporate the
following constraints:
* 4mv is disabled for the handheld profile
* 1:1 picture aspect only
* disable bframes if interlacing is enabled
* force maximum of 1 consecutive bvop for the portable and ht profiles, and
2 bvops for the hd profile
* always write divx 5 userdata string to bitstream "DivX503b1393(p)"
* force packed bitstream option
* update vbv params
i have assembled a patch, that adds an additional "strict conformance to dxn
profile
standard" checkbox. this is checked by default, but can be unchecked by
advanced
users who wish to experiment. since the v1.1 release is impending and
feature
frozen, i have attached the patch below for review. perhaps we need another
beta,
to give users a chance to test the "new" profiles with hardware players?
christoph: dxn now uses a "max bits over 1sec constraint" instead of the
3sec constraint.
this needs to be changed within xvidcore. currently, vfw multiplies the
1second
constraint by 3 before passing it to xvidcore.
FULL CHANGE LOG:
xvidcore
========
added XVID_GLOBAL_DIVX5_USERDATA global flag
removed the bvop delay warning text. this confuses joe user.
"warning: nothing to output"
"bframe decoder lag"
minor changed to closed gop image_printf statement:
s/"DX50 BVOP->PVOP"/"CLOSED GOP BVOP->PVOP"
additional comments for low_delay_default mode within decoder_decode()
divx userdata string: s/DivX999b000/DivX503b1393
this has been suggested by dxn for improved hardware compatibility
[nb: i dont have a hardware player to confirm this]
vbv_peakrate constraint is ignored if <= 0
vfw frontend
============
"strict conformance to DXN profile standard" checkbox:
force 1:1 picture aspect ratio
disable bframes if interlacing is enabled
force maximum of 1 consecutive bvops for the portable and ht profiles, 2
bvops for the hd profile
always write divx 5 userdata string to bitstream
force packed bitstream option
updated dxn vbv parameters
added PROFILE_4MV flag. 4mv is now disabled for the dxn handheld profile.
moved PROFILE_AS/PROFILE_ARTS/PROFILE_S to config.c
profile[].max_bitrate now measured in bit/sec (not kbps)
profile->level box: widgets are now greyed-out if they are not used.
increase vertical size of profile drop down list.
about box button: s/Dismiss/OK
cheers,
-- pete
-------------- next part --------------
Index: src/decoder.c
===================================================================
RCS file: /xvid/xvidcore/src/decoder.c,v
retrieving revision 1.68
diff -u -r1.68 decoder.c
--- src/decoder.c 5 Dec 2004 13:56:13 -0000 1.68
+++ src/decoder.c 12 Feb 2005 08:52:30 -0000
@@ -1511,19 +1511,22 @@
done :
- /* low_delay_default mode: if we've gotten here without outputting
anything,
- then output the recently decoded frame, or print an error message */
- if (dec->low_delay_default && output == 0) {
- if (dec->packed_mode && seen_something) {
- /* output the recently decoded frame */
+ /* if we reach here without outputing anything _and_
+ the calling application has specified low_delay_default,
+ we *must* output something.
+ this always occurs on the first call to decode() call
+ when bframes are present in the bitstream. it may also
+ occur if no vops were seen in the bitstream
+
+ if packed_mode is enabled, then we output the recently
+ decoded frame (the very first ivop). otherwise we have
+ nothing to display, and therefore output a black screen.
+ */
+ if (dec->low_delay_default && output == 0) {
+ if (dec->packed_mode && seen_something) {
decoder_output(dec, &dec->refn[0], dec->last_mbs, frame, stats,
dec->last_coding_type, quant);
- } else {
+ } else {
image_clear(&dec->cur, dec->width, dec->height, dec->edged_width, 0, 128,
128);
- image_printf(&dec->cur, dec->edged_width, dec->height, 16, 16,
- "warning: nothing to output");
- image_printf(&dec->cur, dec->edged_width, dec->height, 16, 64,
- "bframe decoder lag");
-
decoder_output(dec, &dec->cur, NULL, frame, stats, P_VOP, quant);
if (stats) stats->type = XVID_TYPE_NOTHING;
}
Index: src/encoder.c
===================================================================
RCS file: /xvid/xvidcore/src/encoder.c,v
retrieving revision 1.116
diff -u -r1.116 encoder.c
--- src/encoder.c 10 Dec 2004 05:37:11 -0000 1.116
+++ src/encoder.c 4 Feb 2005 03:10:52 -0000
@@ -146,6 +146,8 @@
/* global flags */
pEnc->mbParam.global_flags = create->global;
+ if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED))
+ pEnc->mbParam.global_flags |= XVID_GLOBAL_DIVX5_USERDATA;
/* width, height */
pEnc->mbParam.width = create->width;
@@ -1256,7 +1258,7 @@
SWAP(FRAMEINFO*, pEnc->current, pEnc->bframes[pEnc->bframenum_tail]);
if ((pEnc->current->vop_flags & XVID_VOP_DEBUG)) {
- image_printf(&pEnc->current->image, pEnc->mbParam.edged_width,
pEnc->mbParam.height, 5, 100, "DX50 BVOP->PVOP");
+ image_printf(&pEnc->current->image, pEnc->mbParam.edged_width,
pEnc->mbParam.height, 5, 100, "CLOSED GOP BVOP->PVOP");
}
/* convert B-VOP quant to P-VOP */
Index: src/xvid.h
===================================================================
RCS file: /xvid/xvidcore/src/xvid.h,v
retrieving revision 1.48
diff -u -r1.48 xvid.h
--- src/xvid.h 16 Jan 2005 10:34:52 -0000 1.48
+++ src/xvid.h 3 Feb 2005 07:02:37 -0000
@@ -593,7 +593,8 @@
#define XVID_GLOBAL_VOL_AT_IVOP (1<<3) /* write vol at every ivop:
WIN32/divx compatibility */
#define XVID_GLOBAL_FORCE_VOL (1<<4) /* when vol-based parameters
are changed, insert an ivop NOT recommended */
#endif
-
+#define XVID_GLOBAL_DIVX5_USERDATA (1<<5) /* write divx5 userdata string
+ this is implied if
XVID_GLOBAL_PACKED is set */
/*----------------------------------------------------------------------------
* "VOL" flags
Index: src/bitstream/bitstream.c
===================================================================
RCS file: /xvid/xvidcore/src/bitstream/bitstream.c,v
retrieving revision 1.48
diff -u -r1.48 bitstream.c
--- src/bitstream/bitstream.c 5 Dec 2004 13:56:13 -0000 1.48
+++ src/bitstream/bitstream.c 13 Feb 2005 11:16:17 -0000
@@ -1251,10 +1251,12 @@
BitstreamPadAlways(bs); /* next_start_code(); */
- /* fake divx5 id, to ensure compatibility with divx5 decoder */
-#define DIVX5_ID "DivX999b000p"
- if (pParam->max_bframes > 0 && (pParam->global_flags &
XVID_GLOBAL_PACKED)) {
- BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
+ /* divx id */
+#define DIVX5_ID "DivX503b1393"
+ if ((pParam->global_flags & XVID_GLOBAL_DIVX5_USERDATA)) {
+ BitstreamWriteUserData(bs, DIVX5_ID, strlen(DIVX5_ID));
+ if (pParam->max_bframes > 0 && (pParam->global_flags &
XVID_GLOBAL_PACKED))
+ BitstreamPutBits(bs, 'p', 8);
}
/* xvid id */
Index: src/plugins/plugin_2pass2.c
===================================================================
RCS file: /xvid/xvidcore/src/plugins/plugin_2pass2.c,v
retrieving revision 1.6
diff -u -r1.6 plugin_2pass2.c
--- src/plugins/plugin_2pass2.c 9 Jan 2005 20:26:42 -0000 1.6
+++ src/plugins/plugin_2pass2.c 14 Feb 2005 01:36:11 -0000
@@ -457,8 +457,8 @@
if (rc->param.vbv_size==0) {
rc->param.vbv_size = 3145728;
rc->param.vbv_initial = 2359296;
- rc->param.vbv_maxrate = 4000000;
- rc->param.vbv_peakrate = 10000000;
+ rc->param.vbv_maxrate = 4854000;
+ rc->param.vbv_peakrate = 8000000;
}
#endif
@@ -1461,8 +1461,8 @@
* typical values from DivX Home Theater profile:
* vbv_size= 384*1024 (384kB)
* vbv_initial= 288*1024 (75% fill)
- * maxrate= 4000000 (4MBps)
- * peakrate= 10000000 (10MBps)
+ * maxrate= 4854000 (4.854MBps)
+ * peakrate= 8000000 (8MBps)
*
* PAL: offset3s = 75 (3 seconds of 25fps)
* NTSC: offset3s = 90 (3 seconds of 29.97fps) or 72 (3 seconds of
23.976fps)
@@ -1490,7 +1490,8 @@
if (i>=offset3s)
bytes3s -= rc->stats[i-offset3s].scaled_length;
- if (8.f*bytes3s > 3*peakrate)
+ /* ignore peakrate constraint if peakrate is <= 0.f */
+ if (peakrate>0.f && 8.f*bytes3s > 3*peakrate)
return(VBV_PEAKRATE);
/* update vbv fill level */
Index: vfw/src/codec.c
===================================================================
RCS file: /xvid/xvidcore/vfw/src/codec.c,v
retrieving revision 1.16
diff -u -r1.16 codec.c
--- vfw/src/codec.c 30 Jan 2005 14:04:11 -0000 1.16
+++ vfw/src/codec.c 13 Feb 2005 10:15:35 -0000
@@ -504,9 +504,13 @@
/* VBV */
pass2.vbv_size = profiles[codec->config.profile].max_vbv_size;
- pass2.vbv_initial = (profiles[codec->config.profile].max_vbv_size*3)/4;
- pass2.vbv_maxrate = 1000*profiles[codec->config.profile].max_bitrate;
- pass2.vbv_peakrate = 10000000; /* 10mbps -- fixme */
+ pass2.vbv_initial = (profiles[codec->config.profile].max_vbv_size*3)/4;
/* 75% */
+ pass2.vbv_maxrate = profiles[codec->config.profile].max_bitrate;
+
+ // XXX: xvidcore current provides a "peak bits over 3secs" constraint.
+ // according to the latest dxn literature, a 1sec constraint is
now used
+ // until xvidcore is modified, simply times 1sec peak rate by 3.
+ pass2.vbv_peakrate = profiles[codec->config.profile].vbv_peakrate * 3;
plugins[create.num_plugins].func = codec->xvid_plugin_2pass2_func;
plugins[create.num_plugins].param = &pass2;
@@ -563,17 +567,33 @@
create.max_quant[2] = codec->config.max_bquant;
if ((profiles[codec->config.profile].flags & PROFILE_BVOP) &&
codec->config.use_bvop) {
- create.max_bframes = codec->config.max_bframes;
- create.bquant_ratio = codec->config.bquant_ratio;
- create.bquant_offset = codec->config.bquant_offset;
- if (codec->config.packed)
- create.global |= XVID_GLOBAL_PACKED;
+ /* dxn: do not enable bframes if interlacing is selected */
+ if (!(codec->config.strict_dxn &&
(profiles[codec->config.profile].flags & PROFILE_DXN) &&
codec->config.interlacing)) {
+ create.max_bframes = codec->config.max_bframes;
+ create.bquant_ratio = codec->config.bquant_ratio;
+ create.bquant_offset = codec->config.bquant_offset;
+
+ if (codec->config.packed)
+ create.global |= XVID_GLOBAL_PACKED;
+
+ create.global |= XVID_GLOBAL_CLOSED_GOP;
- create.global |= XVID_GLOBAL_CLOSED_GOP;
+ /* dxn: restrict max bframes and enable packed bframes */
+ if (codec->config.strict_dxn &&
(profiles[codec->config.profile].flags & PROFILE_DXN)) {
+ if (create.max_bframes >
profiles[codec->config.profile].dxn_max_bframes)
+ create.max_bframes =
profiles[codec->config.profile].dxn_max_bframes;
+
+ create.global |= XVID_GLOBAL_PACKED;
+ }
+ }
}
+ /* dxn: always write divx5 userdata */
+ if (codec->config.strict_dxn && (profiles[codec->config.profile].flags &
PROFILE_DXN))
+ create.global |= XVID_GLOBAL_DIVX5_USERDATA;
+
create.frame_drop_ratio = codec->config.frame_drop_ratio;
create.num_threads = codec->config.num_threads;
@@ -697,7 +717,10 @@
if ((profiles[codec->config.profile].flags & PROFILE_INTERLACE) &&
codec->config.interlacing)
frame.vol_flags |= XVID_VOL_INTERLACING;
- if (codec->config.ar_mode == 0) { /* PAR */
+ /* dxn: force 1:1 picture aspect ration */
+ if (codec->config.strict_dxn && (profiles[codec->config.profile].flags &
PROFILE_DXN)) {
+ frame.par = XVID_PAR_11_VGA;
+ } else if (codec->config.ar_mode == 0) { /* PAR */
if (codec->config.display_aspect_ratio != 5) {
frame.par = codec->config.display_aspect_ratio + 1;
} else {
@@ -728,8 +751,10 @@
frame.vop_flags |= XVID_VOP_TRELLISQUANT;
}
- if (codec->config.motion_search > 4)
- frame.vop_flags |= XVID_VOP_INTER4V;
+ if ((profiles[codec->config.profile].flags & PROFILE_4MV)) {
+ if (codec->config.motion_search > 4)
+ frame.vop_flags |= XVID_VOP_INTER4V;
+ }
if (codec->config.chromame)
frame.motion |= XVID_ME_CHROMA_PVOP + XVID_ME_CHROMA_BVOP;
Index: vfw/src/config.c
===================================================================
RCS file: /xvid/xvidcore/vfw/src/config.c,v
retrieving revision 1.23
diff -u -r1.23 config.c
--- vfw/src/config.c 10 Jan 2005 06:07:07 -0000 1.23
+++ vfw/src/config.c 14 Feb 2005 00:08:22 -0000
@@ -108,40 +108,46 @@
/* default vbv_occupancy is (64/170)*vbv_buffer_size */
+#define PROFILE_S (PROFILE_4MV)
+#define PROFILE_ARTS (PROFILE_4MV|PROFILE_ADAPTQUANT)
+#define
PROFILE_AS (PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC)
+
const profile_t profiles[] =
{
-/* name p at l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps
flags */
- { "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100,
10*16368, 2048, 64, 0 },
+/* name p at l, w h fps obj Tvmv vmv vcv ac%
vbv pkt bps vbv_peak dbf flags */
+ { "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100,
10*16368, 2048, 64000, 0, -1, PROFILE_S },
/* simple at l0: max f_code=1, intra_dc_vlc_threshold=0 */
/* if ac preidition is used, adaptive quantization must not be used */
/* <=qcif must be used */
- { "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100,
10*16368, 2048, 64, PROFILE_ADAPTQUANT },
- { "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100,
40*16368, 4096, 128, PROFILE_ADAPTQUANT },
- { "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100,
40*16368, 8192, 384, PROFILE_ADAPTQUANT },
-
- { "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100,
10*16368, 8192, 64, PROFILE_ARTS },
- { "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100,
40*16368, 16384, 128, PROFILE_ARTS },
- { "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100,
40*16368, 16384, 384, PROFILE_ARTS },
- { "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100,
80*16368, 16384, 2000, PROFILE_ARTS },
-
- { "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100,
10*16368, 2048, 128, PROFILE_AS },
- { "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100,
10*16368, 2048, 128, PROFILE_AS },
- { "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100,
40*16368, 4096, 384, PROFILE_AS },
- { "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100,
40*16368, 4096, 768, PROFILE_AS },
+ { "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100,
10*16368, 2048, 64000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
+ { "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100,
40*16368, 4096, 128000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
+ { "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100,
40*16368, 8192, 384000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT },
+
+#if 0 /* since rrv encoding is no longer support, these profiles have
little use */
+ { "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100,
10*16368, 8192, 64000, 0, -1, PROFILE_ARTS },
+ { "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100,
40*16368, 16384, 128000, 0, -1, PROFILE_ARTS },
+ { "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100,
40*16368, 16384, 384000, 0, -1, PROFILE_ARTS },
+ { "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100,
80*16368, 16384, 2000000, 0, -1, PROFILE_ARTS },
+#endif
+
+ { "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100,
10*16368, 2048, 128000, 0, -1, PROFILE_AS },
+ { "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100,
10*16368, 2048, 128000, 0, -1, PROFILE_AS },
+ { "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100,
40*16368, 4096, 384000, 0, -1, PROFILE_AS },
+ { "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100,
40*16368, 4096, 768000, 0, -1, PROFILE_AS },
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps,
1.5Mbps max ??? */
- { "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50,
80*16368, 8192, 3000, PROFILE_AS },
- { "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25,
112*16368, 16384, 8000, PROFILE_AS },
+ { "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50,
80*16368, 8192, 3000000, 0, -1, PROFILE_AS },
+ { "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25,
112*16368, 16384, 8000000, 0, -1, PROFILE_AS },
#ifdef DXN_PROFILES
- { "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100,
16*16368, -1, 128, PROFILE_ADAPTQUANT },
- { "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100,
64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP },
- { "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100,
64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP },
- { "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100,
192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE },
- { "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100,
192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE },
- { "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100,
384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE },
+ { "DXN Handheld", 0x00, 176, 144, 15, 1, 198, 99, 1485, 100,
32*8192, -1, 537600, 800000, 0, PROFILE_ADAPTQUANT|PROFILE_DXN },
+ { "DXN Portable NTSC",0x00, 352, 240, 30, 1, 990, 330, 36000, 100,
384*8192, -1, 4854000, 8000000, 1,
PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },
+ { "DXN Portable PAL", 0x00, 352, 288, 25, 1, 1188, 396, 36000, 100,
384*8192, -1, 4854000, 8000000, 1,
PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN },
+ { "DXN HT NTSC", 0x00, 720, 480, 30, 1, 4050, 1350, 40500, 100,
384*8192, -1, 4854000, 8000000, 1,
PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
+ { "DXN HT PAL", 0x00, 720, 576, 25, 1, 4860, 1620, 40500, 100,
384*8192, -1, 4854000, 8000000, 1,
PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
+ { "DXN HDTV", 0x00, 1280, 720, 30, 1,10800, 3600, 108000, 100,
768*8192, -1, 9708400, 16000000, 2,
PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN },
#endif
- { "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368,
0, 0, 0xffffffff },
+ { "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100,
0*16368, -1, 0, 0, -1, 0xffffffff & ~PROFILE_DXN },
};
@@ -208,6 +214,7 @@
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */
{"packed", ®.packed, 1},
+ {"strict_dxn", ®.strict_dxn, 1},
/* aspect ratio */
{"ar_mode", ®.ar_mode, 0},
@@ -547,6 +554,12 @@
SetDlgItemText(hDlg, item, buf);
}
+static void set_dlgitem_float1000(HWND hDlg, UINT item, int value)
+{
+ char buf[FLOAT_BUF_SZ];
+ sprintf(buf, "%.3f", (float)value/1000);
+ SetDlgItemText(hDlg, item, buf);
+}
#define HEX_BUF_SZ 16
static unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def)
@@ -853,6 +866,8 @@
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops);
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops);
EnableDlgWindow(hDlg, IDC_PACKED, bvops);
+
+ EnableDlgWindow(hDlg, IDC_STRICT_DXN,
profiles[profile].flags&PROFILE_DXN);
break;
case IDD_AR:
@@ -890,7 +905,36 @@
SetDlgItemInt(hDlg, IDC_LEVEL_VMV, profiles[profile].max_vmv_buffer_sz,
FALSE);
SetDlgItemInt(hDlg, IDC_LEVEL_VCV, profiles[profile].vcv_decoder_rate,
FALSE);
SetDlgItemInt(hDlg, IDC_LEVEL_VBV, profiles[profile].max_vbv_size, FALSE);
- SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate,
FALSE);
+ set_dlgitem_float1000(hDlg, IDC_LEVEL_BITRATE,
profiles[profile].max_bitrate);
+ SetDlgItemInt(hDlg, IDC_LEVEL_PEAKRATE, profiles[profile].vbv_peakrate,
FALSE);
+
+ {
+ int en_dim = profiles[profile].width && profiles[profile].height;
+ int en_vmv = profiles[profile].max_vmv_buffer_sz;
+ int en_vcv = profiles[profile].vcv_decoder_rate;
+ EnableDlgWindow(hDlg, IDC_LEVEL_LEVEL_G, en_dim || en_vmv || en_vcv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_DIM_S, en_dim);
+ EnableDlgWindow(hDlg, IDC_LEVEL_WIDTH, en_dim);
+ EnableDlgWindow(hDlg, IDC_LEVEL_HEIGHT,en_dim);
+ EnableDlgWindow(hDlg, IDC_LEVEL_FPS, en_dim);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VMV_S, en_vmv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VMV, en_vmv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VCV_S, en_vcv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VCV, en_vcv);
+ }
+ {
+ int en_vbv = profiles[profile].max_vbv_size;
+ int en_br = profiles[profile].max_bitrate;
+ int en_pr = profiles[profile].vbv_peakrate;
+
+ EnableDlgWindow(hDlg, IDC_LEVEL_VBV_G, en_vbv || en_br ||
en_pr);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VBV_S, en_vbv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_VBV, en_vbv);
+ EnableDlgWindow(hDlg, IDC_LEVEL_BITRATE_S, en_br);
+ EnableDlgWindow(hDlg, IDC_LEVEL_BITRATE, en_br);
+ EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE_S, en_pr);
+ EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE, en_pr);
+ }
break;
case IDD_BITRATE :
@@ -1068,6 +1112,7 @@
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset);
CheckDlg(hDlg, IDC_PACKED, config->packed);
+ CheckDlg(hDlg, IDC_STRICT_DXN, config->strict_dxn);
break;
case IDD_AR:
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR :
IDC_AR);
@@ -1214,6 +1259,8 @@
config->bquant_ratio = get_dlgitem_float(hDlg, IDC_BQUANTRATIO,
config->bquant_ratio);
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET,
config->bquant_offset);
config->packed = IsDlgChecked(hDlg, IDC_PACKED);
+
+ config->strict_dxn = IsDlgChecked(hDlg, IDC_STRICT_DXN);
break;
case IDD_AR:
Index: vfw/src/config.h
===================================================================
RCS file: /xvid/xvidcore/vfw/src/config.h,v
retrieving revision 1.6
diff -u -r1.6 config.h
--- vfw/src/config.h 10 Jan 2005 05:01:01 -0000 1.6
+++ vfw/src/config.h 13 Feb 2005 09:30:22 -0000
@@ -125,6 +125,7 @@
int bquant_ratio;
int bquant_offset;
int packed;
+ int strict_dxn; /* strict conformance to dxn profile standard */
int display_aspect_ratio; /* aspect ratio */
int ar_x, ar_y; /* picture aspect ratio */
int par_x, par_y; /* custom pixel aspect ratio */
@@ -228,9 +229,9 @@
#define PROFILE_INTERLACE 0x00000008
#define PROFILE_QPEL 0x00000010
#define PROFILE_GMC 0x00000020
+#define PROFILE_4MV 0x00000040
+#define PROFILE_DXN 0x00000080
-#define
PROFILE_AS (PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC)
-#define PROFILE_ARTS (PROFILE_ADAPTQUANT)
static const int PARS[][2] = {
{1, 1},
@@ -258,7 +259,9 @@
int max_acpred_mbs; /* percentage */
int max_vbv_size; /* max vbv size (bits) 16368 bits */
int max_video_packet_length; /* bits */
- int max_bitrate; /* kbits/s */
+ int max_bitrate; /* bits per second */
+ int vbv_peakrate; /* max bits over anyone second period; 0=don't care
*/
+ int dxn_max_bframes; /* dxn: max consecutive bframes */
unsigned int flags;
} profile_t;
Index: vfw/src/resource.h
===================================================================
RCS file: /xvid/xvidcore/vfw/src/resource.h,v
retrieving revision 1.8
diff -u -r1.8 resource.h
--- vfw/src/resource.h 25 Jul 2004 02:26:57 -0000 1.8
+++ vfw/src/resource.h 13 Feb 2005 09:52:41 -0000
@@ -253,6 +253,7 @@
#define IDC_CBR_BUFFER 1214
#define IDC_PACKED 1215
#define IDC_BSTATIC1 1216
+#define IDC_STRICT_DXN 1216
#define IDC_MAXBFRAMES_S 1217
#define IDC_BQUANTRATIO_S 1218
#define IDC_DX50BVOP 1219
@@ -330,6 +331,7 @@
#define IDC_LEVEL_VBV 1299
#define IDC_LEVEL_BITRATE 1300
#define IDC_BITRATE 1302
+#define IDC_LEVEL_PEAKRATE 1302
#define IDC_BITRATE_MIN 1303
#define IDC_BITRATE_MAX 1304
#define IDC_ZONE_BVOPTHRESHOLD_S 1305
@@ -418,6 +420,14 @@
#define IDC_TFF 1394
#define IDC_VHQ_BFRAME 1395
#define IDC_LICENSE_TEXT 1396
+#define IDC_LEVEL_PEAKRATE_S 1397
+#define IDC_LEVEL_BITRATE_S 1398
+#define IDC_LEVEL_VBV_S 1399
+#define IDC_LEVEL_VBV_G 1400
+#define IDC_LEVEL_DIM_S 1401
+#define IDC_LEVEL_VMV_S 1402
+#define IDC_LEVEL_VCV_S 1403
+#define IDC_LEVEL_LEVEL_G 1404
// Next default values for new objects
//
@@ -425,7 +435,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 132
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1397
+#define _APS_NEXT_CONTROL_VALUE 1405
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
Index: vfw/src/resource.rc
===================================================================
RCS file: /xvid/xvidcore/vfw/src/resource.rc,v
retrieving revision 1.18
diff -u -r1.18 resource.rc
--- vfw/src/resource.rc 16 Jan 2005 10:23:53 -0000 1.18
+++ vfw/src/resource.rc 13 Feb 2005 10:08:25 -0000
@@ -78,9 +78,9 @@
IDD_MAIN DIALOGEX 0, 0, 225, 255
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "XviD Configuration"
-FONT 8, "MS Shell Dlg", 0, 0, 0x1
+FONT 8, "MS Shell Dlg"
BEGIN
- COMBOBOX IDC_PROFILE,88,16,91,76,CBS_DROPDOWNLIST | WS_VSCROLL |
+ COMBOBOX IDC_PROFILE,88,16,91,200,CBS_DROPDOWNLIST | WS_VSCROLL
|
WS_TABSTOP
PUSHBUTTON "more...",IDC_PROFILE_ADV,184,16,28,12
COMBOBOX IDC_MODE,88,34,92,76,CBS_DROPDOWNLIST | WS_VSCROLL |
@@ -519,9 +519,9 @@
CAPTION "Profile"
FONT 8, "MS Shell Dlg"
BEGIN
- GROUPBOX "",IDC_STATIC,8,120,196,86
+ GROUPBOX "",IDC_STATIC,8,120,196,72
LTEXT "Profile @ Level:",IDC_STATIC,8,10,52,8
- COMBOBOX IDC_PROFILE_PROFILE,84,8,116,76,CBS_DROPDOWNLIST |
+ COMBOBOX IDC_PROFILE_PROFILE,84,8,116,200,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_QUANTTYPE,111,32,76,76,CBS_DROPDOWNLIST |
WS_VSCROLL |
WS_TABSTOP
@@ -541,12 +541,15 @@
EDITTEXT IDC_BQUANTRATIO,120,147,76,12,ES_AUTOHSCROLL
EDITTEXT IDC_BQUANTOFFSET,120,161,76,12,ES_AUTOHSCROLL
CONTROL "Packed bitstream",IDC_PACKED,"Button",BS_AUTOCHECKBOX
|
- WS_TABSTOP,16,182,71,10
+ WS_TABSTOP,16,178,71,10
LTEXT "Quantizer ratio:",IDC_BQUANTRATIO_S,16,150,89,8
LTEXT "Quantizer offset:",IDC_BQUANTOFFSET_S,16,164,52,8
LTEXT "Quantization type:",IDC_QUANTTYPE_S,16,36,85,8
CONTROL "Top field first",IDC_TFF,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,100,72,56,10
+ CONTROL "Strict conformance to DXN profile standard",
+ IDC_STRICT_DXN,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,16,
+ 196,151,10
END
IDD_ZONE DIALOG DISCARDABLE 0, 0, 212, 194
@@ -586,29 +589,38 @@
CAPTION "Level"
FONT 8, "MS Shell Dlg"
BEGIN
- COMBOBOX IDC_LEVEL_PROFILE,84,8,116,76,CBS_DROPDOWNLIST |
+ COMBOBOX IDC_LEVEL_PROFILE,84,8,116,200,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_LEVEL_WIDTH,88,43,28,12,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_LEVEL_HEIGHT,128,43,28,12,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_LEVEL_FPS,168,43,28,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_LEVEL_VMV,156,60,40,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_LEVEL_VCV,156,77,40,12,ES_AUTOHSCROLL | ES_READONLY
- EDITTEXT IDC_LEVEL_VBV,156,115,40,12,ES_AUTOHSCROLL |
ES_READONLY
- EDITTEXT IDC_LEVEL_BITRATE,156,131,40,12,ES_AUTOHSCROLL |
+ EDITTEXT IDC_LEVEL_VMV,156,60,40,12,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_READONLY
+ EDITTEXT IDC_LEVEL_VCV,156,77,40,12,ES_RIGHT | ES_AUTOHSCROLL |
+ ES_READONLY
+ EDITTEXT IDC_LEVEL_VBV,156,115,40,12,ES_RIGHT | ES_AUTOHSCROLL |
ES_READONLY
+ EDITTEXT IDC_LEVEL_BITRATE,156,131,40,12,ES_RIGHT |
+ ES_AUTOHSCROLL | ES_READONLY
LTEXT "Profile @ Level:",IDC_STATIC,8,10,52,8
GROUPBOX "Level - XviD will not force you to respect these",
- IDC_STATIC,8,28,196,66
- LTEXT "Suggested:",IDC_STATIC,16,45,48,8
+ IDC_LEVEL_LEVEL_G,8,28,196,66
+ LTEXT "Suggested:",IDC_LEVEL_DIM_S,16,45,48,8
LTEXT "x",IDC_STATIC,120,45,8,8
- LTEXT "Max bitrate (kbps)",IDC_STATIC,16,133,108,8
- LTEXT "Max buffer size (bits):",IDC_STATIC,16,117,108,8
- LTEXT "Max processing rate (mbs/sec)",IDC_STATIC,16,79,108,8
- LTEXT "Max frame size (macroblocks):",IDC_STATIC,16,63,108,8
+ LTEXT "Max bitrate (kbps)",IDC_LEVEL_BITRATE_S,16,133,108,8
+ LTEXT "Max buffer size (bits):",IDC_LEVEL_VBV_S,16,117,108,8
+ LTEXT "Max processing rate (mbs/sec)",IDC_LEVEL_VCV_S,16,79,
+ 108,8
+ LTEXT "Max frame size (macroblocks):",IDC_LEVEL_VMV_S,16,63,
+ 108,8
LTEXT "x",IDC_STATIC,160,45,8,8
GROUPBOX "Video Buffer Verifier - used in Two-Pass mode",
- IDC_STATIC,8,100,196,49
+ IDC_LEVEL_VBV_G,8,100,196,66
+ EDITTEXT IDC_LEVEL_PEAKRATE,156,148,40,12,ES_RIGHT |
+ ES_AUTOHSCROLL | ES_READONLY
+ LTEXT "Max bits over any one second interval:",
+ IDC_LEVEL_PEAKRATE_S,16,150,128,8
END
IDD_DEC DIALOG DISCARDABLE 0, 0, 212, 212
@@ -853,7 +865,7 @@
CAPTION "GNU General Public License"
FONT 8, "MS Sans Serif"
BEGIN
- PUSHBUTTON "Dismiss",IDOK,172,218,84,14
+ PUSHBUTTON "OK",IDOK,172,218,84,14
EDITTEXT IDC_LICENSE_TEXT,2,2,426,212,ES_MULTILINE |
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
END
@@ -936,6 +948,7 @@
STRINGTABLE DISCARDABLE
BEGIN
+ IDC_STRICT_DXN "The option improves compatibility with DXN
certified hardware players. When enabled, the following constraints take
effect:\n\n* force 1:1 picture aspect ratio\n* disable bvops if interlaced
encoding is enabled\n* force a maximum of 1 consecutive bvop for the
portable and HT profiles, and a maximum of 2 consecutive bvops for the HD
profile\n* always write divx5 user data string into the bitstream\n* force
packed bitstream"
IDC_FRAMEDROP "Frame dropping ratio. 0 = no frame dropping ..
100 = drop all frames."
IDC_KFREDUCTION "Reduction of bitrate for the first consecutive
i-frames. The last i-frame will get treated normally."
IDC_GMC "Use Global Motion Compensation."
More information about the XviD-devel
mailing list