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 <jxl/types.h>
19 #include <stddef.h>
20 #include <stdint.h>
21 
22 #if defined(__cplusplus) || defined(c_plusplus)
23 extern "C" {
24 #endif
25 
31 typedef enum {
32  JXL_ORIENT_IDENTITY = 1,
33  JXL_ORIENT_FLIP_HORIZONTAL = 2,
34  JXL_ORIENT_ROTATE_180 = 3,
35  JXL_ORIENT_FLIP_VERTICAL = 4,
36  JXL_ORIENT_TRANSPOSE = 5,
37  JXL_ORIENT_ROTATE_90_CW = 6,
38  JXL_ORIENT_ANTI_TRANSPOSE = 7,
39  JXL_ORIENT_ROTATE_90_CCW = 8,
41 
44 typedef enum {
45  JXL_CHANNEL_ALPHA,
46  JXL_CHANNEL_DEPTH,
47  JXL_CHANNEL_SPOT_COLOR,
48  JXL_CHANNEL_SELECTION_MASK,
49  JXL_CHANNEL_BLACK,
50  JXL_CHANNEL_CFA,
51  JXL_CHANNEL_THERMAL,
52  JXL_CHANNEL_RESERVED0,
53  JXL_CHANNEL_RESERVED1,
54  JXL_CHANNEL_RESERVED2,
55  JXL_CHANNEL_RESERVED3,
56  JXL_CHANNEL_RESERVED4,
57  JXL_CHANNEL_RESERVED5,
58  JXL_CHANNEL_RESERVED6,
59  JXL_CHANNEL_RESERVED7,
60  JXL_CHANNEL_UNKNOWN,
61  JXL_CHANNEL_OPTIONAL
63 
65 typedef struct {
67  uint32_t xsize;
68 
70  uint32_t ysize;
72 
77 typedef struct {
79  uint32_t tps_numerator;
80 
82  uint32_t tps_denominator;
83 
85  uint32_t num_loops;
86 
91 
95 typedef struct {
96  /* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
97  * fields orientation must be read from Exif APP1. For has_icc_profile: must
98  * look up where ICC profile is guaranteed to be in a JPEG file to be able to
99  * indicate this. */
100 
101  /* TODO(lode): make struct packed, and/or make this opaque struct with getter
102  * functions (still separate struct from opaque decoder) */
103 
109 
112  uint32_t xsize;
113 
116  uint32_t ysize;
117 
120  uint32_t bits_per_sample;
121 
129 
139 
144  float min_nits;
145 
149 
156 
177 
182 
187 
192 
201 
210 
215  uint32_t alpha_bits;
216 
222 
228 
233 
238 
245  uint32_t intrinsic_xsize;
246 
253  uint32_t intrinsic_ysize;
254 
258  uint8_t padding[100];
259 } JxlBasicInfo;
260 
263 typedef struct {
267 
270  uint32_t bits_per_sample;
271 
276 
282  uint32_t dim_shift;
283 
287  uint32_t name_length;
288 
293 
297  float spot_color[4];
298 
302  uint32_t cfa_channel;
304 
305 /* TODO(lode): add API to get the codestream header extensions. */
307 typedef struct {
309  uint64_t extensions;
311 
315 typedef enum {
316  JXL_BLEND_REPLACE = 0,
317  JXL_BLEND_ADD = 1,
318  JXL_BLEND_BLEND = 2,
319  JXL_BLEND_MULADD = 3,
320  JXL_BLEND_MUL = 4,
321 } JxlBlendMode;
322 
328 typedef struct {
334  uint32_t source;
338  uint32_t alpha;
342 } JxlBlendInfo;
343 
349 typedef struct {
357 
360  int32_t crop_x0;
361 
364  int32_t crop_y0;
365 
368  uint32_t xsize;
369 
372  uint32_t ysize;
373 
378 
386 } JxlLayerInfo;
387 
389 typedef struct {
393  uint32_t duration;
394 
403  uint32_t timecode;
404 
410  uint32_t name_length;
411 
418 
423 
424 #if defined(__cplusplus) || defined(c_plusplus)
425 }
426 #endif
427 
428 #endif /* JXL_CODESTREAM_HEADER_H_ */
429 
#define JXL_BOOL
Definition: types.h:30
JxlExtraChannelType
Definition: codestream_header.h:44
JxlBlendMode
Definition: codestream_header.h:315
JxlOrientation
Definition: codestream_header.h:31
Definition: codestream_header.h:77
JXL_BOOL have_timecodes
Definition: codestream_header.h:89
uint32_t tps_denominator
Definition: codestream_header.h:82
uint32_t num_loops
Definition: codestream_header.h:85
uint32_t tps_numerator
Definition: codestream_header.h:79
Definition: codestream_header.h:95
JXL_BOOL uses_original_profile
Definition: codestream_header.h:176
uint32_t alpha_bits
Definition: codestream_header.h:215
uint32_t ysize
Definition: codestream_header.h:116
uint32_t intrinsic_ysize
Definition: codestream_header.h:253
float min_nits
Definition: codestream_header.h:144
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:227
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:148
JXL_BOOL have_animation
Definition: codestream_header.h:186
JxlOrientation orientation
Definition: codestream_header.h:191
uint32_t alpha_exponent_bits
Definition: codestream_header.h:221
uint32_t bits_per_sample
Definition: codestream_header.h:120
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:128
uint32_t num_color_channels
Definition: codestream_header.h:200
uint32_t intrinsic_xsize
Definition: codestream_header.h:245
uint32_t xsize
Definition: codestream_header.h:112
uint32_t num_extra_channels
Definition: codestream_header.h:209
JXL_BOOL have_preview
Definition: codestream_header.h:181
JxlPreviewHeader preview
Definition: codestream_header.h:232
float linear_below
Definition: codestream_header.h:155
JxlAnimationHeader animation
Definition: codestream_header.h:237
JXL_BOOL have_container
Definition: codestream_header.h:108
float intensity_target
Definition: codestream_header.h:138
Definition: codestream_header.h:328
JxlBlendMode blendmode
Definition: codestream_header.h:331
uint32_t source
Definition: codestream_header.h:334
uint32_t alpha
Definition: codestream_header.h:338
JXL_BOOL clamp
Definition: codestream_header.h:341
Definition: codestream_header.h:263
JxlExtraChannelType type
Definition: codestream_header.h:266
uint32_t cfa_channel
Definition: codestream_header.h:302
uint32_t bits_per_sample
Definition: codestream_header.h:270
uint32_t dim_shift
Definition: codestream_header.h:282
uint32_t name_length
Definition: codestream_header.h:287
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:275
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:292
Definition: codestream_header.h:389
JxlLayerInfo layer_info
Definition: codestream_header.h:421
JXL_BOOL is_last
Definition: codestream_header.h:417
uint32_t name_length
Definition: codestream_header.h:410
uint32_t duration
Definition: codestream_header.h:393
uint32_t timecode
Definition: codestream_header.h:403
Definition: codestream_header.h:307
uint64_t extensions
Definition: codestream_header.h:309
Definition: codestream_header.h:349
uint32_t xsize
Definition: codestream_header.h:368
uint32_t save_as_reference
Definition: codestream_header.h:385
JxlBlendInfo blend_info
Definition: codestream_header.h:377
JXL_BOOL have_crop
Definition: codestream_header.h:356
uint32_t ysize
Definition: codestream_header.h:372
int32_t crop_x0
Definition: codestream_header.h:360
int32_t crop_y0
Definition: codestream_header.h:364
Definition: codestream_header.h:65
uint32_t xsize
Definition: codestream_header.h:67
uint32_t ysize
Definition: codestream_header.h:70
Data types for the JPEG XL API, for both encoding and decoding.