| 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_neon_DEFINED | 8 #ifndef SkNx_neon_DEFINED |
| 9 #define SkNx_neon_DEFINED | 9 #define SkNx_neon_DEFINED |
| 10 | 10 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 500 } |
| 501 | 501 |
| 502 template<> inline Sk4i SkNx_cast<int32_t, uint16_t>(const Sk4h& src) { | 502 template<> inline Sk4i SkNx_cast<int32_t, uint16_t>(const Sk4h& src) { |
| 503 return vreinterpretq_s32_u32(vmovl_u16(src.fVec)); | 503 return vreinterpretq_s32_u32(vmovl_u16(src.fVec)); |
| 504 } | 504 } |
| 505 | 505 |
| 506 template<> inline Sk4h SkNx_cast<uint16_t, int32_t>(const Sk4i& src) { | 506 template<> inline Sk4h SkNx_cast<uint16_t, int32_t>(const Sk4i& src) { |
| 507 return vmovn_u32(vreinterpretq_u32_s32(src.fVec)); | 507 return vmovn_u32(vreinterpretq_u32_s32(src.fVec)); |
| 508 } | 508 } |
| 509 | 509 |
| 510 template<> /*static*/ inline Sk4i SkNx_cast<int32_t, uint32_t>(const Sk4u& src)
{ |
| 511 return vreinterpretq_s32_u32(src.fVec); |
| 512 } |
| 513 |
| 510 static inline Sk4i Sk4f_round(const Sk4f& x) { | 514 static inline Sk4i Sk4f_round(const Sk4f& x) { |
| 511 return vcvtq_s32_f32((x + 0.5f).fVec); | 515 return vcvtq_s32_f32((x + 0.5f).fVec); |
| 512 } | 516 } |
| 513 | 517 |
| 514 static inline void Sk4h_load4(const void* ptr, Sk4h* r, Sk4h* g, Sk4h* b, Sk4h*
a) { | 518 static inline void Sk4h_load4(const void* ptr, Sk4h* r, Sk4h* g, Sk4h* b, Sk4h*
a) { |
| 515 uint16x4x4_t rgba = vld4_u16((const uint16_t*)ptr); | 519 uint16x4x4_t rgba = vld4_u16((const uint16_t*)ptr); |
| 516 *r = rgba.val[0]; | 520 *r = rgba.val[0]; |
| 517 *g = rgba.val[1]; | 521 *g = rgba.val[1]; |
| 518 *b = rgba.val[2]; | 522 *b = rgba.val[2]; |
| 519 *a = rgba.val[3]; | 523 *a = rgba.val[3]; |
| 520 } | 524 } |
| 521 | 525 |
| 522 static inline void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk
4h& b, | 526 static inline void Sk4h_store4(void* dst, const Sk4h& r, const Sk4h& g, const Sk
4h& b, |
| 523 const Sk4h& a) { | 527 const Sk4h& a) { |
| 524 uint16x4x4_t rgba = {{ | 528 uint16x4x4_t rgba = {{ |
| 525 r.fVec, | 529 r.fVec, |
| 526 g.fVec, | 530 g.fVec, |
| 527 b.fVec, | 531 b.fVec, |
| 528 a.fVec, | 532 a.fVec, |
| 529 }}; | 533 }}; |
| 530 vst4_u16((uint16_t*) dst, rgba); | 534 vst4_u16((uint16_t*) dst, rgba); |
| 531 } | 535 } |
| 532 | 536 |
| 533 #endif//SkNx_neon_DEFINED | 537 #endif//SkNx_neon_DEFINED |
| OLD | NEW |