Chromium Code Reviews| Index: third_party/qcms/src/transform_util.c |
| diff --git a/third_party/qcms/src/transform_util.c b/third_party/qcms/src/transform_util.c |
| index fc19b650f4013400ce1239dd5e974c005afca80e..650117706519f7c0407c45dea85e130d0b7fae6d 100644 |
| --- a/third_party/qcms/src/transform_util.c |
| +++ b/third_party/qcms/src/transform_util.c |
| @@ -611,7 +611,22 @@ void build_output_lut(struct curveType *trc, |
| for(i = 0; i < 256; i++) { |
| output[i] = (uint16_t)(gamma_table[i] * 65535); |
| } |
| - *output_gamma_lut = output; |
| + |
| + uint16_t *inverted; |
| + int inverted_size = 256; |
|
Noel Gordon
2016/04/21 06:01:54
These two variables need to be declared just after
radu.velea
2016/04/21 07:13:45
Done.
|
| + |
| + //XXX: the choice of a minimum of 256 here is not backed by any theory, |
| + // measurement or data, however it is what lcms uses. |
| + // the maximum number we would need is 65535 because that's the |
| + // accuracy used for computing the pre cache table |
| + if (inverted_size < 256) |
| + inverted_size = 256; |
| + |
| + inverted = invert_lut(output, 256, inverted_size); |
| + if (!inverted) |
| + return; |
| + *output_gamma_lut = inverted; |
| + free(output); |
| } else { |
| if (trc->count == 0) { |
| *output_gamma_lut = build_linear_table(4096); |