[MPlayer-dev-eng] [PATCH] x264 option renaming

Loren Merritt lorenm at u.washington.edu
Mon Sep 27 01:12:55 CEST 2004


Renames:
   iframe => keyint
   idrframe => idrint
   bframe => bframes

Adds:
   nocabac
   nodeblock
   nofullinter
   nopsnr
(Need these be separately documented? (I did.)
The man page says "Every 'flag' option has a 'noflag' counterpart",
but that seems to be true of only top level options, not -<codec>opts.)

Changed defaults:
   keyint=250 (no reason to set it smaller than MPEG4)
   cabac=on (because it always helps a lot, and is pretty cheap)

Changed ranges (to the ranges actually supported by x264):
   frameref=<1-15>
   bframes=<0-16>

Sorted options in the man page:
   put idrint next to keyint
   put log next to psnr

--Loren Merritt
-------------- next part --------------
Index: libmpcodecs/ve_x264.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_x264.c,v
retrieving revision 1.5
diff -u -r1.5 ve_x264.c
--- libmpcodecs/ve_x264.c	22 Sep 2004 10:26:21 -0000	1.5
+++ libmpcodecs/ve_x264.c	26 Sep 2004 23:04:38 -0000
@@ -61,13 +61,13 @@
 static int bitrate = -1;
 static int qp_constant = 26;
 static int frame_ref = 1;
-static int iframe = 60;
-static int idrframe = 2;
-static int bframe = 0;
+static int key_interval = 250;
+static int idr_interval = 2;
+static int bframes = 0;
 static int deblock = 1;
 static int deblockalpha = 0;
 static int deblockbeta = 0;
-static int cabac = 0;
+static int cabac = 1;
 static int cabacidc = -1;
 static int fullinter = 0;
 static float ip_factor = 2.0;
