Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Issue 15969015: Reland again "Decode GIF image frames on demand". (Closed)

Created:
7 years, 6 months ago by Xianzhu
Modified:
7 years, 6 months ago
CC:
blink-reviews, jamesr, eae+blinkwatch, danakj, Rik, f(malita), pdr, Stephen Chennney, jeez, pdr.
Visibility:
Public.

Description

Reland again "Decode GIF image frames on demand". Change over https://codereview.chromium.org/16260002 (r151564): - Fix ImageFrame operator =. - Set requiredPreviousFrameIndex to notFound and premultiplyAlpha to m_premultiplyAlpha after the ImageFrame is assigned from PNGImageDecoder decoding result. - Remove ASSERT(m_decodedSize == 0 || frameCount > 1) (which caused bug 246118). We could preserve the ASSERT by not clearing m_frames if frameCount == 1 in BitmapImage::destroyDecodedData(), but I think we'd better let the decoder control which frames to clear. If the frame is not actually cleared, recaching the frame is cheap. Change over https://codereview.chromium.org/15350006 (r151560): Workaround const_reverse_iterator issue of Android compiler. Previously GIFImageDecoder::frameBufferAtIndex() decodes all frames from the last decoded frame to the requested frame. This causes delays when skipping to specific frames. With this change, GIFImageDecoder decodes only necessary frames based on previous frames' disposal methods. Added ImageDecoder::findRequiredPreviousFrame() to find the required previous frame based on the disposal methods. Also changed the behavior of GIFImageDecoder::clearFrameBufferCache() (moved to ImageDecoder because it can be shared between multi-frame decoders) because the original semantics no longer apply with on-demand frame decoding. Instead of clearing before the given frame, now clear from the whole frame buffer cache, preserving the frames that are likely to be used soon. BUG=238242, 246118 TEST=ImageDecoderTest.requiredPreviousFrameIndex*, ImageDecoderTest.clearCacheExceptFrame*, GIFImageDecoderTest.updateRequiredPreviousFrameAfterFirstDecode, GIFImageDecoderTest.randomFrameDecode, GIFImageDecoderTest.randomDecodeAfterClearFrameBufferCache, GIFImageDecoderTest.resumePartialDecodeAfterClearFrameBufferCache,ICODecoderTest.Decode(in content_unittests). R=pkasting@chromium.org TBR=abarth@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151702

Patch Set 1 : Original code (revert of revert) #

Patch Set 2 : Fix the issue #

Patch Set 3 : Remove ASSERT in BitmapImage::cacheFrame() #

Total comments: 2

Patch Set 4 : For landing #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+731 lines, -668 lines) Patch
M Source/WebKit/chromium/WebKit.gypi View 1 chunk +0 lines, -1 line 0 comments Download
M Source/WebKit/chromium/tests/DragImageTest.cpp View 2 chunks +6 lines, -8 lines 0 comments Download
D Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp View 1 chunk +0 lines, -325 lines 0 comments Download
M Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp View 3 chunks +9 lines, -11 lines 0 comments Download
M Source/core/core.gypi View 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/platform/graphics/BitmapImage.h View 5 chunks +20 lines, -24 lines 0 comments Download
M Source/core/platform/graphics/BitmapImage.cpp View 1 2 5 chunks +12 lines, -28 lines 0 comments Download
M Source/core/platform/graphics/GeneratedImage.h View 1 chunk +10 lines, -11 lines 0 comments Download
M Source/core/platform/graphics/Image.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/platform/graphics/ImageSource.h View 2 chunks +15 lines, -23 lines 0 comments Download
M Source/core/platform/graphics/ImageSource.cpp View 1 chunk +2 lines, -11 lines 0 comments Download
M Source/core/platform/graphics/chromium/DeferredImageDecoder.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/core/platform/graphics/chromium/DeferredImageDecoder.cpp View 1 chunk +2 lines, -3 lines 0 comments Download
M Source/core/platform/image-decoders/ImageDecoder.h View 5 chunks +50 lines, -4 lines 0 comments Download
M Source/core/platform/image-decoders/ImageDecoder.cpp View 2 chunks +70 lines, -1 line 0 comments Download
A Source/core/platform/image-decoders/ImageDecoderTest.cpp View 1 chunk +216 lines, -0 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageDecoder.h View 1 chunk +26 lines, -20 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp View 8 chunks +90 lines, -132 lines 0 comments Download
A + Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp View 1 12 chunks +152 lines, -11 lines 2 comments Download
M Source/core/platform/image-decoders/gif/GIFImageReader.h View 7 chunks +6 lines, -8 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageReader.cpp View 3 chunks +14 lines, -31 lines 0 comments Download
M Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp View 1 2 3 2 chunks +5 lines, -1 line 0 comments Download
M Source/core/platform/image-decoders/skia/ImageDecoderSkia.cpp View 1 2 chunks +9 lines, -0 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.h View 2 chunks +11 lines, -11 lines 0 comments Download
M Source/core/svg/graphics/SVGImageForContainer.h View 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Xianzhu
7 years, 6 months ago (2013-06-03 17:18:11 UTC) #1
Peter Kasting
LGTM https://codereview.chromium.org/15969015/diff/1026/Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp File Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp (right): https://codereview.chromium.org/15969015/diff/1026/Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp#newcode240 Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp:240: m_frameBufferCache[index].setRequiredPreviousFrameIndex(notFound); Do you need to call setPremultiplyAlpha here ...
7 years, 6 months ago (2013-06-03 18:39:10 UTC) #2
Xianzhu
https://codereview.chromium.org/15969015/diff/1026/Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp File Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp (right): https://codereview.chromium.org/15969015/diff/1026/Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp#newcode240 Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp:240: m_frameBufferCache[index].setRequiredPreviousFrameIndex(notFound); On 2013/06/03 18:39:10, Peter Kasting wrote: > Do ...
7 years, 6 months ago (2013-06-03 18:44:43 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15969015/13001
7 years, 6 months ago (2013-06-03 18:45:04 UTC) #4
commit-bot: I haz the power
Commit queue rejected this change because the description was changed between the time the change ...
7 years, 6 months ago (2013-06-03 23:42:22 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15969015/13001
7 years, 6 months ago (2013-06-03 23:44:28 UTC) #6
commit-bot: I haz the power
Change committed as 151702
7 years, 6 months ago (2013-06-03 23:53:12 UTC) #7
urvang (Google)
7 years, 6 months ago (2013-06-06 18:33:50 UTC) #8
Message was sent while issue was closed.
Noticed this when applying similar changes to my WebP animation patch.

https://chromiumcodereview.appspot.com/15969015/diff/13001/Source/core/platfo...
File Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp (right):

https://chromiumcodereview.appspot.com/15969015/diff/13001/Source/core/platfo...
Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp:410:
OwnPtr<GIFImageDecoder> decoder = createDecoder();
Need to do "decoder->setData()" after this.

https://chromiumcodereview.appspot.com/15969015/diff/13001/Source/core/platfo...
Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp:427:
testRandomFrameDecode("/Source/WebKit/chromium/tests/data/radient.gif");
All these calls should be "testRandomDecodeAfterClearFrameBufferCache()"
instead!!

Powered by Google App Engine
This is Rietveld 408576698