[MPlayer-dev-eng] [PATCH] H.264 encoding in mencoder

Jeff Clagg snacky at ikaruga.co.uk
Wed Sep 1 20:41:01 CEST 2004


On Wed, Sep 01, 2004 at 11:08:03AM -0700, Loren Merritt wrote:
> qblur is just a temporal gaussian blur. While a very large blur may not
> be useful, there's no reason it should be limited to a radius of 1.

Better? (also man page fix)
-------------- next part --------------
diff -ruN main.orig/DOCS/man/en/mplayer.1 main/DOCS/man/en/mplayer.1
--- main.orig/DOCS/man/en/mplayer.1	2004-09-01 13:30:13.000000000 -0400
+++ main/DOCS/man/en/mplayer.1	2004-09-01 14:37:39.000000000 -0400
@@ -6319,7 +6319,7 @@
 .
 .TP
 .B qp_min=<2-51> (CBR only)
-Minimum quantizer, 20-40 seems to be a useful range (default: 2).
+Minimum quantizer, 15-35 seems to be a useful range (default: 10).
 .
 .TP
 .B qp_max=<2-51>  (CBR only)
@@ -6328,7 +6328,7 @@
 .TP
 .B qp_step=<value>
 Maximum Value by which the quantizer may be incremented/decremented between
-frames.
+frames (default: 1)
 .
 .TP
 .B rc_buffer_size=<value>
@@ -6341,7 +6341,7 @@
 .
 .TP
 .B rc_sens=<0-100>
-ratecontrol sensitivity (default: 100)
+ratecontrol sensitivity (default: 4)
 .
 .TP
 .B ip_factor=<value>
@@ -6354,7 +6354,7 @@
 .TP
 .B pass=<1|2>
 Enable 2-pass mode.
-The first pass saves statistics.
+The first pass saves statistics to ./divx2pass.log
 .
 .TP
 .B qcompress=<0-1>
@@ -6364,10 +6364,10 @@
 more constant.
 .
 .TP
-.B qblur=<0-1>
+.B qblur=<0-100>
 Temporal blur of the quantization parameter (default: 0.5).
-Lower values allow the quantizer value to jump around more,
-higher values force it to vary more smoothly.
+Lower values allow the quantizer value to vary more rapidly;
+higher values force it to vary less rapidly.
 .
 .TP
 .B fullinter
diff -ruN main.orig/libmpcodecs/ve_x264.c main/libmpcodecs/ve_x264.c
--- main.orig/libmpcodecs/ve_x264.c	2004-08-27 16:43:05.000000000 -0400
+++ main/libmpcodecs/ve_x264.c	2004-09-01 14:38:55.000000000 -0400
@@ -29,7 +29,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#ifdef HAVE_STDINT_H
 #include <stdint.h>
+#endif
 
 #include "../config.h"
 #include "../mp_msg.h"
@@ -133,44 +135,57 @@
     mod->param.i_deblocking_filter_beta = deblockbeta;
     mod->param.b_cabac = cabac;
     mod->param.i_cabac_init_idc = cabacidc;
-    mod->param.i_qp_constant = qp_constant;
+
+    mod->param.rc.i_qp_constant = qp_constant;
     if(qp_min > qp_constant)
         qp_min = qp_constant;
     if(qp_max < qp_constant)
         qp_max = qp_constant;
-    mod->param.i_qp_min = qp_min;
-    mod->param.i_qp_max = qp_max;
-    mod->param.i_qp_step = qp_step;
-#if 0
-    mod->param.i_pass = pass;
-    mod->param.s_rc_eq = rc_eq;
-    mod->param.f_qcompress = qcomp;
-    mod->param.f_qblur = qblur;
-    mod->param.s_2pass_file_out = passtmpfile;
-    mod->param.s_2pass_file_in = passtmpfile;
+    mod->param.rc.i_qp_min = qp_min;
+    mod->param.rc.i_qp_max = qp_max;
+    mod->param.rc.i_qp_step = qp_step;
+    mod->param.rc.psz_rc_eq = rc_eq;
+    mod->param.rc.f_qcompress = qcomp;
+    mod->param.rc.f_qblur = qblur;
+    mod->param.rc.psz_stat_out = passtmpfile;
+    mod->param.rc.psz_stat_in = passtmpfile;
     if((pass & 2) && bitrate <= 0)
     {
         mp_msg(MSGT_MENCODER, MSGL_ERR,
                "2 pass encoding enabled, but no bitrate specified.\n");
         return 0;
     }
-#endif
+    switch(pass) {
+    case 0:
+        mod->param.rc.b_stat_write = 0;
+        mod->param.rc.b_stat_read = 0;
+        break;
+    case 1:
+        mod->param.rc.b_stat_write = 1;
+        mod->param.rc.b_stat_read = 0;
+        break;
+    case 2:
+        mod->param.rc.b_stat_write = 0;
+        mod->param.rc.b_stat_read = 1;
+        break;
+    }
     if(bitrate > 0) {
         if(rc_buffer_size <= 0)
             rc_buffer_size = bitrate;
         if(rc_init_buffer < 0)
             rc_init_buffer = rc_buffer_size/4;
-        mod->param.b_cbr = 1;
-        mod->param.i_bitrate = bitrate;
-        mod->param.i_rc_buffer_size = rc_buffer_size;
-        mod->param.i_rc_init_buffer = rc_init_buffer;
-        mod->param.i_rc_sens = rc_sens;
+        mod->param.rc.b_cbr = 1;
+        mod->param.rc.i_bitrate = bitrate;
+        mod->param.rc.i_rc_buffer_size = rc_buffer_size;
+        mod->param.rc.i_rc_init_buffer = rc_init_buffer;
+        mod->param.rc.i_rc_sens = rc_sens;
     }
-    if(fullinter)
-        mod->param.analyse.inter = X264_ANALYSE_I4x4 | X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8;
-    mod->param.f_ip_factor = ip_factor;
-    mod->param.f_pb_factor = pb_factor;
+    mod->param.rc.f_ip_factor = ip_factor;
+    mod->param.rc.f_pb_factor = pb_factor;
 
+    if(fullinter)
+        mod->param.analyse.inter = X264_ANALYSE_I4x4 |
+            X264_ANALYSE_PSUB16x16 | X264_ANALYSE_PSUB8x8;
     mod->param.i_width = width;
     mod->param.i_height = height;
     mod->param.i_fps_num = mod->mux->h.dwRate;


More information about the MPlayer-dev-eng mailing list