LIBJXL: jxl/codestream_header.h Source File

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)
24extern "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,
41} JxlOrientation;
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
63} JxlExtraChannelType;
64
66 typedef struct {
68 uint32_t xsize;
69
71 uint32_t ysize;
72} JxlPreviewHeader;
73
75 typedef struct {
77 uint32_t xsize;
78
80 uint32_t ysize;
81} JxlIntrinsicSizeHeader;
82
87 typedef struct {
89 uint32_t tps_numerator;
90
92 uint32_t tps_denominator;
93
95 uint32_t num_loops;
96
99 JXL_BOOL have_timecodes;
100} JxlAnimationHeader;
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
118 JXL_BOOL have_container;
119
122 uint32_t xsize;
123
126 uint32_t ysize;
127
130 uint32_t bits_per_sample;
131
138 uint32_t exponent_bits_per_sample;
139
148 float intensity_target;
149
154 float min_nits;
155
158 JXL_BOOL relative_to_max_display;
159
165 float linear_below;
166
186 JXL_BOOL uses_original_profile;
187
191 JXL_BOOL have_preview;
192
196 JXL_BOOL have_animation;
197
201 JxlOrientation orientation;
202
210 uint32_t num_color_channels;
211
219 uint32_t num_extra_channels;
220
225 uint32_t alpha_bits;
226
231 uint32_t alpha_exponent_bits;
232
237 JXL_BOOL alpha_premultiplied;
238
242 JxlPreviewHeader preview;
243
247 JxlAnimationHeader animation;
248
255 uint32_t intrinsic_xsize;
256
263 uint32_t intrinsic_ysize;
264
268 uint8_t padding[100];
269} JxlBasicInfo;
270
273 typedef struct {
276 JxlExtraChannelType type;
277
280 uint32_t bits_per_sample;
281
285 uint32_t exponent_bits_per_sample;
286
292 uint32_t dim_shift;
293
297 uint32_t name_length;
298
302 JXL_BOOL alpha_premultiplied;
303
307 float spot_color[4];
308
312 uint32_t cfa_channel;
313} JxlExtraChannelInfo;
314
315/* TODO(lode): add API to get the codestream header extensions. */
317 typedef struct {
319 uint64_t extensions;
320} JxlHeaderExtensions;
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 {
341 JxlBlendMode blendmode;
344 uint32_t source;
348 uint32_t alpha;
351 JXL_BOOL clamp;
352} JxlBlendInfo;
353
359 typedef struct {
366 JXL_BOOL have_crop;
367
370 int32_t crop_x0;
371
374 int32_t crop_y0;
375
378 uint32_t xsize;
379
382 uint32_t ysize;
383
387 JxlBlendInfo blend_info;
388
393 uint32_t save_as_reference;
394} JxlLayerInfo;
395
397 typedef struct {
401 uint32_t duration;
402
411 uint32_t timecode;
412
418 uint32_t name_length;
419
425 JXL_BOOL is_last;
426
429 JxlLayerInfo layer_info;
430} JxlFrameHeader;
431
432#if defined(__cplusplus) || defined(c_plusplus)
433}
434#endif
435
436#endif /* JXL_CODESTREAM_HEADER_H_ */
437
JxlExtraChannelType
JxlExtraChannelType
Definition: codestream_header.h:45
JXL_BOOL
#define JXL_BOOL
Definition: types.h:31
JxlBlendMode
JxlBlendMode
Definition: codestream_header.h:325
JxlOrientation
JxlOrientation
Definition: codestream_header.h:32
JxlAnimationHeader
Definition: codestream_header.h:87
JxlAnimationHeader::have_timecodes
JXL_BOOL have_timecodes
Definition: codestream_header.h:99
JxlAnimationHeader::tps_denominator
uint32_t tps_denominator
Definition: codestream_header.h:92
JxlAnimationHeader::num_loops
uint32_t num_loops
Definition: codestream_header.h:95
JxlAnimationHeader::tps_numerator
uint32_t tps_numerator
Definition: codestream_header.h:89
JxlBasicInfo
Definition: codestream_header.h:105
JxlBasicInfo::uses_original_profile
JXL_BOOL uses_original_profile
Definition: codestream_header.h:186
JxlBasicInfo::alpha_bits
uint32_t alpha_bits
Definition: codestream_header.h:225
JxlBasicInfo::ysize
uint32_t ysize
Definition: codestream_header.h:126
JxlBasicInfo::intrinsic_ysize
uint32_t intrinsic_ysize
Definition: codestream_header.h:263
JxlBasicInfo::min_nits
float min_nits
Definition: codestream_header.h:154
JxlBasicInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:237
JxlBasicInfo::relative_to_max_display
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:158
JxlBasicInfo::have_animation
JXL_BOOL have_animation
Definition: codestream_header.h:196
JxlBasicInfo::orientation
JxlOrientation orientation
Definition: codestream_header.h:201
JxlBasicInfo::alpha_exponent_bits
uint32_t alpha_exponent_bits
Definition: codestream_header.h:231
JxlBasicInfo::bits_per_sample
uint32_t bits_per_sample
Definition: codestream_header.h:130
JxlBasicInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:138
JxlBasicInfo::num_color_channels
uint32_t num_color_channels
Definition: codestream_header.h:210
JxlBasicInfo::intrinsic_xsize
uint32_t intrinsic_xsize
Definition: codestream_header.h:255
JxlBasicInfo::xsize
uint32_t xsize
Definition: codestream_header.h:122
JxlBasicInfo::num_extra_channels
uint32_t num_extra_channels
Definition: codestream_header.h:219
JxlBasicInfo::have_preview
JXL_BOOL have_preview
Definition: codestream_header.h:191
JxlBasicInfo::preview
JxlPreviewHeader preview
Definition: codestream_header.h:242
JxlBasicInfo::linear_below
float linear_below
Definition: codestream_header.h:165
JxlBasicInfo::animation
JxlAnimationHeader animation
Definition: codestream_header.h:247
JxlBasicInfo::have_container
JXL_BOOL have_container
Definition: codestream_header.h:118
JxlBasicInfo::intensity_target
float intensity_target
Definition: codestream_header.h:148
JxlBlendInfo
Definition: codestream_header.h:338
JxlBlendInfo::blendmode
JxlBlendMode blendmode
Definition: codestream_header.h:341
JxlBlendInfo::source
uint32_t source
Definition: codestream_header.h:344
JxlBlendInfo::alpha
uint32_t alpha
Definition: codestream_header.h:348
JxlBlendInfo::clamp
JXL_BOOL clamp
Definition: codestream_header.h:351
JxlExtraChannelInfo
Definition: codestream_header.h:273
JxlExtraChannelInfo::type
JxlExtraChannelType type
Definition: codestream_header.h:276
JxlExtraChannelInfo::cfa_channel
uint32_t cfa_channel
Definition: codestream_header.h:312
JxlExtraChannelInfo::bits_per_sample
uint32_t bits_per_sample
Definition: codestream_header.h:280
JxlExtraChannelInfo::dim_shift
uint32_t dim_shift
Definition: codestream_header.h:292
JxlExtraChannelInfo::name_length
uint32_t name_length
Definition: codestream_header.h:297
JxlExtraChannelInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:285
JxlExtraChannelInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:302
JxlFrameHeader
Definition: codestream_header.h:397
JxlFrameHeader::layer_info
JxlLayerInfo layer_info
Definition: codestream_header.h:429
JxlFrameHeader::is_last
JXL_BOOL is_last
Definition: codestream_header.h:425
JxlFrameHeader::name_length
uint32_t name_length
Definition: codestream_header.h:418
JxlFrameHeader::duration
uint32_t duration
Definition: codestream_header.h:401
JxlFrameHeader::timecode
uint32_t timecode
Definition: codestream_header.h:411
JxlHeaderExtensions
Definition: codestream_header.h:317
JxlHeaderExtensions::extensions
uint64_t extensions
Definition: codestream_header.h:319
JxlIntrinsicSizeHeader
Definition: codestream_header.h:75
JxlIntrinsicSizeHeader::ysize
uint32_t ysize
Definition: codestream_header.h:80
JxlIntrinsicSizeHeader::xsize
uint32_t xsize
Definition: codestream_header.h:77
JxlLayerInfo
Definition: codestream_header.h:359
JxlLayerInfo::xsize
uint32_t xsize
Definition: codestream_header.h:378
JxlLayerInfo::save_as_reference
uint32_t save_as_reference
Definition: codestream_header.h:393
JxlLayerInfo::blend_info
JxlBlendInfo blend_info
Definition: codestream_header.h:387
JxlLayerInfo::have_crop
JXL_BOOL have_crop
Definition: codestream_header.h:366
JxlLayerInfo::ysize
uint32_t ysize
Definition: codestream_header.h:382
JxlLayerInfo::crop_x0
int32_t crop_x0
Definition: codestream_header.h:370
JxlLayerInfo::crop_y0
int32_t crop_y0
Definition: codestream_header.h:374
JxlPreviewHeader
Definition: codestream_header.h:66
JxlPreviewHeader::xsize
uint32_t xsize
Definition: codestream_header.h:68
JxlPreviewHeader::ysize
uint32_t ysize
Definition: codestream_header.h:71
types.h
Data types for the JPEG XL API, for both encoding and decoding.