diff options
author | msarett <msarett@google.com> | 2016-07-19 09:07:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-19 09:07:55 -0700 |
commit | 6bdbf4412bd1a6fe26be1042ccf080174b13021f (patch) | |
tree | b25a250336c9de632cfc40a2e6204626620f099d /src/core/SkNx.h | |
parent | 9061aa4217cabc75aca24f929f370c9a82208e73 (diff) |
Improve naive SkColorXform to half floats
This should give us a good baseline to explore using SkRasterPipeline.
A particular colorxform to half float drops from 425us to 282us on my desktop.
Color Xform to Half Float (HP z620)
Original 425us
Trans16 (not 32) 355us
Vector Trans16 378us
Trans16 + Keep Halfs in Vector 335us
Vector Trans16 + Keep Halfs in Vector 282us
Final 282us
Color Xform to Half Float (Nexus 5X)
Original 556us
Final 472us
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2159993003
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Review-Url: https://codereview.chromium.org/2159993003
Diffstat (limited to 'src/core/SkNx.h')
-rw-r--r-- | src/core/SkNx.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/SkNx.h b/src/core/SkNx.h index dec63f8d89..253fcf22fe 100644 --- a/src/core/SkNx.h +++ b/src/core/SkNx.h @@ -309,6 +309,15 @@ SI Sk4i Sk4f_round(const Sk4f& x) { (int) lrintf (x[3]), }; } +// Transpose 4 Sk4h and store (256 bits total). +SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, const Sk4h& a) { + uint64_t* dst64 = (uint64_t*) dst; + Sk4h(r[0], g[0], b[0], a[0]).store(dst64 + 0); + Sk4h(r[1], g[1], b[1], a[1]).store(dst64 + 1); + Sk4h(r[2], g[2], b[2], a[2]).store(dst64 + 2); + Sk4h(r[3], g[3], b[3], a[3]).store(dst64 + 3); +} + #endif SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) { |