diff options
author | reed <reed@google.com> | 2016-05-17 03:07:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-17 03:07:01 -0700 |
commit | 4933d0baadae6786ad5636e2c4fdf7e2591d09e1 (patch) | |
tree | 4706db11cb73a742aa4a6df13f0d5516f4e46574 /tests | |
parent | bc927548db17accec2195af6e15053f7918bb3f5 (diff) |
Revert of Add specialized sRGB blitter for SkOpts (patchset #21 id:400001 of https://codereview.chromium.org/1939513002/ )
Reason for revert:
broke some debug bots:
Running LinearSrcOvericonstrip.pngVSkOptsSSE41 nonrendering
../../../bench/SkBlend_optsBench.cpp:118: fatal error: ""fPixmap.colorType() == kRGBA_8888_SkColorType""
Original issue's description:
> 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
TBR=mtklein@google.com,fmalita@chromium.org,herb@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/1986763002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/SkBlend_optsTest.cpp | 134 |
1 files changed, 0 insertions, 134 deletions
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp deleted file mode 100644 index ee60d5ebdf..0000000000 --- a/tests/SkBlend_optsTest.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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" -#include "SkNx.h" -#include "Test.h" -#include "../include/core/SkImageInfo.h" - -typedef void (*Blender)(uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); - -namespace sk_default { -extern void brute_force_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -namespace sk_default { -extern void trivial_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); - -extern void best_non_simd_srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); - -extern void srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} - -#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) -namespace sk_sse41 { -extern void srcover_srgb_srgb( - uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc); -} -#endif - -static SkString missmatch_message(std::string resourceName, std::string name, int x, int y, - uint32_t src, uint32_t good, uint32_t bad) { - return SkStringPrintf( - "%s - %s missmatch at %d, %d src: %08x good: %08x bad: %08x", - resourceName.c_str(), name.c_str(), x, y, src, good, bad); -} - -using Spec = std::tuple<Blender, std::string>; - -static void test_blender( - Spec spec, - std::string resourceName, - skiatest::Reporter* reporter) -{ - Blender blender; - std::string name; - std::tie(blender, name) = spec; - - std::string fileName = resourceName + ".png"; - sk_sp<SkImage> image = GetResourceAsImage(fileName.c_str()); - SkASSERT(image != nullptr); - if (image == nullptr) { - SkFAIL("image is NULL"); - } - SkBitmap bm; - if (!as_IB(image)->getROPixels(&bm)) { - SkFAIL("Could not read resource"); - } - - 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++) { - memset(correctDst.get(), 0, width * sizeof(uint32_t)); - memset(testDst.get(), 0, width * sizeof(uint32_t)); - sk_default::brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width); - blender(testDst.get(), src, width, width); - for (int x = 0; x < width; x++) { - REPORTER_ASSERT_MESSAGE( - reporter, correctDst[x] == testDst[x], - missmatch_message(resourceName, name, x, y, src[x], correctDst[x], testDst[x])); - if (correctDst[x] != testDst[x]) break; - } - src += width; - } -} - -DEF_TEST(SkBlend_optsCheck, reporter) { - std::vector<Spec> specs = { - Spec{sk_default::trivial_srcover_srgb_srgb, "trivial"}, - Spec{sk_default::best_non_simd_srcover_srgb_srgb, "best_non_simd"}, - Spec{sk_default::srcover_srgb_srgb, "default"}, - }; - #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) - if (SkCpu::Supports(SkCpu::SSE41)) { - specs.push_back(Spec{sk_sse41::srcover_srgb_srgb, "sse41", }); - } - #endif - - std::vector<std::string> testResources = { - "yellow_rose", "baby_tux", "plane", "mandrill_512", "iconstrip" - }; - - for (auto& spec : specs) { - for (auto& resourceName : testResources) { - test_blender(spec, resourceName, reporter); - } - } -} - - - -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])); - } -} |