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/types.h"
22 
23 #if defined(__cplusplus) || defined(c_plusplus)
24 extern "C" {
25 #endif
26 
32 typedef enum {
33  JXL_ORIENT_IDENTITY = 1,
34  JXL_ORIENT_FLIP_HORIZONTAL = 2,
35  JXL_ORIENT_ROTATE_180 = 3,
36  JXL_ORIENT_FLIP_VERTICAL = 4,
37  JXL_ORIENT_TRANSPOSE = 5,
38  JXL_ORIENT_ROTATE_90_CW = 6,
39  JXL_ORIENT_ANTI_TRANSPOSE = 7,
40  JXL_ORIENT_ROTATE_90_CCW = 8,
42 
45 typedef enum {
46  JXL_CHANNEL_ALPHA,
47  JXL_CHANNEL_DEPTH,
48  JXL_CHANNEL_SPOT_COLOR,
49  JXL_CHANNEL_SELECTION_MASK,
50  JXL_CHANNEL_BLACK,
51  JXL_CHANNEL_CFA,
52  JXL_CHANNEL_THERMAL,
53  JXL_CHANNEL_RESERVED0,
54  JXL_CHANNEL_RESERVED1,
55  JXL_CHANNEL_RESERVED2,
56  JXL_CHANNEL_RESERVED3,
57  JXL_CHANNEL_RESERVED4,
58  JXL_CHANNEL_RESERVED5,
59  JXL_CHANNEL_RESERVED6,
60  JXL_CHANNEL_RESERVED7,
61  JXL_CHANNEL_UNKNOWN,
62  JXL_CHANNEL_OPTIONAL
64 
66 typedef struct {
68  uint32_t xsize;
69 
71  uint32_t ysize;
73 
78 typedef struct {
80  uint32_t tps_numerator;
81 
83  uint32_t tps_denominator;
84 
86  uint32_t num_loops;
87 
92 
96 typedef struct {
97  /* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
98  * fields orientation must be read from Exif APP1. For has_icc_profile: must
99  * look up where ICC profile is guaranteed to be in a JPEG file to be able to
100  * indicate this. */
101 
102  /* TODO(lode): make struct packed, and/or make this opaque struct with getter
103  * functions (still separate struct from opaque decoder) */
104 
110 
113  uint32_t xsize;
114 
117  uint32_t ysize;
118 
121  uint32_t bits_per_sample;
122 
130 
140 
145  float min_nits;
146 
150 
157 
178 
183 
188 
193 
202 
211 
216  uint32_t alpha_bits;
217 
223 
229 
234 
239 
246  uint32_t intrinsic_xsize;
247 
254  uint32_t intrinsic_ysize;
255 
259  uint8_t padding[100];
260 } JxlBasicInfo;
261 
264 typedef struct {
268 
271  uint32_t bits_per_sample;
272 
277 
283  uint32_t dim_shift;
284 
288  uint32_t name_length;
289 
294 
298  float spot_color[4];
299 
303  uint32_t cfa_channel;
305 
306 /* TODO(lode): add API to get the codestream header extensions. */
308 typedef struct {
310  uint64_t extensions;
312 
316 typedef enum {
317  JXL_BLEND_REPLACE = 0,
318  JXL_BLEND_ADD = 1,
319  JXL_BLEND_BLEND = 2,
320  JXL_BLEND_MULADD = 3,
321  JXL_BLEND_MUL = 4,
322 } JxlBlendMode;
323 
329 typedef struct {
335  uint32_t source;
339  uint32_t alpha;
343 } JxlBlendInfo;
344 
350 typedef struct {
358 
361  int32_t crop_x0;
362 
365  int32_t crop_y0;
366 
369  uint32_t xsize;
370 
373  uint32_t ysize;
374 
379 
385 } JxlLayerInfo;
386 
388 typedef struct {
392  uint32_t duration;
393 
402  uint32_t timecode;
403 
409  uint32_t name_length;
410 
417 
422 
423 #if defined(__cplusplus) || defined(c_plusplus)
424 }
425 #endif
426 
427 #endif /* JXL_CODESTREAM_HEADER_H_ */
428 
JxlExtraChannelType
Definition: codestream_header.h:45
#define JXL_BOOL
Definition: types.h:31
JxlBlendMode
Definition: codestream_header.h:316
JxlOrientation
Definition: codestream_header.h:32
Definition: codestream_header.h:78
JXL_BOOL have_timecodes
Definition: codestream_header.h:90
uint32_t tps_denominator
Definition: codestream_header.h:83
uint32_t num_loops
Definition: codestream_header.h:86
uint32_t tps_numerator
Definition: codestream_header.h:80
Definition: codestream_header.h:96
JXL_BOOL uses_original_profile
Definition: codestream_header.h:177
uint32_t alpha_bits
Definition: codestream_header.h:216
uint32_t ysize
Definition: codestream_header.h:117
uint32_t intrinsic_ysize
Definition: codestream_header.h:254
float min_nits
Definition: codestream_header.h:145
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:228
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:149
JXL_BOOL have_animation
Definition: codestream_header.h:187
JxlOrientation orientation
Definition: codestream_header.h:192
uint32_t alpha_exponent_bits
Definition: codestream_header.h:222
uint32_t bits_per_sample
Definition: codestream_header.h:121
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:129
uint32_t num_color_channels
Definition: codestream_header.h:201
uint32_t intrinsic_xsize
Definition: codestream_header.h:246
uint32_t xsize
Definition: codestream_header.h:113
uint32_t num_extra_channels
Definition: codestream_header.h:210
JXL_BOOL have_preview
Definition: codestream_header.h:182
JxlPreviewHeader preview
Definition: codestream_header.h:233
float linear_below
Definition: codestream_header.h:156
JxlAnimationHeader animation
Definition: codestream_header.h:238
JXL_BOOL have_container
Definition: codestream_header.h:109
float intensity_target
Definition: codestream_header.h:139
Definition: codestream_header.h:329
JxlBlendMode blendmode
Definition: codestream_header.h:332
uint32_t source
Definition: codestream_header.h:335
uint32_t alpha
Definition: codestream_header.h:339
JXL_BOOL clamp
Definition: codestream_header.h:342
Definition: codestream_header.h:264
JxlExtraChannelType type
Definition: codestream_header.h:267
uint32_t cfa_channel
Definition: codestream_header.h:303
uint32_t bits_per_sample
Definition: codestream_header.h:271
uint32_t dim_shift
Definition: codestream_header.h:283
uint32_t name_length
Definition: codestream_header.h:288
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:276
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:293
Definition: codestream_header.h:388
JxlLayerInfo layer_info
Definition: codestream_header.h:420
JXL_BOOL is_last
Definition: codestream_header.h:416
uint32_t name_length
Definition: codestream_header.h:409
uint32_t duration
Definition: codestream_header.h:392
uint32_t timecode
Definition: codestream_header.h:402
Definition: codestream_header.h:308
uint64_t extensions
Definition: codestream_header.h:310
Definition: codestream_header.h:350
uint32_t xsize
Definition: codestream_header.h:369
uint32_t save_as_reference
Definition: codestream_header.h:384
JxlBlendInfo blend_info
Definition: codestream_header.h:378
JXL_BOOL have_crop
Definition: codestream_header.h:357
uint32_t ysize
Definition: codestream_header.h:373
int32_t crop_x0
Definition: codestream_header.h:361
int32_t crop_y0
Definition: codestream_header.h:365
Definition: codestream_header.h:66
uint32_t xsize
Definition: codestream_header.h:68
uint32_t ysize
Definition: codestream_header.h:71
Data types for the JPEG XL API, for both encoding and decoding.