codestream_header.h
Go to the documentation of this file.
/* Copyright (c) the JPEG XL Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
#ifndef JXL_CODESTREAM_HEADER_H_
#define JXL_CODESTREAM_HEADER_H_
#include <stddef.h>
#include <stdint.h>
#include "jxl/types.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
typedef enum {
JXL_ORIENT_IDENTITY = 1,
JXL_ORIENT_FLIP_HORIZONTAL = 2,
JXL_ORIENT_ROTATE_180 = 3,
JXL_ORIENT_FLIP_VERTICAL = 4,
JXL_ORIENT_TRANSPOSE = 5,
JXL_ORIENT_ROTATE_90_CW = 6,
JXL_ORIENT_ANTI_TRANSPOSE = 7,
JXL_ORIENT_ROTATE_90_CCW = 8,
} JxlOrientation;
typedef enum {
JXL_CHANNEL_ALPHA,
JXL_CHANNEL_DEPTH,
JXL_CHANNEL_SPOT_COLOR,
JXL_CHANNEL_SELECTION_MASK,
JXL_CHANNEL_BLACK,
JXL_CHANNEL_CFA,
JXL_CHANNEL_THERMAL,
JXL_CHANNEL_RESERVED0,
JXL_CHANNEL_RESERVED1,
JXL_CHANNEL_RESERVED2,
JXL_CHANNEL_RESERVED3,
JXL_CHANNEL_RESERVED4,
JXL_CHANNEL_RESERVED5,
JXL_CHANNEL_RESERVED6,
JXL_CHANNEL_RESERVED7,
JXL_CHANNEL_UNKNOWN,
JXL_CHANNEL_OPTIONAL
} JxlExtraChannelType;
typedef struct {
uint32_t xsize;
uint32_t ysize;
} JxlPreviewHeader;
typedef struct {
uint32_t xsize;
uint32_t ysize;
} JxlIntrinsicSizeHeader;
typedef struct {
uint32_t tps_numerator;
uint32_t tps_denominator;
uint32_t num_loops;
JXL_BOOL have_timecodes;
} JxlAnimationHeader;
typedef struct {
/* TODO(lode): need additional fields for (transcoded) JPEG? For reusable
* fields orientation must be read from Exif APP1. For has_icc_profile: must
* look up where ICC profile is guaranteed to be in a JPEG file to be able to
* indicate this. */
/* TODO(lode): make struct packed, and/or make this opaque struct with getter
* functions (still separate struct from opaque decoder) */
JXL_BOOL have_container;
uint32_t xsize;
uint32_t ysize;
uint32_t bits_per_sample;
uint32_t exponent_bits_per_sample;
float intensity_target;
float min_nits;
JXL_BOOL relative_to_max_display;
float linear_below;
JXL_BOOL uses_original_profile;
JXL_BOOL have_preview;
JXL_BOOL have_animation;
JxlOrientation orientation;
uint32_t num_color_channels;
uint32_t num_extra_channels;
uint32_t alpha_bits;
uint32_t alpha_exponent_bits;
JXL_BOOL alpha_premultiplied;
JxlPreviewHeader preview;
JxlAnimationHeader animation;
uint32_t intrinsic_xsize;
uint32_t intrinsic_ysize;
uint8_t padding[100];
} JxlBasicInfo;
typedef struct {
JxlExtraChannelType type;
uint32_t bits_per_sample;
uint32_t exponent_bits_per_sample;
uint32_t dim_shift;
uint32_t name_length;
JXL_BOOL alpha_premultiplied;
float spot_color[4];
uint32_t cfa_channel;
} JxlExtraChannelInfo;
/* TODO(lode): add API to get the codestream header extensions. */
typedef struct {
uint64_t extensions;
} JxlHeaderExtensions;
typedef enum {
JXL_BLEND_REPLACE = 0,
JXL_BLEND_ADD = 1,
JXL_BLEND_BLEND = 2,
JXL_BLEND_MULADD = 3,
JXL_BLEND_MUL = 4,
} JxlBlendMode;
typedef struct {
JxlBlendMode blendmode;
uint32_t source;
uint32_t alpha;
JXL_BOOL clamp;
} JxlBlendInfo;
typedef struct {
JXL_BOOL have_crop;
int32_t crop_x0;
int32_t crop_y0;
uint32_t xsize;
uint32_t ysize;
JxlBlendInfo blend_info;
uint32_t save_as_reference;
} JxlLayerInfo;
typedef struct {
uint32_t duration;
uint32_t timecode;
uint32_t name_length;
JXL_BOOL is_last;
JxlLayerInfo layer_info;
} JxlFrameHeader;
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif /* JXL_CODESTREAM_HEADER_H_ */
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.