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

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

Issue 270473003: Make gMask_00FF00FF a constant (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const mask no-static Created 6 years, 7 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/core/SkBlitter.cpp ('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 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
(...skipping 24 matching lines...) Expand all
35 __m128i prod = _mm_mullo_epi16(a, b); 35 __m128i prod = _mm_mullo_epi16(a, b);
36 prod = _mm_add_epi32(prod, _mm_set1_epi32(128)); 36 prod = _mm_add_epi32(prod, _mm_set1_epi32(128));
37 prod = _mm_add_epi32(prod, _mm_srli_epi32(prod, 8)); 37 prod = _mm_add_epi32(prod, _mm_srli_epi32(prod, 8));
38 prod = _mm_srli_epi32(prod, 8); 38 prod = _mm_srli_epi32(prod, 8);
39 39
40 return prod; 40 return prod;
41 } 41 }
42 42
43 // Portable version SkAlphaMulQ is in SkColorPriv.h. 43 // Portable version SkAlphaMulQ is in SkColorPriv.h.
44 static inline __m128i SkAlphaMulQ_SSE2(const __m128i& c, const __m128i& scale) { 44 static inline __m128i SkAlphaMulQ_SSE2(const __m128i& c, const __m128i& scale) {
45 __m128i mask = _mm_set1_epi32(gMask_00FF00FF); 45 __m128i mask = _mm_set1_epi32(0xFF00FF);
46 __m128i s = _mm_or_si128(_mm_slli_epi32(scale, 16), scale); 46 __m128i s = _mm_or_si128(_mm_slli_epi32(scale, 16), scale);
47 47
48 // uint32_t rb = ((c & mask) * scale) >> 8 48 // uint32_t rb = ((c & mask) * scale) >> 8
49 __m128i rb = _mm_and_si128(mask, c); 49 __m128i rb = _mm_and_si128(mask, c);
50 rb = _mm_mullo_epi16(rb, s); 50 rb = _mm_mullo_epi16(rb, s);
51 rb = _mm_srli_epi16(rb, 8); 51 rb = _mm_srli_epi16(rb, 8);
52 52
53 // uint32_t ag = ((c >> 8) & mask) * scale 53 // uint32_t ag = ((c >> 8) & mask) * scale
54 __m128i ag = _mm_srli_epi16(c, 8); 54 __m128i ag = _mm_srli_epi16(c, 8);
55 ag = _mm_and_si128(ag, mask); 55 ag = _mm_and_si128(ag, mask);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 b2 = _mm_and_si128(b2, _mm_set1_epi32(SK_B16_MASK)); 177 b2 = _mm_and_si128(b2, _mm_set1_epi32(SK_B16_MASK));
178 __m128i b = _mm_packs_epi32(b1, b2); 178 __m128i b = _mm_packs_epi32(b1, b2);
179 179
180 // Store 8 16-bit colors in dst. 180 // Store 8 16-bit colors in dst.
181 __m128i d_pixel = SkPackRGB16_SSE2(r, g, b); 181 __m128i d_pixel = SkPackRGB16_SSE2(r, g, b);
182 182
183 return d_pixel; 183 return d_pixel;
184 } 184 }
185 185
186 #endif // SkColor_opts_SSE2_DEFINED 186 #endif // SkColor_opts_SSE2_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698