From e3912d560bb83aaffde2729da8810ffa1b161d5d Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Tue, 19 Apr 2016 16:13:45 -0700 Subject: [PATCH] WebPAnimEncoder: Restore canvas before evaluating blending possibility. Without this, the canvas may have been modified in-between two GenerateCandidate() calls. Change-Id: I0364a269caabdf282c30a8fa3c61896f0247342e --- src/mux/anim_encode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mux/anim_encode.c b/src/mux/anim_encode.c index 44f63efb..79aaa87c 100644 --- a/src/mux/anim_encode.c +++ b/src/mux/anim_encode.c @@ -873,10 +873,14 @@ static WebPEncodingError GenerateCandidates( WebPPicture* const curr_canvas = &enc->curr_canvas_copy_; const WebPPicture* const prev_canvas = is_dispose_none ? &enc->prev_canvas_ : &enc->prev_canvas_disposed_; - const int use_blending_ll = + int use_blending_ll; + int use_blending_lossy; + + CopyCurrentCanvas(enc); + use_blending_ll = !is_key_frame && IsLosslessBlendingPossible(prev_canvas, curr_canvas, ¶ms->rect_ll_); - const int use_blending_lossy = + use_blending_lossy = !is_key_frame && IsLossyBlendingPossible(prev_canvas, curr_canvas, ¶ms->rect_lossy_, config_lossy->quality);