diff options
author | yang.zhang <yang.zhang@linaro.org> | 2015-07-15 07:07:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-15 07:07:30 -0700 |
commit | dc77b3591841bf1e70ed45455490d688e5d4e6f9 (patch) | |
tree | 83c6aadf5818ffcfff8d929428735a947e89cf10 /src/core/SkBlitter_RGB16.cpp | |
parent | 004aebd42c26ddd5433492dbb9a70b1bcbcadd3a (diff) |
Optimize RGB16 blitV functions with NEON for ARM platform.
Here are some performance resultsi on Nexus 9:
SkRGB16BlitterBlitV_neon:
+--------+-----------+
|height | C/NEON |
+--------+-----------+
|1 | 0.765230 |
+--------+-----------+
|8 | 1.273330 |
+--------+-----------+
|18 | 1.441462 |
+--------+-----------+
|32 | 1.627798 |
+--------+-----------+
|76 | 1.683131 |
+--------+-----------+
|85 | 1.679456 |
+--------+-----------+
|120 | 1.721311 |
+--------+-----------+
|128 | 1.725482 |
+--------+-----------+
|512 | 1.784117 |
+--------+-----------+
BUG=skia:
Review URL: https://codereview.chromium.org/1213723002
Diffstat (limited to 'src/core/SkBlitter_RGB16.cpp')
-rw-r--r-- | src/core/SkBlitter_RGB16.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkBlitter_RGB16.cpp b/src/core/SkBlitter_RGB16.cpp index 6724b12ace..8caf908312 100644 --- a/src/core/SkBlitter_RGB16.cpp +++ b/src/core/SkBlitter_RGB16.cpp @@ -22,6 +22,11 @@ extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) #include <arm_neon.h> +extern void SkRGB16BlitterBlitV_neon(uint16_t* device, + int height, + size_t deviceRB, + unsigned scale, + uint32_t src32); #else // if we don't have neon, then our black blitter is worth the extra code #define USE_BLACK_BLITTER @@ -484,11 +489,15 @@ void SkRGB16_Opaque_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { unsigned scale5 = SkAlpha255To256(alpha) >> 3; uint32_t src32 = fExpandedRaw16 * scale5; scale5 = 32 - scale5; +#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) + SkRGB16BlitterBlitV_neon(device, height, deviceRB, scale5, src32); +#else do { uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; *device = SkCompact_rgb_16((src32 + dst32) >> 5); device = (uint16_t*)((char*)device + deviceRB); } while (--height != 0); +#endif } void SkRGB16_Opaque_Blitter::blitRect(int x, int y, int width, int height) { @@ -659,11 +668,15 @@ void SkRGB16_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { unsigned scale5 = SkAlpha255To256(alpha) * fScale >> (8 + 3); uint32_t src32 = fExpandedRaw16 * scale5; scale5 = 32 - scale5; +#if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) + SkRGB16BlitterBlitV_neon(device, height, deviceRB, scale5, src32); +#else do { uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; *device = SkCompact_rgb_16((src32 + dst32) >> 5); device = (uint16_t*)((char*)device + deviceRB); } while (--height != 0); +#endif } void SkRGB16_Blitter::blitRect(int x, int y, int width, int height) { |