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 <stddef.h>
17 #include <stdint.h>
18 
19 #include "jxl/cms_interface.h"
20 #include "jxl/codestream_header.h"
21 #include "jxl/color_encoding.h"
22 #include "jxl/jxl_export.h"
23 #include "jxl/memory_manager.h"
24 #include "jxl/parallel_runner.h"
25 #include "jxl/types.h"
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
38 JXL_EXPORT uint32_t JxlDecoderVersion(void);
39 
42 typedef enum {
46 
49 
54 
59 } JxlSignature;
60 
75 JXL_EXPORT JxlSignature JxlSignatureCheck(const uint8_t* buf, size_t len);
76 
83 typedef struct JxlDecoderStruct JxlDecoder;
84 
97 JXL_EXPORT JxlDecoder* JxlDecoderCreate(const JxlMemoryManager* memory_manager);
98 
106 JXL_EXPORT void JxlDecoderReset(JxlDecoder* dec);
107 
113 JXL_EXPORT void JxlDecoderDestroy(JxlDecoder* dec);
114 
121 typedef enum {
126 
131 
142 
150 
160 
167 
174 
180 
185 
191 
198 
205 
222  JXL_DEC_FRAME = 0x400,
223 
236 
245 
255 
286  JXL_DEC_BOX = 0x4000,
287 
301 
313 JXL_EXPORT void JxlDecoderRewind(JxlDecoder* dec);
314 
331 JXL_EXPORT void JxlDecoderSkipFrames(JxlDecoder* dec, size_t amount);
332 
344 JXL_EXPORT JxlDecoderStatus
346 
359 JXL_EXPORT JxlDecoderStatus
361  void* parallel_runner_opaque);
362 
378 JXL_EXPORT size_t JxlDecoderSizeHintBasicInfo(const JxlDecoder* dec);
379 
393  int events_wanted);
394 
427 JXL_EXPORT JxlDecoderStatus
429 
440 JXL_EXPORT JxlDecoderStatus
442 
457  JXL_BOOL coalescing);
458 
503 
518  const uint8_t* data,
519  size_t size);
520 
538 JXL_EXPORT size_t JxlDecoderReleaseInput(JxlDecoder* dec);
539 
555 JXL_EXPORT void JxlDecoderCloseInput(JxlDecoder* dec);
556 
569  JxlBasicInfo* info);
570 
584  const JxlDecoder* dec, size_t index, JxlExtraChannelInfo* info);
585 
601  size_t index,
602  char* name,
603  size_t size);
604 
610 typedef enum {
614 
618 
657  const JxlDecoder* dec, const JxlPixelFormat* format,
658  JxlColorProfileTarget target, JxlColorEncoding* color_encoding);
659 
683 JXL_EXPORT JxlDecoderStatus
685  JxlColorProfileTarget target, size_t* size);
686 
705  const JxlDecoder* dec, const JxlPixelFormat* format,
706  JxlColorProfileTarget target, uint8_t* icc_profile, size_t size);
707 
747  JxlDecoder* dec, const JxlColorEncoding* color_encoding);
748 
761  const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
762 
779  JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
780 
794  JxlFrameHeader* header);
795 
809  char* name, size_t size);
810 
824  const JxlDecoder* dec, size_t index, JxlBlendInfo* blend_info);
825 
840 JXL_EXPORT JXL_DEPRECATED JxlDecoderStatus JxlDecoderDCOutBufferSize(
841  const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
842 
861 JXL_EXPORT JXL_DEPRECATED JxlDecoderStatus JxlDecoderSetDCOutBuffer(
862  JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
863 
880  const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size);
881 
899  JxlDecoder* dec, const JxlPixelFormat* format, void* buffer, size_t size);
900 
917 typedef void (*JxlImageOutCallback)(void* opaque, size_t x, size_t y,
918  size_t num_pixels, const void* pixels);
919 
962 JXL_EXPORT JxlDecoderStatus
964  JxlImageOutCallback callback, void* opaque);
965 
982  const JxlDecoder* dec, const JxlPixelFormat* format, size_t* size,
983  uint32_t index);
984 
1014 JXL_EXPORT JxlDecoderStatus
1016  void* buffer, size_t size, uint32_t index);
1017 
1036  uint8_t* data, size_t size);
1037 
1054 JXL_EXPORT size_t JxlDecoderReleaseJPEGBuffer(JxlDecoder* dec);
1055 
1077  uint8_t* data, size_t size);
1078 
1095 JXL_EXPORT size_t JxlDecoderReleaseBoxBuffer(JxlDecoder* dec);
1096 
1118  JXL_BOOL decompress);
1119 
1134  JxlBoxType type,
1135  JXL_BOOL decompressed);
1136 
1154  uint64_t* size);
1155 
1168  uint32_t detail);
1169 
1187 
1188 #if defined(__cplusplus) || defined(c_plusplus)
1189 }
1190 #endif
1191 
1192 #endif /* JXL_DECODE_H_ */
1193 
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:116
#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 size_t JxlDecoderReleaseInput(JxlDecoder *dec)
JXL_EXPORT JXL_DEPRECATED JxlDecoderStatus JxlDecoderSetDCOutBuffer(JxlDecoder *dec, const JxlPixelFormat *format, void *buffer, size_t size)
JXL_EXPORT JxlDecoderStatus JxlDecoderPreviewOutBufferSize(const JxlDecoder *dec, const JxlPixelFormat *format, size_t *size)
JXL_EXPORT void JxlDecoderSetProgressiveDetail(JxlDecoder *dec, uint32_t detail)
JXL_EXPORT void JxlDecoderRewind(JxlDecoder *dec)
JXL_EXPORT JxlDecoderStatus JxlDecoderDefaultPixelFormat(const JxlDecoder *dec, JxlPixelFormat *format)
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 JxlDecoderSetImageOutBuffer(JxlDecoder *dec, const JxlPixelFormat *format, void *buffer, size_t size)
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 JxlDecoderSetDecompressBoxes(JxlDecoder *dec, JXL_BOOL decompress)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsICCProfile(const JxlDecoder *dec, const JxlPixelFormat *format, JxlColorProfileTarget target, uint8_t *icc_profile, size_t size)
JXL_EXPORT size_t JxlDecoderReleaseJPEGBuffer(JxlDecoder *dec)
JxlColorProfileTarget
Definition: decode.h:610
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 JxlDecoderSetPreferredColorProfile(JxlDecoder *dec, const JxlColorEncoding *color_encoding)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetICCProfileSize(const JxlDecoder *dec, const JxlPixelFormat *format, JxlColorProfileTarget target, size_t *size)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetImageOutCallback(JxlDecoder *dec, const JxlPixelFormat *format, JxlImageOutCallback callback, void *opaque)
JXL_EXPORT JXL_DEPRECATED JxlDecoderStatus JxlDecoderDCOutBufferSize(const JxlDecoder *dec, const JxlPixelFormat *format, size_t *size)
void(* JxlImageOutCallback)(void *opaque, size_t x, size_t y, size_t num_pixels, const void *pixels)
Definition: decode.h:917
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBoxType(JxlDecoder *dec, JxlBoxType type, JXL_BOOL decompressed)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetBasicInfo(const JxlDecoder *dec, JxlBasicInfo *info)
JXL_EXPORT JxlDecoderStatus JxlDecoderSetKeepOrientation(JxlDecoder *dec, JXL_BOOL skip_reorientation)
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 JxlDecoder * JxlDecoderCreate(const JxlMemoryManager *memory_manager)
JxlDecoderStatus
Definition: decode.h:121
struct JxlDecoderStruct JxlDecoder
Definition: decode.h:83
JXL_EXPORT JxlDecoderStatus JxlDecoderSetRenderSpotcolors(JxlDecoder *dec, JXL_BOOL render_spotcolors)
JXL_EXPORT JxlDecoderStatus JxlDecoderGetColorAsEncodedProfile(const JxlDecoder *dec, const JxlPixelFormat *format, JxlColorProfileTarget target, JxlColorEncoding *color_encoding)
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:616
@ JXL_COLOR_PROFILE_TARGET_ORIGINAL
Definition: decode.h:613
@ 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:254
@ JXL_DEC_JPEG_NEED_MORE_OUTPUT
Definition: decode.h:173
@ JXL_DEC_BASIC_INFO
Definition: decode.h:184
@ JXL_DEC_EXTENSIONS
Definition: decode.h:190
@ JXL_DEC_FRAME_PROGRESSION
Definition: decode.h:299
@ JXL_DEC_DC_IMAGE
Definition: decode.h:235
@ JXL_DEC_ERROR
Definition: decode.h:130
@ JXL_DEC_NEED_IMAGE_OUT_BUFFER
Definition: decode.h:166
@ JXL_DEC_FULL_IMAGE
Definition: decode.h:244
@ JXL_DEC_COLOR_ENCODING
Definition: decode.h:197
@ JXL_DEC_SUCCESS
Definition: decode.h:125
@ JXL_DEC_PREVIEW_IMAGE
Definition: decode.h:204
@ JXL_DEC_BOX_NEED_MORE_OUTPUT
Definition: decode.h:179
@ JXL_DEC_BOX
Definition: decode.h:286
@ JXL_DEC_NEED_DC_OUT_BUFFER
Definition: decode.h:159
@ JXL_DEC_NEED_MORE_INPUT
Definition: decode.h:141
@ JXL_DEC_NEED_PREVIEW_OUT_BUFFER
Definition: decode.h:149
@ JXL_DEC_FRAME
Definition: decode.h:222
Abstraction functions used by JPEG XL to allocate memory.
Definition: codestream_header.h:106
Definition: codestream_header.h:333
Definition: color_encoding.h:118
Definition: codestream_header.h:268
Definition: codestream_header.h:392
Definition: memory_manager.h:51
Definition: types.h:87
Data types for the JPEG XL API, for both encoding and decoding.