Roll skia/third_party/skcms dc97dc542b6d..95d1987a561d (1 commits)

https://skia.googlesource.com/skcms.git/+log/dc97dc542b6d..95d1987a561d

2018-08-01 mtklein@google.com pay some attention to apply_tf()


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

Change-Id: I4ac39555011685f177143758bdb4de8060221a1d
Reviewed-on: https://skia-review.googlesource.com/144764
Commit-Queue: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
Reviewed-by: skcms-skia-autoroll <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>
diff --git a/third_party/skcms/src/Transform_inl.h b/third_party/skcms/src/Transform_inl.h
index 49d324a..86d9c9b 100644
--- a/third_party/skcms/src/Transform_inl.h
+++ b/third_party/skcms/src/Transform_inl.h
@@ -236,13 +236,17 @@
 
 // Return tf(x).
 SI ATTR F apply_tf(const skcms_TransferFunction* tf, F x) {
-    F sign = if_then_else(x < 0, -F1, F1);
-    x *= sign;
+    // Peel off the sign bit and set x = |x|.
+    U32 bits = bit_pun<U32>(x),
+        sign = bits & 0x80000000;
+    x = bit_pun<F>(bits ^ sign);
 
-    F linear    =            tf->c*x + tf->f;
-    F nonlinear = approx_pow(tf->a*x + tf->b, tf->g) + tf->e;
+    // The transfer function has a linear part up to d, exponential at d and after.
+    F v = if_then_else(x < tf->d,            tf->c*x + tf->f
+                                , approx_pow(tf->a*x + tf->b, tf->g) + tf->e);
 
-    return sign * if_then_else(x < tf->d, linear, nonlinear);
+    // Tack the sign bit back on.
+    return bit_pun<F>(sign | bit_pun<U32>(v));
 }
 
 
diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1
index c7eeae4..8cc1990 100755
--- a/third_party/skcms/version.sha1
+++ b/third_party/skcms/version.sha1
@@ -1 +1 @@
-dc97dc542b6dc25d78a945b084425204ab380dd8
\ No newline at end of file
+95d1987a561d666f0c635b807e33f1e4f7247434
\ No newline at end of file