| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkNx_DEFINED | 8 #ifndef SkNx_DEFINED |
| 9 #define SkNx_DEFINED | 9 #define SkNx_DEFINED |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 #include "../opts/SkNx_neon.h" | 302 #include "../opts/SkNx_neon.h" |
| 303 #else | 303 #else |
| 304 | 304 |
| 305 SI Sk4i Sk4f_round(const Sk4f& x) { | 305 SI Sk4i Sk4f_round(const Sk4f& x) { |
| 306 return { (int) lrintf (x[0]), | 306 return { (int) lrintf (x[0]), |
| 307 (int) lrintf (x[1]), | 307 (int) lrintf (x[1]), |
| 308 (int) lrintf (x[2]), | 308 (int) lrintf (x[2]), |
| 309 (int) lrintf (x[3]), }; | 309 (int) lrintf (x[3]), }; |
| 310 } | 310 } |
| 311 | 311 |
| 312 // Load 4 Sk4h and transpose them (256 bits total). |
| 313 SI void Sk4h_load4(const void* vptr, Sk4h* r, Sk4h* g, Sk4h* b, Sk4h* a) { |
| 314 const uint64_t* ptr = (const uint64_t*)vptr; |
| 315 auto p0 = Sk4h::Load(ptr+0), |
| 316 p1 = Sk4h::Load(ptr+1), |
| 317 p2 = Sk4h::Load(ptr+2), |
| 318 p3 = Sk4h::Load(ptr+3); |
| 319 *r = { p0[0], p1[0], p2[0], p3[0] }; |
| 320 *g = { p0[1], p1[1], p2[1], p3[1] }; |
| 321 *b = { p0[2], p1[2], p2[2], p3[2] }; |
| 322 *a = { p0[3], p1[3], p2[3], p3[3] }; |
| 323 } |
| 324 |
| 312 // Transpose 4 Sk4h and store (256 bits total). | 325 // Transpose 4 Sk4h and store (256 bits total). |
| 313 SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, cons
t Sk4h& a) { | 326 SI void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk4h& b, cons
t Sk4h& a) { |
| 314 uint64_t* dst64 = (uint64_t*) dst; | 327 uint64_t* dst64 = (uint64_t*) dst; |
| 315 Sk4h(r[0], g[0], b[0], a[0]).store(dst64 + 0); | 328 Sk4h(r[0], g[0], b[0], a[0]).store(dst64 + 0); |
| 316 Sk4h(r[1], g[1], b[1], a[1]).store(dst64 + 1); | 329 Sk4h(r[1], g[1], b[1], a[1]).store(dst64 + 1); |
| 317 Sk4h(r[2], g[2], b[2], a[2]).store(dst64 + 2); | 330 Sk4h(r[2], g[2], b[2], a[2]).store(dst64 + 2); |
| 318 Sk4h(r[3], g[3], b[3], a[3]).store(dst64 + 3); | 331 Sk4h(r[3], g[3], b[3], a[3]).store(dst64 + 3); |
| 319 } | 332 } |
| 320 | 333 |
| 321 #endif | 334 #endif |
| 322 | 335 |
| 323 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { | 336 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { |
| 324 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 337 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
| 325 } | 338 } |
| 326 | 339 |
| 327 #undef SI | 340 #undef SI |
| 328 | 341 |
| 329 #endif//SkNx_DEFINED | 342 #endif//SkNx_DEFINED |
| OLD | NEW |