Chromium Code Reviews| 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 typedef SkNx<8, uint16_t> Sk8h; | 292 typedef SkNx<8, uint16_t> Sk8h; |
| 293 typedef SkNx<16, uint16_t> Sk16h; | 293 typedef SkNx<16, uint16_t> Sk16h; |
| 294 | 294 |
| 295 typedef SkNx<4, int> Sk4i; | 295 typedef SkNx<4, int> Sk4i; |
| 296 | 296 |
| 297 // Include platform specific specializations if available. | 297 // Include platform specific specializations if available. |
| 298 #if !defined(SKNX_NO_SIMD) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 | 298 #if !defined(SKNX_NO_SIMD) && SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 299 #include "../opts/SkNx_sse.h" | 299 #include "../opts/SkNx_sse.h" |
| 300 #elif !defined(SKNX_NO_SIMD) && defined(SK_ARM_HAS_NEON) | 300 #elif !defined(SKNX_NO_SIMD) && defined(SK_ARM_HAS_NEON) |
| 301 #include "../opts/SkNx_neon.h" | 301 #include "../opts/SkNx_neon.h" |
| 302 #else | |
| 303 | |
| 304 SI Sk4i Sk4f_RoundToInt(const Sk4f& x) { | |
| 305 return { sk_float_round2int(x[0]), | |
|
mtklein
2016/07/11 14:05:03
If we can't implement this in terms of things from
msarett
2016/07/12 15:42:43
lrintf() seems fine to me.
| |
| 306 sk_float_round2int(x[1]), | |
| 307 sk_float_round2int(x[2]), | |
| 308 sk_float_round2int(x[3]), }; | |
| 309 } | |
| 310 | |
| 311 SI uint32_t Sk4f_RoundToByte(const Sk4f& x) { | |
|
mtklein
2016/07/11 14:05:03
Why don't we simplify this by adding just one new
msarett
2016/07/12 15:42:43
SGTM
| |
| 312 return sk_float_round2int(x[0]) << 0 | |
| 313 | sk_float_round2int(x[1]) << 8 | |
| 314 | sk_float_round2int(x[2]) << 16 | |
| 315 | sk_float_round2int(x[3]) << 24; | |
| 316 } | |
| 317 | |
| 302 #endif | 318 #endif |
| 303 | 319 |
| 304 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) { | 320 SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) { |
| 305 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); | 321 SkNx_cast<uint8_t>(SkNx_join(SkNx_join(a,b), SkNx_join(c,d))).store(p); |
| 306 } | 322 } |
| 307 | 323 |
| 308 #undef SI | 324 #undef SI |
| 309 | 325 |
| 310 #endif//SkNx_DEFINED | 326 #endif//SkNx_DEFINED |
| OLD | NEW |