10 /* if we've already got an ICC_H header we can ignore the following */
14 /*****************************************************************
15 Copyright (c) 1994-1996 SunSoft, Inc.
19 Permission is hereby granted, free of charge, to any person
20 obtaining a copy of this software and associated documentation
21 files (the "Software"), to deal in the Software without restrict-
22 ion, including without limitation the rights to use, copy, modify,
23 merge, publish distribute, sublicense, and/or sell copies of the
24 Software, and to permit persons to whom the Software is furnished
25 to do so, subject to the following conditions:
27 The above copyright notice and this permission notice shall be
28 included in all copies or substantial portions of the Software.
30 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
32 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
33 INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT
34 COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
35 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
37 OTHER DEALINGS IN THE SOFTWARE.
39 Except as contained in this notice, the name of SunSoft, Inc.
40 shall not be used in advertising or otherwise to promote the
41 sale, use or other dealings in this Software without written
42 authorization from SunSoft Inc.
43 ******************************************************************/
46 * QCMS, in general, is not threadsafe. However, it should be safe to create
47 * profile and transformation objects on different threads, so long as you
48 * don't use the same objects on different threads at the same time.
52 * Color Space Signatures
53 * Note that only icSigXYZData and icSigLabData are valid
54 * Profile Connection Spaces (PCSs)
57 icSigXYZData
= 0x58595A20L
, /* 'XYZ ' */
58 icSigLabData
= 0x4C616220L
, /* 'Lab ' */
59 icSigLuvData
= 0x4C757620L
, /* 'Luv ' */
60 icSigYCbCrData
= 0x59436272L
, /* 'YCbr' */
61 icSigYxyData
= 0x59787920L
, /* 'Yxy ' */
62 icSigRgbData
= 0x52474220L
, /* 'RGB ' */
63 icSigGrayData
= 0x47524159L
, /* 'GRAY' */
64 icSigHsvData
= 0x48535620L
, /* 'HSV ' */
65 icSigHlsData
= 0x484C5320L
, /* 'HLS ' */
66 icSigCmykData
= 0x434D594BL
, /* 'CMYK' */
67 icSigCmyData
= 0x434D5920L
, /* 'CMY ' */
68 icSig2colorData
= 0x32434C52L
, /* '2CLR' */
69 icSig3colorData
= 0x33434C52L
, /* '3CLR' */
70 icSig4colorData
= 0x34434C52L
, /* '4CLR' */
71 icSig5colorData
= 0x35434C52L
, /* '5CLR' */
72 icSig6colorData
= 0x36434C52L
, /* '6CLR' */
73 icSig7colorData
= 0x37434C52L
, /* '7CLR' */
74 icSig8colorData
= 0x38434C52L
, /* '8CLR' */
75 icSig9colorData
= 0x39434C52L
, /* '9CLR' */
76 icSig10colorData
= 0x41434C52L
, /* 'ACLR' */
77 icSig11colorData
= 0x42434C52L
, /* 'BCLR' */
78 icSig12colorData
= 0x43434C52L
, /* 'CCLR' */
79 icSig13colorData
= 0x44434C52L
, /* 'DCLR' */
80 icSig14colorData
= 0x45434C52L
, /* 'ECLR' */
81 icSig15colorData
= 0x46434C52L
, /* 'FCLR' */
82 icMaxEnumData
= 0xFFFFFFFFL
83 } icColorSpaceSignature
;
90 struct _qcms_transform
;
91 typedef struct _qcms_transform qcms_transform
;
94 typedef struct _qcms_profile qcms_profile
;
96 /* these values match the Rendering Intent values from the ICC spec */
99 QCMS_INTENT_PERCEPTUAL
= 0,
100 QCMS_INTENT_RELATIVE_COLORIMETRIC
= 1,
101 QCMS_INTENT_SATURATION
= 2,
102 QCMS_INTENT_ABSOLUTE_COLORIMETRIC
= 3,
105 /* Chris Murphy (CM consultant) suggests this as a default in the event that we
106 * cannot reproduce relative + Black Point Compensation. BPC brings an
107 * unacceptable performance overhead, so we go with perceptual. */
108 QCMS_INTENT_DEFAULT
= QCMS_INTENT_PERCEPTUAL
,
111 //XXX: I don't really like the _DATA_ prefix
121 /* the names for the following two types are sort of ugly */
134 } qcms_CIE_xyYTRIPLE
;
136 qcms_profile
* qcms_profile_create_rgb_with_gamma_set(
137 qcms_CIE_xyY white_point
,
138 qcms_CIE_xyYTRIPLE primaries
,
143 qcms_profile
* qcms_profile_create_rgb_with_gamma(
144 qcms_CIE_xyY white_point
,
145 qcms_CIE_xyYTRIPLE primaries
,
148 void qcms_data_create_rgb_with_gamma(
149 qcms_CIE_xyY white_point
,
150 qcms_CIE_xyYTRIPLE primaries
,
155 /* The arguments are standardized Coding-independent Code Points
156 * See [Rec. ITU-T H.273 (12/2016)](https://www.itu.int/rec/T-REC-H.273-201612-I/en)
158 * Don't use enums here because they can't go safely across FFI. */
159 qcms_profile
* qcms_profile_create_cicp(uint8_t colour_primaries
,
160 uint8_t transfer_characteristics
);
162 qcms_profile
* qcms_profile_from_memory(const void *mem
, size_t size
);
163 qcms_profile
* qcms_profile_from_memory_curves_only(const void *mem
, size_t size
);
165 qcms_profile
* qcms_profile_from_file(FILE *file
);
166 qcms_profile
* qcms_profile_from_path(const char *path
);
168 void qcms_data_from_path(const char *path
, void **mem
, size_t *size
);
171 qcms_profile
* qcms_profile_from_unicode_path(const wchar_t *path
);
172 void qcms_data_from_unicode_path(const wchar_t *path
, void **mem
, size_t *size
);
175 qcms_CIE_xyY
qcms_white_point_sRGB(void);
176 qcms_profile
* qcms_profile_sRGB(void);
177 qcms_profile
* qcms_profile_displayP3(void);
179 void qcms_profile_release(qcms_profile
*profile
);
181 bool qcms_profile_is_bogus(qcms_profile
*profile
);
182 qcms_intent
qcms_profile_get_rendering_intent(qcms_profile
*profile
);
183 icColorSpaceSignature
qcms_profile_get_color_space(qcms_profile
*profile
);
184 bool qcms_profile_is_sRGB(qcms_profile
*profile
);
186 void qcms_profile_precache_output_transform(qcms_profile
*profile
);
188 qcms_transform
* qcms_transform_create(
189 qcms_profile
*in
, qcms_data_type in_type
,
190 qcms_profile
* out
, qcms_data_type out_type
,
193 void qcms_transform_release(qcms_transform
*);
195 void qcms_transform_data(qcms_transform
*transform
, const void *src
, void *dest
, size_t length
);
197 void qcms_enable_iccv4();
198 void qcms_enable_neon();
199 void qcms_enable_avx();
212 struct qcms_profile_data
{
214 uint32_t color_space
;
216 qcms_intent rendering_intent
;
217 float red_colorant_xyzd50
[3];
218 float blue_colorant_xyzd50
[3];
219 float green_colorant_xyzd50
[3];
220 int32_t linear_from_trc_red_samples
;
221 int32_t linear_from_trc_blue_samples
;
222 int32_t linear_from_trc_green_samples
;
225 void qcms_profile_get_data(const qcms_profile
*, qcms_profile_data
* out_data
);
228 enum class qcms_color_channel
: uint8_t {
234 void qcms_profile_get_lut(const qcms_profile
*, qcms_color_channel
,
235 float* begin
, float* end
);