diff options
author | Mike Klein <mtklein@chromium.org> | 2018-06-19 16:00:40 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-06-19 21:15:18 +0000 |
commit | 0e4041f5c962dd16c4a69cbd9ff35685e9519ff3 (patch) | |
tree | 09b89a6f52f52082ee74d2f596f42750027678e8 | |
parent | c069a57301a468dbc45f3f3775b623e5532f9398 (diff) |
update software DM/nanobench configs for color testing
- Rename 'srgbnl' to just 'srgb'.
- Add 'narrow' and 'enarrow' for testing a gamut narrower than sRGB.
Tested by running xfermodes2 in DM... all look different, what a mess.
I also ran a few nanobenches and they seemed somewhat sane.
Change-Id: Iacdc391dc0eef4153a76f5b4f78d72c57a4371ee
Reviewed-on: https://skia-review.googlesource.com/135871
Commit-Queue: Mike Klein <mtklein@chromium.org>
Auto-Submit: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
12 files changed, 84 insertions, 34 deletions
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp index f77299fece..68923d1c3e 100644 --- a/bench/nanobench.cpp +++ b/bench/nanobench.cpp @@ -27,6 +27,7 @@ #include "SkBitmapRegionDecoder.h" #include "SkCanvas.h" #include "SkCodec.h" +#include "SkColorSpacePriv.h" #include "SkCommonFlags.h" #include "SkCommonFlagsConfig.h" #include "SkCommonFlagsGpu.h" @@ -472,15 +473,23 @@ static void create_config(const SkCommandLineConfig* config, SkTArray<Config>* c CPU_CONFIG(nonrendering, kNonRendering_Backend, kUnknown_SkColorType, kUnpremul_SkAlphaType, nullptr) - CPU_CONFIG(a8, kRaster_Backend, - kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr) - CPU_CONFIG(8888, kRaster_Backend, - kN32_SkColorType, kPremul_SkAlphaType, nullptr) - CPU_CONFIG(565, kRaster_Backend, - kRGB_565_SkColorType, kOpaque_SkAlphaType, nullptr) - auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear(); - CPU_CONFIG(f16, kRaster_Backend, - kRGBA_F16_SkColorType, kPremul_SkAlphaType, srgbLinearColorSpace) + CPU_CONFIG(a8, kRaster_Backend, kAlpha_8_SkColorType, kPremul_SkAlphaType, nullptr) + CPU_CONFIG(8888, kRaster_Backend, kN32_SkColorType, kPremul_SkAlphaType, nullptr) + CPU_CONFIG(565, kRaster_Backend, kRGB_565_SkColorType, kOpaque_SkAlphaType, nullptr) + + // 'narrow' has a gamut narrower than sRGB, and different transfer function. + SkMatrix44 narrow_gamut(SkMatrix44::kUninitialized_Constructor); + narrow_gamut.set3x3RowMajorf(gNarrow_toXYZD50); + + auto narrow = SkColorSpace::MakeRGB(k2Dot2Curve_SkGammaNamed, narrow_gamut), + srgb = SkColorSpace::MakeSRGB(), + srgbLinear = SkColorSpace::MakeSRGBLinear(); + + CPU_CONFIG( f16, kRaster_Backend, kRGBA_F16_SkColorType, kPremul_SkAlphaType, srgbLinear) + CPU_CONFIG( srgb, kRaster_Backend, kRGBA_8888_SkColorType, kPremul_SkAlphaType, srgb ) + CPU_CONFIG( esrgb, kRaster_Backend, kRGBA_F16_SkColorType, kPremul_SkAlphaType, srgb ) + CPU_CONFIG( narrow, kRaster_Backend, kRGBA_8888_SkColorType, kPremul_SkAlphaType, narrow ) + CPU_CONFIG(enarrow, kRaster_Backend, kRGBA_F16_SkColorType, kPremul_SkAlphaType, narrow ) #undef CPU_CONFIG @@ -891,9 +891,6 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi #define SINK(t, sink, ...) if (config->getBackend().equals(t)) { return new sink(__VA_ARGS__); } if (FLAGS_cpu) { - auto srgbColorSpace = SkColorSpace::MakeSRGB(); - auto srgbLinearColorSpace = SkColorSpace::MakeSRGBLinear(); - SINK("g8", RasterSink, kGray_8_SkColorType); SINK("565", RasterSink, kRGB_565_SkColorType); SINK("4444", RasterSink, kARGB_4444_SkColorType); @@ -903,9 +900,6 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi SINK("rgbx", RasterSink, kRGB_888x_SkColorType); SINK("1010102", RasterSink, kRGBA_1010102_SkColorType); SINK("101010x", RasterSink, kRGB_101010x_SkColorType); - SINK("f16", RasterSink, kRGBA_F16_SkColorType, srgbLinearColorSpace); - SINK("esrgb", RasterSink, kRGBA_F16_SkColorType, srgbColorSpace); - SINK("srgbnl", RasterSink, kRGBA_8888_SkColorType, srgbColorSpace); SINK("t8888", ThreadedSink, kN32_SkColorType); SINK("pdf", PDFSink, false, SK_ScalarDefaultRasterDPI); SINK("skp", SKPSink); @@ -916,6 +910,22 @@ static Sink* create_sink(const GrContextOptions& grCtxOptions, const SkCommandLi SINK("pdfa", PDFSink, true, SK_ScalarDefaultRasterDPI); SINK("pdf300", PDFSink, false, 300); SINK("jsdebug", DebugSink); + + // Configs relevant to color management testing (and 8888 for reference). + + // 'narrow' has a gamut narrower than sRGB, and different transfer function. + SkMatrix44 narrow_gamut(SkMatrix44::kUninitialized_Constructor); + narrow_gamut.set3x3RowMajorf(gNarrow_toXYZD50); + + auto narrow = SkColorSpace::MakeRGB(k2Dot2Curve_SkGammaNamed, narrow_gamut), + srgb = SkColorSpace::MakeSRGB(), + srgbLinear = SkColorSpace::MakeSRGBLinear(); + + SINK( "f16", RasterSink, kRGBA_F16_SkColorType, srgbLinear); + SINK( "srgb", RasterSink, kRGBA_8888_SkColorType, srgb ); + SINK( "esrgb", RasterSink, kRGBA_F16_SkColorType, srgb ); + SINK( "narrow", RasterSink, kRGBA_8888_SkColorType, narrow ); + SINK("enarrow", RasterSink, kRGBA_F16_SkColorType, narrow ); } #undef SINK return nullptr; diff --git a/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json b/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json index ef18e8fc56..8295775740 100644 --- a/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json +++ b/infra/bots/recipes/perf.expected/Perf-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json @@ -150,6 +150,10 @@ "8888", "nonrendering", "f16", + "srgb", + "esrgb", + "narrow", + "enarrow", "--match", "~^floor2int_undef$", "~inc0.gif", diff --git a/infra/bots/recipes/perf.py b/infra/bots/recipes/perf.py index da9afbf3fd..139a8b5d39 100644 --- a/infra/bots/recipes/perf.py +++ b/infra/bots/recipes/perf.py @@ -61,7 +61,13 @@ def nanobench_flags(api, bot): configs.extend(['8888', 'nonrendering']) if '-GCE-' in bot: - configs += [ 'f16' ] + configs += [ + 'f16', + 'srgb', + 'esrgb', + 'narrow', + 'enarrow', + ] elif api.vars.builder_cfg.get('cpu_or_gpu') == 'GPU': args.append('--nocpu') diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json index 8f3549533d..a3a61d2863 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-ASAN.json @@ -181,11 +181,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "t8888", "serialize-8888", "tiles_rt-8888", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json index f00cfeb3c6..d59a4eed9e 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-MSAN.json @@ -180,11 +180,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "t8888", "serialize-8888", "tiles_rt-8888", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json index ccbc17b215..4925f9c011 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-All-SK_USE_DISCARDABLE_SCALEDIMAGECACHE.json @@ -263,11 +263,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "serialize-8888", "tiles_rt-8888", "pic-8888", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json index f499bc0bb6..9c8175acee 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Debug-shard_00_10-Coverage.json @@ -186,11 +186,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "serialize-8888", "tiles_rt-8888", "pic-8888", diff --git a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json index 45d7adf0de..ccd7ffee74 100644 --- a/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json +++ b/infra/bots/recipes/test.expected/Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-TSAN.json @@ -181,11 +181,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "t8888", "serialize-8888", "tiles_rt-8888", diff --git a/infra/bots/recipes/test.expected/failed_dm.json b/infra/bots/recipes/test.expected/failed_dm.json index 5a0d0969cb..caf20a1a46 100644 --- a/infra/bots/recipes/test.expected/failed_dm.json +++ b/infra/bots/recipes/test.expected/failed_dm.json @@ -259,11 +259,13 @@ "pdf", "g8", "565", - "f16", "lite-8888", "gbr-8888", - "srgbnl", + "f16", + "srgb", "esrgb", + "narrow", + "enarrow", "serialize-8888", "tiles_rt-8888", "pic-8888", diff --git a/infra/bots/recipes/test.py b/infra/bots/recipes/test.py index cec5578a13..cf9de3aca5 100644 --- a/infra/bots/recipes/test.py +++ b/infra/bots/recipes/test.py @@ -115,11 +115,13 @@ def dm_flags(api, bot): if '-GCE-' in bot and 'x86_64' in bot: configs.extend(['g8']) configs.extend(['565']) - configs.extend(['f16']) configs.extend(['lite-8888']) # Experimental display list. configs.extend(['gbr-8888']) - configs.extend(['srgbnl']) + configs.extend(['f16']) + configs.extend(['srgb']) configs.extend(['esrgb']) + configs.extend(['narrow']) + configs.extend(['enarrow']) if 'SAN' in bot: configs.extend(['t8888']) diff --git a/src/core/SkColorSpacePriv.h b/src/core/SkColorSpacePriv.h index 2ec895fdb7..7742a8770a 100644 --- a/src/core/SkColorSpacePriv.h +++ b/src/core/SkColorSpacePriv.h @@ -16,7 +16,7 @@ static constexpr float gSRGB_toXYZD50[] { 0.4360747f, 0.3850649f, 0.1430804f, // Rx, Gx, Bx - 0.2225045f, 0.7168786f, 0.0606169f, // Ry, Gy, Gz + 0.2225045f, 0.7168786f, 0.0606169f, // Ry, Gy, By 0.0139322f, 0.0971045f, 0.7141733f, // Rz, Gz, Bz }; @@ -26,22 +26,29 @@ static constexpr float gAdobeRGB_toXYZD50[] { // 0.31111, 0.62567, 0.06322, // 0.01947, 0.06087, 0.74457, SkFixedToFloat(0x9c18), SkFixedToFloat(0x348d), SkFixedToFloat(0x2631), // Rx, Gx, Bx - SkFixedToFloat(0x4fa5), SkFixedToFloat(0xa02c), SkFixedToFloat(0x102f), // Ry, Gy, Gz + SkFixedToFloat(0x4fa5), SkFixedToFloat(0xa02c), SkFixedToFloat(0x102f), // Ry, Gy, By SkFixedToFloat(0x04fc), SkFixedToFloat(0x0f95), SkFixedToFloat(0xbe9c), // Rz, Gz, Bz }; static constexpr float gDCIP3_toXYZD50[] { 0.515102f, 0.291965f, 0.157153f, // Rx, Gx, Bx - 0.241182f, 0.692236f, 0.0665819f, // Ry, Gy, Gz + 0.241182f, 0.692236f, 0.0665819f, // Ry, Gy, By -0.00104941f, 0.0418818f, 0.784378f, // Rz, Gz, Bz }; static constexpr float gRec2020_toXYZD50[] { 0.673459f, 0.165661f, 0.125100f, // Rx, Gx, Bx - 0.279033f, 0.675338f, 0.0456288f, // Ry, Gy, Gz + 0.279033f, 0.675338f, 0.0456288f, // Ry, Gy, By -0.00193139f, 0.0299794f, 0.797162f, // Rz, Gz, Bz }; +// A gamut narrower than sRGB, useful for testing. +static constexpr float gNarrow_toXYZD50[] { + 0.190974f, 0.404865f, 0.368380f, + 0.114746f, 0.582937f, 0.302318f, + 0.032925f, 0.153615f, 0.638669f, +}; + static constexpr SkColorSpaceTransferFn gSRGB_TransferFn = { 2.4f, 1.0f / 1.055f, 0.055f / 1.055f, 1.0f / 12.92f, 0.04045f, 0.0f, 0.0f }; |