@revizly/sharp-libvips-dev 1.0.53 → 1.0.55

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.
Files changed (41) hide show
  1. package/README.md +2 -0
  2. package/include/archive.h +6 -4
  3. package/include/archive_entry.h +1 -1
  4. package/include/brotli/decode.h +409 -0
  5. package/include/brotli/encode.h +505 -0
  6. package/include/brotli/port.h +302 -0
  7. package/include/brotli/shared_dictionary.h +100 -0
  8. package/include/brotli/types.h +83 -0
  9. package/include/freetype2/freetype/config/ftmodule.h +1 -0
  10. package/include/freetype2/freetype/config/ftoption.h +36 -2
  11. package/include/freetype2/freetype/freetype.h +8 -7
  12. package/include/freetype2/freetype/ftimage.h +2 -2
  13. package/include/freetype2/freetype/ftmoderr.h +1 -0
  14. package/include/freetype2/freetype/fttypes.h +0 -2
  15. package/include/freetype2/freetype/tttags.h +12 -0
  16. package/include/jxl/cms.h +24 -0
  17. package/include/jxl/cms_interface.h +255 -0
  18. package/include/jxl/codestream_header.h +433 -0
  19. package/include/jxl/color_encoding.h +161 -0
  20. package/include/jxl/compressed_icc.h +75 -0
  21. package/include/jxl/decode.h +1475 -0
  22. package/include/jxl/decode_cxx.h +58 -0
  23. package/include/jxl/encode.h +1629 -0
  24. package/include/jxl/encode_cxx.h +58 -0
  25. package/include/jxl/gain_map.h +129 -0
  26. package/include/jxl/jxl_cms_export.h +42 -0
  27. package/include/jxl/jxl_export.h +42 -0
  28. package/include/jxl/jxl_threads_export.h +42 -0
  29. package/include/jxl/memory_manager.h +73 -0
  30. package/include/jxl/parallel_runner.h +164 -0
  31. package/include/jxl/resizable_parallel_runner.h +77 -0
  32. package/include/jxl/resizable_parallel_runner_cxx.h +65 -0
  33. package/include/jxl/stats.h +103 -0
  34. package/include/jxl/thread_parallel_runner.h +71 -0
  35. package/include/jxl/thread_parallel_runner_cxx.h +66 -0
  36. package/include/jxl/types.h +154 -0
  37. package/include/jxl/version.h +44 -0
  38. package/include/librsvg-2.0/librsvg/rsvg-version.h +2 -2
  39. package/include/vips/version.h +1 -1
  40. package/package.json +1 -1
  41. package/versions.json +6 -4
