diff options
author | skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com> | 2018-04-30 18:11:38 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-30 18:32:13 +0000 |
commit | 13496cbab97f423d142c05b0ca5504af15b544b8 (patch) | |
tree | 7768b2bb0012356621c967095a1f4335edaf3b00 /third_party/skcms | |
parent | 44a8c74e3554abf8ad8726312ceecfbce2cddb7a (diff) |
Roll skia/third_party/skcms 03457e1..42c2748 (1 commits)
https://skia.googlesource.com/skcms.git/+log/03457e1..42c2748
2018-04-30 mtklein@chromium.org handle L==N-1 special case in PolyTF fit
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.
TBR=brianosman@google.com
Change-Id: Ie06b99b89bd8f1ac24efe9c6149450f4f9942009
Reviewed-on: https://skia-review.googlesource.com/124528
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>
Diffstat (limited to 'third_party/skcms')
-rw-r--r-- | third_party/skcms/src/PolyTF.c | 23 | ||||
-rw-r--r-- | third_party/skcms/src/TransferFunction.c | 6 | ||||
-rwxr-xr-x | third_party/skcms/version.sha1 | 2 |
3 files changed, 20 insertions, 11 deletions
diff --git a/third_party/skcms/src/PolyTF.c b/third_party/skcms/src/PolyTF.c index b7b34c3d36..89e0cc40ca 100644 --- a/third_party/skcms/src/PolyTF.c +++ b/third_party/skcms/src/PolyTF.c @@ -94,13 +94,18 @@ static bool fit_poly_tf(const skcms_Curve* curve, skcms_PolyTF* tf) { } // Detect linear baseline: (ax + b)^g + e --> ax ~~> Cx - if (baseline.g == 1 && baseline.d == 0 && baseline.b + baseline.e == 0) { - tf->A = 0; - tf->B = 0; - tf->C = baseline.a; - tf->D = INFINITY_; // Always use Cx, never Ax^3+Bx^2+(1-A-B) - return true; + if (baseline.g == 1 && baseline.d == 0) { + if (baseline.b + baseline.e == 0) { + tf->A = 0; + tf->B = 0; + tf->C = baseline.a; + tf->D = INFINITY_; // Always use Cx, never Ax^3+Bx^2+(1-A-B) + return true; + } else { + return false; // Just like baseline.f != 0 above, can't represent this offset. + } } + // This case is less likely, but also guards against divide by zero below. if (tf->D == 1) { tf->A = 0; @@ -112,7 +117,11 @@ static bool fit_poly_tf(const skcms_Curve* curve, skcms_PolyTF* tf) { // If the curve isn't parametric and we approximated instead, this should be exact. const int L = (int)(tf->D * (N-1)) + 1; - // TODO: handle special case of L == N-1 to avoid /0 in Gauss-Newton. + if (L == N-1) { + // All points but one fit the linear section. + // We could connect the last point with a quadratic, but let's just be lazy. + return false; + } skcms_TransferFunction inv; if (!skcms_TransferFunction_invert(&baseline, &inv)) { diff --git a/third_party/skcms/src/TransferFunction.c b/third_party/skcms/src/TransferFunction.c index b9bbf0b59b..14a7898f00 100644 --- a/third_party/skcms/src/TransferFunction.c +++ b/third_party/skcms/src/TransferFunction.c @@ -295,9 +295,9 @@ bool skcms_ApproximateCurve(const skcms_Curve* curve, // Degenerate case with only two points in the nonlinear segment. Solve directly. tf.g = 1; tf.a = (skcms_eval_curve((N-1)*x_scale, curve) - skcms_eval_curve((N-2)*x_scale, curve)) - * (N-1); - tf.b = skcms_eval_curve((N-1)*x_scale, curve) - - tf.a * (N-2) * x_scale; + / x_scale; + tf.b = skcms_eval_curve((N-2)*x_scale, curve) + - tf.a * (N-2)*x_scale; tf.e = 0; } else { // Start by guessing a gamma-only curve through the midpoint. diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1 index 91b45a81ee..db34bce1c4 100755 --- a/third_party/skcms/version.sha1 +++ b/third_party/skcms/version.sha1 @@ -1 +1 @@ -03457e177feaa237d742a795a7c050c0476c2cb5
\ No newline at end of file +42c27486c1ffb16339be984eb6dde03e714a2c65
\ No newline at end of file |