From fcf5895a64475d3a989fdc1ba8f8acd3731225ce Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Mon, 22 Nov 2010 17:17:36 +0300 Subject: [PATCH] Add missed weight_cache which can result in artifacts with weightp --- encoder/encoder.c | 3 ++- encoder/slicetype.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 6cfef3c..8b14b41 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1537,7 +1537,8 @@ static void x264_weighted_pred_init( x264_t *h ) if( !weightplane[0] ) h->sh.weight[0][0].i_denom = 0; if( !weightplane[1] ) - h->sh.weight[0][1].i_denom = h->sh.weight[0][2].i_denom = 0; + h->sh.weight[0][1].i_denom = 0; + h->sh.weight[0][2].i_denom = h->sh.weight[0][1].i_denom; } static inline void x264_reference_build_list( x264_t *h, int i_poc ) diff --git a/encoder/slicetype.c b/encoder/slicetype.c index 450cc5c..edf74c4 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -262,6 +262,8 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int } else x264_weight_get_h264( round( guess_scale * 128 ), 0, &weights[plane] ); + if( weights[plane].weightfn ) + h->mc.weight_cache( h, &weights[plane] ); found = 0; mindenom = weights[plane].i_denom; @@ -333,6 +335,7 @@ void x264_weights_analyse( x264_t *h, x264_frame_t *fenc, x264_frame_t *ref, int { weights[i].i_scale = x264_clip3( weights[i].i_scale >> ( weights[i].i_denom - denom ), 0, 255 ); weights[i].i_denom = denom; + h->mc.weight_cache( h, &weights[i] ); } } -- 1.6.1.9.g97c34