| 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: |
| 11 | 11 |
| 12 % ninja -C /out/Release image_decode_bench && | 12 % ninja -C /out/Release image_decode_bench && |
| 13 ./out/Release/image_decode_beanch file [iterations] | 13 ./out/Release/image_decode_bench file [iterations] |
| 14 | 14 |
| 15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the | 15 FIXME: Consider adding md5 checksum support to WTF. Use it to compute the |
| 16 decoded image frame md5 and output that value. | 16 decoded image frame md5 and output that value. |
| 17 | 17 |
| 18 FIXME: Consider adding an input data packetization option. Break the input | 18 FIXME: Consider adding an input data packetization option. Break the input |
| 19 into network-sized packets, pump the packets into the image decoder until | 19 into network-sized packets, pump the packets into the image decoder until |
| 20 the input data is complete (allDataReceived). This to include any internal | 20 the input data is complete (allDataReceived). This to include any internal |
| 21 SharedBuffer costs, such as buffer coalescing, in the reported results. | 21 SharedBuffer costs, such as buffer coalescing, in the reported results. |
| 22 | 22 |
| 23 FIXME: Consider integrating this tool in Chrome telemetry for realz, using | 23 FIXME: Consider integrating this tool in Chrome telemetry for realz, using |
| 24 the image corpii used to assess Blink image decode performance. Refer to | 24 the image corpii used to assess Blink image decode performance. Refer to |
| 25 http://crbug.com/398235#c103 and http://crbug.com/258324#c5 | 25 http://crbug.com/398235#c103 and http://crbug.com/258324#c5 |
| 26 | 26 |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 | 30 |
| 31 #include "wtf/Threading.h" | |
| 32 #include "platform/SharedBuffer.h" | 31 #include "platform/SharedBuffer.h" |
| 33 #include "platform/graphics/DeferredImageDecoder.h" | |
| 34 #include "platform/image-decoders/ImageDecoder.h" | 32 #include "platform/image-decoders/ImageDecoder.h" |
| 35 #include "public/platform/Platform.h" | 33 #include "public/platform/Platform.h" |
| 36 #include "public/web/WebKit.h" | 34 #include "public/web/WebKit.h" |
| 37 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 38 #include "wtf/PassOwnPtr.h" | |
| 39 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 40 | 37 |
| 41 #if defined(_WIN32) | 38 #if defined(_WIN32) |
| 42 #if defined(WIN32_LEAN_AND_MEAN) | 39 #if defined(WIN32_LEAN_AND_MEAN) |
| 43 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod. | 40 #error Fix: WIN32_LEAN_AND_MEAN disables timeBeginPeriod/TimeEndPeriod. |
| 44 #endif | 41 #endif |
| 45 #include <mmsystem.h> | 42 #include <mmsystem.h> |
| 46 #include <sys/stat.h> | 43 #include <sys/stat.h> |
| 47 #include <time.h> | 44 #include <time.h> |
| 48 #define stat(x,y) _stat(x,y) | 45 #define stat(x,y) _stat(x,y) |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 virtual void screenColorProfile(WebVector<char>* profile) override | 341 virtual void screenColorProfile(WebVector<char>* profile) override |
| 345 { | 342 { |
| 346 getScreenColorProfile(profile); // Returns a whacked color profile. | 343 getScreenColorProfile(profile); // Returns a whacked color profile. |
| 347 } | 344 } |
| 348 }; | 345 }; |
| 349 | 346 |
| 350 blink::initializeWithoutV8(new WebPlatform()); | 347 blink::initializeWithoutV8(new WebPlatform()); |
| 351 | 348 |
| 352 // Set image decoding Platform options. | 349 // Set image decoding Platform options. |
| 353 | 350 |
| 354 DeferredImageDecoder::setEnabled(false); // Disable threaded image decodes. | |
| 355 #if USE(QCMSLIB) | 351 #if USE(QCMSLIB) |
| 356 ImageDecoder::qcmsOutputDeviceProfile(); // Initialize screen colorProfile. | 352 ImageDecoder::qcmsOutputDeviceProfile(); // Initialize screen colorProfile. |
| 357 #endif | 353 #endif |
| 358 | 354 |
| 359 // Read entire file content to data. | 355 // Read entire file content to data. |
| 360 | 356 |
| 361 RefPtr<SharedBuffer> data = readFile(argv[1]); | 357 RefPtr<SharedBuffer> data = readFile(argv[1]); |
| 362 if (!data.get() || !data->size()) { | 358 if (!data.get() || !data->size()) { |
| 363 fprintf(stderr, "Error reading image data from [%s]\n", argv[1]); | 359 fprintf(stderr, "Error reading image data from [%s]\n", argv[1]); |
| 364 exit(2); | 360 exit(2); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 378 exit(3); | 374 exit(3); |
| 379 } | 375 } |
| 380 } | 376 } |
| 381 | 377 |
| 382 // Results to stdout. | 378 // Results to stdout. |
| 383 | 379 |
| 384 double averageTime = totalTime / static_cast<double>(iterations); | 380 double averageTime = totalTime / static_cast<double>(iterations); |
| 385 printf("%f %f\n", totalTime, averageTime); | 381 printf("%f %f\n", totalTime, averageTime); |
| 386 return 0; | 382 return 0; |
| 387 } | 383 } |
| OLD | NEW |