summaryrefslogtreecommitdiffstats
path: root/third_party/qcms
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/qcms')
-rw-r--r--third_party/qcms/README.chromium2
-rw-r--r--third_party/qcms/src/transform.c21
2 files changed, 14 insertions, 9 deletions
diff --git a/third_party/qcms/README.chromium b/third_party/qcms/README.chromium
index fdf3394..8fb3768 100644
--- a/third_party/qcms/README.chromium
+++ b/third_party/qcms/README.chromium
@@ -51,5 +51,7 @@ google.patch contains the following modifications. Apply with
- https://code.google.com/p/chromium/issues/detail?id=401971
- Minor variable name change: description -> description_offset
- https://code.google.com/p/chromium/issues/detail?id=401971
+ - Avoid divisions creating sample points in the float cube LUT builder
+ - https://code.google.com/p/chromium/issues/detail?id=443863
To regenerate google.patch:
git diff b8456f38 src > google.patch
diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c
index 08db142..9fd8238 100644
--- a/third_party/qcms/src/transform.c
+++ b/third_party/qcms/src/transform.c
@@ -1118,28 +1118,31 @@ qcms_transform* qcms_transform_precacheLUT_float(qcms_transform *transform, qcms
float* src = NULL;
float* dest = NULL;
float* lut = NULL;
+ float inverse;
src = malloc(lutSize*sizeof(float));
dest = malloc(lutSize*sizeof(float));
if (src && dest) {
- /* Prepare a list of points we want to sample */
+ /* Prepare a list of points we want to sample: x, y, z order */
l = 0;
+ inverse = 1 / (float)(samples-1);
for (x = 0; x < samples; x++) {
for (y = 0; y < samples; y++) {
for (z = 0; z < samples; z++) {
- src[l++] = x / (float)(samples-1);
- src[l++] = y / (float)(samples-1);
- src[l++] = z / (float)(samples-1);
+ src[l++] = x * inverse; // r
+ src[l++] = y * inverse; // g
+ src[l++] = z * inverse; // b
}
}
}
lut = qcms_chain_transform(in, out, src, dest, lutSize);
+
if (lut) {
- transform->r_clut = &lut[0];
- transform->g_clut = &lut[1];
- transform->b_clut = &lut[2];
+ transform->r_clut = &lut[0]; // r
+ transform->g_clut = &lut[1]; // g
+ transform->b_clut = &lut[2]; // b
transform->grid_size = samples;
if (in_type == QCMS_DATA_RGBA_8) {
transform->transform_fn = qcms_transform_data_tetra_clut_rgba;
@@ -1149,8 +1152,8 @@ qcms_transform* qcms_transform_precacheLUT_float(qcms_transform *transform, qcms
}
}
-
- //XXX: qcms_modular_transform_data may return either the src or dest buffer. If so it must not be free-ed
+ // XXX: qcms_modular_transform_data may return the lut in either the src or the
+ // dest buffer. If so, it must not be free-ed.
if (src && lut != src) {
free(src);
}