From: Dylan Yudaken Date: Thu, 7 Apr 2011 23:06:19 +0000 (-0700) Subject: Remove redundant mbcmp calls in weightp analysis X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=e577efbf274f78ef9149414b65c80634484b42ad;p=x264.git Remove redundant mbcmp calls in weightp analysis --- diff --git a/encoder/slicetype.c b/encoder/slicetype.c index df20fcf6..e3df242b 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -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; }