Index: bench/SkBlend_optsBench.cpp |
diff --git a/bench/SkBlend_optsBench.cpp b/bench/SkBlend_optsBench.cpp |
index c290714128bde2263c61d8d04ed876ff2aa11f90..184e93335e3f907dac915425fea921e48ee3fb6b 100644 |
--- a/bench/SkBlend_optsBench.cpp |
+++ b/bench/SkBlend_optsBench.cpp |
@@ -19,13 +19,39 @@ |
#define INNER_LOOPS 10 |
+static inline void brute_srcover_srgb_srgb_1(uint32_t* dst, uint32_t src) { |
+ auto d = Sk4f_fromS32(*dst), |
+ s = Sk4f_fromS32( src); |
+ *dst = Sk4f_toS32(s + d * (1.0f - s[3])); |
+} |
+ |
+static inline void srcover_srgb_srgb_1(uint32_t* dst, uint32_t src) { |
+ if (src >= 0xFF000000) { |
+ *dst = src; |
+ return; |
+ } |
+ brute_srcover_srgb_srgb_1(dst, src); |
+} |
+ |
static void brute_force_srcover_srgb_srgb( |
uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
while (ndst > 0) { |
int n = SkTMin(ndst, nsrc); |
for (int i = 0; i < n; i++) { |
- srcover_blend_srgb8888_srgb_1(dst++, srgb_to_linear(to_4f(src[i]))); |
+ brute_srcover_srgb_srgb_1(dst++, src[i]); |
+ } |
+ ndst -= n; |
+ } |
+} |
+ |
+static void trivial_srcover_srgb_srgb( |
+ uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
+ while (ndst > 0) { |
+ int n = SkTMin(ndst, nsrc); |
+ |
+ for (int i = 0; i < n; i++) { |
+ srcover_srgb_srgb_1(dst++, src[i]); |
} |
ndst -= n; |
} |
@@ -36,8 +62,8 @@ static void best_non_simd_srcover_srgb_srgb( |
uint64_t* ddst = reinterpret_cast<uint64_t*>(dst); |
auto srcover_srgb_srgb_2 = [](uint32_t* dst, const uint32_t* src) { |
- srcover_srgb8888_srgb_1(dst++, *src++); |
- srcover_srgb8888_srgb_1(dst, *src); |
+ srcover_srgb_srgb_1(dst++, *src++); |
+ srcover_srgb_srgb_1(dst, *src); |
}; |
while (ndst >0) { |
@@ -62,24 +88,12 @@ static void best_non_simd_srcover_srgb_srgb( |
} while (dsrc < end); |
if ((count & 1) != 0) { |
- srcover_srgb8888_srgb_1(reinterpret_cast<uint32_t*>(ddst), |
- *reinterpret_cast<const uint32_t*>(dsrc)); |
+ srcover_srgb_srgb_1(reinterpret_cast<uint32_t*>(ddst), |
+ *reinterpret_cast<const uint32_t*>(dsrc)); |
} |
} |
} |
-static void trivial_srcover_srgb_srgb( |
- uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) { |
- while (ndst > 0) { |
- int n = SkTMin(ndst, nsrc); |
- |
- for (int i = 0; i < n; i++) { |
- srcover_srgb8888_srgb_1(dst++, src[i]); |
- } |
- ndst -= n; |
- } |
-} |
- |
class SrcOverVSkOptsBruteForce { |
public: |
static SkString Name() { return SkString{"VSkOptsBruteForce"}; } |