Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <tuple>
|
|
|
|
#include <vector>
|
|
|
|
#include "Resources.h"
|
|
|
|
#include "SkCpu.h"
|
|
|
|
#include "SkImage.h"
|
|
|
|
#include "SkImage_Base.h"
|
|
|
|
#include "SkOpts.h"
|
2016-07-12 22:00:46 +00:00
|
|
|
#include "SkPM4fPriv.h"
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
#include "SkNx.h"
|
|
|
|
#include "Test.h"
|
|
|
|
|
|
|
|
typedef void (*Blender)(uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
|
|
|
|
|
2016-07-21 01:10:07 +00:00
|
|
|
static inline void 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]));
|
|
|
|
}
|
|
|
|
|
2016-07-12 22:00:46 +00:00
|
|
|
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++) {
|
2016-07-21 01:10:07 +00:00
|
|
|
srcover_srgb_srgb_1(dst++, src[i]);
|
2016-07-12 22:00:46 +00:00
|
|
|
}
|
|
|
|
ndst -= n;
|
|
|
|
}
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
}
|
|
|
|
|
2016-07-13 15:02:20 +00:00
|
|
|
static SkString mismatch_message(std::string resourceName, int x, int y,
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
uint32_t src, uint32_t good, uint32_t bad) {
|
|
|
|
return SkStringPrintf(
|
2016-07-13 15:02:20 +00:00
|
|
|
"%s - missmatch at %d, %d src: %08x good: %08x bad: %08x",
|
|
|
|
resourceName.c_str(), x, y, src, good, bad);
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
}
|
|
|
|
|
2016-07-13 15:02:20 +00:00
|
|
|
static void test_blender(std::string resourceName, skiatest::Reporter* reporter) {
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
std::string fileName = resourceName + ".png";
|
|
|
|
sk_sp<SkImage> image = GetResourceAsImage(fileName.c_str());
|
|
|
|
if (image == nullptr) {
|
2016-05-18 01:36:23 +00:00
|
|
|
ERRORF(reporter, "image is NULL");
|
|
|
|
return;
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
}
|
|
|
|
SkBitmap bm;
|
|
|
|
if (!as_IB(image)->getROPixels(&bm)) {
|
2016-05-18 01:36:23 +00:00
|
|
|
ERRORF(reporter, "Could not read resource");
|
|
|
|
return;
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SkPixmap pixmap;
|
|
|
|
bm.peekPixels(&pixmap);
|
|
|
|
SkASSERTF(pixmap.colorType() == kN32_SkColorType, "colorType: %d", pixmap.colorType());
|
|
|
|
SkASSERT(pixmap.alphaType() != kUnpremul_SkAlphaType);
|
|
|
|
const uint32_t* src = pixmap.addr32();
|
|
|
|
const int width = pixmap.rowBytesAsPixels();
|
|
|
|
SkASSERT(width > 0);
|
|
|
|
SkASSERT(width < 4000);
|
|
|
|
SkAutoTArray<uint32_t> correctDst(width);
|
|
|
|
SkAutoTArray<uint32_t> testDst(width);
|
|
|
|
|
|
|
|
for (int y = 0; y < pixmap.height(); y++) {
|
2016-07-21 01:10:07 +00:00
|
|
|
// TODO: zero is not the most interesting dst to test srcover...
|
2016-07-12 22:00:46 +00:00
|
|
|
sk_bzero(correctDst.get(), width * sizeof(uint32_t));
|
|
|
|
sk_bzero(testDst.get(), width * sizeof(uint32_t));
|
|
|
|
brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width);
|
2016-07-13 15:02:20 +00:00
|
|
|
SkOpts:: srcover_srgb_srgb( testDst.get(), src, width, width);
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
for (int x = 0; x < width; x++) {
|
|
|
|
REPORTER_ASSERT_MESSAGE(
|
|
|
|
reporter, correctDst[x] == testDst[x],
|
2016-07-13 15:02:20 +00:00
|
|
|
mismatch_message(resourceName, x, y, src[x], correctDst[x], testDst[x]));
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
if (correctDst[x] != testDst[x]) break;
|
|
|
|
}
|
|
|
|
src += width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEF_TEST(SkBlend_optsCheck, reporter) {
|
|
|
|
std::vector<std::string> testResources = {
|
|
|
|
"yellow_rose", "baby_tux", "plane", "mandrill_512", "iconstrip"
|
|
|
|
};
|
|
|
|
|
2016-07-13 15:02:20 +00:00
|
|
|
for (auto& resourceName : testResources) {
|
|
|
|
test_blender(resourceName, reporter);
|
Add tests and benches to support the sRGB blitter for SkOpts
1,370.85 LinearSrcOvericonstrip.pngVSkOptsSSE41
2,359.69 LinearSrcOvericonstrip.pngVSkOptsDefault
1,828.72 LinearSrcOvericonstrip.pngVSkOptsNonSimdCore
3,277.40 LinearSrcOvericonstrip.pngVSkOptsTrivial
9,862.34 LinearSrcOvericonstrip.pngVSkOptsBruteForce
633.55 LinearSrcOvermandrill_512.pngVSkOptsSSE41
684.29 LinearSrcOvermandrill_512.pngVSkOptsDefault
1,201.88 LinearSrcOvermandrill_512.pngVSkOptsNonSimdCore
2,382.63 LinearSrcOvermandrill_512.pngVSkOptsTrivial
10,888.74 LinearSrcOvermandrill_512.pngVSkOptsBruteForce
209.14 LinearSrcOverplane.pngVSkOptsSSE41
562.24 LinearSrcOverplane.pngVSkOptsDefault
272.64 LinearSrcOverplane.pngVSkOptsNonSimdCore
436.46 LinearSrcOverplane.pngVSkOptsTrivial
1,327.23 LinearSrcOverplane.pngVSkOptsBruteForce
318.01 LinearSrcOverbaby_tux.pngVSkOptsSSE41
529.05 LinearSrcOverbaby_tux.pngVSkOptsDefault
441.33 LinearSrcOverbaby_tux.pngVSkOptsNonSimdCore
720.50 LinearSrcOverbaby_tux.pngVSkOptsTrivial
2,191.10 LinearSrcOverbaby_tux.pngVSkOptsBruteForce
479.68 LinearSrcOveryellow_rose.pngVSkOptsSSE41
1,095.03 LinearSrcOveryellow_rose.pngVSkOptsDefault
668.60 LinearSrcOveryellow_rose.pngVSkOptsNonSimdCore
1,257.19 LinearSrcOveryellow_rose.pngVSkOptsTrivial
4,970.25 LinearSrcOveryellow_rose.pngVSkOptsBruteForce
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1939513002
CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
Committed: https://skia.googlesource.com/skia/+/554784cd85029c05d9ed04b1aeb71520d196153a
Committed: https://skia.googlesource.com/skia/+/bc927548db17accec2195af6e15053f7918bb3f5
Review-Url: https://codereview.chromium.org/1939513002
2016-05-17 16:57:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
DEF_TEST(SkBlend_optsSqrtCheck, reporter) {
|
|
|
|
for (int c = 0; c < 256; c++) {
|
|
|
|
Sk4f i{(float)c};
|
|
|
|
Sk4f ii = i * i;
|
|
|
|
Sk4f s = ii.sqrt() + 0.5f;
|
|
|
|
Sk4f sf = s.floor();
|
|
|
|
REPORTER_ASSERT_MESSAGE(
|
|
|
|
reporter, i[0] == sf[0], SkStringPrintf("i: %f, s: %f", i[0], sf[0]));
|
|
|
|
}
|
|
|
|
}
|