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 */ |
11 | 11 |
12 #ifndef SkBlend_opts_DEFINED | 12 #ifndef SkBlend_opts_DEFINED |
13 #define SkBlend_opts_DEFINED | 13 #define SkBlend_opts_DEFINED |
14 | 14 |
15 #include "SkNx.h" | 15 #include "SkNx.h" |
16 #include "SkPM4fPriv.h" | 16 #include "SkPM4fPriv.h" |
17 | 17 |
| 18 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2 |
| 19 #include <immintrin.h> |
| 20 #endif |
| 21 |
18 namespace SK_OPTS_NS { | 22 namespace SK_OPTS_NS { |
19 | 23 |
20 // An implementation of SrcOver from bytes to bytes in linear space that takes a
dvantage of the | 24 // An implementation of SrcOver from bytes to bytes in linear space that takes a
dvantage of the |
21 // observation that the 255's cancel. | 25 // observation that the 255's cancel. |
22 // invA = 1 - (As / 255); | 26 // invA = 1 - (As / 255); |
23 // | 27 // |
24 // R = 255 * sqrt((Rs/255)^2 + (Rd/255)^2 * invA) | 28 // R = 255 * sqrt((Rs/255)^2 + (Rd/255)^2 * invA) |
25 // => R = 255 * sqrt((Rs^2 + Rd^2 * invA)/255^2) | 29 // => R = 255 * sqrt((Rs^2 + Rd^2 * invA)/255^2) |
26 // => R = sqrt(Rs^2 + Rd^2 * invA) | 30 // => R = sqrt(Rs^2 + Rd^2 * invA) |
27 static inline void blend_srgb_srgb_1(uint32_t* dst, const uint32_t pixel) { | 31 static inline void blend_srgb_srgb_1(uint32_t* dst, const uint32_t pixel) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void srcover_srgb_srgb( | 245 void srcover_srgb_srgb( |
242 uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { | 246 uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
243 trivial_srcover_srgb_srgb(dst, src, ndst, nsrc); | 247 trivial_srcover_srgb_srgb(dst, src, ndst, nsrc); |
244 } | 248 } |
245 | 249 |
246 #endif | 250 #endif |
247 | 251 |
248 } // namespace SK_OPTS_NS | 252 } // namespace SK_OPTS_NS |
249 | 253 |
250 #endif//SkBlend_opts_DEFINED | 254 #endif//SkBlend_opts_DEFINED |
OLD | NEW |