Roll skia/third_party/skcms d931999c3afd..6655095842ec (1 commits)
Also whitelist third_party/skcms from #include rewrites. https://skia.googlesource.com/skcms.git/+log/d931999c3afd..6655095842ec git log d931999c3afd..6655095842ec --date=short --no-merges --format='%ad %ae %s' 2019-08-20 mtklein@google.com Add missing b-tweak to skcms_TF_Invert() Created with: gclient setdep -r skia/third_party/skcms@6655095842ec The AutoRoll server is located here: https://autoroll.skia.org/r/skcms-skia-autoroll Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+/master/autoroll/README.md If the roll is causing failures, please contact the current sheriff, who should be CC'd on the roll, and stop the roller if necessary. CQ_INCLUDE_TRYBOTS=luci.chromium.try:linux-blink-rel Bug: chromium:976551 Change-Id: I6566968525070f0af808d04211b16e71f9850cea TBR=egdaniel@google.com,mtklein@google.com TBR=egdaniel@google.com,mtklein@google.com Change-Id: I2c9b6a270693e9e93303b9cfef1262488bba1aae Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235936 Commit-Queue: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: Mike Klein <mtklein@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
723a877d0c
commit
fe16a33005
20
third_party/skcms/skcms.cc
vendored
20
third_party/skcms/skcms.cc
vendored
@ -266,6 +266,11 @@ static bool tf_is_valid(const skcms_TransferFunction* tf) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// It's rather _complex_ to raise a negative number to a fractional power tf->g.
|
||||
if (tf->a * tf->d + tf->b < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1404,6 +1409,7 @@ static float exp2f_(float x) {
|
||||
}
|
||||
|
||||
float powf_(float x, float y) {
|
||||
assert (x >= 0);
|
||||
return (x == 0) || (x == 1) ? x
|
||||
: exp2f_(log2f_(x) * y);
|
||||
}
|
||||
@ -1468,6 +1474,17 @@ bool skcms_TransferFunction_invert(const skcms_TransferFunction* src, skcms_Tran
|
||||
inv.b = -k * src->e;
|
||||
inv.e = -src->b / src->a;
|
||||
|
||||
// We need to enforce the same constraints here that we do when fitting a curve,
|
||||
// a >= 0 and ad+b >= 0. These constraints are checked by tf_is_valid(), so they're true
|
||||
// of the source function if we're here. And if the source a >= 0, inv.a definitely is too.
|
||||
assert (inv.a >= 0);
|
||||
|
||||
// On the other hand our ad+b could have gone slightly negative here. Tweak inv.b if needed.
|
||||
if (inv.a * inv.d + inv.b < 0) {
|
||||
inv.b = -inv.a * inv.d;
|
||||
}
|
||||
assert (inv.a * inv.d + inv.b >= 0);
|
||||
|
||||
// Now in principle we're done.
|
||||
// But to preserve the valuable invariant inv(src(1.0f)) == 1.0f,
|
||||
// we'll tweak e. These two values should be close to each other,
|
||||
@ -1663,6 +1680,9 @@ static bool fit_nonlinear(const skcms_Curve* curve, int L, int N, skcms_Transfer
|
||||
P[2] = -P[1] * tf->d;
|
||||
}
|
||||
|
||||
assert (P[1] >= 0 &&
|
||||
P[1] * tf->d + P[2] >= 0);
|
||||
|
||||
tf->g = P[0];
|
||||
tf->a = P[1];
|
||||
tf->b = P[2];
|
||||
|
2
third_party/skcms/version.sha1
vendored
2
third_party/skcms/version.sha1
vendored
@ -1 +1 @@
|
||||
d931999c3afd98880d3f366e12f858824be44fba
|
||||
6655095842ecdc56e1ab5507646dedd241e13d8b
|
@ -69,7 +69,7 @@ def to_rewrite():
|
||||
# Rewrite any #includes relative to Skia's top-level directory.
|
||||
need_rewriting = []
|
||||
for file_path in to_rewrite():
|
||||
if 'generated' in file_path:
|
||||
if 'generated' in file_path or 'third_party/skcms' in file_path:
|
||||
continue
|
||||
if (file_path.endswith('.h') or
|
||||
file_path.endswith('.c') or
|
||||
|
Loading…
Reference in New Issue
Block a user