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 
75 typedef struct {
77  uint32_t xsize;
78 
80  uint32_t ysize;
82 
87 typedef struct {
89  uint32_t tps_numerator;
90 
92  uint32_t tps_denominator;
93 
95  uint32_t num_loops;
96 
101 
105 typedef struct {
106  /* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
107  * fields orientation must be read from Exif APP1. For has_icc_profile: must
108  * look up where ICC profile is guaranteed to be in a JPEG file to be able to
109  * indicate this. */
110 
111  /* TODO(lode): make struct packed, and/or make this opaque struct with getter
112  * functions (still separate struct from opaque decoder) */
113 
119 
122  uint32_t xsize;
123 
126  uint32_t ysize;
127 
130  uint32_t bits_per_sample;
131 
139 
149 
154  float min_nits;
155 
159 
166 
187 
192 
197 
202 
211 
220 
225  uint32_t alpha_bits;
226 
232 
238 
243 
248 
255  uint32_t intrinsic_xsize;
256 
263  uint32_t intrinsic_ysize;
264 
268  uint8_t padding[100];
269 } JxlBasicInfo;
270 
273 typedef struct {
277 
280  uint32_t bits_per_sample;
281 
286 
292  uint32_t dim_shift;
293 
297  uint32_t name_length;
298 
303 
307  float spot_color[4];
308 
312  uint32_t cfa_channel;
314 
315 /* TODO(lode): add API to get the codestream header extensions. */
317 typedef struct {
319  uint64_t extensions;
321 
325 typedef enum {
326  JXL_BLEND_REPLACE = 0,
327  JXL_BLEND_ADD = 1,
328  JXL_BLEND_BLEND = 2,
329  JXL_BLEND_MULADD = 3,
330  JXL_BLEND_MUL = 4,
331 } JxlBlendMode;
332 
338 typedef struct {
344  uint32_t source;
348  uint32_t alpha;
352 } JxlBlendInfo;
353 
359 typedef struct {
367 
370  int32_t crop_x0;
371 
374  int32_t crop_y0;
375 
378  uint32_t xsize;
379 
382  uint32_t ysize;
383 
388 
394 } JxlLayerInfo;
395 
397 typedef struct {
401  uint32_t duration;
402 
411  uint32_t timecode;
412 
418  uint32_t name_length;
419 
426 
431 
432 #if defined(__cplusplus) || defined(c_plusplus)
433 }
434 #endif
435 
436 #endif /* JXL_CODESTREAM_HEADER_H_ */
437 
Definition: codestream_header.h:359
uint32_t alpha
Definition: codestream_header.h:348
uint32_t dim_shift
Definition: codestream_header.h:292
JxlOrientation orientation
Definition: codestream_header.h:201
JxlExtraChannelType
Definition: codestream_header.h:45
uint32_t ysize
Definition: codestream_header.h:126
#define JXL_BOOL
Definition: types.h:31
Data types for the JPEG XL API, for both encoding and decoding.
uint32_t intrinsic_xsize
Definition: codestream_header.h:255
Definition: codestream_header.h:317
uint32_t name_length
Definition: codestream_header.h:297
Definition: codestream_header.h:66
JXL_BOOL clamp
Definition: codestream_header.h:351
JxlBlendMode blendmode
Definition: codestream_header.h:341
uint32_t ysize
Definition: codestream_header.h:71
int32_t crop_y0
Definition: codestream_header.h:374
uint32_t ysize
Definition: codestream_header.h:80
uint32_t num_extra_channels
Definition: codestream_header.h:219
Definition: codestream_header.h:87
Definition: codestream_header.h:273
uint32_t source
Definition: codestream_header.h:344
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:237
int32_t crop_x0
Definition: codestream_header.h:370
uint32_t bits_per_sample
Definition: codestream_header.h:130
uint64_t extensions
Definition: codestream_header.h:319
uint32_t num_color_channels
Definition: codestream_header.h:210
JxlLayerInfo layer_info
Definition: codestream_header.h:429
uint32_t name_length
Definition: codestream_header.h:418
JXL_BOOL have_animation
Definition: codestream_header.h:196
uint32_t alpha_exponent_bits
Definition: codestream_header.h:231
uint32_t duration
Definition: codestream_header.h:401
uint32_t ysize
Definition: codestream_header.h:382
JxlAnimationHeader animation
Definition: codestream_header.h:247
uint32_t intrinsic_ysize
Definition: codestream_header.h:263
Definition: codestream_header.h:397
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:285
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:138
uint32_t xsize
Definition: codestream_header.h:122
uint32_t tps_denominator
Definition: codestream_header.h:92
Definition: codestream_header.h:338
JXL_BOOL is_last
Definition: codestream_header.h:425
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:302
Definition: codestream_header.h:105
JxlExtraChannelType type
Definition: codestream_header.h:276
uint32_t xsize
Definition: codestream_header.h:68
uint32_t num_loops
Definition: codestream_header.h:95
uint32_t alpha_bits
Definition: codestream_header.h:225
uint32_t xsize
Definition: codestream_header.h:77
JxlBlendInfo blend_info
Definition: codestream_header.h:387
JXL_BOOL have_timecodes
Definition: codestream_header.h:99
float min_nits
Definition: codestream_header.h:154
float linear_below
Definition: codestream_header.h:165
uint32_t cfa_channel
Definition: codestream_header.h:312
JXL_BOOL have_preview
Definition: codestream_header.h:191
uint32_t bits_per_sample
Definition: codestream_header.h:280
float intensity_target
Definition: codestream_header.h:148
JxlPreviewHeader preview
Definition: codestream_header.h:242
JXL_BOOL have_crop
Definition: codestream_header.h:366
uint32_t save_as_reference
Definition: codestream_header.h:393
Definition: codestream_header.h:75
uint32_t xsize
Definition: codestream_header.h:378
uint32_t timecode
Definition: codestream_header.h:411
JxlOrientation
Definition: codestream_header.h:32
JxlBlendMode
Definition: codestream_header.h:325
JXL_BOOL uses_original_profile
Definition: codestream_header.h:186
JXL_BOOL have_container
Definition: codestream_header.h:118
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:158
uint32_t tps_numerator
Definition: codestream_header.h:89