From 59ce517a0213bd8505bb4e6315e2970df04dae6e Mon Sep 17 00:00:00 2001 From: Dylan Yudaken Date: Thu, 7 Apr 2011 16:06:19 -0700 Subject: [PATCH] Remove redundant mbcmp calls in weightp analysis --- encoder/slicetype.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/encoder/slicetype.c b/encoder/slicetype.c index 6bef0fba..88b90445 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; } -- 2.40.0