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

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

Issue 2078623002: Support sRGB dsts in opt code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Drop parens Created 4 years, 6 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/SkColorXform_opts.h ('k') | src/opts/SkOpts_sse41.cpp » ('j') | 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 float operator[](int k) const { 117 float operator[](int k) const {
118 SkASSERT(0 <= k && k < 4); 118 SkASSERT(0 <= k && k < 4);
119 union { __m128 v; float fs[4]; } pun = {fVec}; 119 union { __m128 v; float fs[4]; } pun = {fVec};
120 return pun.fs[k&3]; 120 return pun.fs[k&3];
121 } 121 }
122 122
123 bool allTrue() const { return 0xffff == _mm_movemask_epi8(_mm_castps_si128(f Vec)); } 123 bool allTrue() const { return 0xffff == _mm_movemask_epi8(_mm_castps_si128(f Vec)); }
124 bool anyTrue() const { return 0x0000 != _mm_movemask_epi8(_mm_castps_si128(f Vec)); } 124 bool anyTrue() const { return 0x0000 != _mm_movemask_epi8(_mm_castps_si128(f Vec)); }
125 125
126 SkNx thenElse(const SkNx& t, const SkNx& e) const { 126 SkNx thenElse(const SkNx& t, const SkNx& e) const {
127 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41
128 return _mm_blendv_ps(e.fVec, t.fVec, fVec);
129 #else
127 return _mm_or_ps(_mm_and_ps (fVec, t.fVec), 130 return _mm_or_ps(_mm_and_ps (fVec, t.fVec),
128 _mm_andnot_ps(fVec, e.fVec)); 131 _mm_andnot_ps(fVec, e.fVec));
132 #endif
129 } 133 }
130 134
131 __m128 fVec; 135 __m128 fVec;
132 }; 136 };
133 137
134 template <> 138 template <>
135 class SkNx<4, int> { 139 class SkNx<4, int> {
136 public: 140 public:
137 SkNx(const __m128i& vec) : fVec(vec) {} 141 SkNx(const __m128i& vec) : fVec(vec) {}
138 142
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 371
368 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) {
369 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128()); 373 return _mm_unpacklo_epi8(src.fVec, _mm_setzero_si128());
370 } 374 }
371 375
372 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) {
373 return _mm_packus_epi16(src.fVec, src.fVec); 377 return _mm_packus_epi16(src.fVec, src.fVec);
374 } 378 }
375 379
376 #endif//SkNx_sse_DEFINED 380 #endif//SkNx_sse_DEFINED
OLDNEW
« no previous file with comments | « src/opts/SkColorXform_opts.h ('k') | src/opts/SkOpts_sse41.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698