@revizly/sharp-libvips-dev 1.0.53 → 1.0.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,161 @@
1
+ /* Copyright (c) the JPEG XL Project Authors. All rights reserved.
2
+ *
3
+ * Use of this source code is governed by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ /** @addtogroup libjxl_color
8
+ * @{
9
+ * @file color_encoding.h
10
+ * @brief Color Encoding definitions used by JPEG XL.
11
+ * All CIE units are for the standard 1931 2 degree observer.
12
+ */
13
+
14
+ #ifndef JXL_COLOR_ENCODING_H_
15
+ #define JXL_COLOR_ENCODING_H_
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ /** Color space of the image data. */
22
+ typedef enum {
23
+ /** Tristimulus RGB */
24
+ JXL_COLOR_SPACE_RGB,
25
+ /** Luminance based, the primaries in @ref JxlColorEncoding must be ignored.
26
+ * This value implies that num_color_channels in @ref JxlBasicInfo is 1, any
27
+ * other value implies num_color_channels is 3. */
28
+ JXL_COLOR_SPACE_GRAY,
29
+ /** XYB (opsin) color space */
30
+ JXL_COLOR_SPACE_XYB,
31
+ /** None of the other table entries describe the color space appropriately */
32
+ JXL_COLOR_SPACE_UNKNOWN,
33
+ } JxlColorSpace;
34
+
35
+ /** Built-in white points for color encoding. When decoding, the numerical xy
36
+ * white point value can be read from the @ref JxlColorEncoding white_point
37
+ * field regardless of the enum value. When encoding, enum values except
38
+ * ::JXL_WHITE_POINT_CUSTOM override the numerical fields. Some enum values
39
+ * match a subset of CICP (Rec. ITU-T H.273 | ISO/IEC 23091-2:2019(E)), however
40
+ * the white point and RGB primaries are separate enums here.
41
+ */
42
+ typedef enum {
43
+ /** CIE Standard Illuminant D65: 0.3127, 0.3290 */
44
+ JXL_WHITE_POINT_D65 = 1,
45
+ /** White point must be read from the @ref JxlColorEncoding white_point field,
46
+ * or as ICC profile. This enum value is not an exact match of the
47
+ * corresponding CICP value. */
48
+ JXL_WHITE_POINT_CUSTOM = 2,
49
+ /** CIE Standard Illuminant E (equal-energy): 1/3, 1/3 */
50
+ JXL_WHITE_POINT_E = 10,
51
+ /** DCI-P3 from SMPTE RP 431-2: 0.314, 0.351 */
52
+ JXL_WHITE_POINT_DCI = 11,
53
+ } JxlWhitePoint;
54
+
55
+ /** Built-in primaries for color encoding. When decoding, the primaries can be
56
+ * read from the @ref JxlColorEncoding primaries_red_xy, primaries_green_xy and
57
+ * primaries_blue_xy fields regardless of the enum value. When encoding, the
58
+ * enum values except ::JXL_PRIMARIES_CUSTOM override the numerical fields.
59
+ * Some enum values match a subset of CICP (Rec. ITU-T H.273 | ISO/IEC
60
+ * 23091-2:2019(E)), however the white point and RGB primaries are separate
61
+ * enums here.
62
+ */
63
+ typedef enum {
64
+ /** The CIE xy values of the red, green and blue primaries are: 0.639998686,
65
+ 0.330010138; 0.300003784, 0.600003357; 0.150002046, 0.059997204 */
66
+ JXL_PRIMARIES_SRGB = 1,
67
+ /** Primaries must be read from the @ref JxlColorEncoding primaries_red_xy,
68
+ * primaries_green_xy and primaries_blue_xy fields, or as ICC profile. This
69
+ * enum value is not an exact match of the corresponding CICP value. */
70
+ JXL_PRIMARIES_CUSTOM = 2,
71
+ /** As specified in Rec. ITU-R BT.2100-1 */
72
+ JXL_PRIMARIES_2100 = 9,
73
+ /** As specified in SMPTE RP 431-2 */
74
+ JXL_PRIMARIES_P3 = 11,
75
+ } JxlPrimaries;
76
+
77
+ /** Built-in transfer functions for color encoding. Enum values match a subset
78
+ * of CICP (Rec. ITU-T H.273 | ISO/IEC 23091-2:2019(E)) unless specified
79
+ * otherwise. */
80
+ typedef enum {
81
+ /** As specified in ITU-R BT.709-6 */
82
+ JXL_TRANSFER_FUNCTION_709 = 1,
83
+ /** None of the other table entries describe the transfer function. */
84
+ JXL_TRANSFER_FUNCTION_UNKNOWN = 2,
85
+ /** The gamma exponent is 1 */
86
+ JXL_TRANSFER_FUNCTION_LINEAR = 8,
87
+ /** As specified in IEC 61966-2-1 sRGB */
88
+ JXL_TRANSFER_FUNCTION_SRGB = 13,
89
+ /** As specified in SMPTE ST 2084 */
90
+ JXL_TRANSFER_FUNCTION_PQ = 16,
91
+ /** As specified in SMPTE ST 428-1 */
92
+ JXL_TRANSFER_FUNCTION_DCI = 17,
93
+ /** As specified in Rec. ITU-R BT.2100-1 (HLG) */
94
+ JXL_TRANSFER_FUNCTION_HLG = 18,
95
+ /** Transfer function follows power law given by the gamma value in @ref
96
+ JxlColorEncoding. Not a CICP value. */
97
+ JXL_TRANSFER_FUNCTION_GAMMA = 65535,
98
+ } JxlTransferFunction;
99
+
100
+ /** Rendering intent for color encoding, as specified in ISO 15076-1:2010 */
101
+ typedef enum {
102
+ /** vendor-specific */
103
+ JXL_RENDERING_INTENT_PERCEPTUAL = 0,
104
+ /** media-relative */
105
+ JXL_RENDERING_INTENT_RELATIVE,
106
+ /** vendor-specific */
107
+ JXL_RENDERING_INTENT_SATURATION,
108
+ /** ICC-absolute */
109
+ JXL_RENDERING_INTENT_ABSOLUTE,
110
+ } JxlRenderingIntent;
111
+
112
+ /** Color encoding of the image as structured information.
113
+ */
114
+ typedef struct {
115
+ /** Color space of the image data.
116
+ */
117
+ JxlColorSpace color_space;
118
+
119
+ /** Built-in white point. If this value is ::JXL_WHITE_POINT_CUSTOM, must
120
+ * use the numerical white point values from white_point_xy.
121
+ */
122
+ JxlWhitePoint white_point;
123
+
124
+ /** Numerical whitepoint values in CIE xy space. */
125
+ double white_point_xy[2];
126
+
127
+ /** Built-in RGB primaries. If this value is ::JXL_PRIMARIES_CUSTOM, must
128
+ * use the numerical primaries values below. This field and the custom values
129
+ * below are unused and must be ignored if the color space is
130
+ * ::JXL_COLOR_SPACE_GRAY or ::JXL_COLOR_SPACE_XYB.
131
+ */
132
+ JxlPrimaries primaries;
133
+
134
+ /** Numerical red primary values in CIE xy space. */
135
+ double primaries_red_xy[2];
136
+
137
+ /** Numerical green primary values in CIE xy space. */
138
+ double primaries_green_xy[2];
139
+
140
+ /** Numerical blue primary values in CIE xy space. */
141
+ double primaries_blue_xy[2];
142
+
143
+ /** Transfer function if have_gamma is 0 */
144
+ JxlTransferFunction transfer_function;
145
+
146
+ /** Gamma value used when transfer_function is @ref
147
+ * JXL_TRANSFER_FUNCTION_GAMMA
148
+ */
149
+ double gamma;
150
+
151
+ /** Rendering intent defined for the color profile. */
152
+ JxlRenderingIntent rendering_intent;
153
+ } JxlColorEncoding;
154
+
155
+ #ifdef __cplusplus
156
+ }
157
+ #endif
158
+
159
+ #endif /* JXL_COLOR_ENCODING_H_ */
160
+
161
+ /** @}*/
@@ -0,0 +1,75 @@
1
+ /* Copyright (c) the JPEG XL Project Authors. All rights reserved.
2
+ *
3
+ * Use of this source code is governed by a BSD-style
4
+ * license that can be found in the LICENSE file.
5
+ */
6
+
7
+ /** @addtogroup libjxl_metadata
8
+ * @{
9
+ * @file compressed_icc.h
10
+ * @brief Utility functions to compress and decompress ICC streams.
11
+ */
12
+
13
+ #ifndef JXL_COMPRESSED_ICC_H_
14
+ #define JXL_COMPRESSED_ICC_H_
15
+
16
+ #include <jxl/jxl_export.h>
17
+ #include <jxl/memory_manager.h>
18
+ #include <jxl/types.h>
19
+
20
+ #ifdef __cplusplus
21
+ extern "C" {
22
+ #endif
23
+
24
+ /**
25
+ * Allocates a buffer using the memory manager, fills it with a compressed
26
+ * representation of an ICC profile, returns the result through @c output_buffer
27
+ * and indicates its size through @c output_size.
28
+ *
29
+ * The result must be freed using the memory manager once it is not of any more
30
+ * use.
31
+ *
32
+ * @param[in] memory_manager Pointer to a JxlMemoryManager.
33
+ * @param[in] icc Pointer to a buffer containing the uncompressed ICC profile.
34
+ * @param[in] icc_size Size of the buffer containing the ICC profile.
35
+ * @param[out] compressed_icc Will be set to a pointer to the buffer containing
36
+ * the result.
37
+ * @param[out] compressed_icc_size Will be set to the size of the buffer
38
+ * containing the result.
39
+ * @return Whether compressing the profile was successful.
40
+ */
41
+ JXL_EXPORT JXL_BOOL JxlICCProfileEncode(const JxlMemoryManager* memory_manager,
42
+ const uint8_t* icc, size_t icc_size,
43
+ uint8_t** compressed_icc,
44
+ size_t* compressed_icc_size);
45
+
46
+ /**
47
+ * Allocates a buffer using the memory manager, fills it with the decompressed
48
+ * version of the ICC profile in @c compressed_icc, returns the result through
49
+ * @c output_buffer and indicates its size through @c output_size.
50
+ *
51
+ * The result must be freed using the memory manager once it is not of any more
52
+ * use.
53
+ *
54
+ * @param[in] memory_manager Pointer to a JxlMemoryManager.
55
+ * @param[in] compressed_icc Pointer to a buffer containing the compressed ICC
56
+ * profile.
57
+ * @param[in] compressed_icc_size Size of the buffer containing the compressed
58
+ * ICC profile.
59
+ * @param[out] icc Will be set to a pointer to the buffer containing the result.
60
+ * @param[out] icc_size Will be set to the size of the buffer containing the
61
+ * result.
62
+ * @return Whether decompressing the profile was successful.
63
+ */
64
+ JXL_EXPORT JXL_BOOL JxlICCProfileDecode(const JxlMemoryManager* memory_manager,
65
+ const uint8_t* compressed_icc,
66
+ size_t compressed_icc_size,
67
+ uint8_t** icc, size_t* icc_size);
68
+
69
+ #ifdef __cplusplus
70
+ }
71
+ #endif
72
+
73
+ #endif /* JXL_COMPRESSED_ICC_H_ */
74
+
75
+ /** @} */