| OLD | NEW |
| 1 /* vim: set ts=8 sw=8 noexpandtab: */ | 1 /* vim: set ts=8 sw=8 noexpandtab: */ |
| 2 // qcms | 2 // qcms |
| 3 // Copyright (C) 2009 Mozilla Corporation | 3 // Copyright (C) 2009 Mozilla Corporation |
| 4 // Copyright (C) 1998-2007 Marti Maria | 4 // Copyright (C) 1998-2007 Marti Maria |
| 5 // | 5 // |
| 6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
| 7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
| 8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
| 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
| 11 // is furnished to do so, subject to the following conditions: | 11 // is furnished to do so, subject to the following conditions: |
| 12 // | 12 // |
| 13 // The above copyright notice and this permission notice shall be included in | 13 // The above copyright notice and this permission notice shall be included in |
| 14 // all copies or substantial portions of the Software. | 14 // all copies or substantial portions of the Software. |
| 15 // | 15 // |
| 16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO | 17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO |
| 18 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 18 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | 23 |
| 24 #include <stdlib.h> | 24 #include <stdlib.h> |
| 25 #include <math.h> | 25 #include <math.h> |
| 26 #include <assert.h> | 26 #include <assert.h> |
| 27 #include <string.h> //memcpy | 27 #include <string.h> //memcpy |
| 28 #include "qcmsint.h" | 28 #include "qcmsint.h" |
| 29 #include "chain.h" | 29 #include "chain.h" |
| 30 #include "halffloat.h" |
| 30 #include "matrix.h" | 31 #include "matrix.h" |
| 31 #include "transform_util.h" | 32 #include "transform_util.h" |
| 32 | 33 |
| 33 /* for MSVC, GCC, Intel, and Sun compilers */ | 34 /* for MSVC, GCC, Intel, and Sun compilers */ |
| 34 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_M_AMD64
) || defined(__x86_64__) || defined(__x86_64) | 35 #if defined(_M_IX86) || defined(__i386__) || defined(__i386) || defined(_M_AMD64
) || defined(__x86_64__) || defined(__x86_64) |
| 35 #define X86 | 36 #define X86 |
| 36 #endif /* _M_IX86 || __i386__ || __i386 || _M_AMD64 || __x86_64__ || __x86_64 */ | 37 #endif /* _M_IX86 || __i386__ || __i386 || _M_AMD64 || __x86_64__ || __x86_64 */ |
| 37 | 38 |
| 38 // Build a White point, primary chromas transfer matrix from RGB to CIE XYZ | 39 // Build a White point, primary chromas transfer matrix from RGB to CIE XYZ |
| 39 // This is just an approximation, I am not handling all the non-linear | 40 // This is just an approximation, I am not handling all the non-linear |
| (...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1543 | 1544 |
| 1544 for (i = 0; i < size; ++i) { | 1545 for (i = 0; i < size; ++i) { |
| 1545 *data++ = float_to_half_float(t->output_gamma_lut_r[i] * inverse
65535); // r | 1546 *data++ = float_to_half_float(t->output_gamma_lut_r[i] * inverse
65535); // r |
| 1546 *data++ = float_to_half_float(t->output_gamma_lut_g[i] * inverse
65535); // g | 1547 *data++ = float_to_half_float(t->output_gamma_lut_g[i] * inverse
65535); // g |
| 1547 *data++ = float_to_half_float(t->output_gamma_lut_b[i] * inverse
65535); // b | 1548 *data++ = float_to_half_float(t->output_gamma_lut_b[i] * inverse
65535); // b |
| 1548 *data++ = half_float_one;
// a | 1549 *data++ = half_float_one;
// a |
| 1549 } | 1550 } |
| 1550 | 1551 |
| 1551 return size; | 1552 return size; |
| 1552 } | 1553 } |
| OLD | NEW |