@@ -0,0 +1,433 @@
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 codestream_header.h
10
+ * @brief Definitions of structs and enums for the metadata from the JPEG XL
11
+ * codestream headers (signature, metadata, preview dimensions, ...), excluding
12
+ * color encoding which is in color_encoding.h.
13
+ */
14
+
15
+ #ifndef JXL_CODESTREAM_HEADER_H_
16
+ #define JXL_CODESTREAM_HEADER_H_
17
+
18
+ #include <jxl/types.h>
19
+ #include <stddef.h>
20
+ #include <stdint.h>
21
+
22
+ #ifdef __cplusplus
23
+ extern "C" {
24
+ #endif
25
+
26
+ /** Image orientation metadata.
27
+ * Values 1..8 match the EXIF definitions.
28
+ * The name indicates the operation to perform to transform from the encoded
29
+ * image to the display image.
30
+ */
31
+ typedef enum {
32
+ JXL_ORIENT_IDENTITY = 1,
33
+ JXL_ORIENT_FLIP_HORIZONTAL = 2,
34
+ JXL_ORIENT_ROTATE_180 = 3,
35
+ JXL_ORIENT_FLIP_VERTICAL = 4,
36
+ JXL_ORIENT_TRANSPOSE = 5,
37
+ JXL_ORIENT_ROTATE_90_CW = 6,
38
+ JXL_ORIENT_ANTI_TRANSPOSE = 7,
39
+ JXL_ORIENT_ROTATE_90_CCW = 8,
40
+ } JxlOrientation;
41
+
42
+ /** Given type of an extra channel.
43
+ */
44
+ typedef enum {
45
+ JXL_CHANNEL_ALPHA,
46
+ JXL_CHANNEL_DEPTH,
47
+ JXL_CHANNEL_SPOT_COLOR,
48
+ JXL_CHANNEL_SELECTION_MASK,
49
+ JXL_CHANNEL_BLACK,
50
+ JXL_CHANNEL_CFA,
51
+ JXL_CHANNEL_THERMAL,
52
+ JXL_CHANNEL_RESERVED0,
53
+ JXL_CHANNEL_RESERVED1,
54
+ JXL_CHANNEL_RESERVED2,
55
+ JXL_CHANNEL_RESERVED3,
56
+ JXL_CHANNEL_RESERVED4,
57
+ JXL_CHANNEL_RESERVED5,
58
+ JXL_CHANNEL_RESERVED6,
59
+ JXL_CHANNEL_RESERVED7,
60
+ JXL_CHANNEL_UNKNOWN,
61
+ JXL_CHANNEL_OPTIONAL
62
+ } JxlExtraChannelType;
63
+
64
+ /** The codestream preview header */
65
+ typedef struct {
66
+ /** Preview width in pixels */
67
+ uint32_t xsize;
68
+
69
+ /** Preview height in pixels */
70
+ uint32_t ysize;
71
+ } JxlPreviewHeader;
72
+
73
+ /** The codestream animation header, optionally present in the beginning of
74
+ * the codestream, and if it is it applies to all animation frames, unlike @ref
75
+ * JxlFrameHeader which applies to an individual frame.
76
+ */
77
+ typedef struct {
78
+ /** Numerator of ticks per second of a single animation frame time unit */
79
+ uint32_t tps_numerator;
80
+
81
+ /** Denominator of ticks per second of a single animation frame time unit */
82
+ uint32_t tps_denominator;
83
+
84
+ /** Amount of animation loops, or 0 to repeat infinitely */
85
+ uint32_t num_loops;
86
+
87
+ /** Whether animation time codes are present at animation frames in the
88
+ * codestream */
89
+ JXL_BOOL have_timecodes;
90
+ } JxlAnimationHeader;
91
+
92
+ /** Basic image information. This information is available from the file
93
+ * signature and first part of the codestream header.
94
+ */
95
+ typedef struct {
96
+ /* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
97
+ * fields orientation must be read from Exif APP1. For has_icc_profile: must
98
+ * look up where ICC profile is guaranteed to be in a JPEG file to be able to
99
+ * indicate this. */
100
+
101
+ /* TODO(lode): make struct packed, and/or make this opaque struct with getter
102
+ * functions (still separate struct from opaque decoder) */
103
+
104
+ /** Whether the codestream is embedded in the container format. If true,
105
+ * metadata information and extensions may be available in addition to the
106
+ * codestream.
107
+ */
108
+ JXL_BOOL have_container;
109
+
110
+ /** Width of the image in pixels, before applying orientation.
111
+ */
112
+ uint32_t xsize;
113
+
114
+ /** Height of the image in pixels, before applying orientation.
115
+ */
116
+ uint32_t ysize;
117
+
118
+ /** Original image color channel bit depth.
119
+ */
120
+ uint32_t bits_per_sample;
121
+
122
+ /** Original image color channel floating point exponent bits, or 0 if they
123
+ * are unsigned integer. For example, if the original data is half-precision
124
+ * (binary16) floating point, bits_per_sample is 16 and
125
+ * exponent_bits_per_sample is 5, and so on for other floating point
126
+ * precisions.
127
+ */
128
+ uint32_t exponent_bits_per_sample;
129
+
130
+ /** Upper bound on the intensity level present in the image in nits. For
131
+ * unsigned integer pixel encodings, this is the brightness of the largest
132
+ * representable value. The image does not necessarily contain a pixel
133
+ * actually this bright. An encoder is allowed to set 255 for SDR images
134
+ * without computing a histogram.
135
+ * Leaving this set to its default of 0 lets libjxl choose a sensible default
136
+ * value based on the color encoding.
137
+ */
138
+ float intensity_target;
139
+
140
+ /** Lower bound on the intensity level present in the image. This may be
141
+ * loose, i.e. lower than the actual darkest pixel. When tone mapping, a
142
+ * decoder will map [min_nits, intensity_target] to the display range.
143
+ */
144
+ float min_nits;
145
+
146
+ /** See the description of @see linear_below.
147
+ */
148
+ JXL_BOOL relative_to_max_display;
149
+
150
+ /** The tone mapping will leave unchanged (linear mapping) any pixels whose
151
+ * brightness is strictly below this. The interpretation depends on
152
+ * relative_to_max_display. If true, this is a ratio [0, 1] of the maximum
153
+ * display brightness [nits], otherwise an absolute brightness [nits].
154
+ */
155
+ float linear_below;
156
+
157
+ /** Whether the data in the codestream is encoded in the original color
158
+ * profile that is attached to the codestream metadata header, or is
159
+ * encoded in an internally supported absolute color space (which the decoder
160
+ * can always convert to linear or non-linear sRGB or to XYB). If the original
161
+ * profile is used, the decoder outputs pixel data in the color space matching
162
+ * that profile, but doesn't convert it to any other color space. If the
163
+ * original profile is not used, the decoder only outputs the data as sRGB
164
+ * (linear if outputting to floating point, nonlinear with standard sRGB
165
+ * transfer function if outputting to unsigned integers) but will not convert
166
+ * it to the original color profile. The decoder also does not convert to
167
+ * the target display color profile. To convert the pixel data produced by
168
+ * the decoder to the original color profile, one of the JxlDecoderGetColor*
169
+ * functions needs to be called with
170
+ * ::JXL_COLOR_PROFILE_TARGET_DATA to get the color profile of the decoder
171
+ * output, and then an external CMS can be used for conversion. Note that for
172
+ * lossy compression, this should be set to false for most use cases, and if
173
+ * needed, the image should be converted to the original color profile after
174
+ * decoding, as described above.
175
+ */
176
+ JXL_BOOL uses_original_profile;
177
+
178
+ /** Indicates a preview image exists near the beginning of the codestream.
179
+ * The preview itself or its dimensions are not included in the basic info.
180
+ */
181
+ JXL_BOOL have_preview;
182
+
183
+ /** Indicates animation frames exist in the codestream. The animation
184
+ * information is not included in the basic info.
185
+ */
186
+ JXL_BOOL have_animation;
187
+
188
+ /** Image orientation, value 1-8 matching the values used by JEITA CP-3451C
189
+ * (Exif version 2.3).
190
+ */
191
+ JxlOrientation orientation;
192
+
193
+ /** Number of color channels encoded in the image, this is either 1 for
194
+ * grayscale data, or 3 for colored data. This count does not include
195
+ * the alpha channel or other extra channels. To check presence of an alpha
196
+ * channel, such as in the case of RGBA color, check alpha_bits != 0.
197
+ * If and only if this is 1, the @ref JxlColorSpace in the @ref
198
+ * JxlColorEncoding is
199
+ * ::JXL_COLOR_SPACE_GRAY.
200
+ */
201
+ uint32_t num_color_channels;
202
+
203
+ /** Number of additional image channels. This includes the main alpha channel,
204
+ * but can also include additional channels such as depth, additional alpha
205
+ * channels, spot colors, and so on. Information about the extra channels
206
+ * can be queried with @ref JxlDecoderGetExtraChannelInfo. The main alpha
207
+ * channel, if it exists, also has its information available in the
208
+ * alpha_bits, alpha_exponent_bits and alpha_premultiplied fields in this @ref
209
+ * JxlBasicInfo.
210
+ */
211
+ uint32_t num_extra_channels;
212
+
213
+ /** Bit depth of the encoded alpha channel, or 0 if there is no alpha channel.
214
+ * If present, matches the alpha_bits value of the JxlExtraChannelInfo
215
+ * associated with this alpha channel.
216
+ */
217
+ uint32_t alpha_bits;
218
+
219
+ /** Alpha channel floating point exponent bits, or 0 if they are unsigned. If
220
+ * present, matches the alpha_bits value of the JxlExtraChannelInfo associated
221
+ * with this alpha channel. integer.
222
+ */
223
+ uint32_t alpha_exponent_bits;
224
+
225
+ /** Whether the alpha channel is premultiplied. Only used if there is a main
226
+ * alpha channel. Matches the alpha_premultiplied value of the
227
+ * JxlExtraChannelInfo associated with this alpha channel.
228
+ */
229
+ JXL_BOOL alpha_premultiplied;
230
+
231
+ /** Dimensions of encoded preview image, only used if have_preview is
232
+ * JXL_TRUE.
233
+ */
234
+ JxlPreviewHeader preview;
235
+
236
+ /** Animation header with global animation properties for all frames, only
237
+ * used if have_animation is JXL_TRUE.
238
+ */
239
+ JxlAnimationHeader animation;
240
+
241
+ /** Intrinsic width of the image.
242
+ * The intrinsic size can be different from the actual size in pixels
243
+ * (as given by xsize and ysize) and it denotes the recommended dimensions
244
+ * for displaying the image, i.e. applications are advised to resample the
245
+ * decoded image to the intrinsic dimensions.
246
+ */
247
+ uint32_t intrinsic_xsize;
248
+
249
+ /** Intrinsic height of the image.
250
+ * The intrinsic size can be different from the actual size in pixels
251
+ * (as given by xsize and ysize) and it denotes the recommended dimensions
252
+ * for displaying the image, i.e. applications are advised to resample the
253
+ * decoded image to the intrinsic dimensions.
254
+ */
255
+ uint32_t intrinsic_ysize;
256
+
257
+ /** Padding for forwards-compatibility, in case more fields are exposed
258
+ * in a future version of the library.
259
+ */
260
+ uint8_t padding[100];
261
+ } JxlBasicInfo;
262
+
263
+ /** Information for a single extra channel.
264
+ */
265
+ typedef struct {
266
+ /** Given type of an extra channel.
267
+ */
268
+ JxlExtraChannelType type;
269
+
270
+ /** Total bits per sample for this channel.
271
+ */
272
+ uint32_t bits_per_sample;
273
+
274
+ /** Floating point exponent bits per channel, or 0 if they are unsigned
275
+ * integer.
276
+ */
277
+ uint32_t exponent_bits_per_sample;
278
+
279
+ /** The exponent the channel is downsampled by on each axis.
280
+ * TODO(lode): expand this comment to match the JPEG XL specification,
281
+ * specify how to upscale, how to round the size computation, and to which
282
+ * extra channels this field applies.
283
+ */
284
+ uint32_t dim_shift;
285
+
286
+ /** Length of the extra channel name in bytes, or 0 if no name.
287
+ * Excludes null termination character.
288
+ */
289
+ uint32_t name_length;
290
+
291
+ /** Whether alpha channel uses premultiplied alpha. Only applicable if
292
+ * type is JXL_CHANNEL_ALPHA.
293
+ */
294
+ JXL_BOOL alpha_premultiplied;
295
+
296
+ /** Spot color of the current spot channel in linear RGBA. Only applicable if
297
+ * type is JXL_CHANNEL_SPOT_COLOR.
298
+ */
299
+ float spot_color[4];
300
+
301
+ /** Only applicable if type is JXL_CHANNEL_CFA.
302
+ * TODO(lode): add comment about the meaning of this field.
303
+ */
304
+ uint32_t cfa_channel;
305
+ } JxlExtraChannelInfo;
306
+
307
+ /* TODO(lode): add API to get the codestream header extensions. */
308
+ /** Extensions in the codestream header. */
309
+ typedef struct {
310
+ /** Extension bits. */
311
+ uint64_t extensions;
312
+ } JxlHeaderExtensions;
313
+
314
+ /** Frame blend modes.
315
+ * When decoding, if coalescing is enabled (default), this can be ignored.
316
+ */
317
+ typedef enum {
318
+ JXL_BLEND_REPLACE = 0,
319
+ JXL_BLEND_ADD = 1,
320
+ JXL_BLEND_BLEND = 2,
321
+ JXL_BLEND_MULADD = 3,
322
+ JXL_BLEND_MUL = 4,
323
+ } JxlBlendMode;
324
+
325
+ /** The information about blending the color channels or a single extra channel.
326
+ * When decoding, if coalescing is enabled (default), this can be ignored and
327
+ * the blend mode is considered to be JXL_BLEND_REPLACE.
328
+ * When encoding, these settings apply to the pixel data given to the encoder.
329
+ */
330
+ typedef struct {
331
+ /** Blend mode.
332
+ */
333
+ JxlBlendMode blendmode;
334
+ /** Reference frame ID to use as the 'bottom' layer (0-3).
335
+ */
336
+ uint32_t source;
337
+ /** Which extra channel to use as the 'alpha' channel for blend modes
338
+ * JXL_BLEND_BLEND and JXL_BLEND_MULADD.
339
+ */
340
+ uint32_t alpha;
341
+ /** Clamp values to [0,1] for the purpose of blending.
342
+ */
343
+ JXL_BOOL clamp;
344
+ } JxlBlendInfo;
345
+
346
+ /** The information about layers.
347
+ * When decoding, if coalescing is enabled (default), this can be ignored.
348
+ * When encoding, these settings apply to the pixel data given to the encoder,
349
+ * the encoder could choose an internal representation that differs.
350
+ */
351
+ typedef struct {
352
+ /** Whether cropping is applied for this frame. When decoding, if false,
353
+ * crop_x0 and crop_y0 are set to zero, and xsize and ysize to the main
354
+ * image dimensions. When encoding and this is false, those fields are
355
+ * ignored. When decoding, if coalescing is enabled (default), this is always
356
+ * false, regardless of the internal encoding in the JPEG XL codestream.
357
+ */
358
+ JXL_BOOL have_crop;
359
+
360
+ /** Horizontal offset of the frame (can be negative).
361
+ */
362
+ int32_t crop_x0;
363
+
364
+ /** Vertical offset of the frame (can be negative).
365
+ */
366
+ int32_t crop_y0;
367
+
368
+ /** Width of the frame (number of columns).
369
+ */
370
+ uint32_t xsize;
371
+
372
+ /** Height of the frame (number of rows).
373
+ */
374
+ uint32_t ysize;
375
+
376
+ /** The blending info for the color channels. Blending info for extra channels
377
+ * has to be retrieved separately using JxlDecoderGetExtraChannelBlendInfo.
378
+ */
379
+ JxlBlendInfo blend_info;
380
+
381
+ /** After blending, save the frame as reference frame with this ID (0-3).
382
+ * Special case: if the frame duration is nonzero, ID 0 means "will not be
383
+ * referenced in the future". This value is not used for the last frame.
384
+ * When encoding, ID 3 is reserved to frames that are generated internally by
385
+ * the encoder, and should not be used by applications.
386
+ */
387
+ uint32_t save_as_reference;
388
+ } JxlLayerInfo;
389
+
390
+ /** The header of one displayed frame or non-coalesced layer. */
391
+ typedef struct {
392
+ /** How long to wait after rendering in ticks. The duration in seconds of a
393
+ * tick is given by tps_numerator and tps_denominator in @ref
394
+ * JxlAnimationHeader.
395
+ */
396
+ uint32_t duration;
397
+
398
+ /** SMPTE timecode of the current frame in form 0xHHMMSSFF, or 0. The bits are
399
+ * interpreted from most-significant to least-significant as hour, minute,
400
+ * second, and frame. If timecode is nonzero, it is strictly larger than that
401
+ * of a previous frame with nonzero duration. These values are only available
402
+ * if have_timecodes in @ref JxlAnimationHeader is ::JXL_TRUE.
403
+ * This value is only used if have_timecodes in @ref JxlAnimationHeader is
404
+ * ::JXL_TRUE.
405
+ */
406
+ uint32_t timecode;
407
+
408
+ /** Length of the frame name in bytes, or 0 if no name.
409
+ * Excludes null termination character. This value is set by the decoder.
410
+ * For the encoder, this value is ignored and @ref JxlEncoderSetFrameName is
411
+ * used instead to set the name and the length.
412
+ */
413
+ uint32_t name_length;
414
+
415
+ /** Indicates this is the last animation frame. This value is set by the
416
+ * decoder to indicate no further frames follow. For the encoder, it is not
417
+ * required to set this value and it is ignored, @ref JxlEncoderCloseFrames is
418
+ * used to indicate the last frame to the encoder instead.
419
+ */
420
+ JXL_BOOL is_last;
421
+
422
+ /** Information about the layer in case of no coalescing.
423
+ */
424
+ JxlLayerInfo layer_info;
425
+ } JxlFrameHeader;
426
+
427
+ #ifdef __cplusplus
428
+ }
429
+ #endif
430
+
431
+ #endif /* JXL_CODESTREAM_HEADER_H_ */
432
+
433
+ /** @}*/
@@ -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
+ /** @} */