From 59cb2eb53913ac463f7aef99332d3558a95ff040 Mon Sep 17 00:00:00 2001 From: Henrik Gramner Date: Sun, 7 Aug 2011 11:58:36 +0200 Subject: [PATCH] Fix two bugs in 4:4:4 chroma weightp analysis Caused slightly worse compression. --- encoder/slicetype.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/encoder/slicetype.c b/encoder/slicetype.c index 8fb7031d..609b0f1d 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -273,7 +273,7 @@ static NOINLINE unsigned int x264_weight_cost_chroma444( x264_t *h, x264_frame_t else for( int y = 0; y < i_lines; y += 16, pixoff = y*i_stride ) for( int x = 0; x < i_width; x += 16, pixoff += 16 ) - cost += h->pixf.mbcmp[PIXEL_16x16]( &ref[pixoff], 16, &src[pixoff], i_stride ); + cost += h->pixf.mbcmp[PIXEL_16x16]( &ref[pixoff], i_stride, &src[pixoff], i_stride ); x264_emms(); return cost; } @@ -340,7 +340,10 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int else { if( CHROMA444 ) + { mcbuf = x264_weight_cost_init_chroma444( h, fenc, ref, h->mb.p_weight_buf[0], plane ); + origscore = minscore = x264_weight_cost_chroma444( h, fenc, mcbuf, NULL, plane ); + } else { pixel *dstu = h->mb.p_weight_buf[0]; @@ -349,8 +352,8 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int if( plane == 1 ) x264_weight_cost_init_chroma( h, fenc, ref, dstu, dstv ); mcbuf = plane == 1 ? dstu : dstv; + origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL ); } - origscore = minscore = x264_weight_cost_chroma( h, fenc, mcbuf, NULL ); } if( !minscore ) -- 2.47.3