diff options
author | msarett <msarett@google.com> | 2016-02-02 12:59:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-02 12:59:45 -0800 |
commit | 2eff71c9b5f984b58961e5a6b4e66774c4385224 (patch) | |
tree | 293d3695ce3fef947112572bef608b5773927573 /src/codec/SkSwizzler.cpp | |
parent | c92159c8250c62cc47b7b63686538d61d54d2835 (diff) |
NEON optimizations for gray -> RGBA (or BGRA) conversions
Swizzle Bench Runtime
Nexus 6P 0.32x
Nexus 9 0.89x
PNG Decode Time (for test set of gray encoded PNGs)
Nexus 6P 0.88x
Nexus 9 0.91x
BUG=skia:4767
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1656383002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Review URL: https://codereview.chromium.org/1656383002
Diffstat (limited to 'src/codec/SkSwizzler.cpp')
-rw-r--r-- | src/codec/SkSwizzler.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp index 7865184cce..fa93a6e928 100644 --- a/src/codec/SkSwizzler.cpp +++ b/src/codec/SkSwizzler.cpp @@ -270,6 +270,19 @@ static void swizzle_gray_to_n32( } } +static void fast_swizzle_gray_to_n32( + void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, + const SkPMColor ctable[]) { + + // This function must not be called if we are sampling. If we are not + // sampling, deltaSrc should equal bpp. + SkASSERT(deltaSrc == bpp); + + // Note that there is no need to distinguish between RGB and BGR. + // Each color channel will get the same value. + SkOpts::gray_to_RGB1((uint32_t*) dst, src + offset, width); +} + static void swizzle_gray_to_565( void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[]) { @@ -639,6 +652,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, switch (dstInfo.colorType()) { case kN32_SkColorType: proc = &swizzle_gray_to_n32; + fastProc = &fast_swizzle_gray_to_n32; break; case kGray_8_SkColorType: proc = &sample1; |