aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party/skcms/src/Curve.c
diff options
context:
space:
mode:
authorGravatar skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com <skcms-skia-autoroll@skia-buildbots.google.com.iam.gserviceaccount.com>2018-07-02 19:08:45 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-02 19:38:22 +0000
commit5155d38fdcd4d4e94181bf01ef4831e442a4380b (patch)
tree710a7e7c650aed6b81acf917c7272e1c07cffe1c /third_party/skcms/src/Curve.c
parent5dfd0694dc0b320e13eb7e253b77419b32ceab49 (diff)
Roll skia/third_party/skcms 14ea609fa6ca..99b01c076f47 (1 commits)
https://skia.googlesource.com/skcms.git/+log/14ea609fa6ca..99b01c076f47 2018-07-02 mtklein@chromium.org move skcms impl into skcms.c 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=ethannicholas@google.com Change-Id: I950f7b604eef056641fec3e6691d8c8a928d2d37 Reviewed-on: https://skia-review.googlesource.com/138950 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/src/Curve.c')
-rw-r--r--third_party/skcms/src/Curve.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/third_party/skcms/src/Curve.c b/third_party/skcms/src/Curve.c
deleted file mode 100644
index 2b99fd7bf4..0000000000
--- a/third_party/skcms/src/Curve.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "../skcms_internal.h"
-#include <assert.h>
-
-static float minus_1_ulp(float x) {
- int32_t bits;
- memcpy(&bits, &x, sizeof(bits));
- bits = bits - 1;
- memcpy(&x, &bits, sizeof(bits));
- return x;
-}
-
-float skcms_eval_curve(const skcms_Curve* curve, float x) {
- if (curve->table_entries == 0) {
- return skcms_TransferFunction_eval(&curve->parametric, x);
- }
-
- float ix = fmaxf_(0, fminf_(x, 1)) * (curve->table_entries - 1);
- int lo = (int) ix,
- hi = (int)minus_1_ulp(ix + 1.0f);
- float t = ix - (float)lo;
-
- float l, h;
- if (curve->table_8) {
- l = curve->table_8[lo] * (1/255.0f);
- h = curve->table_8[hi] * (1/255.0f);
- } else {
- uint16_t be_l, be_h;
- memcpy(&be_l, curve->table_16 + 2*lo, 2);
- memcpy(&be_h, curve->table_16 + 2*hi, 2);
- uint16_t le_l = ((be_l << 8) | (be_l >> 8)) & 0xffff;
- uint16_t le_h = ((be_h << 8) | (be_h >> 8)) & 0xffff;
- l = le_l * (1/65535.0f);
- h = le_h * (1/65535.0f);
- }
- return l + (h-l)*t;
-}
-
-float skcms_MaxRoundtripError(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf) {
- uint32_t N = curve->table_entries > 256 ? curve->table_entries : 256;
- const float dx = 1.0f / (N - 1);
- float err = 0;
- for (uint32_t i = 0; i < N; i++) {
- float x = i * dx,
- y = skcms_eval_curve(curve, x);
- err = fmaxf_(err, fabsf_(x - skcms_TransferFunction_eval(inv_tf, y)));
- }
- return err;
-}
-
-bool skcms_AreApproximateInverses(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf) {
- return skcms_MaxRoundtripError(curve, inv_tf) < (1/512.0f);
-}