Roll skia/third_party/skcms baef14c..aee343c (1 commits)
https://skia.googlesource.com/skcms.git/+log/baef14c..aee343c 2018-05-02 brianosman@google.com Remove skcms_EnsureUsableAsDestination* 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=brianosman@google.com Change-Id: Id25529fc96b68f69dc7baa346d3583710963ddbf Reviewed-on: https://skia-review.googlesource.com/125390 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>
This commit is contained in:
parent
baf9e05233
commit
908ad22437
14
third_party/skcms/skcms.h
vendored
14
third_party/skcms/skcms.h
vendored
@ -209,18 +209,6 @@ SKCMS_API bool skcms_Transform(const void* src,
|
||||
const skcms_ICCProfile* dstProfile,
|
||||
size_t npixels);
|
||||
|
||||
// If profile cannot be used as a destination profile in skcms_Transform(),
|
||||
// rewrite it with approximations where reasonable or by pulling from fallback
|
||||
// (e.g. skcms_sRGB_profile) where not.
|
||||
SKCMS_API void skcms_EnsureUsableAsDestination(skcms_ICCProfile* profile,
|
||||
const skcms_ICCProfile* fallback);
|
||||
|
||||
// If profile cannot be used as a destination profile with a single parametric transfer function,
|
||||
// (ie for rasterization), rewrite it with approximations where reasonable or by pulling from
|
||||
// fallback (e.g. skcms_sRGB_profile) where not.
|
||||
SKCMS_API void skcms_EnsureUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile,
|
||||
const skcms_ICCProfile* fallback);
|
||||
|
||||
// If profile can be used as a destination in skcms_Transform, return true. Otherwise, attempt to
|
||||
// rewrite it with approximations where reasonable. If successful, return true. If no reasonable
|
||||
// approximation exists, leave the profile unchanged and return false.
|
||||
@ -228,7 +216,7 @@ SKCMS_API bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile);
|
||||
|
||||
// If profile can be used as a destination with a single parametric transfer function (ie for
|
||||
// rasterization), return true. Otherwise, attempt to rewrite it with approximations where
|
||||
// reasonable. If successful, return true. If not reasonable approximation exists, leave the
|
||||
// reasonable. If successful, return true. If no reasonable approximation exists, leave the
|
||||
// profile unchanged and return false.
|
||||
SKCMS_API bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile);
|
||||
|
||||
|
64
third_party/skcms/src/Transform.c
vendored
64
third_party/skcms/src/Transform.c
vendored
@ -622,39 +622,6 @@ static void assert_usable_as_destination(const skcms_ICCProfile* profile) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void skcms_EnsureUsableAsDestination(skcms_ICCProfile* profile, const skcms_ICCProfile* fallback) {
|
||||
assert_usable_as_destination(fallback);
|
||||
|
||||
skcms_Matrix3x3 fromXYZD50;
|
||||
if (!profile->has_toXYZD50 || !skcms_Matrix3x3_invert(&profile->toXYZD50, &fromXYZD50)) {
|
||||
profile->toXYZD50 = fallback->toXYZD50;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
skcms_TransferFunction inv;
|
||||
if (profile->has_trc && profile->trc[i].table_entries == 0
|
||||
&& skcms_TransferFunction_invert(&profile->trc[i].parametric, &inv)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Note there's a little gap here that we could fill by allowing fitting
|
||||
// parametric curves to non-invertible parametric curves.
|
||||
|
||||
float max_error;
|
||||
skcms_TransferFunction tf = fallback->trc[i].parametric;
|
||||
// Parametric curves from skcms_ApproximateCurve() are guaranteed to be invertible.
|
||||
// If approximation fails, tf will still hold fallback's parametric TRC curve.
|
||||
(void)skcms_ApproximateCurve(&profile->trc[i], &tf, &max_error);
|
||||
profile->trc[i].table_entries = 0;
|
||||
profile->trc[i].parametric = tf;
|
||||
}
|
||||
|
||||
profile->has_toXYZD50 = true;
|
||||
profile->has_trc = true;
|
||||
|
||||
assert_usable_as_destination(profile);
|
||||
}
|
||||
|
||||
static float max_roundtrip_error(const skcms_TransferFunction* inv_tf, const skcms_Curve* curve) {
|
||||
int N = curve->table_entries ? (int)curve->table_entries : 256;
|
||||
const float x_scale = 1.0f / (N - 1);
|
||||
@ -667,37 +634,6 @@ static float max_roundtrip_error(const skcms_TransferFunction* inv_tf, const skc
|
||||
return err;
|
||||
}
|
||||
|
||||
void skcms_EnsureUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile,
|
||||
const skcms_ICCProfile* fallback) {
|
||||
// Operate on a copy of profile, so we can choose the best TF for the original curves
|
||||
skcms_ICCProfile result = *profile;
|
||||
skcms_EnsureUsableAsDestination(&result, fallback);
|
||||
|
||||
int best_tf = 0;
|
||||
float min_max_error = INFINITY_;
|
||||
const skcms_ICCProfile* ref = profile->has_trc ? profile : fallback;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
skcms_TransferFunction inv;
|
||||
skcms_TransferFunction_invert(&result.trc[i].parametric, &inv);
|
||||
|
||||
float err = 0;
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
err = fmaxf_(err, max_roundtrip_error(&inv, &ref->trc[j]));
|
||||
}
|
||||
if (min_max_error > err) {
|
||||
min_max_error = err;
|
||||
best_tf = i;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
result.trc[i].parametric = result.trc[best_tf].parametric;
|
||||
}
|
||||
|
||||
*profile = result;
|
||||
assert_usable_as_destination(profile);
|
||||
}
|
||||
|
||||
bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile) {
|
||||
skcms_Matrix3x3 fromXYZD50;
|
||||
if (!profile->has_trc || !profile->has_toXYZD50
|
||||
|
2
third_party/skcms/version.sha1
vendored
2
third_party/skcms/version.sha1
vendored
@ -1 +1 @@
|
||||
baef14ce357a67a20251276475241f574cc5e2ee
|
||||
aee343ca3bc90ac49f2c410ed3578efad8012710
|
Loading…
Reference in New Issue
Block a user