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

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

Issue 232783002: Xfermode: SSE2 implementation of overlay_modeproc (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 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 | « no previous file | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | src/opts/SkXfermode_opts_SSE2.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Android Open Source Project 2 * Copyright 2014 The Android Open Source Project
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 SkColor_opts_SSE2_DEFINED 8 #ifndef SkColor_opts_SSE2_DEFINED
9 #define SkColor_opts_SSE2_DEFINED 9 #define SkColor_opts_SSE2_DEFINED
10 10
11 #include <emmintrin.h> 11 #include <emmintrin.h>
12 12
13 static inline __m128i Multiply32_SSE2(const __m128i& a, const __m128i& b) {
14 __m128i r1 = _mm_mul_epu32(a, b);
15 __m128i r2 = _mm_mul_epu32(_mm_srli_si128(a, 4), _mm_srli_si128(b, 4));
mtklein 2014/04/22 15:18:21 Can you narrate this method a bit more, at least w
qiankun 2014/04/23 07:40:05 Done.
16 __m128i r = _mm_unpacklo_epi32(_mm_shuffle_epi32(r1, _MM_SHUFFLE(0,0,2,0)),
17 _mm_shuffle_epi32(r2, _MM_SHUFFLE(0,0,2,0)));
18 return r;
19 }
20
13 static inline __m128i SkAlpha255To256_SSE2(const __m128i& alpha) { 21 static inline __m128i SkAlpha255To256_SSE2(const __m128i& alpha) {
14 return _mm_add_epi32(alpha, _mm_set1_epi32(1)); 22 return _mm_add_epi32(alpha, _mm_set1_epi32(1));
15 } 23 }
16 24
17 // See #define SkAlphaMulAlpha(a, b) SkMulDiv255Round(a, b) in SkXfermode.cpp. 25 // See #define SkAlphaMulAlpha(a, b) SkMulDiv255Round(a, b) in SkXfermode.cpp.
18 static inline __m128i SkAlphaMulAlpha_SSE2(const __m128i& a, 26 static inline __m128i SkAlphaMulAlpha_SSE2(const __m128i& a,
19 const __m128i& b) { 27 const __m128i& b) {
20 __m128i prod = _mm_mullo_epi16(a, b); 28 __m128i prod = _mm_mullo_epi16(a, b);
21 prod = _mm_add_epi32(prod, _mm_set1_epi32(128)); 29 prod = _mm_add_epi32(prod, _mm_set1_epi32(128));
22 prod = _mm_add_epi32(prod, _mm_srli_epi32(prod, 8)); 30 prod = _mm_add_epi32(prod, _mm_srli_epi32(prod, 8));
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 b2 = _mm_and_si128(b2, _mm_set1_epi32(SK_B16_MASK)); 170 b2 = _mm_and_si128(b2, _mm_set1_epi32(SK_B16_MASK));
163 __m128i b = _mm_packs_epi32(b1, b2); 171 __m128i b = _mm_packs_epi32(b1, b2);
164 172
165 // Store 8 16-bit colors in dst. 173 // Store 8 16-bit colors in dst.
166 __m128i d_pixel = SkPackRGB16_SSE2(r, g, b); 174 __m128i d_pixel = SkPackRGB16_SSE2(r, g, b);
167 175
168 return d_pixel; 176 return d_pixel;
169 } 177 }
170 178
171 #endif // SkColor_opts_SSE2_DEFINED 179 #endif // SkColor_opts_SSE2_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkXfermode_opts_SSE2.cpp » ('j') | src/opts/SkXfermode_opts_SSE2.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698