Roll skia/third_party/skcms 5f03dc9abfb1..da25e1a6d412 (1 commits)
https://skia.googlesource.com/skcms.git/+log/5f03dc9abfb1..da25e1a6d412 2018-08-29 mtklein@google.com add skcms_ApproximatelyEqualProfiles() fastpath The AutoRoll server is located here: https://autoroll.skia.org/r/skcms-skia-autoroll 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=stephana@google.com Change-Id: I183eebaf701cf50afc631e6cd931d79c328d9a78 Reviewed-on: https://skia-review.googlesource.com/150299 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
e5dd9bac9a
commit
67eac38e67
11
third_party/skcms/skcms.cc
vendored
11
third_party/skcms/skcms.cc
vendored
@ -1124,6 +1124,11 @@ const uint8_t skcms_252_random_bytes[] = {
|
||||
};
|
||||
|
||||
bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICCProfile* B) {
|
||||
// Test for exactly equal profiles first.
|
||||
if (A == B || 0 == memcmp(A,B, sizeof(skcms_ICCProfile))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// For now this is the essentially the same strategy we use in test_only.c
|
||||
// for our skcms_Transform() smoke tests:
|
||||
// 1) transform A to XYZD50
|
||||
@ -1131,7 +1136,7 @@ bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICC
|
||||
// 3) return true if they're similar enough
|
||||
// Our current criterion in 3) is maximum 1 bit error per XYZD50 byte.
|
||||
|
||||
// Here are 252 of a random shuffle of all possible bytes.
|
||||
// skcms_252_random_bytes are 252 of a random shuffle of all possible bytes.
|
||||
// 252 is evenly divisible by 3 and 4. Only 192, 10, 241, and 43 are missing.
|
||||
|
||||
if (A->data_color_space != B->data_color_space) {
|
||||
@ -1139,6 +1144,7 @@ bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICC
|
||||
}
|
||||
|
||||
// Interpret as RGB_888 if data color space is RGB or GRAY, RGBA_8888 if CMYK.
|
||||
// TODO: working with RGBA_8888 either way is probably fastest.
|
||||
skcms_PixelFormat fmt = skcms_PixelFormat_RGB_888;
|
||||
size_t npixels = 84;
|
||||
if (A->data_color_space == skcms_Signature_CMYK) {
|
||||
@ -1146,6 +1152,8 @@ bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICC
|
||||
npixels = 63;
|
||||
}
|
||||
|
||||
// TODO: if A or B is a known profile (skcms_sRGB_profile, skcms_XYZD50_profile),
|
||||
// use pre-canned results and skip that skcms_Transform() call?
|
||||
uint8_t dstA[252],
|
||||
dstB[252];
|
||||
if (!skcms_Transform(
|
||||
@ -1161,6 +1169,7 @@ bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, const skcms_ICC
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: make sure this final check has reasonable codegen.
|
||||
for (size_t i = 0; i < 252; i++) {
|
||||
if (abs((int)dstA[i] - (int)dstB[i]) > 1) {
|
||||
return false;
|
||||
|
2
third_party/skcms/version.sha1
vendored
2
third_party/skcms/version.sha1
vendored
@ -1 +1 @@
|
||||
5f03dc9abfb1d5b0f5598a9cb551ab478bbe0945
|
||||
da25e1a6d4122e89a93155969ec7ad648cfadbd0
|
Loading…
Reference in New Issue
Block a user