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_sse_DEFINED | 8 #ifndef SkNx_sse_DEFINED |
9 #define SkNx_sse_DEFINED | 9 #define SkNx_sse_DEFINED |
10 | 10 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 static inline void Sk4f_ToBytes(uint8_t bytes[16], | 373 static inline void Sk4f_ToBytes(uint8_t bytes[16], |
374 const Sk4f& a, const Sk4f& b, const Sk4f& c, con
st Sk4f& d) { | 374 const Sk4f& a, const Sk4f& b, const Sk4f& c, con
st Sk4f& d) { |
375 _mm_storeu_si128((__m128i*)bytes, | 375 _mm_storeu_si128((__m128i*)bytes, |
376 _mm_packus_epi16(_mm_packus_epi16(_mm_cvttps_epi32(a.fVec), | 376 _mm_packus_epi16(_mm_packus_epi16(_mm_cvttps_epi32(a.fVec), |
377 _mm_cvttps_epi32(b.fVec))
, | 377 _mm_cvttps_epi32(b.fVec))
, |
378 _mm_packus_epi16(_mm_cvttps_epi32(c.fVec), | 378 _mm_packus_epi16(_mm_cvttps_epi32(c.fVec), |
379 _mm_cvttps_epi32(d.fVec))
)); | 379 _mm_cvttps_epi32(d.fVec))
)); |
380 } | 380 } |
381 | 381 |
| 382 template<> inline Sk4h SkNx_cast<uint16_t, uint8_t, 4>(const Sk4b& src) { |
| 383 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); |
| 384 } |
| 385 |
| 386 template<> inline Sk4b SkNx_cast<uint8_t, uint16_t, 4>(const Sk4h& src) { |
| 387 return _mm_packus_epi16(src.fVec, src.fVec); |
| 388 } |
| 389 |
382 | 390 |
383 } // namespace | 391 } // namespace |
384 | 392 |
385 #endif//SkNx_sse_DEFINED | 393 #endif//SkNx_sse_DEFINED |
OLD | NEW |