aboutsummaryrefslogtreecommitdiffhomepage
path: root/third_party
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 20:24:31 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-07-02 20:52:52 +0000
commitaae58023a88f9d914e5ef32e2af1262bebbc3d3c (patch)
tree2437616b47dd407d92833337269c02c62bc14884 /third_party
parent9aa30c6ee0e5e2ba4ccc25a4913966a65f808f28 (diff)
Roll skia/third_party/skcms 0977edc92270..9d19e2abf000 (4 commits)
https://skia.googlesource.com/skcms.git/+log/0977edc92270..9d19e2abf000 2018-07-02 mtklein@chromium.org stop using designated initializers 2018-07-02 mtklein@chromium.org explicitly cast 16-bit constants to uint16_t 2018-07-02 mtklein@chromium.org fix typo in c++ header check 2018-07-02 mtklein@chromium.org make skcms buildable as 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: I5c9b29c5d8fcc3d8e3bf64ecd1ab24cac86b5d01 Reviewed-on: https://skia-review.googlesource.com/138954 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')
-rw-r--r--third_party/skcms/skcms.c136
-rw-r--r--third_party/skcms/skcms_internal.h6
-rw-r--r--third_party/skcms/src/Transform_inl.h46
-rwxr-xr-xthird_party/skcms/version.sha12
4 files changed, 127 insertions, 63 deletions
diff --git a/third_party/skcms/skcms.c b/third_party/skcms/skcms.c
index ddcd02e5ab..ff382860d9 100644
--- a/third_party/skcms/skcms.c
+++ b/third_party/skcms/skcms.c
@@ -846,8 +846,8 @@ bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) {
}
// Byte-swap all header fields
- const header_Layout* header = buf;
- profile->buffer = buf;
+ const header_Layout* header = (const header_Layout*)buf;
+ profile->buffer = (const uint8_t*)buf;
profile->size = read_big_u32(header->size);
uint32_t version = read_big_u32(header->version);
profile->data_color_space = read_big_u32(header->data_color_space);
@@ -960,57 +960,121 @@ bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) {
const skcms_ICCProfile* skcms_sRGB_profile() {
static const skcms_ICCProfile sRGB_profile = {
- // These fields are moot when not a skcms_Parse()'d profile.
- .buffer = NULL,
- .size = 0,
- .tag_count = 0,
+ NULL, // buffer, moot here
+
+ 0, // size, moot here
+ skcms_Signature_RGB, // data_color_space
+ skcms_Signature_XYZ, // pcs
+ 0, // tag count, moot here
// We choose to represent sRGB with its canonical transfer function,
// and with its canonical XYZD50 gamut matrix.
- .data_color_space = skcms_Signature_RGB,
- .pcs = skcms_Signature_XYZ,
- .has_trc = true,
- .has_toXYZD50 = true,
- .has_A2B = false,
-
- .trc = {
- {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0 }}},
- {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0 }}},
- {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0 }}},
+ true, // has_trc, followed by the 3 trc curves
+ {
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
+ {{0, {2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0, 0}}},
},
- .toXYZD50 = {{
+ true, // has_toXYZD50, followed by 3x3 toXYZD50 matrix
+ {{
{ 0.436065674f, 0.385147095f, 0.143066406f },
{ 0.222488403f, 0.716873169f, 0.060607910f },
{ 0.013916016f, 0.097076416f, 0.714096069f },
}},
+
+ false, // has_A2B, followed by a2b itself which we don't care about.
+ {
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ {0,0,0,0},
+ NULL,
+ NULL,
+
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ {{
+ { 1,0,0,0 },
+ { 0,1,0,0 },
+ { 0,0,1,0 },
+ }},
+
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ },
};
return &sRGB_profile;
}
const skcms_ICCProfile* skcms_XYZD50_profile() {
+ // Just like sRGB above, but with identity transfer functions and toXYZD50 matrix.
static const skcms_ICCProfile XYZD50_profile = {
- .buffer = NULL,
- .size = 0,
- .tag_count = 0,
-
- .data_color_space = skcms_Signature_RGB,
- .pcs = skcms_Signature_XYZ,
- .has_trc = true,
- .has_toXYZD50 = true,
- .has_A2B = false,
-
- .trc = {
- {{0, {1,1,0,0,0,0,0}}},
- {{0, {1,1,0,0,0,0,0}}},
- {{0, {1,1,0,0,0,0,0}}},
+ NULL, // buffer, moot here
+
+ 0, // size, moot here
+ skcms_Signature_RGB, // data_color_space
+ skcms_Signature_XYZ, // pcs
+ 0, // tag count, moot here
+
+ true, // has_trc, followed by the 3 trc curves
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
},
- .toXYZD50 = {{
- {1,0,0},
- {0,1,0},
- {0,0,1},
+ true, // has_toXYZD50, followed by 3x3 toXYZD50 matrix
+ {{
+ { 1,0,0 },
+ { 0,1,0 },
+ { 0,0,1 },
}},
+
+ false, // has_A2B, followed by a2b itself which we don't care about.
+ {
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ {0,0,0,0},
+ NULL,
+ NULL,
+
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ {{
+ { 1,0,0,0 },
+ { 0,1,0,0 },
+ { 0,0,1,0 },
+ }},
+
+ 0,
+ {
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ {{0, {1,1, 0,0,0,0,0}}},
+ },
+ },
};
return &XYZD50_profile;
@@ -2275,7 +2339,7 @@ bool skcms_Transform(const void* src,
run = run_program_hsw;
}
#endif
- run(program, arguments, src, dst, n, src_bpp,dst_bpp);
+ run(program, arguments, (const char*)src, (char*)dst, n, src_bpp,dst_bpp);
return true;
}
diff --git a/third_party/skcms/skcms_internal.h b/third_party/skcms/skcms_internal.h
index d8fe695265..3e2fc2be82 100644
--- a/third_party/skcms/skcms_internal.h
+++ b/third_party/skcms/skcms_internal.h
@@ -14,7 +14,7 @@
#include <stdbool.h>
#include <stdint.h>
-#if defined(__cpluscplus)
+#ifdef __cplusplus
extern "C" {
#endif
@@ -46,6 +46,6 @@ extern "C" {
static inline float fabsf_(float x) { return x < 0 ? -x : x; }
float powf_(float, float);
-#if defined(__cpluscplus)
-} // extern "C"
+#ifdef __cplusplus
+}
#endif
diff --git a/third_party/skcms/src/Transform_inl.h b/third_party/skcms/src/Transform_inl.h
index a8f3c8a0bd..6dc2a7950f 100644
--- a/third_party/skcms/src/Transform_inl.h
+++ b/third_party/skcms/src/Transform_inl.h
@@ -229,7 +229,7 @@ SI ATTR F NS(approx_pow_)(F x, float y) {
#define approx_pow NS(approx_pow_)
// Return tf(x).
-SI ATTR F NS(apply_transfer_function_)(const skcms_TransferFunction* tf, F x) {
+SI ATTR F NS(apply_tf_)(const skcms_TransferFunction* tf, F x) {
F sign = (F)if_then_else(x < 0, -F1, F1);
x *= sign;
@@ -238,7 +238,7 @@ SI ATTR F NS(apply_transfer_function_)(const skcms_TransferFunction* tf, F x) {
return sign * (F)if_then_else(x < tf->d, linear, nonlinear);
}
-#define apply_transfer_function NS(apply_transfer_function_)
+#define apply_tf NS(apply_tf_)
// Strided loads and stores of N values, starting from p.
#if N == 1
@@ -600,9 +600,9 @@ static void NS(exec_ops)(const Op* ops, const void** args,
U16 rgb;
small_memcpy(&rgb, src + 2*i, 2*N);
- r = CAST(F, rgb & (31<< 0)) * (1.0f / (31<< 0));
- g = CAST(F, rgb & (63<< 5)) * (1.0f / (63<< 5));
- b = CAST(F, rgb & (31<<11)) * (1.0f / (31<<11));
+ r = CAST(F, rgb & (uint16_t)(31<< 0)) * (1.0f / (31<< 0));
+ g = CAST(F, rgb & (uint16_t)(63<< 5)) * (1.0f / (63<< 5));
+ b = CAST(F, rgb & (uint16_t)(31<<11)) * (1.0f / (31<<11));
a = F1;
} break;
@@ -812,7 +812,7 @@ static void NS(exec_ops)(const Op* ops, const void** args,
} break;
case Op_matrix_3x3:{
- const skcms_Matrix3x3* matrix = *args++;
+ const skcms_Matrix3x3* matrix = (const skcms_Matrix3x3*) *args++;
const float* m = &matrix->vals[0][0];
F R = m[0]*r + m[1]*g + m[2]*b,
@@ -825,7 +825,7 @@ static void NS(exec_ops)(const Op* ops, const void** args,
} break;
case Op_matrix_3x4:{
- const skcms_Matrix3x4* matrix = *args++;
+ const skcms_Matrix3x4* matrix = (const skcms_Matrix3x4*) *args++;
const float* m = &matrix->vals[0][0];
F R = m[0]*r + m[1]*g + m[ 2]*b + m[ 3],
@@ -858,40 +858,40 @@ static void NS(exec_ops)(const Op* ops, const void** args,
b = Z * 0.8249f;
} break;
- case Op_tf_r:{ r = apply_transfer_function(*args++, r); } break;
- case Op_tf_g:{ g = apply_transfer_function(*args++, g); } break;
- case Op_tf_b:{ b = apply_transfer_function(*args++, b); } break;
- case Op_tf_a:{ a = apply_transfer_function(*args++, a); } break;
+ case Op_tf_r:{ r = apply_tf((const skcms_TransferFunction*)*args++, r); } break;
+ case Op_tf_g:{ g = apply_tf((const skcms_TransferFunction*)*args++, g); } break;
+ case Op_tf_b:{ b = apply_tf((const skcms_TransferFunction*)*args++, b); } break;
+ case Op_tf_a:{ a = apply_tf((const skcms_TransferFunction*)*args++, a); } break;
- case Op_table_8_r: { r = NS(table_8_ )(*args++, r); } break;
- case Op_table_8_g: { g = NS(table_8_ )(*args++, g); } break;
- case Op_table_8_b: { b = NS(table_8_ )(*args++, b); } break;
- case Op_table_8_a: { a = NS(table_8_ )(*args++, a); } break;
+ case Op_table_8_r: { r = NS(table_8_ )((const skcms_Curve*)*args++, r); } break;
+ case Op_table_8_g: { g = NS(table_8_ )((const skcms_Curve*)*args++, g); } break;
+ case Op_table_8_b: { b = NS(table_8_ )((const skcms_Curve*)*args++, b); } break;
+ case Op_table_8_a: { a = NS(table_8_ )((const skcms_Curve*)*args++, a); } break;
- case Op_table_16_r:{ r = NS(table_16_)(*args++, r); } break;
- case Op_table_16_g:{ g = NS(table_16_)(*args++, g); } break;
- case Op_table_16_b:{ b = NS(table_16_)(*args++, b); } break;
- case Op_table_16_a:{ a = NS(table_16_)(*args++, a); } break;
+ case Op_table_16_r:{ r = NS(table_16_)((const skcms_Curve*)*args++, r); } break;
+ case Op_table_16_g:{ g = NS(table_16_)((const skcms_Curve*)*args++, g); } break;
+ case Op_table_16_b:{ b = NS(table_16_)((const skcms_Curve*)*args++, b); } break;
+ case Op_table_16_a:{ a = NS(table_16_)((const skcms_Curve*)*args++, a); } break;
case Op_clut_3D_8:{
- const skcms_A2B* a2b = *args++;
+ const skcms_A2B* a2b = (const skcms_A2B*) *args++;
NS(clut_3_8_)(a2b, CAST(I32,F0),CAST(I32,F1), &r,&g,&b,a);
} break;
case Op_clut_3D_16:{
- const skcms_A2B* a2b = *args++;
+ const skcms_A2B* a2b = (const skcms_A2B*) *args++;
NS(clut_3_16_)(a2b, CAST(I32,F0),CAST(I32,F1), &r,&g,&b,a);
} break;
case Op_clut_4D_8:{
- const skcms_A2B* a2b = *args++;
+ const skcms_A2B* a2b = (const skcms_A2B*) *args++;
NS(clut_4_8_)(a2b, CAST(I32,F0),CAST(I32,F1), &r,&g,&b,a);
// 'a' was really a CMYK K, so our output is actually opaque.
a = F1;
} break;
case Op_clut_4D_16:{
- const skcms_A2B* a2b = *args++;
+ const skcms_A2B* a2b = (const skcms_A2B*) *args++;
NS(clut_4_16_)(a2b, CAST(I32,F0),CAST(I32,F1), &r,&g,&b,a);
// 'a' was really a CMYK K, so our output is actually opaque.
a = F1;
diff --git a/third_party/skcms/version.sha1 b/third_party/skcms/version.sha1
index 78208e0824..93029be8a3 100755
--- a/third_party/skcms/version.sha1
+++ b/third_party/skcms/version.sha1
@@ -1 +1 @@
-0977edc9227061b4b9a90b789ee3bdae85aae256 \ No newline at end of file
+9d19e2abf000a4531ede9ee1e80267557358cb69 \ No newline at end of file