LIBJXL
encode.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_ENCODE_H_
14#define JXL_ENCODE_H_
15
16#include <jxl/cms_interface.h>
18#include <jxl/jxl_export.h>
19#include <jxl/memory_manager.h>
20#include <jxl/parallel_runner.h>
21#include <jxl/version.h>
22
23#if defined(__cplusplus) || defined(c_plusplus)
24extern "C" {
25#endif
26
34JXL_EXPORT uint32_t JxlEncoderVersion(void);
35
42typedef struct JxlEncoderStruct JxlEncoder;
43
52typedef struct JxlEncoderFrameSettingsStruct JxlEncoderFrameSettings;
53
57typedef enum {
62
66
70
72
78typedef enum {
82
86
91
96
100
106
112
114
121typedef enum {
128
134
142
149
160
167
173
178
183
188
193
199
204
210
216
221
226
232
238
244
250
256
261
266
273
282
286
293
299
307
312
323
330
337
342
344
357JXL_EXPORT JxlEncoder* JxlEncoderCreate(const JxlMemoryManager* memory_manager);
358
366JXL_EXPORT void JxlEncoderReset(JxlEncoder* enc);
367
373JXL_EXPORT void JxlEncoderDestroy(JxlEncoder* enc);
374
384JXL_EXPORT void JxlEncoderSetCms(JxlEncoder* enc, JxlCmsInterface cms);
385
398JXL_EXPORT JxlEncoderStatus
400 void* parallel_runner_opaque);
401
410
442 uint8_t** next_out,
443 size_t* avail_out);
444
478JXL_EXPORT JxlEncoderStatus
480 const JxlFrameHeader* frame_header);
481
494 JxlEncoderFrameSettings* frame_settings, size_t index,
495 const JxlBlendInfo* blend_info);
496
517 JxlEncoderFrameSettings* frame_settings, const char* frame_name);
518
533 JxlEncoderFrameSettings* frame_settings, const JxlBitDepth* bit_depth);
534
561JXL_EXPORT JxlEncoderStatus
563 const uint8_t* buffer, size_t size);
564
630 const JxlEncoderFrameSettings* frame_settings,
631 const JxlPixelFormat* pixel_format, const void* buffer, size_t size);
632
657 const JxlEncoderFrameSettings* frame_settings,
658 const JxlPixelFormat* pixel_format, const void* buffer, size_t size,
659 uint32_t index);
660
730 const JxlBoxType type,
731 const uint8_t* contents,
732 size_t size,
733 JXL_BOOL compress_box);
734
747
763JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder* enc);
764
777JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder* enc);
778
793JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder* enc);
794
808JXL_EXPORT JxlEncoderStatus
810
825 const uint8_t* icc_profile,
826 size_t size);
827
838
849JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader* frame_header);
850
858JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo* blend_info);
859
876 const JxlBasicInfo* info);
877
889 JxlExtraChannelInfo* info);
890
902 JxlEncoder* enc, size_t index, const JxlExtraChannelInfo* info);
903
919 size_t index,
920 const char* name,
921 size_t size);
922
939 int64_t value);
940
957 float value);
958
978 JXL_BOOL use_container);
979
994JXL_EXPORT JxlEncoderStatus
996
1032 int level);
1033
1054
1074 JxlEncoderFrameSettings* frame_settings, JXL_BOOL lossless);
1075
1091 JxlEncoderFrameSettings* frame_settings, float distance);
1092
1107 JxlEncoderFrameSettings* frame_settings, size_t index, float distance);
1108
1125 JxlEncoder* enc, const JxlEncoderFrameSettings* source);
1126
1133JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding* color_encoding,
1134 JXL_BOOL is_gray);
1135
1143 JxlColorEncoding* color_encoding, JXL_BOOL is_gray);
1144
1154
1155#if defined(__cplusplus) || defined(c_plusplus)
1156}
1157#endif
1158
1159#endif /* JXL_ENCODE_H_ */
1160
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,...
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:143
JxlExtraChannelType
Definition: codestream_header.h:44
#define JXL_BOOL
Definition: types.h:30
JXL_EXPORT int JxlEncoderGetRequiredCodestreamLevel(const JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetCodestreamLevel(JxlEncoder *enc, int level)
JXL_EXPORT JxlEncoderStatus JxlEncoderAddJPEGFrame(const JxlEncoderFrameSettings *frame_settings, const uint8_t *buffer, size_t size)
JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo *blend_info)
JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetParallelRunner(JxlEncoder *enc, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)
JXL_EXPORT JxlEncoderStatus JxlEncoderFrameSettingsSetOption(JxlEncoderFrameSettings *frame_settings, JxlEncoderFrameSettingId option, int64_t value)
struct JxlEncoderStruct JxlEncoder
Definition: encode.h:42
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelBuffer(const JxlEncoderFrameSettings *frame_settings, const JxlPixelFormat *pixel_format, const void *buffer, size_t size, uint32_t index)
JXL_EXPORT JxlEncoderStatus JxlEncoderProcessOutput(JxlEncoder *enc, uint8_t **next_out, size_t *avail_out)
JXL_EXPORT JxlEncoderStatus JxlEncoderUseContainer(JxlEncoder *enc, JXL_BOOL use_container)
JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
JXL_EXPORT void JxlEncoderSetCms(JxlEncoder *enc, JxlCmsInterface cms)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameBitDepth(JxlEncoderFrameSettings *frame_settings, const JxlBitDepth *bit_depth)
JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader *frame_header)
JXL_EXPORT void JxlEncoderReset(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameLossless(JxlEncoderFrameSettings *frame_settings, JXL_BOOL lossless)
JXL_EXPORT JxlEncoderStatus JxlEncoderFrameSettingsSetFloatOption(JxlEncoderFrameSettings *frame_settings, JxlEncoderFrameSettingId option, float value)
JXL_EXPORT JxlEncoderStatus JxlEncoderUseBoxes(JxlEncoder *enc)
JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetBasicInfo(JxlEncoder *enc, const JxlBasicInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetColorEncoding(JxlEncoder *enc, const JxlColorEncoding *color)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelBlendInfo(JxlEncoderFrameSettings *frame_settings, size_t index, const JxlBlendInfo *blend_info)
JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameDistance(JxlEncoderFrameSettings *frame_settings, float distance)
JxlEncoderStatus
Definition: encode.h:57
JXL_EXPORT void JxlEncoderAllowExpertOptions(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameHeader(JxlEncoderFrameSettings *frame_settings, const JxlFrameHeader *frame_header)
JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
JXL_EXPORT void JxlEncoderInitExtraChannelInfo(JxlExtraChannelType type, JxlExtraChannelInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelDistance(JxlEncoderFrameSettings *frame_settings, size_t index, float distance)
JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderAddImageFrame(const JxlEncoderFrameSettings *frame_settings, const JxlPixelFormat *pixel_format, const void *buffer, size_t size)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetICCProfile(JxlEncoder *enc, const uint8_t *icc_profile, size_t size)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameName(JxlEncoderFrameSettings *frame_settings, const char *frame_name)
JXL_EXPORT uint32_t JxlEncoderVersion(void)
JXL_EXPORT JxlEncoderFrameSettings * JxlEncoderFrameSettingsCreate(JxlEncoder *enc, const JxlEncoderFrameSettings *source)
JXL_EXPORT JxlEncoderError JxlEncoderGetError(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelName(JxlEncoder *enc, size_t index, const char *name, size_t size)
struct JxlEncoderFrameSettingsStruct JxlEncoderFrameSettings
Definition: encode.h:52
JXL_EXPORT JxlEncoderStatus JxlEncoderAddBox(JxlEncoder *enc, const JxlBoxType type, const uint8_t *contents, size_t size, JXL_BOOL compress_box)
JxlEncoderError
Definition: encode.h:78
JxlEncoderFrameSettingId
Definition: encode.h:121
JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetExtraChannelInfo(JxlEncoder *enc, size_t index, const JxlExtraChannelInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderStoreJPEGMetadata(JxlEncoder *enc, JXL_BOOL store_jpeg_metadata)
@ JXL_ENC_ERROR
Definition: encode.h:65
@ JXL_ENC_NEED_MORE_OUTPUT
Definition: encode.h:69
@ JXL_ENC_SUCCESS
Definition: encode.h:61
@ JXL_ENC_ERR_NOT_SUPPORTED
Definition: encode.h:105
@ JXL_ENC_ERR_JBRD
Definition: encode.h:95
@ JXL_ENC_ERR_API_USAGE
Definition: encode.h:111
@ JXL_ENC_ERR_OOM
Definition: encode.h:90
@ JXL_ENC_ERR_OK
Definition: encode.h:81
@ JXL_ENC_ERR_GENERIC
Definition: encode.h:85
@ JXL_ENC_ERR_BAD_INPUT
Definition: encode.h:99
@ JXL_ENC_FRAME_SETTING_DECODING_SPEED
Definition: encode.h:133
@ JXL_ENC_FRAME_SETTING_JPEG_COMPRESS_BOXES
Definition: encode.h:336
@ JXL_ENC_FRAME_SETTING_MODULAR_GROUP_SIZE
Definition: encode.h:285
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_DC
Definition: encode.h:243
@ JXL_ENC_FRAME_SETTING_EXTRA_CHANNEL_RESAMPLING
Definition: encode.h:148
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_X
Definition: encode.h:215
@ JXL_ENC_FRAME_SETTING_NOISE
Definition: encode.h:172
@ JXL_ENC_FRAME_SETTING_ALREADY_DOWNSAMPLED
Definition: encode.h:159
@ JXL_ENC_FRAME_SETTING_RESPONSIVE
Definition: encode.h:225
@ JXL_ENC_FRAME_SETTING_JPEG_RECON_CFL
Definition: encode.h:311
@ JXL_ENC_FRAME_SETTING_PATCHES
Definition: encode.h:182
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER
Definition: encode.h:209
@ JXL_ENC_FRAME_SETTING_EPF
Definition: encode.h:187
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GLOBAL_PERCENT
Definition: encode.h:249
@ JXL_ENC_FRAME_SETTING_RESAMPLING
Definition: encode.h:141
@ JXL_ENC_FRAME_SETTING_DOTS
Definition: encode.h:177
@ JXL_ENC_FRAME_SETTING_COLOR_TRANSFORM
Definition: encode.h:272
@ JXL_ENC_FRAME_SETTING_EFFORT
Definition: encode.h:127
@ JXL_ENC_FRAME_SETTING_MODULAR
Definition: encode.h:198
@ JXL_ENC_FRAME_SETTING_MODULAR_COLOR_SPACE
Definition: encode.h:281
@ JXL_ENC_FRAME_SETTING_KEEP_INVISIBLE
Definition: encode.h:203
@ JXL_ENC_FRAME_SETTING_PHOTON_NOISE
Definition: encode.h:166
@ JXL_ENC_FRAME_SETTING_BROTLI_EFFORT
Definition: encode.h:329
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_Y
Definition: encode.h:220
@ JXL_ENC_FRAME_SETTING_GABORISH
Definition: encode.h:192
@ JXL_ENC_FRAME_SETTING_QPROGRESSIVE_AC
Definition: encode.h:237
@ JXL_ENC_FRAME_SETTING_MODULAR_NB_PREV_CHANNELS
Definition: encode.h:306
@ JXL_ENC_FRAME_SETTING_FILL_ENUM
Definition: encode.h:341
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_AC
Definition: encode.h:231
@ JXL_ENC_FRAME_SETTING_MODULAR_MA_TREE_LEARNING_PERCENT
Definition: encode.h:298
@ JXL_ENC_FRAME_SETTING_LOSSY_PALETTE
Definition: encode.h:265
@ JXL_ENC_FRAME_SETTING_MODULAR_PREDICTOR
Definition: encode.h:292
@ JXL_ENC_FRAME_SETTING_PALETTE_COLORS
Definition: encode.h:260
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GROUP_PERCENT
Definition: encode.h:255
@ JXL_ENC_FRAME_INDEX_BOX
Definition: encode.h:322
Abstraction functions used by JPEG XL to allocate memory.
Definition: codestream_header.h:95
Definition: types.h:130
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:77