[MPlayer-dev-eng] [PATCH] H.264 encoding in mencoder
Jeff Clagg
snacky at ikaruga.co.uk
Sun Aug 29 02:56:37 CEST 2004
On Sat, Aug 28, 2004 at 12:36:33AM +0300, Ivan Kalvachev wrote:
> Commited
> With small changes - disabled 2pass encoding.
fenrir committed 2pass encoding to x264 today, so I am sending a new
patch. Enjoy!
-------------- 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-08-28 16:36:34.000000000 -0400
+++ main/DOCS/man/en/mplayer.1 2004-08-28 19:51:48.000000000 -0400
@@ -6338,10 +6338,10 @@
.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>
+.B qcomp=<0-1>
quantizer compression (default: 0.6).
This affects the ratecontrol: a lower value makes the
bitrate more constant, while a higher value makes the quantization parameter
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-08-28 20:45:04.000000000 -0400
@@ -133,44 +133,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;
+ 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