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

Side by Side Diff: Source/platform/image-decoders/ImageDecoder.cpp

Issue 23532077: [Experiment] Animated image decoder benchmark tool Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/image-decoders/ImageDecoder.h ('k') | Source/web/ImageDecodeBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // this frame is a blank frame, so it can again be decoded alone. 191 // this frame is a blank frame, so it can again be decoded alone.
192 // Otherwise, the previous frame contributes to this frame. 192 // Otherwise, the previous frame contributes to this frame.
193 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz e())) 193 return (prevBuffer->originalFrameRect().contains(IntRect(IntPoint(), siz e()))
194 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo und : prevFrame; 194 || (prevBuffer->requiredPreviousFrameIndex() == kNotFound)) ? kNotFo und : prevFrame;
195 default: 195 default:
196 ASSERT_NOT_REACHED(); 196 ASSERT_NOT_REACHED();
197 return kNotFound; 197 return kNotFound;
198 } 198 }
199 } 199 }
200 200
201 size_t ImageDecoder::countIndependentFrames() const
202 {
203 size_t count = 0;
204 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) {
205 if (m_frameBufferCache[i].requiredPreviousFrameIndex() == kNotFound)
206 ++count;
207 }
208 return count;
209 }
210
211 float ImageDecoder::countAverageDependentFrames() const
212 {
213 const size_t numFrames = m_frameBufferCache.size();
214 float total = 0;
215 for (size_t i = 0; i < numFrames; ++i) {
216 const ImageFrame* buffer = &m_frameBufferCache[i];
217 while (buffer->requiredPreviousFrameIndex() != kNotFound) {
218 ++total;
219 buffer = &m_frameBufferCache[buffer->requiredPreviousFrameIndex()];
220 }
221 }
222 return total / numFrames;
223 }
224
225 size_t ImageDecoder::countMaxDependentFrames() const
226 {
227 size_t max = 0;
228 for (size_t i = 0; i < m_frameBufferCache.size(); ++i) {
229 size_t count = 0;
230 const ImageFrame* buffer = &m_frameBufferCache[i];
231 while (buffer->requiredPreviousFrameIndex() != kNotFound) {
232 ++count;
233 buffer = &m_frameBufferCache[buffer->requiredPreviousFrameIndex()];
234 }
235 if (count > max)
236 max = count;
237 }
238 return max;
239 }
240
201 } // namespace WebCore 241 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/platform/image-decoders/ImageDecoder.h ('k') | Source/web/ImageDecodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698