]> git.sesse.net Git - x264/commitdiff
Remove redundant mbcmp calls in weightp analysis
authorDylan Yudaken <dyudaken@gmail.com>
Thu, 7 Apr 2011 23:06:19 +0000 (16:06 -0700)
committerFiona Glaser <fiona@x264.com>
Tue, 12 Apr 2011 08:37:36 +0000 (01:37 -0700)
encoder/slicetype.c

index 6bef0fba68a059b3eca4687d107d431d0f2664e0..88b9044571dc9746ba0fe134f45ff98ff30b54a0 100644 (file)
@@ -167,14 +167,18 @@ static NOINLINE unsigned int x264_weight_cost_luma( x264_t *h, x264_frame_t *fen
             for( int x = 0; x < i_width; x += 8, i_mb++, pixoff += 8)
             {
                 w->weightfn[8>>2]( buf, 8, &src[pixoff], i_stride, w, 8 );
-                cost += X264_MIN( h->pixf.mbcmp[PIXEL_8x8]( buf, 8, &fenc_plane[pixoff], i_stride ), fenc->i_intra_cost[i_mb] );
+                int cmp = h->pixf.mbcmp[PIXEL_8x8]( buf, 8, &fenc_plane[pixoff], i_stride );
+                cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] );
             }
         cost += x264_weight_slice_header_cost( h, w, 0 );
     }
     else
         for( int y = 0; y < i_lines; y += 8, pixoff = y*i_stride )
             for( int x = 0; x < i_width; x += 8, i_mb++, pixoff += 8 )
-                cost += X264_MIN( h->pixf.mbcmp[PIXEL_8x8]( &src[pixoff], i_stride, &fenc_plane[pixoff], i_stride ), fenc->i_intra_cost[i_mb] );
+            {
+                int cmp = h->pixf.mbcmp[PIXEL_8x8]( &src[pixoff], i_stride, &fenc_plane[pixoff], i_stride );
+                cost += X264_MIN( cmp, fenc->i_intra_cost[i_mb] );
+            }
     x264_emms();
     return cost;
 }