summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorgpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-11 17:52:03 +0000
committergpoirier <gpoirier@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-07-11 17:52:03 +0000
commitc60555edbf80b05838156a103f180cdb5d405654 (patch)
treecb5f8105095ea0f5f48a8fc9e0d786ef920167b2 /libmpcodecs
parentfc245d56826de987a556c0583c3094ff8f521f17 (diff)
downloadmpv-c60555edbf80b05838156a103f180cdb5d405654.tar.bz2
mpv-c60555edbf80b05838156a103f180cdb5d405654.tar.xz
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15965 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ve_x264.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c
index 35c88f5653..ffdd3fd11b 100644
--- a/libmpcodecs/ve_x264.c
+++ b/libmpcodecs/ve_x264.c
@@ -104,6 +104,7 @@ static int threads = 1;
static int level_idc = 40;
static int psnr = 0;
static int log_level = 2;
+static int turbo = 0;
m_option_t x264encopts_conf[] = {
{"bitrate", &bitrate, CONF_TYPE_INT, CONF_RANGE, 0, 24000000, NULL},
@@ -212,24 +213,6 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
"2 pass encoding enabled, but no bitrate specified.\n");
return 0;
}
- 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;
- case 3:
- mod->param.rc.b_stat_write = 1;
- mod->param.rc.b_stat_read = 1;
- break;
- }
if(bitrate > 0) {
if((vbv_maxrate > 0) != (vbv_bufsize > 0)) {
mp_msg(MSGT_MENCODER, MSGL_ERR,
@@ -252,8 +235,6 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
case 3: mod->param.analyse.i_me_method = X264_ME_UMH; break;
case 4: mod->param.analyse.i_me_method = X264_ME_ESA; break;
}
- if(me_method >= 3)
- mod->param.analyse.i_me_range = me_range;
mod->param.analyse.inter = 0;
if(p4x4mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB8x8;
if(p8x8mv) mod->param.analyse.inter |= X264_ANALYSE_PSUB16x16;
@@ -277,6 +258,45 @@ static int config(struct vf_instance_s* vf, int width, int height, int d_width,
mod->param.vui.i_sar_height = d_height*width;
mod->param.i_threads = threads;
+ switch(pass) {
+ case 0:
+ mod->param.rc.b_stat_write = 0;
+ mod->param.rc.b_stat_read = 0;
+ break;
+ case 1:
+ /* Adjust or disable some flags to gain speed in the first pass */
+ if(turbo == 1)
+ {
+ mod->param.i_frame_reference = ( frame_ref + 1 ) >> 1;
+ mod->param.analyse.i_subpel_refine = max( min( 3, subq - 1 ), 1 );
+ mod->param.analyse.inter &= ( ~X264_ANALYSE_PSUB8x8 );
+ mod->param.analyse.inter &= ( ~X264_ANALYSE_BSUB16x16 );
+ }
+ else if(turbo == 2)
+ {
+ mod->param.i_frame_reference = 1;
+ mod->param.analyse.i_subpel_refine = 1;
+ mod->param.analyse.i_me_method = X264_ME_DIA;
+ mod->param.analyse.inter = 0;
+ mod->param.analyse.b_transform_8x8 = 0;
+ mod->param.analyse.b_weighted_bipred = 0;
+ }
+ 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;
+ case 3:
+ mod->param.rc.b_stat_write = 1;
+ mod->param.rc.b_stat_read = 1;
+ break;
+ }
+
+ if(me_method >= 3)
+ mod->param.analyse.i_me_range = me_range;
+
switch(outfmt) {
case IMGFMT_I420:
mod->param.i_csp = X264_CSP_I420;