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 <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
78 typedef struct {
80 uint32_t tps_numerator;
81
83 uint32_t tps_denominator;
84
86 uint32_t num_loops;
87
90 JXL_BOOL have_timecodes;
91} JxlAnimationHeader;
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
109 JXL_BOOL have_container;
110
113 uint32_t xsize;
114
117 uint32_t ysize;
118
121 uint32_t bits_per_sample;
122
129 uint32_t exponent_bits_per_sample;
130
139 float intensity_target;
140
145 float min_nits;
146
149 JXL_BOOL relative_to_max_display;
150
156 float linear_below;
157
177 JXL_BOOL uses_original_profile;
178
182 JXL_BOOL have_preview;
183
187 JXL_BOOL have_animation;
188
192 JxlOrientation orientation;
193
201 uint32_t num_color_channels;
202
210 uint32_t num_extra_channels;
211
216 uint32_t alpha_bits;
217
222 uint32_t alpha_exponent_bits;
223
228 JXL_BOOL alpha_premultiplied;
229
233 JxlPreviewHeader preview;
234
238 JxlAnimationHeader animation;
239
246 uint32_t intrinsic_xsize;
247
254 uint32_t intrinsic_ysize;
255
259 uint8_t padding[100];
260} JxlBasicInfo;
261
264 typedef struct {
267 JxlExtraChannelType type;
268
271 uint32_t bits_per_sample;
272
276 uint32_t exponent_bits_per_sample;
277
283 uint32_t dim_shift;
284
288 uint32_t name_length;
289
293 JXL_BOOL alpha_premultiplied;
294
298 float spot_color[4];
299
303 uint32_t cfa_channel;
304} JxlExtraChannelInfo;
305
306/* TODO(lode): add API to get the codestream header extensions. */
308 typedef struct {
310 uint64_t extensions;
311} JxlHeaderExtensions;
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 {
332 JxlBlendMode blendmode;
335 uint32_t source;
339 uint32_t alpha;
342 JXL_BOOL clamp;
343} JxlBlendInfo;
344
350 typedef struct {
357 JXL_BOOL have_crop;
358
361 int32_t crop_x0;
362
365 int32_t crop_y0;
366
369 uint32_t xsize;
370
373 uint32_t ysize;
374
378 JxlBlendInfo blend_info;
379
384 uint32_t save_as_reference;
385} JxlLayerInfo;
386
388 typedef struct {
392 uint32_t duration;
393
402 uint32_t timecode;
403
409 uint32_t name_length;
410
416 JXL_BOOL is_last;
417
420 JxlLayerInfo layer_info;
421} JxlFrameHeader;
422
423#if defined(__cplusplus) || defined(c_plusplus)
424}
425#endif
426
427#endif /* JXL_CODESTREAM_HEADER_H_ */
428
JxlExtraChannelType
JxlExtraChannelType
Definition: codestream_header.h:45
JXL_BOOL
#define JXL_BOOL
Definition: types.h:31
JxlBlendMode
JxlBlendMode
Definition: codestream_header.h:316
JxlOrientation
JxlOrientation
Definition: codestream_header.h:32
JxlAnimationHeader
Definition: codestream_header.h:78
JxlAnimationHeader::have_timecodes
JXL_BOOL have_timecodes
Definition: codestream_header.h:90
JxlAnimationHeader::tps_denominator
uint32_t tps_denominator
Definition: codestream_header.h:83
JxlAnimationHeader::num_loops
uint32_t num_loops
Definition: codestream_header.h:86
JxlAnimationHeader::tps_numerator
uint32_t tps_numerator
Definition: codestream_header.h:80
JxlBasicInfo
Definition: codestream_header.h:96
JxlBasicInfo::uses_original_profile
JXL_BOOL uses_original_profile
Definition: codestream_header.h:177
JxlBasicInfo::alpha_bits
uint32_t alpha_bits
Definition: codestream_header.h:216
JxlBasicInfo::ysize
uint32_t ysize
Definition: codestream_header.h:117
JxlBasicInfo::intrinsic_ysize
uint32_t intrinsic_ysize
Definition: codestream_header.h:254
JxlBasicInfo::min_nits
float min_nits
Definition: codestream_header.h:145
JxlBasicInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:228
JxlBasicInfo::relative_to_max_display
JXL_BOOL relative_to_max_display
Definition: codestream_header.h:149
JxlBasicInfo::have_animation
JXL_BOOL have_animation
Definition: codestream_header.h:187
JxlBasicInfo::orientation
JxlOrientation orientation
Definition: codestream_header.h:192
JxlBasicInfo::alpha_exponent_bits
uint32_t alpha_exponent_bits
Definition: codestream_header.h:222
JxlBasicInfo::bits_per_sample
uint32_t bits_per_sample
Definition: codestream_header.h:121
JxlBasicInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:129
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:246
JxlBasicInfo::xsize
uint32_t xsize
Definition: codestream_header.h:113
JxlBasicInfo::num_extra_channels
uint32_t num_extra_channels
Definition: codestream_header.h:210
JxlBasicInfo::have_preview
JXL_BOOL have_preview
Definition: codestream_header.h:182
JxlBasicInfo::preview
JxlPreviewHeader preview
Definition: codestream_header.h:233
JxlBasicInfo::linear_below
float linear_below
Definition: codestream_header.h:156
JxlBasicInfo::animation
JxlAnimationHeader animation
Definition: codestream_header.h:238
JxlBasicInfo::have_container
JXL_BOOL have_container
Definition: codestream_header.h:109
JxlBasicInfo::intensity_target
float intensity_target
Definition: codestream_header.h:139
JxlBlendInfo
Definition: codestream_header.h:329
JxlBlendInfo::blendmode
JxlBlendMode blendmode
Definition: codestream_header.h:332
JxlBlendInfo::source
uint32_t source
Definition: codestream_header.h:335
JxlBlendInfo::alpha
uint32_t alpha
Definition: codestream_header.h:339
JxlBlendInfo::clamp
JXL_BOOL clamp
Definition: codestream_header.h:342
JxlExtraChannelInfo
Definition: codestream_header.h:264
JxlExtraChannelInfo::type
JxlExtraChannelType type
Definition: codestream_header.h:267
JxlExtraChannelInfo::cfa_channel
uint32_t cfa_channel
Definition: codestream_header.h:303
JxlExtraChannelInfo::bits_per_sample
uint32_t bits_per_sample
Definition: codestream_header.h:271
JxlExtraChannelInfo::dim_shift
uint32_t dim_shift
Definition: codestream_header.h:283
JxlExtraChannelInfo::name_length
uint32_t name_length
Definition: codestream_header.h:288
JxlExtraChannelInfo::exponent_bits_per_sample
uint32_t exponent_bits_per_sample
Definition: codestream_header.h:276
JxlExtraChannelInfo::alpha_premultiplied
JXL_BOOL alpha_premultiplied
Definition: codestream_header.h:293
JxlFrameHeader
Definition: codestream_header.h:388
JxlFrameHeader::layer_info
JxlLayerInfo layer_info
Definition: codestream_header.h:420
JxlFrameHeader::is_last
JXL_BOOL is_last
Definition: codestream_header.h:416
JxlFrameHeader::name_length
uint32_t name_length
Definition: codestream_header.h:409
JxlFrameHeader::duration
uint32_t duration
Definition: codestream_header.h:392
JxlFrameHeader::timecode
uint32_t timecode
Definition: codestream_header.h:402
JxlHeaderExtensions
Definition: codestream_header.h:308
JxlHeaderExtensions::extensions
uint64_t extensions
Definition: codestream_header.h:310
JxlLayerInfo
Definition: codestream_header.h:350
JxlLayerInfo::xsize
uint32_t xsize
Definition: codestream_header.h:369
JxlLayerInfo::save_as_reference
uint32_t save_as_reference
Definition: codestream_header.h:384
JxlLayerInfo::blend_info
JxlBlendInfo blend_info
Definition: codestream_header.h:378
JxlLayerInfo::have_crop
JXL_BOOL have_crop
Definition: codestream_header.h:357
JxlLayerInfo::ysize
uint32_t ysize
Definition: codestream_header.h:373
JxlLayerInfo::crop_x0
int32_t crop_x0
Definition: codestream_header.h:361
JxlLayerInfo::crop_y0
int32_t crop_y0
Definition: codestream_header.h:365
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.