From dc77b3591841bf1e70ed45455490d688e5d4e6f9 Mon Sep 17 00:00:00 2001 From: "yang.zhang" Date: Wed, 15 Jul 2015 07:07:30 -0700 Subject: 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 --- src/core/SkBlitter_RGB16.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/core/SkBlitter_RGB16.cpp') 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 +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) { -- cgit v1.2.3