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

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

Issue 2880533002: ImageDecodeBench packeted runs should resume decoding where it left off (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 | « no previous file | 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;
229 while (true) { 230 while (true) {
230 const char* packet; 231 const char* packet;
231 size_t length = data->GetSomeData(packet, position); 232 size_t length = data->GetSomeData(packet, position);
232 233
233 length = std::min(length, packet_size); 234 length = std::min(length, packet_size);
234 packet_data->Append(packet, length); 235 packet_data->Append(packet, length);
235 position += length; 236 position += length;
236 237
237 bool all_data_received = position == data->size(); 238 bool all_data_received = position == data->size();
238 decoder->SetData(packet_data.Get(), all_data_received); 239 decoder->SetData(packet_data.Get(), all_data_received);
239 240
240 int frame_count = decoder->FrameCount(); 241 int frame_count = decoder->FrameCount();
241 for (int i = 0; i < frame_count; ++i) { 242 for (int i = next_frame_to_decode; i < frame_count; ++i) {
scroggo 2017/05/11 13:56:23 FWIW, starting from frame 0 doesn't re-decode thos
cblume 2017/05/11 15:45:31 Ah. I agree. Since I believe this test is aimed a
242 if (!decoder->FrameBufferAtIndex(i)) 243 if (!decoder->FrameBufferAtIndex(i)) {
244 next_frame_to_decode = i;
243 break; 245 break;
246 }
244 } 247 }
245 248
246 if (all_data_received || decoder->Failed()) 249 if (all_data_received || decoder->Failed())
247 break; 250 break;
248 } 251 }
249 252
250 return !decoder->Failed(); 253 return !decoder->Failed();
251 } 254 }
252 255
253 } // namespace 256 } // namespace
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 double average_time = total_time / static_cast<double>(iterations); 350 double average_time = total_time / static_cast<double>(iterations);
348 printf("%f %f\n", total_time, average_time); 351 printf("%f %f\n", total_time, average_time);
349 return 0; 352 return 0;
350 } 353 }
351 354
352 } // namespace blink 355 } // namespace blink
353 356
354 int main(int argc, char* argv[]) { 357 int main(int argc, char* argv[]) {
355 return blink::Main(argc, argv); 358 return blink::Main(argc, argv);
356 } 359 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698