OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 /* | 8 /* |
9 ninja -C out/Release dm nanobench ; and ./out/Release/dm --match Blend_opts ; an
d ./out/Release/nanobench --samples 300 --nompd --match LinearSrcOver -q | 9 ninja -C out/Release dm nanobench ; and ./out/Release/dm --match Blend_opts ; an
d ./out/Release/nanobench --samples 300 --nompd --match LinearSrcOver -q |
10 */ | 10 */ |
(...skipping 30 matching lines...) Expand all Loading... |
41 static inline __m128i load(const uint32_t* p) { | 41 static inline __m128i load(const uint32_t* p) { |
42 return _mm_loadu_si128(reinterpret_cast<const __m128i*>(p)); | 42 return _mm_loadu_si128(reinterpret_cast<const __m128i*>(p)); |
43 } | 43 } |
44 | 44 |
45 static inline void store(uint32_t* p, __m128i v) { | 45 static inline void store(uint32_t* p, __m128i v) { |
46 _mm_storeu_si128(reinterpret_cast<__m128i*>(p), v); | 46 _mm_storeu_si128(reinterpret_cast<__m128i*>(p), v); |
47 } | 47 } |
48 | 48 |
49 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 | 49 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 |
50 | 50 |
51 void srcover_srgb_srgb( | 51 static void srcover_srgb_srgb( |
52 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int n
src) { | 52 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int n
src) { |
53 const __m128i alphaMask = _mm_set1_epi32(0xFF000000); | 53 const __m128i alphaMask = _mm_set1_epi32(0xFF000000); |
54 while (ndst > 0) { | 54 while (ndst > 0) { |
55 int count = SkTMin(ndst, nsrc); | 55 int count = SkTMin(ndst, nsrc); |
56 ndst -= count; | 56 ndst -= count; |
57 const uint32_t* src = srcStart; | 57 const uint32_t* src = srcStart; |
58 const uint32_t* end = dst + (count & ~3); | 58 const uint32_t* end = dst + (count & ~3); |
59 ptrdiff_t delta = src - dst; | 59 ptrdiff_t delta = src - dst; |
60 | 60 |
61 while (dst < end) { | 61 while (dst < end) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 116 } |
117 | 117 |
118 static inline bool check_partial_alphas(__m128i pixels) { | 118 static inline bool check_partial_alphas(__m128i pixels) { |
119 __m128i signedPixels = _mm_xor_si128(pixels, _mm_set1_epi32(0x800000
00)); | 119 __m128i signedPixels = _mm_xor_si128(pixels, _mm_set1_epi32(0x800000
00)); |
120 __m128i opaque = _mm_cmplt_epi32(signedPixels, _mm_set1_epi32(
0x7F000000)); | 120 __m128i opaque = _mm_cmplt_epi32(signedPixels, _mm_set1_epi32(
0x7F000000)); |
121 __m128i transparent = _mm_cmpgt_epi32(signedPixels, _mm_set1_epi32(
0x80FFFFFF)); | 121 __m128i transparent = _mm_cmpgt_epi32(signedPixels, _mm_set1_epi32(
0x80FFFFFF)); |
122 int mask = _mm_movemask_epi8(_mm_xor_si128(opaque, trans
parent)); | 122 int mask = _mm_movemask_epi8(_mm_xor_si128(opaque, trans
parent)); |
123 return mask == 0; | 123 return mask == 0; |
124 } | 124 } |
125 | 125 |
126 void srcover_srgb_srgb( | 126 static void srcover_srgb_srgb( |
127 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int n
src) { | 127 uint32_t* dst, const uint32_t* const srcStart, int ndst, const int n
src) { |
128 while (ndst > 0) { | 128 while (ndst > 0) { |
129 int count = SkTMin(ndst, nsrc); | 129 int count = SkTMin(ndst, nsrc); |
130 ndst -= count; | 130 ndst -= count; |
131 const uint32_t* src = srcStart; | 131 const uint32_t* src = srcStart; |
132 const uint32_t* end = dst + (count & ~3); | 132 const uint32_t* end = dst + (count & ~3); |
133 const ptrdiff_t delta = src - dst; | 133 const ptrdiff_t delta = src - dst; |
134 | 134 |
135 __m128i pixels = load(src); | 135 __m128i pixels = load(src); |
136 do { | 136 do { |
(...skipping 22 matching lines...) Expand all Loading... |
159 | 159 |
160 count = count & 3; | 160 count = count & 3; |
161 while (count-- > 0) { | 161 while (count-- > 0) { |
162 srcover_srgb8888_srgb_1(dst++, *src++); | 162 srcover_srgb8888_srgb_1(dst++, *src++); |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 #endif | 166 #endif |
167 #else | 167 #else |
168 | 168 |
169 void srcover_srgb_srgb( | 169 static void srcover_srgb_srgb( |
170 uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { | 170 uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
171 while (ndst > 0) { | 171 while (ndst > 0) { |
172 int n = SkTMin(ndst, nsrc); | 172 int n = SkTMin(ndst, nsrc); |
173 | 173 |
174 for (int i = 0; i < n; i++) { | 174 for (int i = 0; i < n; i++) { |
175 srcover_srgb8888_srgb_1(dst++, src[i]); | 175 srcover_srgb8888_srgb_1(dst++, src[i]); |
176 } | 176 } |
177 ndst -= n; | 177 ndst -= n; |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 #endif | 181 #endif |
182 | 182 |
183 } // namespace SK_OPTS_NS | 183 } // namespace SK_OPTS_NS |
184 | 184 |
185 #endif//SkBlend_opts_DEFINED | 185 #endif//SkBlend_opts_DEFINED |
OLD | NEW |