Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d5e7b0b

Browse files
skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.comSkia Commit-Bot
authored andcommitted
Roll skia/third_party/skcms aee343c..cc1799c (1 commits)
https://skia.googlesource.com/skcms.git/+log/aee343c..cc1799c 2018-05-03 [email protected] Enforce constraints at the start of nonlinear fitting The AutoRoll server is located here: https://skcms-skia-roll.skia.org 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=master.tryserver.blink:linux_trusty_blink_rel [email protected] Change-Id: Ic85d08764124fd57fc44950001d2f67348984fa2 Reviewed-on: https://skia-review.googlesource.com/125779 Reviewed-by: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com> Commit-Queue: Mike Klein <[email protected]>
1 parent ba2c826 commit d5e7b0b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

third_party/skcms/src/TransferFunction.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ static bool fit_nonlinear(const skcms_Curve* curve, int start, int N, skcms_Tran
238238

239239
for (int j = 0; j < 3/*TODO: tune*/; j++) {
240240
// These extra constraints a >= 0 and ad+b >= 0 are not modeled in the optimization.
241+
// We don't really know how to fix up a if it goes negative.
242+
if (P[1] < 0) {
243+
return false;
244+
}
245+
// If ad+b goes negative, we feel just barely not uneasy enough to tweak b so ad+b is zero.
246+
if (P[1] * tf->d + P[2] < 0) {
247+
P[2] = -P[1] * tf->d;
248+
}
241249
assert (P[1] >= 0 &&
242250
P[1] * tf->d + P[2] >= 0);
243251

@@ -247,15 +255,14 @@ static bool fit_nonlinear(const skcms_Curve* curve, int start, int N, skcms_Tran
247255
start*x_scale, 1, N-start)) {
248256
return false;
249257
}
258+
}
250259

251-
// We don't really know how to fix up a if it goes negative.
252-
if (P[1] < 0) {
253-
return false;
254-
}
255-
// If ad+b goes negative, we feel just barely not uneasy enough to tweak b so ad+b is zero.
256-
if (P[1] * tf->d + P[2] < 0) {
257-
P[2] = -P[1] * tf->d;
258-
}
260+
// We need to apply our fixups one last time
261+
if (P[1] < 0) {
262+
return false;
263+
}
264+
if (P[1] * tf->d + P[2] < 0) {
265+
P[2] = -P[1] * tf->d;
259266
}
260267

261268
tf->g = P[0];

third_party/skcms/version.sha1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
aee343ca3bc90ac49f2c410ed3578efad8012710
1+
cc1799c6b4fce905ad3810924d1a1a73b10ec230

0 commit comments

Comments
 (0)