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 // 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) { |
| 314 uint64_t* dst64 = (uint64_t*) dst; |
| 315 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); |
| 317 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); |
| 319 } |
| 320 |
312 #endif | 321 #endif |
313 | 322 |
314 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { | 323 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c,
const Sk4f& d) { |
315 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 324 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
316 } | 325 } |
317 | 326 |
318 #undef SI | 327 #undef SI |
319 | 328 |
320 #endif//SkNx_DEFINED | 329 #endif//SkNx_DEFINED |
OLD | NEW |