@@ -89,16 +89,19 @@
 m_option_t x264encopts_conf[] = {
     {"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
     {"qp_constant", &qp_constant, CONF_TYPE_INT, CONF_RANGE, 1, 51, NULL},
-    {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 100, NULL},
-    {"iframe", &iframe, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
-    {"idrframe", &idrframe, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
-    {"bframe", &bframe, CONF_TYPE_INT, CONF_RANGE, 0, 10, NULL},
-    {"deblock", &deblock, CONF_TYPE_INT, CONF_RANGE, 0, 1, NULL},
+    {"frameref", &frame_ref, CONF_TYPE_INT, CONF_RANGE, 1, 15, NULL},
+    {"keyint", &key_interval, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
+    {"idrint", &idr_interval, CONF_TYPE_INT, CONF_RANGE, 1, 24000000, NULL},
+    {"bframes", &bframes, CONF_TYPE_INT, CONF_RANGE, 0, 16, NULL},
+    {"deblock", &deblock, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nodeblock", &deblock, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"deblockalpha", &deblockalpha, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL},
     {"deblockbeta", &deblockbeta, CONF_TYPE_INT, CONF_RANGE, -6, 6, NULL},
     {"cabac", &cabac, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nocabac", &cabac, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"cabacidc", &cabacidc, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
     {"fullinter", &fullinter, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nofullinter", &fullinter, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"ip_factor", &ip_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL},
     {"pb_factor", &pb_factor, CONF_TYPE_FLOAT, CONF_RANGE, -10.0, 10.0, NULL},
     {"rc_buffer_size", &rc_buffer_size, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
@@ -113,6 +116,7 @@
     {"qblur", &qblur, CONF_TYPE_FLOAT, CONF_RANGE, 0, 99, NULL},
     {"subq", &subq, CONF_TYPE_INT, CONF_RANGE, 0, 5, NULL},
     {"psnr", &psnr, CONF_TYPE_FLAG, 0, 0, 1, NULL},
+    {"nopsnr", &psnr, CONF_TYPE_FLAG, 0, 1, 0, NULL},
     {"log", &log_level, CONF_TYPE_INT, CONF_RANGE, -1, 3, NULL},
     {NULL, NULL, 0, 0, 0, 0, NULL}
 };
@@ -126,9 +130,9 @@
     
     x264_param_default(&mod->param);
     mod->param.i_frame_reference = frame_ref;
-    mod->param.i_idrframe = idrframe;
-    mod->param.i_iframe = iframe;
-    mod->param.i_bframe = bframe;
+    mod->param.i_idrframe = idr_interval;
+    mod->param.i_iframe = key_interval;
+    mod->param.i_bframe = bframes;
     mod->param.b_deblocking_filter = deblock;
     mod->param.i_deblocking_filter_alphac0 = deblockalpha;
     mod->param.i_deblocking_filter_beta = deblockbeta;
@@ -168,6 +172,10 @@
         mod->param.rc.b_stat_write = 0;
         mod->param.rc.b_stat_read = 1;
         break;
+    case 3:
+        mod->param.rc.b_stat_write = 1;
+        mod->param.rc.b_stat_read = 1;
+        break;
     }
     if(bitrate > 0) {
         if(rc_buffer_size <= 0)
Index: DOCS/man/en/mplayer.1
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v
retrieving revision 1.748
diff -u -r1.748 mplayer.1
--- DOCS/man/en/mplayer.1	26 Sep 2004 19:03:19 -0000	1.748
+++ DOCS/man/en/mplayer.1	26 Sep 2004 23:04:41 -0000
@@ -6773,20 +6773,13 @@
 This is required if you want a CBR (constant bitrate) encode.
 .
 .TP
-.B iframe=<value>
+.B keyint=<value>
 Sets maximum interval between I frames.
 Larger values save bits, thus improve quality, at the cost of seeking
-precision (default: 60).
+precision (default: 250).
 .
 .TP
-.B frameref=<1\-15>
-Number of previous frames used as predictors in a P frame (default: 1).
-This is effective in Anime, but seems to make little difference in
-live-action source material.
-Some decoders are unable to deal with large frameref values.
-.
-.TP
-.B idrframe=<value>
+.B idrint=<value>
 Each <value> I-Frames are IDR-Frames (default: 2).
 In H.264, I-Frames do not necessarily bound a closed GOP because it is
 allowable for a P-frame to be predicted from more frames than just the one
@@ -6796,11 +6789,18 @@
 prior to the IDR-Frame.
 .
 .TP
-.B bframe=<value>
-number of B-Frames between I- and P-Frames (default: 0)
+.B frameref=<1\-15>
+Number of previous frames used as predictors in a P frame (default: 1).
+This is effective in Anime, but seems to make little difference in
+live-action source material.
+Some decoders are unable to deal with large frameref values.
 .
 .TP
-.B deblock=<0|1>
+.B bframes=<0\-16>
+number of consecutive B-Frames between I- and P-Frames (default: 0)
+.
+.TP
+.B deblock | nodeblock
 Use deblocking filter (default: on).
 As it takes very little time compared to its quality gain, it's not
 recommend to disable it.
@@ -6827,10 +6827,10 @@
 Affects the maximum allowed gradient within two adjacent blocks.
 .
 .TP
-.B cabac\ \ \ 
-Use CABAC (Context-Adaptive Binary Arithmetic Coding).
-Slows down encoding but should save 10-15% of the bits.
-Unless you are looking for speed, you should activate it.
+.B cabac | nocabac
+Use CABAC (Context-Adaptive Binary Arithmetic Coding) (default: on).
+Slightly slows down encoding and decoding, but should save 10-15% bitrate.
+Unless you are looking for speed, you should not disable it.
 .
 .TP
 .B cabacidc=<value>
@@ -6850,7 +6850,7 @@
 .REss
 .
 .TP
-.B qp_constant=<2\-51>
+.B qp_constant=<1\-51>
 This selects the quantizer to use.
 20\-40 is a useful range (default: 26).
 Lower values result in better fidelity, but higher bitrates.
@@ -6861,11 +6861,11 @@
 Useful quantizers in H.264 tend to be very large compared to MPEG[124].
 .
 .TP
-.B qp_min=<2\-51> (CBR only)
+.B qp_min=<1\-51> (CBR or 2 pass)
 Minimum quantizer, 15\-35 seems to be a useful range (default: 10).
 .
 .TP
-.B qp_max=<2\-51>  (CBR only)
+.B qp_max=<1\-51> (CBR or 2 pass)
 maximum quantizer (default: 51)
 .
 .TP
@@ -6915,7 +6915,7 @@
 higher values force it to vary more smoothly.
 .
 .TP
-.B fullinter
+.B fullinter | nofullinter
 Use all available interframe macroblock types (i16x16, i4x4, p16x16-4x4)
 The idea is to find the type and size that best describe a certain area
 of the picture, i.e.\& very effective for Anime, which usually contains
@@ -6924,22 +6924,6 @@
 it with care.
 .
 .TP
-.B log=<-1\-3>
-Adjust the amount of logging info printed to the screen.
-.RSs
--1: none
-.br
- 0: Print errors only.
-.br
- 1: warnings
-.br
- 2: PSNR, encoding times, and other analysis stats when the encode finishes
-(default)
-.br
- 3: PSNR, QP, frametype, size, and other stats for every frame
-.REss
-.
-.TP
 .B subq=<0\-5>
 Adjust subpel refinement quality.
 This parameter controls quality versus speed tradeoffs involved in the motion
@@ -6960,8 +6944,24 @@
 .REss
 .
 .TP
-.B psnr\ \ \ 
-Print signal-to-noise ratio statistics.
+.B log=<-1\-3>
+Adjust the amount of logging info printed to the screen.
+.RSs
+-1: none
+.br
+ 0: Print errors only.
+.br
+ 1: warnings
+.br
+ 2: PSNR, encoding times, and other analysis stats when the encode finishes
+(default)
+.br
+ 3: PSNR, QP, frametype, size, and other stats for every frame
+.REss
+.
+.TP
+.B psnr | nopsnr
+Print signal-to-noise ratio statistics (default: off).
 .
 .
 .\" --------------------------------------------------------------------------


More information about the MPlayer-dev-eng mailing list