LIBJXL
Loading...
Searching...
No Matches
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> // TODO(eustas): remove before v1.0
24#include <stddef.h>
25#include <stdint.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
38JXL_EXPORT uint32_t JxlDecoderVersion(void);
39
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
328
369
393JXL_EXPORT void JxlDecoderRewind(JxlDecoder* dec);
394
413JXL_EXPORT void JxlDecoderSkipFrames(JxlDecoder* dec, size_t amount);
414
428
441JXL_EXPORT JxlDecoderStatus
443 void* parallel_runner_opaque);
444
460JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder* dec);
461
475 int events_wanted);
476
508JXL_EXPORT JxlDecoderStatus
510
527JXL_EXPORT JxlDecoderStatus
529
540JXL_EXPORT JxlDecoderStatus
542
557 JXL_BOOL coalescing);
558
600
616 const uint8_t* data,
617 size_t size);
618
638JXL_EXPORT size_t JxlDecoderReleaseInput(JxlDecoder* dec);
639
658JXL_EXPORT void JxlDecoderCloseInput(JxlDecoder* dec);
659
672 JxlBasicInfo* info);
673
687 const JxlDecoder* dec, size_t index, JxlExtraChannelInfo* info);
688
704 size_t index,
705 char* name,
706 size_t size);
707
721
771 const JxlDecoder* dec, JxlColorProfileTarget target,
772 JxlColorEncoding* color_encoding);
773
797 const JxlDecoder* dec, JxlColorProfileTarget target, size_t* size);
798
815 const JxlDecoder* dec, JxlColorProfileTarget target, uint8_t* icc_profile,
816 size_t size);
817
829 JxlDecoder* dec, const JxlColorEncoding* color_encoding);
830
842 JxlDecoder* dec, float desired_intensity_target);
843
886 JxlDecoder* dec, const JxlColorEncoding* color_encoding,
887 const uint8_t* icc_data, size_t icc_size);
888
902 JxlCmsInterface cms);
903// TODO(firsching): add a function JxlDecoderSetDefaultCms() for setting a
904// default in case libjxl is build with a CMS.
905
919 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
920
937 JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
938
952 JxlFrameHeader* header);
953
967 char* name, size_t size);
968
982 const JxlDecoder* dec, size_t index, JxlBlendInfo* blend_info);
983
1000 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
1001
1019 JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
1020
1037typedef void (*JxlImageOutCallback)(void* opaque, size_t x, size_t y,
1038 size_t num_pixels, const void* pixels);
1039
1052typedef void* (*JxlImageOutInitCallback)(void* init_opaque, size_t num_threads,
1053 size_t num_pixels_per_thread);
1054
1071typedef void (*JxlImageOutRunCallback)(void* run_opaque, size_t thread_id,
1072 size_t x, size_t y, size_t num_pixels,
1073 const void* pixels);
1074
1082typedef void (*JxlImageOutDestroyCallback)(void* run_opaque);
1083
1126JXL_EXPORT JxlDecoderStatus
1128 JxlImageOutCallback callback, void* opaque);
1129
1150 JxlDecoder* dec, const JxlPixelFormat* format,
1151 JxlImageOutInitCallback init_callback, JxlImageOutRunCallback run_callback,
1152 JxlImageOutDestroyCallback destroy_callback, void* init_opaque);
1153
1170 const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size,
1171 uint32_t index);
1172
1203JXL_EXPORT JxlDecoderStatus
1205 void* buffer, size_t size, uint32_t index);
1206
1226 uint8_t* data, size_t size);
1227
1245
1269 uint8_t* data, size_t size);
1270
1288
1310 JXL_BOOL decompress);
1311
1378 JxlBoxType type,
1379 JXL_BOOL decompressed);
1380
1391 uint64_t* size);
1392
1407 uint64_t* size);
1408
1420JXL_EXPORT JxlDecoderStatus
1422
1432
1450
1463JXL_EXPORT JxlDecoderStatus
1465
1466#ifdef __cplusplus
1467}
1468#endif
1469
1470#endif /* JXL_DECODE_H_ */
1471
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...
char JxlBoxType[4]
Definition types.h:146
#define JXL_BOOL
Definition types.h:29
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_EXPORT JxlDecoderStatus JxlDecoderSetMultithreadedImageOutCallback(JxlDecoder *dec, const JxlPixelFormat *format, JxlImageOutInitCallback init_callback, JxlImageOutRunCallback run_callback, JxlImageOutDestroyCallback destroy_callback, void *init_opaque)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsEncodedProfile(const JxlDecoder *dec, JxlColorProfileTarget target, JxlColorEncoding *color_encoding)
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 JxlDecoderStatus JxlDecoderGetICCProfileSize(const JxlDecoder *dec, JxlColorProfileTarget target, size_t *size)
JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetCms(JxlDecoder *dec, JxlCmsInterface cms)
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 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)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile(const JxlDecoder *dec, JxlColorProfileTarget target, uint8_t *icc_profile, size_t size)
JxlColorProfileTarget
Definition decode.h:713
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 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)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxSizeContents(const JxlDecoder *dec, uint64_t *size)
void *(* JxlImageOutInitCallback)(void *init_opaque, size_t num_threads, size_t num_pixels_per_thread)
Definition decode.h:1052
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:1071
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:1037
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 JxlDecoderSetKeepOrientation(JxlDecoder *dec, JXL_BOOL skip_reorientation)
void(* JxlImageOutDestroyCallback)(void *run_opaque)
Definition decode.h:1082
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
JxlProgressiveDetail
Definition decode.h:337
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:719
@ JXL_COLOR_PROFILE_TARGET_ORIGINAL
Definition decode.h:716
@ 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:266
@ JXL_DEC_JPEG_NEED_MORE_OUTPUT
Definition decode.h:184
@ JXL_DEC_BASIC_INFO
Definition decode.h:199
@ JXL_DEC_FRAME_PROGRESSION
Definition decode.h:321
@ JXL_DEC_BOX_COMPLETE
Definition decode.h:326
@ JXL_DEC_ERROR
Definition decode.h:141
@ JXL_DEC_NEED_IMAGE_OUT_BUFFER
Definition decode.h:177
@ JXL_DEC_FULL_IMAGE
Definition decode.h:253
@ JXL_DEC_COLOR_ENCODING
Definition decode.h:209
@ JXL_DEC_SUCCESS
Definition decode.h:136
@ JXL_DEC_PREVIEW_IMAGE
Definition decode.h:219
@ JXL_DEC_BOX_NEED_MORE_OUTPUT
Definition decode.h:190
@ JXL_DEC_BOX
Definition decode.h:304
@ 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:240
@ kDCGroups
Definition decode.h:363
@ kDCProgressive
Definition decode.h:359
@ kFrames
Definition decode.h:341
@ kPasses
Definition decode.h:355
@ kDC
Definition decode.h:345
@ kGroups
Definition decode.h:367
@ kLastPasses
Definition decode.h:350
JxlParallelRetCode(* JxlParallelRunner)(void *runner_opaque, void *jpegxl_opaque, JxlParallelRunInit init, JxlParallelRunFunction func, uint32_t start_range, uint32_t end_range)
Definition parallel_runner.h:127
Abstraction functions used by JPEG XL to allocate memory.
Definition codestream_header.h:95
Definition types.h:133
Definition codestream_header.h:330
Definition cms_interface.h:227
Definition color_encoding.h:114
Definition codestream_header.h:265
Definition codestream_header.h:391
Definition memory_manager.h:51
Definition types.h:80
Data types for the JPEG XL API, for both encoding and decoding.