Roll skia/third_party/skcms 289cedc..f771d23 (1 commits)

https://skia.googlesource.com/skcms.git/+log/289cedc..f771d23

2018-05-09 brianosman@google.com Ensure that the TFs from ApproximateCurve are invertible


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
TBR=egdaniel@google.com

Change-Id: I327db3e5e51694678c84606272de4791ac35c263
Reviewed-on: https://skia-review.googlesource.com/126982
Reviewed-by: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
Commit-Queue: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
diff --git a/third_party/skcms/src/TransferFunction.c b/third_party/skcms/src/TransferFunction.c
index c1fce37..8fd94b4 100644
--- a/third_party/skcms/src/TransferFunction.c
+++ b/third_party/skcms/src/TransferFunction.c
@@ -307,11 +307,6 @@
             tf.a = tf.c;
             tf.b = tf.f;
             tf.c = tf.d = tf.e = tf.f = 0;
-
-            // We set tf directly, so calculate tf_inv to keep in sync.
-            if (!skcms_TransferFunction_invert(&tf, &tf_inv)) {
-                continue;
-            }
         } else if (L == N - 1) {
             // Degenerate case with only two points in the nonlinear segment. Solve directly.
             tf.g = 1;
@@ -320,11 +315,6 @@
             tf.b = skcms_eval_curve((N-2)*x_scale, curve)
                  - tf.a * (N-2)*x_scale;
             tf.e = 0;
-
-            // We solved tf directly, so calculate tf_inv to keep in sync.
-            if (!skcms_TransferFunction_invert(&tf, &tf_inv)) {
-                continue;
-            }
         } else {
             // Start by guessing a gamma-only curve through the midpoint.
             int mid = (L + N) / 2;
@@ -353,7 +343,11 @@
         // (The most likely use case for this approximation is to be inverted and
         // used as the transfer function for a destination color space.)
         //
-        // We test using tf_inv, but all paths above have kept tf and tf_inv in sync.
+        // We've kept tf and tf_inv in sync above, but we can't guarantee that tf is
+        // invertible, so re-verify that here (and use the new inverse for testing).
+        if (!skcms_TransferFunction_invert(&tf, &tf_inv)) {
+            continue;
+        }
 
         float err = 0;
         for (int i = 0; i < N; i++) {
diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1
index 7152f3a..c85bd27 100755
--- a/third_party/skcms/version.sha1
+++ b/third_party/skcms/version.sha1
@@ -1 +1 @@
-289cedcdb6874b9ebe68ce12c2b620768e6c1b3e
\ No newline at end of file
+f771d234ebdc7a1297ad6afd7574987d2ed2c7ad
\ No newline at end of file