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 
184 
189 
194 
199 
208 
217 
222  uint32_t alpha_bits;
223 
229 
235 
240 
245 
252  uint32_t intrinsic_xsize;
253 
260  uint32_t intrinsic_ysize;
261 
265  uint8_t padding[100];
266 } JxlBasicInfo;
267 
270 typedef struct {
274 
277  uint32_t bits_per_sample;
278 
283 
289  uint32_t dim_shift;
290 
294  uint32_t name_length;
295 
300 
304  float spot_color[4];
305 
309  uint32_t cfa_channel;
311 
312 /* TODO(lode): add API to get the codestream header extensions. */
314 typedef struct {
316  uint64_t extensions;
318 
322 typedef enum {
323  JXL_BLEND_REPLACE = 0,
324  JXL_BLEND_ADD = 1,
325  JXL_BLEND_BLEND = 2,
326  JXL_BLEND_MULADD = 3,
327  JXL_BLEND_MUL = 4,
328 } JxlBlendMode;
329 
335 typedef struct {
341  uint32_t source;
345  uint32_t alpha;
349 } JxlBlendInfo;
350 
356 typedef struct {
364 
367  int32_t crop_x0;
368 
371  int32_t crop_y0;
372 
375  uint32_t xsize;
376 
379  uint32_t ysize;
380 
385 
391 } JxlLayerInfo;
392 
394 typedef struct {
398  uint32_t duration;
399 
408  uint32_t timecode;
409 
415  uint32_t name_length;
416 
423 
428 
429 #if defined(__cplusplus) || defined(c_plusplus)
430 }
431 #endif
432 
433 #endif /* JXL_CODESTREAM_HEADER_H_ */
434 
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:29
JxlBlendMode
Definition: codestream_header.h:322
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:183
uint32_t alpha_bits
Definition: codestream_header.h:222
uint32_t ysize
Definition: codestream_header.h:127
uint32_t intrinsic_ysize
Definition: codestream_header.h:260
float min_nits
Definition: codestream_header.h:155
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:234
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:159
JXL_BOOL have_animation
Definition: codestream_header.h:193
JxlOrientation orientation
Definition: codestream_header.h:198
uint32_t alpha_exponent_bits
Definition: codestream_header.h:228
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:207
uint32_t intrinsic_xsize
Definition: codestream_header.h:252
uint32_t xsize
Definition: codestream_header.h:123
uint32_t num_extra_channels
Definition: codestream_header.h:216
JXL_BOOL have_preview
Definition: codestream_header.h:188
JxlPreviewHeader preview
Definition: codestream_header.h:239
float linear_below
Definition: codestream_header.h:166
JxlAnimationHeader animation
Definition: codestream_header.h:244
JXL_BOOL have_container
Definition: codestream_header.h:119
float intensity_target
Definition: codestream_header.h:149
Definition: codestream_header.h:335
JxlBlendMode blendmode
Definition: codestream_header.h:338
uint32_t source
Definition: codestream_header.h:341
uint32_t alpha
Definition: codestream_header.h:345
JXL_BOOL clamp
Definition: codestream_header.h:348
Definition: codestream_header.h:270
JxlExtraChannelType type
Definition: codestream_header.h:273
uint32_t cfa_channel
Definition: codestream_header.h:309
uint32_t bits_per_sample
Definition: codestream_header.h:277
uint32_t dim_shift
Definition: codestream_header.h:289
uint32_t name_length
Definition: codestream_header.h:294
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:282
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:299
Definition: codestream_header.h:394
JxlLayerInfo layer_info
Definition: codestream_header.h:426
JXL_BOOL is_last
Definition: codestream_header.h:422
uint32_t name_length
Definition: codestream_header.h:415
uint32_t duration
Definition: codestream_header.h:398
uint32_t timecode
Definition: codestream_header.h:408
Definition: codestream_header.h:314
uint64_t extensions
Definition: codestream_header.h:316
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:356
uint32_t xsize
Definition: codestream_header.h:375
uint32_t save_as_reference
Definition: codestream_header.h:390
JxlBlendInfo blend_info
Definition: codestream_header.h:384
JXL_BOOL have_crop
Definition: codestream_header.h:363
uint32_t ysize
Definition: codestream_header.h:379
int32_t crop_x0
Definition: codestream_header.h:367
int32_t crop_y0
Definition: codestream_header.h:371
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.