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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 } | 370 } |
371 | 371 |
372 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src)
{ | 372 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src)
{ |
373 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); | 373 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); |
374 } | 374 } |
375 | 375 |
376 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src)
{ | 376 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src)
{ |
377 return _mm_packus_epi16(src.fVec, src.fVec); | 377 return _mm_packus_epi16(src.fVec, src.fVec); |
378 } | 378 } |
379 | 379 |
| 380 template<> inline Sk4b SkNx_cast<uint8_t, int>(const Sk4i& src) { |
| 381 return _mm_packus_epi16(_mm_packus_epi16(src.fVec, src.fVec), src.fVec); |
| 382 } |
| 383 |
| 384 static inline Sk4i Sk4f_round(const Sk4f& x) { |
| 385 return _mm_cvtps_epi32(x.fVec); |
| 386 } |
| 387 |
380 #endif//SkNx_sse_DEFINED | 388 #endif//SkNx_sse_DEFINED |
OLD | NEW |