LIBJXL: jxl/codestream_header.h Source File

LIBJXL

Loading...
Searching...
No Matches
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)
23extern "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,
40} JxlOrientation;
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
62} JxlExtraChannelType;
63
65 typedef struct {
67 uint32_t xsize;
68
70 uint32_t ysize;
71} JxlPreviewHeader;
72
77 typedef struct {
79 uint32_t tps_numerator;
80
82 uint32_t tps_denominator;
83
85 uint32_t num_loops;
86
89 JXL_BOOL have_timecodes;
90} JxlAnimationHeader;
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
108 JXL_BOOL have_container;
109
112 uint32_t xsize;
113
116 uint32_t ysize;
117
120 uint32_t bits_per_sample;
121
128 uint32_t exponent_bits_per_sample;
129
138 float intensity_target;
139
144 float min_nits;
145
148 JXL_BOOL relative_to_max_display;
149
155 float linear_below;
156
176 JXL_BOOL uses_original_profile;
177
181 JXL_BOOL have_preview;
182
186 JXL_BOOL have_animation;
187
191 JxlOrientation orientation;
192
201 uint32_t num_color_channels;
202
211 uint32_t num_extra_channels;
212
217 uint32_t alpha_bits;
218
223 uint32_t alpha_exponent_bits;
224
229 JXL_BOOL alpha_premultiplied;
230
234 JxlPreviewHeader preview;
235
239 JxlAnimationHeader animation;
240
247 uint32_t intrinsic_xsize;
248
255 uint32_t intrinsic_ysize;
256
260 uint8_t padding[100];
261} JxlBasicInfo;
262
265 typedef struct {
268 JxlExtraChannelType type;
269
272 uint32_t bits_per_sample;
273
277 uint32_t exponent_bits_per_sample;
278
284 uint32_t dim_shift;
285
289 uint32_t name_length;
290
294 JXL_BOOL alpha_premultiplied;
295
299 float spot_color[4];
300
304 uint32_t cfa_channel;
305} JxlExtraChannelInfo;
306
307/* TODO(lode): add API to get the codestream header extensions. */
309 typedef struct {
311 uint64_t extensions;
312} JxlHeaderExtensions;
313
317 typedef enum {
318 JXL_BLEND_REPLACE = 0,
319 JXL_BLEND_ADD = 1,
320 JXL_BLEND_BLEND = 2,
321 JXL_BLEND_MULADD = 3,
322 JXL_BLEND_MUL = 4,
323} JxlBlendMode;
324
330 typedef struct {
333 JxlBlendMode blendmode;
336 uint32_t source;
340 uint32_t alpha;
343 JXL_BOOL clamp;
344} JxlBlendInfo;
345
351 typedef struct {
358 JXL_BOOL have_crop;
359
362 int32_t crop_x0;
363
366 int32_t crop_y0;
367
370 uint32_t xsize;
371
374 uint32_t ysize;
375
379 JxlBlendInfo blend_info;
380
387 uint32_t save_as_reference;
388} JxlLayerInfo;
389
391 typedef struct {
396 uint32_t duration;
397
406 uint32_t timecode;
407
413 uint32_t name_length;
414
420 JXL_BOOL is_last;
421
424 JxlLayerInfo layer_info;
425} JxlFrameHeader;
426
427#if defined(__cplusplus) || defined(c_plusplus)
428}
429#endif
430
431#endif /* JXL_CODESTREAM_HEADER_H_ */
432
JXL_BOOL
#define JXL_BOOL
Definition types.h:29
JxlExtraChannelType
JxlExtraChannelType
Definition codestream_header.h:44
JxlBlendMode
JxlBlendMode
Definition codestream_header.h:317
JxlOrientation
JxlOrientation
Definition codestream_header.h:31
JxlAnimationHeader
Definition codestream_header.h:77
JxlAnimationHeader::have_timecodes
JXL_BOOL have_timecodes
Definition codestream_header.h:89
JxlAnimationHeader::tps_denominator
uint32_t tps_denominator
Definition codestream_header.h:82
JxlAnimationHeader::num_loops
uint32_t num_loops
Definition codestream_header.h:85
JxlAnimationHeader::tps_numerator
uint32_t tps_numerator
Definition codestream_header.h:79
JxlBasicInfo
Definition codestream_header.h:95
JxlBasicInfo::uses_original_profile
JXL_BOOL uses_original_profile
Definition codestream_header.h:176
JxlBasicInfo::alpha_bits
uint32_t alpha_bits
Definition codestream_header.h:217
JxlBasicInfo::ysize
uint32_t ysize
Definition codestream_header.h:116
JxlBasicInfo::intrinsic_ysize
uint32_t intrinsic_ysize
Definition codestream_header.h:255
JxlBasicInfo::min_nits
float min_nits
Definition codestream_header.h:144
JxlBasicInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition codestream_header.h:229
JxlBasicInfo::relative_to_max_display
JXL_BOOL relative_to_max_display
Definition codestream_header.h:148
JxlBasicInfo::have_animation
JXL_BOOL have_animation
Definition codestream_header.h:186
JxlBasicInfo::orientation
JxlOrientation orientation
Definition codestream_header.h:191
JxlBasicInfo::alpha_exponent_bits
uint32_t alpha_exponent_bits
Definition codestream_header.h:223
JxlBasicInfo::bits_per_sample
uint32_t bits_per_sample
Definition codestream_header.h:120
JxlBasicInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition codestream_header.h:128
JxlBasicInfo::num_color_channels
uint32_t num_color_channels
Definition codestream_header.h:201
JxlBasicInfo::intrinsic_xsize
uint32_t intrinsic_xsize
Definition codestream_header.h:247
JxlBasicInfo::xsize
uint32_t xsize
Definition codestream_header.h:112
JxlBasicInfo::num_extra_channels
uint32_t num_extra_channels
Definition codestream_header.h:211
JxlBasicInfo::have_preview
JXL_BOOL have_preview
Definition codestream_header.h:181
JxlBasicInfo::preview
JxlPreviewHeader preview
Definition codestream_header.h:234
JxlBasicInfo::linear_below
float linear_below
Definition codestream_header.h:155
JxlBasicInfo::animation
JxlAnimationHeader animation
Definition codestream_header.h:239
JxlBasicInfo::have_container
JXL_BOOL have_container
Definition codestream_header.h:108
JxlBasicInfo::intensity_target
float intensity_target
Definition codestream_header.h:138
JxlBlendInfo
Definition codestream_header.h:330
JxlBlendInfo::blendmode
JxlBlendMode blendmode
Definition codestream_header.h:333
JxlBlendInfo::source
uint32_t source
Definition codestream_header.h:336
JxlBlendInfo::alpha
uint32_t alpha
Definition codestream_header.h:340
JxlBlendInfo::clamp
JXL_BOOL clamp
Definition codestream_header.h:343
JxlExtraChannelInfo
Definition codestream_header.h:265
JxlExtraChannelInfo::type
JxlExtraChannelType type
Definition codestream_header.h:268
JxlExtraChannelInfo::cfa_channel
uint32_t cfa_channel
Definition codestream_header.h:304
JxlExtraChannelInfo::bits_per_sample
uint32_t bits_per_sample
Definition codestream_header.h:272
JxlExtraChannelInfo::dim_shift
uint32_t dim_shift
Definition codestream_header.h:284
JxlExtraChannelInfo::name_length
uint32_t name_length
Definition codestream_header.h:289
JxlExtraChannelInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition codestream_header.h:277
JxlExtraChannelInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition codestream_header.h:294
JxlFrameHeader
Definition codestream_header.h:391
JxlFrameHeader::layer_info
JxlLayerInfo layer_info
Definition codestream_header.h:424
JxlFrameHeader::is_last
JXL_BOOL is_last
Definition codestream_header.h:420
JxlFrameHeader::name_length
uint32_t name_length
Definition codestream_header.h:413
JxlFrameHeader::duration
uint32_t duration
Definition codestream_header.h:396
JxlFrameHeader::timecode
uint32_t timecode
Definition codestream_header.h:406
JxlHeaderExtensions
Definition codestream_header.h:309
JxlHeaderExtensions::extensions
uint64_t extensions
Definition codestream_header.h:311
JxlLayerInfo
Definition codestream_header.h:351
JxlLayerInfo::xsize
uint32_t xsize
Definition codestream_header.h:370
JxlLayerInfo::save_as_reference
uint32_t save_as_reference
Definition codestream_header.h:387
JxlLayerInfo::blend_info
JxlBlendInfo blend_info
Definition codestream_header.h:379
JxlLayerInfo::have_crop
JXL_BOOL have_crop
Definition codestream_header.h:358
JxlLayerInfo::ysize
uint32_t ysize
Definition codestream_header.h:374
JxlLayerInfo::crop_x0
int32_t crop_x0
Definition codestream_header.h:362
JxlLayerInfo::crop_y0
int32_t crop_y0
Definition codestream_header.h:366
JxlPreviewHeader
Definition codestream_header.h:65
JxlPreviewHeader::xsize
uint32_t xsize
Definition codestream_header.h:67
JxlPreviewHeader::ysize
uint32_t ysize
Definition codestream_header.h:70
types.h
Data types for the JPEG XL API, for both encoding and decoding.