LIBJXL
codestream_header.h
Go to the documentation of this file.
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 
15 #ifndef JXL_CODESTREAM_HEADER_H_
16 #define JXL_CODESTREAM_HEADER_H_
17 
18 #include <stddef.h>
19 #include <stdint.h>
20 
21 #include "jxl/color_encoding.h"
22 #include "jxl/types.h"
23 
24 #if defined(__cplusplus) || defined(c_plusplus)
25 extern "C" {
26 #endif
27 
33 typedef enum {
34  JXL_ORIENT_IDENTITY = 1,
35  JXL_ORIENT_FLIP_HORIZONTAL = 2,
36  JXL_ORIENT_ROTATE_180 = 3,
37  JXL_ORIENT_FLIP_VERTICAL = 4,
38  JXL_ORIENT_TRANSPOSE = 5,
39  JXL_ORIENT_ROTATE_90_CW = 6,
40  JXL_ORIENT_ANTI_TRANSPOSE = 7,
41  JXL_ORIENT_ROTATE_90_CCW = 8,
43 
46 typedef enum {
47  JXL_CHANNEL_ALPHA,
48  JXL_CHANNEL_DEPTH,
49  JXL_CHANNEL_SPOT_COLOR,
50  JXL_CHANNEL_SELECTION_MASK,
51  JXL_CHANNEL_BLACK,
52  JXL_CHANNEL_CFA,
53  JXL_CHANNEL_THERMAL,
54  JXL_CHANNEL_RESERVED0,
55  JXL_CHANNEL_RESERVED1,
56  JXL_CHANNEL_RESERVED2,
57  JXL_CHANNEL_RESERVED3,
58  JXL_CHANNEL_RESERVED4,
59  JXL_CHANNEL_RESERVED5,
60  JXL_CHANNEL_RESERVED6,
61  JXL_CHANNEL_RESERVED7,
62  JXL_CHANNEL_UNKNOWN,
63  JXL_CHANNEL_OPTIONAL
65 
67 typedef struct {
69  uint32_t xsize;
70 
72  uint32_t ysize;
74 
76 typedef struct {
78  uint32_t xsize;
79 
81  uint32_t ysize;
83 
88 typedef struct {
90  uint32_t tps_numerator;
91 
93  uint32_t tps_denominator;
94 
96  uint32_t num_loops;
97 
102 
106 typedef struct {
107  /* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
108  * fields orientation must be read from Exif APP1. For has_icc_profile: must
109  * look up where ICC profile is guaranteed to be in a JPEG file to be able to
110  * indicate this. */
111 
112  /* TODO(lode): make struct packed, and/or make this opaque struct with getter
113  * functions (still separate struct from opaque decoder) */
114 
120 
123  uint32_t xsize;
124 
127  uint32_t ysize;
128 
131  uint32_t bits_per_sample;
132 
140 
150 
155  float min_nits;
156 
160 
167 
188 
193 
198 
203 
212 
221 
226  uint32_t alpha_bits;
227 
233 
239 
244 
249 
256  uint32_t intrinsic_xsize;
257 
264  uint32_t intrinsic_ysize;
265 
269  uint8_t padding[100];
270 } JxlBasicInfo;
271 
274 typedef struct {
278 
281  uint32_t bits_per_sample;
282 
287 
293  uint32_t dim_shift;
294 
298  uint32_t name_length;
299 
304 
308  float spot_color[4];
309 
313  uint32_t cfa_channel;
315 
316 /* TODO(lode): add API to get the codestream header extensions. */
318 typedef struct {
320  uint64_t extensions;
322 
326 typedef enum {
327  JXL_BLEND_REPLACE = 0,
328  JXL_BLEND_ADD = 1,
329  JXL_BLEND_BLEND = 2,
330  JXL_BLEND_MULADD = 3,
331  JXL_BLEND_MUL = 4,
332 } JxlBlendMode;
333 
339 typedef struct {
345  uint32_t source;
349  uint32_t alpha;
353 } JxlBlendInfo;
354 
360 typedef struct {
368 
371  int32_t crop_x0;
372 
375  int32_t crop_y0;
376 
379  uint32_t xsize;
380 
383  uint32_t ysize;
384 
389 
395 } JxlLayerInfo;
396 
398 typedef struct {
402  uint32_t duration;
403 
412  uint32_t timecode;
413 
419  uint32_t name_length;
420 
427 
432 
433 #if defined(__cplusplus) || defined(c_plusplus)
434 }
435 #endif
436 
437 #endif /* JXL_CODESTREAM_HEADER_H_ */
438 
Color Encoding definitions used by JPEG XL. All CIE units are for the standard 1931 2 degree observer...
JxlExtraChannelType
Definition: codestream_header.h:46
#define JXL_BOOL
Definition: types.h:31
JxlBlendMode
Definition: codestream_header.h:326
JxlOrientation
Definition: codestream_header.h:33
Definition: codestream_header.h:88
JXL_BOOL have_timecodes
Definition: codestream_header.h:100
uint32_t tps_denominator
Definition: codestream_header.h:93
uint32_t num_loops
Definition: codestream_header.h:96
uint32_t tps_numerator
Definition: codestream_header.h:90
Definition: codestream_header.h:106
JXL_BOOL uses_original_profile
Definition: codestream_header.h:187
uint32_t alpha_bits
Definition: codestream_header.h:226
uint32_t ysize
Definition: codestream_header.h:127
uint32_t intrinsic_ysize
Definition: codestream_header.h:264
float min_nits
Definition: codestream_header.h:155
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:238
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:159
JXL_BOOL have_animation
Definition: codestream_header.h:197
JxlOrientation orientation
Definition: codestream_header.h:202
uint32_t alpha_exponent_bits
Definition: codestream_header.h:232
uint32_t bits_per_sample
Definition: codestream_header.h:131
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:139
uint32_t num_color_channels
Definition: codestream_header.h:211
uint32_t intrinsic_xsize
Definition: codestream_header.h:256
uint32_t xsize
Definition: codestream_header.h:123
uint32_t num_extra_channels
Definition: codestream_header.h:220
JXL_BOOL have_preview
Definition: codestream_header.h:192
JxlPreviewHeader preview
Definition: codestream_header.h:243
float linear_below
Definition: codestream_header.h:166
JxlAnimationHeader animation
Definition: codestream_header.h:248
JXL_BOOL have_container
Definition: codestream_header.h:119
float intensity_target
Definition: codestream_header.h:149
Definition: codestream_header.h:339
JxlBlendMode blendmode
Definition: codestream_header.h:342
uint32_t source
Definition: codestream_header.h:345
uint32_t alpha
Definition: codestream_header.h:349
JXL_BOOL clamp
Definition: codestream_header.h:352
Definition: codestream_header.h:274
JxlExtraChannelType type
Definition: codestream_header.h:277
uint32_t cfa_channel
Definition: codestream_header.h:313
uint32_t bits_per_sample
Definition: codestream_header.h:281
uint32_t dim_shift
Definition: codestream_header.h:293
uint32_t name_length
Definition: codestream_header.h:298
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:286
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:303
Definition: codestream_header.h:398
JxlLayerInfo layer_info
Definition: codestream_header.h:430
JXL_BOOL is_last
Definition: codestream_header.h:426
uint32_t name_length
Definition: codestream_header.h:419
uint32_t duration
Definition: codestream_header.h:402
uint32_t timecode
Definition: codestream_header.h:412
Definition: codestream_header.h:318
uint64_t extensions
Definition: codestream_header.h:320
Definition: codestream_header.h:76
uint32_t ysize
Definition: codestream_header.h:81
uint32_t xsize
Definition: codestream_header.h:78
Definition: codestream_header.h:360
uint32_t xsize
Definition: codestream_header.h:379
uint32_t save_as_reference
Definition: codestream_header.h:394
JxlBlendInfo blend_info
Definition: codestream_header.h:388
JXL_BOOL have_crop
Definition: codestream_header.h:367
uint32_t ysize
Definition: codestream_header.h:383
int32_t crop_x0
Definition: codestream_header.h:371
int32_t crop_y0
Definition: codestream_header.h:375
Definition: codestream_header.h:67
uint32_t xsize
Definition: codestream_header.h:69
uint32_t ysize
Definition: codestream_header.h:72
Data types for the JPEG XL API, for both encoding and decoding.