From ae1c046e120350b92e366a421289a060b7711fc2 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Tue, 6 Jan 2015 16:22:29 -0800 Subject: [PATCH] AnimEncoder lib cleanup: prev to prev canvas not needed. Given that we decided to only handle frame disposal for output WebP internally, only current and previous canvas need to be maintained. Change-Id: I625293bed5aeb5aabf4eca779f6ec3ee84c9ff2a --- src/mux/anim_encode.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/mux/anim_encode.c b/src/mux/anim_encode.c index b192ee59..79ebc9a2 100644 --- a/src/mux/anim_encode.c +++ b/src/mux/anim_encode.c @@ -46,7 +46,6 @@ struct WebPAnimEncoder { WebPPicture curr_canvas_mod_; // Possibly modified current canvas. WebPPicture prev_canvas_; // Previous canvas. WebPPicture prev_canvas_disposed_; // Previous canvas disposed to background. - WebPPicture prev_to_prev_canvas_; // Previous to previous canvas. // Encoded data. EncodedFrame* encoded_frames_; // Array of encoded frames. @@ -204,8 +203,7 @@ WebPAnimEncoder* WebPAnimEncoderNewInternal( // Canvas buffers. if (!WebPPictureInit(&enc->curr_canvas_mod_) || !WebPPictureInit(&enc->prev_canvas_) || - !WebPPictureInit(&enc->prev_canvas_disposed_) || - !WebPPictureInit(&enc->prev_to_prev_canvas_)) { + !WebPPictureInit(&enc->prev_canvas_disposed_)) { return NULL; } enc->curr_canvas_mod_.width = width; @@ -213,12 +211,10 @@ WebPAnimEncoder* WebPAnimEncoderNewInternal( enc->curr_canvas_mod_.use_argb = 1; if (!WebPPictureAlloc(&enc->curr_canvas_mod_) || !WebPPictureCopy(&enc->curr_canvas_mod_, &enc->prev_canvas_) || - !WebPPictureCopy(&enc->curr_canvas_mod_, &enc->prev_canvas_disposed_) || - !WebPPictureCopy(&enc->curr_canvas_mod_, &enc->prev_to_prev_canvas_)) { + !WebPPictureCopy(&enc->curr_canvas_mod_, &enc->prev_canvas_disposed_)) { goto Err; } WebPUtilClearPic(&enc->prev_canvas_, NULL); - WebPUtilClearPic(&enc->prev_to_prev_canvas_, NULL); // Encoded frames. ResetCounters(enc); @@ -256,7 +252,6 @@ void WebPAnimEncoderDelete(WebPAnimEncoder* enc) { WebPPictureFree(&enc->curr_canvas_mod_); WebPPictureFree(&enc->prev_canvas_); WebPPictureFree(&enc->prev_canvas_disposed_); - WebPPictureFree(&enc->prev_to_prev_canvas_); if (enc->encoded_frames_ != NULL) { size_t i; for (i = 0; i < enc->size_; ++i) { @@ -966,7 +961,6 @@ static int CacheFrame(WebPAnimEncoder* const enc, int duration, } // Update previous to previous and previous canvases for next call. - CopyPixels(&enc->prev_canvas_, &enc->prev_to_prev_canvas_); CopyPixels(enc->curr_canvas_, &enc->prev_canvas_); enc->is_first_frame_ = 0; ok = 1;