]> granicus.if.org Git - libx264/commitdiff
Faster direct check with subpartitions off
authorFiona Glaser <fiona@x264.com>
Tue, 30 Mar 2010 02:03:13 +0000 (19:03 -0700)
committerFiona Glaser <fiona@x264.com>
Wed, 31 Mar 2010 17:42:38 +0000 (10:42 -0700)
Also simplify the whole function a bit.

encoder/analyse.c

index 3e091d952f6a1b1a50ee5b23873ce3675537e624..fbb97aba1a46205b3cb0a75df729bf0cdd2aa43d 100644 (file)
@@ -1617,22 +1617,24 @@ static void x264_mb_analyse_inter_direct( x264_t *h, x264_mb_analysis_t *a )
     /* Assumes that fdec still contains the results of
      * x264_mb_predict_mv_direct16x16 and x264_mb_mc */
 
-    uint8_t **p_fenc = h->mb.pic.p_fenc;
-    uint8_t **p_fdec = h->mb.pic.p_fdec;
-    int i;
+    uint8_t *p_fenc = h->mb.pic.p_fenc[0];
+    uint8_t *p_fdec = h->mb.pic.p_fdec[0];
 
     a->i_cost16x16direct = a->i_lambda * i_mb_b_cost_table[B_DIRECT];
-    for( i = 0; i < 4; i++ )
-    {
-        const int x = (i&1)*8;
-        const int y = (i>>1)*8;
-        a->i_cost16x16direct +=
-        a->i_cost8x8direct[i] =
-            h->pixf.mbcmp[PIXEL_8x8]( &p_fenc[0][x+y*FENC_STRIDE], FENC_STRIDE, &p_fdec[0][x+y*FDEC_STRIDE], FDEC_STRIDE );
-
-        /* mb type cost */
-        a->i_cost8x8direct[i] += a->i_lambda * i_sub_mb_b_cost_table[D_DIRECT_8x8];
-    }
+    if( h->param.analyse.inter & X264_ANALYSE_BSUB16x16 )
+        for( int i = 0; i < 4; i++ )
+        {
+            const int x = (i&1)*8;
+            const int y = (i>>1)*8;
+            a->i_cost16x16direct +=
+            a->i_cost8x8direct[i] =
+                h->pixf.mbcmp[PIXEL_8x8]( &p_fenc[x+y*FENC_STRIDE], FENC_STRIDE, &p_fdec[x+y*FDEC_STRIDE], FDEC_STRIDE );
+
+            /* mb type cost */
+            a->i_cost8x8direct[i] += a->i_lambda * i_sub_mb_b_cost_table[D_DIRECT_8x8];
+        }
+    else
+        a->i_cost16x16direct += h->pixf.mbcmp[PIXEL_16x16]( p_fenc, FENC_STRIDE, p_fdec, FDEC_STRIDE );
 }
 
 static void x264_mb_analyse_inter_b16x16( x264_t *h, x264_mb_analysis_t *a )