Commit 1b07639c authored by Mike Klein's avatar Mike Klein Committed by Commit Bot

remove SK_LEGACY_SRGB_STAGE_CHOICE

Whenever we linearize or encode sRGB, we use custom fast routines to do
this; other transfer functions go through a slower general case path.

We "recently" realized that the specialized sRGB routines are only
accurate over an input domain of about [-2,2].  This is normally fine,
as the common input domain is normalized values in [0,1], but sometimes
we deal with colors outside a given gamut.  In the limit, a
from_sRGB(to_sRGB(x)) roundtrip asymptotes to 8, not x like you'd want!

So flipping this flag switches us to keep using the fast sRGB math when
we're sure the inputs are normalized, but switch over to the general
case if we even suspect we're not.

Change-Id: Ie604c6d7d3a5d9655ed1af09d832be5ac951b375
Reviewed-on: https://chromium-review.googlesource.com/c/1459397
Auto-Submit: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630641}
parent 32448b33
...@@ -166,8 +166,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, ...@@ -166,8 +166,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal,
#define SK_SUPPORT_LEGACY_AAA_CHOICE #define SK_SUPPORT_LEGACY_AAA_CHOICE
#endif #endif
#define SK_LEGACY_SRGB_STAGE_CHOICE
// We're turning this off indefinitely, // We're turning this off indefinitely,
// until we can figure out some fundamental problems with its approach. // until we can figure out some fundamental problems with its approach.
// //
......
...@@ -16,11 +16,11 @@ function testPixels(actualPixels, refPixels, testScenario) ...@@ -16,11 +16,11 @@ function testPixels(actualPixels, refPixels, testScenario)
// Narrowing down the source of expected error: // Narrowing down the source of expected error:
// - Alpha values should always match. // - Alpha values should always match.
// - Color components should be acceptably close. All tests locally pass // - Color components should be acceptably close. All tests locally pass
// with a tolerance of 4 (uint8), 0.01 (f16/srgb,p3), and 0.02 (rec2020). // with a tolerance of 4 (uint8) or 0.02 (f16).
// - The red channel of the green pixel has the largest error since green // - The red channel of the green pixel has the largest error since green
// has the largest change in what's representable between sRGB and // has the largest change in what's representable between sRGB and
// P3/Rec2020. Red channel of the green pixel is R channel of the second // P3/Rec2020. Red channel of the green pixel is R channel of the second
// pixel. All tests locally pass with a tolerance of 8 (uint8) and 0.03 (f16). // pixel. All tests locally pass with a tolerance of 8 (uint8) and 0.035 (f16).
if (testScenario.canvasColorParam.pixelFormat == 'uint8') { if (testScenario.canvasColorParam.pixelFormat == 'uint8') {
let tolerance_color = 4; let tolerance_color = 4;
let tolerance_r_green = 8; let tolerance_r_green = 8;
...@@ -35,11 +35,9 @@ function testPixels(actualPixels, refPixels, testScenario) ...@@ -35,11 +35,9 @@ function testPixels(actualPixels, refPixels, testScenario)
assert_approx_equals(actualPixels[i], refPixels[i], tolerance_color); assert_approx_equals(actualPixels[i], refPixels[i], tolerance_color);
} }
} else { } else {
// For half float backed canvas, we expect the error < 0.01. // For half float backed canvas, we expect the error < 0.02.
let tolerance_color = 0.01; let tolerance_color = 0.02;
if (testScenario.encodeOptions.colorSpace == 'rec2020') let tolerance_r_green = 0.035;
tolerance_color = 0.02;
let tolerance_r_green = 0.03;
for (let i = 0; i < actualPixels.length; i++) { for (let i = 0; i < actualPixels.length; i++) {
// Alpha channel // Alpha channel
if (i % 4 == 3) if (i % 4 == 3)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment