OLD | NEW |
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 #ifdef WTF | 5 #ifdef WTF |
6 | 6 |
7 Provides a minimal wrapping of the Blink image decoders. Used to perform | 7 Provides a minimal wrapping of the Blink image decoders. Used to perform |
8 a non-threaded, memory-to-memory image decode using micro second accuracy | 8 a non-threaded, memory-to-memory image decode using micro second accuracy |
9 clocks to measure image decode time. Optionally applies color correction | 9 clocks to measure image decode time. Optionally applies color correction |
10 during image decoding on supported platforms (default off). Usage: | 10 during image decoding on supported platforms (default off). Usage: |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 exit(2); | 266 exit(2); |
267 } | 267 } |
268 | 268 |
269 fclose(fp); | 269 fclose(fp); |
270 return SharedBuffer::create(buffer.get(), fileSize); | 270 return SharedBuffer::create(buffer.get(), fileSize); |
271 } | 271 } |
272 | 272 |
273 bool decodeImageData(SharedBuffer* data, bool colorCorrection) | 273 bool decodeImageData(SharedBuffer* data, bool colorCorrection) |
274 { | 274 { |
275 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, | 275 OwnPtr<ImageDecoder> decoder = ImageDecoder::create(*data, |
276 ImageSource::AlphaPremultiplied, colorCorrection ? | 276 ImageDecoder::AlphaPremultiplied, colorCorrection ? |
277 ImageSource::GammaAndColorProfileApplied : ImageSource::GammaAndColo
rProfileIgnored); | 277 ImageDecoder::GammaAndColorProfileApplied : ImageDecoder::GammaAndCo
lorProfileIgnored); |
278 | 278 |
279 bool allDataReceived = true; | 279 bool allDataReceived = true; |
280 decoder->setData(data, allDataReceived); | 280 decoder->setData(data, allDataReceived); |
281 | 281 |
282 int frameCount = decoder->frameCount(); | 282 int frameCount = decoder->frameCount(); |
283 for (int i = 0; i < frameCount; ++i) { | 283 for (int i = 0; i < frameCount; ++i) { |
284 if (!decoder->frameBufferAtIndex(i)) | 284 if (!decoder->frameBufferAtIndex(i)) |
285 return false; | 285 return false; |
286 } | 286 } |
287 | 287 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 exit(3); | 374 exit(3); |
375 } | 375 } |
376 } | 376 } |
377 | 377 |
378 // Results to stdout. | 378 // Results to stdout. |
379 | 379 |
380 double averageTime = totalTime / static_cast<double>(iterations); | 380 double averageTime = totalTime / static_cast<double>(iterations); |
381 printf("%f %f\n", totalTime, averageTime); | 381 printf("%f %f\n", totalTime, averageTime); |
382 return 0; | 382 return 0; |
383 } | 383 } |
OLD | NEW |