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 
148 
153  float min_nits;
154 
158 
165 
182 
187 
192 
197 
206 
215 
220  uint32_t alpha_bits;
221 
227 
233 
238 
243 
250  uint32_t intrinsic_xsize;
251 
258  uint32_t intrinsic_ysize;
259 
263  uint8_t padding[100];
264 } JxlBasicInfo;
265 
268 typedef struct {
272 
275  uint32_t bits_per_sample;
276 
281 
287  uint32_t dim_shift;
288 
292  uint32_t name_length;
293 
298 
302  float spot_color[4];
303 
307  uint32_t cfa_channel;
309 
310 /* TODO(lode): add API to get the codestream header extensions. */
312 typedef struct {
314  uint64_t extensions;
316 
320 typedef enum {
321  JXL_BLEND_REPLACE = 0,
322  JXL_BLEND_ADD = 1,
323  JXL_BLEND_BLEND = 2,
324  JXL_BLEND_MULADD = 3,
325  JXL_BLEND_MUL = 4,
326 } JxlBlendMode;
327 
333 typedef struct {
339  uint32_t source;
343  uint32_t alpha;
347 } JxlBlendInfo;
348 
354 typedef struct {
362 
365  int32_t crop_x0;
366 
369  int32_t crop_y0;
370 
373  uint32_t xsize;
374 
377  uint32_t ysize;
378 
383 
389 } JxlLayerInfo;
390 
392 typedef struct {
396  uint32_t duration;
397 
406  uint32_t timecode;
407 
413  uint32_t name_length;
414 
421 
426 
427 #if defined(__cplusplus) || defined(c_plusplus)
428 }
429 #endif
430 
431 #endif /* JXL_CODESTREAM_HEADER_H_ */
432 
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:320
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:181
uint32_t alpha_bits
Definition: codestream_header.h:220
uint32_t ysize
Definition: codestream_header.h:127
uint32_t intrinsic_ysize
Definition: codestream_header.h:258
float min_nits
Definition: codestream_header.h:153
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:232
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:157
JXL_BOOL have_animation
Definition: codestream_header.h:191
JxlOrientation orientation
Definition: codestream_header.h:196
uint32_t alpha_exponent_bits
Definition: codestream_header.h:226
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:205
uint32_t intrinsic_xsize
Definition: codestream_header.h:250
uint32_t xsize
Definition: codestream_header.h:123
uint32_t num_extra_channels
Definition: codestream_header.h:214
JXL_BOOL have_preview
Definition: codestream_header.h:186
JxlPreviewHeader preview
Definition: codestream_header.h:237
float linear_below
Definition: codestream_header.h:164
JxlAnimationHeader animation
Definition: codestream_header.h:242
JXL_BOOL have_container
Definition: codestream_header.h:119
float intensity_target
Definition: codestream_header.h:147
Definition: codestream_header.h:333
JxlBlendMode blendmode
Definition: codestream_header.h:336
uint32_t source
Definition: codestream_header.h:339
uint32_t alpha
Definition: codestream_header.h:343
JXL_BOOL clamp
Definition: codestream_header.h:346
Definition: codestream_header.h:268
JxlExtraChannelType type
Definition: codestream_header.h:271
uint32_t cfa_channel
Definition: codestream_header.h:307
uint32_t bits_per_sample
Definition: codestream_header.h:275
uint32_t dim_shift
Definition: codestream_header.h:287
uint32_t name_length
Definition: codestream_header.h:292
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:280
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:297
Definition: codestream_header.h:392
JxlLayerInfo layer_info
Definition: codestream_header.h:424
JXL_BOOL is_last
Definition: codestream_header.h:420
uint32_t name_length
Definition: codestream_header.h:413
uint32_t duration
Definition: codestream_header.h:396
uint32_t timecode
Definition: codestream_header.h:406
Definition: codestream_header.h:312
uint64_t extensions
Definition: codestream_header.h:314
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:354
uint32_t xsize
Definition: codestream_header.h:373
uint32_t save_as_reference
Definition: codestream_header.h:388
JxlBlendInfo blend_info
Definition: codestream_header.h:382
JXL_BOOL have_crop
Definition: codestream_header.h:361
uint32_t ysize
Definition: codestream_header.h:377
int32_t crop_x0
Definition: codestream_header.h:365
int32_t crop_y0
Definition: codestream_header.h:369
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.