diff options
author | iive <iive@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-09-12 15:36:43 +0000 |
---|---|---|
committer | iive <iive@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-09-12 15:36:43 +0000 |
commit | ab9f308df4867fadfd52220465b5213588982d4c (patch) | |
tree | 326333e2b125722987b15a7816b5586d8b346891 | |
parent | d7f693a20451132a2a2b7d916e4bcf808cab12ae (diff) | |
download | mpv-ab9f308df4867fadfd52220465b5213588982d4c.tar.bz2 mpv-ab9f308df4867fadfd52220465b5213588982d4c.tar.xz |
2pass encoding support for x264(r46).
patch by Loren Merritt and Jeff Clagg
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13326 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | DOCS/man/en/mplayer.1 | 26 | ||||
-rw-r--r-- | libmpcodecs/ve_x264.c | 50 |
2 files changed, 42 insertions, 34 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index 006cc90669..051564e513 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -6489,9 +6489,8 @@ I frame frequency (default: 60) .TP .B frameref=<value> Number of previous frames used as predictors in a P-frame (default: 1). -.br -.I NOTE: -As of x264 r38 this feature is not implemented yet. +This may cause tiny changes in bitrate and PSNR. +Some decoders are unable to deal with large frameref values. . .TP .B idrframe=<value> @@ -6527,7 +6526,7 @@ Beta parameter of deblocking filter (default: 0). Affects the maximum allowed gradient within two adjacent blocks. . .TP -.B cabac +.B cabac\ \ \ Use CABAC (Context-Adaptive Binary Arithmetic Coding). . .TP @@ -6558,18 +6557,14 @@ As an example, the bitrate difference between QP=20 and QP=40 is about a factor of 10. Useful quantizers in H.264 tend to be very large compared to MPEG[124]. .br -.I NOTE: -This option takes effect even if you specify a CBR encode. -In such a case, the first encoded frame will use the quantization factor you -specified, but in later frames, the ratecontrol decides what quants to use. . .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) -Maximum quantizer +maximum quantizer (default: 51) . .TP .B qp_step=<value> @@ -6587,7 +6582,7 @@ Set the initial ratecontrol buffer (default: 1/4 of rc_buffer_size) . .TP .B rc_sens=<0-100> -ratecontrol sensitivity (default: 100) +ratecontrol sensitivity (default: 4) . .TP .B ip_factor=<value> @@ -6610,7 +6605,7 @@ bitrate more constant, while a higher value makes the quantization parameter more constant. . .TP -.B qblur=<0-1> +.B qblur=<0-99> 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. @@ -6626,17 +6621,18 @@ Adjust the amount of logging info printed to the screen. .RSs -1: none .br - 0: errors (for debugging x264) + 0: Print errors only. .br 1: warnings .br - 2: PSNR and other analysis stats when the encode finishes (default) + 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 +.B psnr\ \ \ Print signal-to-noise ratio statistics. . . diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 3cdff499b3..f58be50496 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -133,43 +133,55 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width, 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.i_width = width; mod->param.i_height = height; |