LIBJXL
decode.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
13#ifndef JXL_DECODE_H_
14#define JXL_DECODE_H_
15
16#include <jxl/cms_interface.h>
18#include <jxl/color_encoding.h>
19#include <jxl/jxl_export.h>
20#include <jxl/memory_manager.h>
21#include <jxl/parallel_runner.h>
22#include <jxl/types.h>
23#include <jxl/version.h>
24#include <stddef.h>
25#include <stdint.h>
26
27#if defined(__cplusplus) || defined(c_plusplus)
28extern "C" {
29#endif
30
38JXL_EXPORT uint32_t JxlDecoderVersion(void);
39
42typedef enum {
46
49
54
60
76JXL_EXPORT JxlSignature JxlSignatureCheck(const uint8_t* buf, size_t len);
77
84typedef struct JxlDecoderStruct JxlDecoder;
85
98JXL_EXPORT JxlDecoder* JxlDecoderCreate(const JxlMemoryManager* memory_manager);
99
107JXL_EXPORT void JxlDecoderReset(JxlDecoder* dec);
108
114JXL_EXPORT void JxlDecoderDestroy(JxlDecoder* dec);
115
122typedef enum {
137
142
158
169
178
185
191
200
210
220
230
251
264
277
313 JXL_DEC_BOX = 0x4000,
314
332
356JXL_EXPORT void JxlDecoderRewind(JxlDecoder* dec);
357
376JXL_EXPORT void JxlDecoderSkipFrames(JxlDecoder* dec, size_t amount);
377
391
406JXL_DEPRECATED JXL_EXPORT JxlDecoderStatus
408
421JXL_EXPORT JxlDecoderStatus
423 void* parallel_runner_opaque);
424
440JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder* dec);
441
455 int events_wanted);
456
488JXL_EXPORT JxlDecoderStatus
490
506JXL_EXPORT JxlDecoderStatus
508
519JXL_EXPORT JxlDecoderStatus
521
536 JXL_BOOL coalescing);
537
579
595 const uint8_t* data,
596 size_t size);
597
617JXL_EXPORT size_t JxlDecoderReleaseInput(JxlDecoder* dec);
618
637JXL_EXPORT void JxlDecoderCloseInput(JxlDecoder* dec);
638
651 JxlBasicInfo* info);
652
666 const JxlDecoder* dec, size_t index, JxlExtraChannelInfo* info);
667
683 size_t index,
684 char* name,
685 size_t size);
686
692typedef enum {
696
700
751 const JxlDecoder* dec, const JxlPixelFormat* unused_format,
752 JxlColorProfileTarget target, JxlColorEncoding* color_encoding);
753
778 const JxlDecoder* dec, const JxlPixelFormat* unused_format,
779 JxlColorProfileTarget target, size_t* size);
780
798 const JxlDecoder* dec, const JxlPixelFormat* unused_format,
799 JxlColorProfileTarget target, uint8_t* icc_profile, size_t size);
800
812 JxlDecoder* dec, const JxlColorEncoding* color_encoding);
813
825 JxlDecoder* dec, float desired_intensity_target);
826
869 JxlDecoder* dec, const JxlColorEncoding* color_encoding,
870 const uint8_t* icc_data, size_t icc_size);
871
884JXL_EXPORT void JxlDecoderSetCms(JxlDecoder* dec, JxlCmsInterface cms);
885// TODO(firsching): add a function JxlDecoderSetDefaultCms() for setting a
886// default in case libjxl is build with a CMS.
887
901 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
902
919 JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
920
934 JxlFrameHeader* header);
935
949 char* name, size_t size);
950
964 const JxlDecoder* dec, size_t index, JxlBlendInfo* blend_info);
965
982 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
983
1001 JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
1002
1019typedef void (*JxlImageOutCallback)(void* opaque, size_t x, size_t y,
1020 size_t num_pixels, const void* pixels);
1021
1034typedef void* (*JxlImageOutInitCallback)(void* init_opaque, size_t num_threads,
1035 size_t num_pixels_per_thread);
1036
1053typedef void (*JxlImageOutRunCallback)(void* run_opaque, size_t thread_id,
1054 size_t x, size_t y, size_t num_pixels,
1055 const void* pixels);
1056
1064typedef void (*JxlImageOutDestroyCallback)(void* run_opaque);
1065
1108JXL_EXPORT JxlDecoderStatus
1110 JxlImageOutCallback callback, void* opaque);
1111
1132 JxlDecoder* dec, const JxlPixelFormat* format,
1133 JxlImageOutInitCallback init_callback, JxlImageOutRunCallback run_callback,
1134 JxlImageOutDestroyCallback destroy_callback, void* init_opaque);
1135
1152 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size,
1153 uint32_t index);
1154
1185JXL_EXPORT JxlDecoderStatus
1187 void* buffer, size_t size, uint32_t index);
1188
1208 uint8_t* data, size_t size);
1209
1227
1251 uint8_t* data, size_t size);
1252
1270
1292 JXL_BOOL decompress);
1293
1360 JxlBoxType type,
1361 JXL_BOOL decompressed);
1362
1381 uint64_t* size);
1382
1394JXL_EXPORT JxlDecoderStatus
1396
1406
1424
1437JXL_EXPORT JxlDecoderStatus
1439
1440#if defined(__cplusplus) || defined(c_plusplus)
1441}
1442#endif
1443
1444#endif /* JXL_DECODE_H_ */
1445
Interface to allow the injection of different color management systems (CMSes, also called color mana...
Definitions of structs and enums for the metadata from the JPEG XL codestream headers (signature,...
Color Encoding definitions used by JPEG XL. All CIE units are for the standard 1931 2 degree observer...
JxlParallelRetCode(* JxlParallelRunner)(void *runner_opaque, void *jpegxl_opaque, JxlParallelRunInit init, JxlParallelRunFunction func, uint32_t start_range, uint32_t end_range)
Definition: parallel_runner.h:119
char JxlBoxType[4]
Definition: types.h:151
#define JXL_BOOL
Definition: types.h:30
JxlProgressiveDetail
Definition: types.h:161
JXL_EXPORT size_t JxlDecoderReleaseBoxBuffer(JxlDecoder *dec)
JXL_EXPORT void JxlDecoderSkipFrames(JxlDecoder *dec, size_t amount)
JXL_EXPORT uint32_t JxlDecoderVersion(void)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetOutputColorProfile(JxlDecoder *dec, const JxlColorEncoding *color_encoding, const uint8_t *icc_data, size_t icc_size)
JXL_EXPORT size_t JxlDecoderReleaseInput(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize(const JxlDecoder *dec, const JxlPixelFormat *format, size_t *size)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutBitDepth(JxlDecoder *dec, const JxlBitDepth *bit_depth)
JXL_EXPORT void JxlDecoderRewind(JxlDecoder *dec)
JXL_DEPRECATED JXL_EXPORT JxlDecoderStatus JxlDecoderDefaultPixelFormat(const JxlDecoder *dec, JxlPixelFormat *format)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetMultithreadedImageOutCallback(JxlDecoder *dec, const JxlPixelFormat *format, JxlImageOutInitCallback init_callback, JxlImageOutRunCallback run_callback, JxlImageOutDestroyCallback destroy_callback, void *init_opaque)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetDesiredIntensityTarget(JxlDecoder *dec, float desired_intensity_target)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreviewOutBuffer(JxlDecoder *dec, const JxlPixelFormat *format, void *buffer, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetFrameName(const JxlDecoder *dec, char *name, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelName(const JxlDecoder *dec, size_t index, char *name, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetCoalescing(JxlDecoder *dec, JXL_BOOL coalescing)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetInput(JxlDecoder *dec, const uint8_t *data, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxSizeRaw(const JxlDecoder *dec, uint64_t *size)
JXL_EXPORT void JxlDecoderCloseInput(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetFrameHeader(const JxlDecoder *dec, JxlFrameHeader *header)
JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsEncodedProfile(const JxlDecoder *dec, const JxlPixelFormat *unused_format, JxlColorProfileTarget target, JxlColorEncoding *color_encoding)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutBuffer(JxlDecoder *dec, const JxlPixelFormat *format, void *buffer, size_t size)
JXL_EXPORT size_t JxlDecoderGetIntendedDownsamplingRatio(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderImageOutBufferSize(const JxlDecoder *dec, const JxlPixelFormat *format, size_t *size)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetICCProfileSize(const JxlDecoder *dec, const JxlPixelFormat *unused_format, JxlColorProfileTarget target, size_t *size)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelInfo(const JxlDecoder *dec, size_t index, JxlExtraChannelInfo *info)
JXL_EXPORT JxlDecoderStatus JxlDecoderSkipCurrentFrame(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetDecompressBoxes(JxlDecoder *dec, JXL_BOOL decompress)
JXL_EXPORT JxlDecoder * JxlDecoderCreate(const JxlMemoryManager *memory_manager)
JXL_EXPORT size_t JxlDecoderReleaseJPEGBuffer(JxlDecoder *dec)
JxlColorProfileTarget
Definition: decode.h:692
JXL_EXPORT JxlDecoderStatus JxlDecoderExtraChannelBufferSize(const JxlDecoder *dec, const JxlPixelFormat *format, size_t *size, uint32_t index)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetBoxBuffer(JxlDecoder *dec, uint8_t *data, size_t size)
JxlSignature
Definition: decode.h:42
JXL_EXPORT void JxlDecoderSetCms(JxlDecoder *dec, JxlCmsInterface cms)
JXL_EXPORT JxlDecoderStatus JxlDecoderSubscribeEvents(JxlDecoder *dec, int events_wanted)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetParallelRunner(JxlDecoder *dec, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)
JXL_EXPORT JxlDecoderStatus JxlDecoderProcessInput(JxlDecoder *dec)
void *(* JxlImageOutInitCallback)(void *init_opaque, size_t num_threads, size_t num_pixels_per_thread)
Definition: decode.h:1034
void(* JxlImageOutRunCallback)(void *run_opaque, size_t thread_id, size_t x, size_t y, size_t num_pixels, const void *pixels)
Definition: decode.h:1053
JXL_EXPORT JxlDecoderStatus JxlDecoderSetPreferredColorProfile(JxlDecoder *dec, const JxlColorEncoding *color_encoding)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutCallback(JxlDecoder *dec, const JxlPixelFormat *format, JxlImageOutCallback callback, void *opaque)
void(* JxlImageOutCallback)(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels)
Definition: decode.h:1019
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxType(JxlDecoder *dec, JxlBoxType type, JXL_BOOL decompressed)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBasicInfo(const JxlDecoder *dec, JxlBasicInfo *info)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetUnpremultiplyAlpha(JxlDecoder *dec, JXL_BOOL unpremul_alpha)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile(const JxlDecoder *dec, const JxlPixelFormat *unused_format, JxlColorProfileTarget target, uint8_t *icc_profile, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetKeepOrientation(JxlDecoder *dec, JXL_BOOL skip_reorientation)
void(* JxlImageOutDestroyCallback)(void *run_opaque)
Definition: decode.h:1064
JXL_EXPORT JxlDecoderStatus JxlDecoderFlushImage(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetExtraChannelBlendInfo(const JxlDecoder *dec, size_t index, JxlBlendInfo *blend_info)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetJPEGBuffer(JxlDecoder *dec, uint8_t *data, size_t size)
JXL_EXPORT void JxlDecoderDestroy(JxlDecoder *dec)
JXL_EXPORT JxlSignature JxlSignatureCheck(const uint8_t *buf, size_t len)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetProgressiveDetail(JxlDecoder *dec, JxlProgressiveDetail detail)
JxlDecoderStatus
Definition: decode.h:122
struct JxlDecoderStruct JxlDecoder
Definition: decode.h:84
JXL_EXPORT JxlDecoderStatus JxlDecoderSetRenderSpotcolors(JxlDecoder *dec, JXL_BOOL render_spotcolors)
JXL_EXPORT void JxlDecoderReset(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetExtraChannelBuffer(JxlDecoder *dec, const JxlPixelFormat *format, void *buffer, size_t size, uint32_t index)
@ JXL_COLOR_PROFILE_TARGET_DATA
Definition: decode.h:698
@ JXL_COLOR_PROFILE_TARGET_ORIGINAL
Definition: decode.h:695
@ JXL_SIG_NOT_ENOUGH_BYTES
Definition: decode.h:45
@ JXL_SIG_INVALID
Definition: decode.h:48
@ JXL_SIG_CONTAINER
Definition: decode.h:58
@ JXL_SIG_CODESTREAM
Definition: decode.h:53
@ JXL_DEC_JPEG_RECONSTRUCTION
Definition: decode.h:276
@ JXL_DEC_JPEG_NEED_MORE_OUTPUT
Definition: decode.h:184
@ JXL_DEC_BASIC_INFO
Definition: decode.h:199
@ JXL_DEC_EXTENSIONS
Definition: decode.h:209
@ JXL_DEC_FRAME_PROGRESSION
Definition: decode.h:330
@ JXL_DEC_ERROR
Definition: decode.h:141
@ JXL_DEC_NEED_IMAGE_OUT_BUFFER
Definition: decode.h:177
@ JXL_DEC_FULL_IMAGE
Definition: decode.h:263
@ JXL_DEC_COLOR_ENCODING
Definition: decode.h:219
@ JXL_DEC_SUCCESS
Definition: decode.h:136
@ JXL_DEC_PREVIEW_IMAGE
Definition: decode.h:229
@ JXL_DEC_BOX_NEED_MORE_OUTPUT
Definition: decode.h:190
@ JXL_DEC_BOX
Definition: decode.h:313
@ JXL_DEC_NEED_MORE_INPUT
Definition: decode.h:157
@ JXL_DEC_NEED_PREVIEW_OUT_BUFFER
Definition: decode.h:168
@ JXL_DEC_FRAME
Definition: decode.h:250
Abstraction functions used by JPEG XL to allocate memory.
Definition: codestream_header.h:95
Definition: types.h:138
Definition: codestream_header.h:328
Definition: cms_interface.h:209
Definition: color_encoding.h:116
Definition: codestream_header.h:263
Definition: codestream_header.h:389
Definition: memory_manager.h:51
Definition: types.h:85
Data types for the JPEG XL API, for both encoding and decoding.