[MPlayer-cvslog] CVS: main/libmpcodecs ve_x264.c,1.31,1.32

Guillaume Poirier CVS syncmail at mplayerhq.hu
Mon Jul 11 19:52:05 CEST 2005


CVS change done by Guillaume Poirier CVS

Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv25567/libmpcodecs

Modified Files:
	ve_x264.c 
Log Message:
x264 fast first pass, patch by Robert Swain < robert POUM swain AH gmail POUM com >


Index: ve_x264.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ve_x264.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- ve_x264.c	17 Jun 2005 08:26:12 -0000	1.31
+++ ve_x264.c	11 Jul 2005 17:52:02 -0000	1.32
@@ -104,6 +104,7 @@
 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 @@
                "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 @@
         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 @@
     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;




More information about the MPlayer-cvslog mailing list