Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: src/opts/SkNx_sse.h

Issue 1746153002: Add swizzle for rgb8888. (Closed) Base URL: https://skia.googlesource.com/skia.git@sample-span-20160229
Patch Set: Make constructors clean and disconnect from sample spans cl. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/opts/SkNx_neon.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 union { __m128i v; uint16_t us[8]; } pun = {fVec}; 228 union { __m128i v; uint16_t us[8]; } pun = {fVec};
229 return pun.us[k&7]; 229 return pun.us[k&7];
230 } 230 }
231 231
232 __m128i fVec; 232 __m128i fVec;
233 }; 233 };
234 234
235 template <> 235 template <>
236 class SkNx<4, uint8_t> { 236 class SkNx<4, uint8_t> {
237 public: 237 public:
238 SkNx() {}
238 SkNx(const __m128i& vec) : fVec(vec) {} 239 SkNx(const __m128i& vec) : fVec(vec) {}
240 SkNx(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
241 : fVec(_mm_setr_epi8(a,b,c,d, 0,0,0,0, 0,0,0,0, 0,0,0,0)) {}
239 242
240 SkNx() {} 243
241 static SkNx Load(const void* ptr) { return _mm_cvtsi32_si128(*(const int*)pt r); } 244 static SkNx Load(const void* ptr) { return _mm_cvtsi32_si128(*(const int*)pt r); }
242 void store(void* ptr) const { *(int*)ptr = _mm_cvtsi128_si32(fVec); } 245 void store(void* ptr) const { *(int*)ptr = _mm_cvtsi128_si32(fVec); }
243 246
247 uint8_t operator[](int k) const {
248 SkASSERT(0 <= k && k < 4);
249 union { __m128i v; uint8_t us[16]; } pun = {fVec};
250 return pun.us[k&3];
251 }
252
244 // TODO as needed 253 // TODO as needed
245 254
246 __m128i fVec; 255 __m128i fVec;
247 }; 256 };
248 257
249 template <> 258 template <>
250 class SkNx<16, uint8_t> { 259 class SkNx<16, uint8_t> {
251 public: 260 public:
252 SkNx(const __m128i& vec) : fVec(vec) {} 261 SkNx(const __m128i& vec) : fVec(vec) {}
253 262
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 357
349 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) { 358 template<> /*static*/ inline Sk4h SkNx_cast<uint16_t, uint8_t>(const Sk4b& src) {
350 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); 359 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128());
351 } 360 }
352 361
353 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) { 362 template<> /*static*/ inline Sk4b SkNx_cast<uint8_t, uint16_t>(const Sk4h& src) {
354 return _mm_packus_epi16(src.fVec, src.fVec); 363 return _mm_packus_epi16(src.fVec, src.fVec);
355 } 364 }
356 365
357 #endif//SkNx_sse_DEFINED 366 #endif//SkNx_sse_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkNx_neon.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698