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

Side by Side Diff: third_party/WebKit/Source/platform/testing/ImageDecodeBench.cpp

Issue 2878363003: Revert of Fix ImageAnimation constant names after Blink renaming (Closed)
Patch Set: Created 3 years, 7 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 | « third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Provides a minimal wrapping of the Blink image decoders. Used to perform 5 // Provides a minimal wrapping of the Blink image decoders. Used to perform
6 // a non-threaded, memory-to-memory image decode using micro second accuracy 6 // a non-threaded, memory-to-memory image decode using micro second accuracy
7 // clocks to measure image decode time. Optionally applies color correction 7 // clocks to measure image decode time. Optionally applies color correction
8 // during image decoding on supported platforms (default off). Usage: 8 // during image decoding on supported platforms (default off). Usage:
9 // 9 //
10 // % ninja -C out/Release image_decode_bench && 10 // % ninja -C out/Release image_decode_bench &&
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 for (int i = 0; i < frame_count; ++i) { 219 for (int i = 0; i < frame_count; ++i) {
220 if (!decoder->FrameBufferAtIndex(i)) 220 if (!decoder->FrameBufferAtIndex(i))
221 return false; 221 return false;
222 } 222 }
223 223
224 return !decoder->Failed(); 224 return !decoder->Failed();
225 } 225 }
226 226
227 RefPtr<SharedBuffer> packet_data = SharedBuffer::Create(); 227 RefPtr<SharedBuffer> packet_data = SharedBuffer::Create();
228 size_t position = 0; 228 size_t position = 0;
229 size_t next_frame_to_decode = 0;
230 while (true) { 229 while (true) {
231 const char* packet; 230 const char* packet;
232 size_t length = data->GetSomeData(packet, position); 231 size_t length = data->GetSomeData(packet, position);
233 232
234 length = std::min(length, packet_size); 233 length = std::min(length, packet_size);
235 packet_data->Append(packet, length); 234 packet_data->Append(packet, length);
236 position += length; 235 position += length;
237 236
238 bool all_data_received = position == data->size(); 237 bool all_data_received = position == data->size();
239 size_t frame_count = decoder->FrameCount(); 238 decoder->SetData(packet_data.Get(), all_data_received);
240 for (; next_frame_to_decode < frame_count; ++next_frame_to_decode) { 239
241 decoder->SetData(packet_data.Get(), all_data_received); 240 int frame_count = decoder->FrameCount();
242 ImageFrame* frame = decoder->FrameBufferAtIndex(next_frame_to_decode); 241 for (int i = 0; i < frame_count; ++i) {
243 if (frame->GetStatus() != ImageFrame::kFrameComplete) 242 if (!decoder->FrameBufferAtIndex(i))
244 break; 243 break;
245 decoder->SetData(PassRefPtr<SegmentReader>(nullptr), false);
246 decoder->ClearCacheExceptFrame(next_frame_to_decode);
247 } 244 }
248 245
249 if (all_data_received || decoder->Failed()) 246 if (all_data_received || decoder->Failed())
250 break; 247 break;
251 } 248 }
252 249
253 return !decoder->Failed(); 250 return !decoder->Failed();
254 } 251 }
255 252
256 } // namespace 253 } // namespace
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 double average_time = total_time / static_cast<double>(iterations); 347 double average_time = total_time / static_cast<double>(iterations);
351 printf("%f %f\n", total_time, average_time); 348 printf("%f %f\n", total_time, average_time);
352 return 0; 349 return 0;
353 } 350 }
354 351
355 } // namespace blink 352 } // namespace blink
356 353
357 int main(int argc, char* argv[]) { 354 int main(int argc, char* argv[]) {
358 return blink::Main(argc, argv); 355 return blink::Main(argc, argv);
359 } 356 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698