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/codestream_header.h"
17 #include "jxl/decode.h"
18 #include "jxl/jxl_export.h"
19 #include "jxl/memory_manager.h"
20 #include "jxl/parallel_runner.h"
21 
22 #if defined(__cplusplus) || defined(c_plusplus)
23 extern "C" {
24 #endif
25 
33 JXL_EXPORT uint32_t JxlEncoderVersion(void);
34 
41 typedef struct JxlEncoderStruct JxlEncoder;
42 
51 typedef struct JxlEncoderFrameSettingsStruct JxlEncoderFrameSettings;
52 
56 
60 typedef enum {
65 
69 
73 
80 
82 
88 typedef enum {
92 
96 
101 
106 
110 
116 
122 
124 
131 typedef enum {
138 
144 
152 
159 
170 
177 
183 
188 
193 
198 
203 
209 
214 
220 
226 
231 
236 
242 
248 
254 
260 
266 
271 
276 
283 
292 
296 
303 
309 
317 
322 
333 
340 
345 
347 
360 JXL_EXPORT JxlEncoder* JxlEncoderCreate(const JxlMemoryManager* memory_manager);
361 
369 JXL_EXPORT void JxlEncoderReset(JxlEncoder* enc);
370 
376 JXL_EXPORT void JxlEncoderDestroy(JxlEncoder* enc);
377 
387 JXL_EXPORT void JxlEncoderSetCms(JxlEncoder* enc, JxlCmsInterface cms);
388 
401 JXL_EXPORT JxlEncoderStatus
403  void* parallel_runner_opaque);
404 
413 
440  uint8_t** next_out,
441  size_t* avail_out);
442 
476 JXL_EXPORT JxlEncoderStatus
478  const JxlFrameHeader* frame_header);
479 
492  JxlEncoderFrameSettings* frame_settings, size_t index,
493  const JxlBlendInfo* blend_info);
494 
515  JxlEncoderFrameSettings* frame_settings, const char* frame_name);
516 
543 JXL_EXPORT JxlEncoderStatus
545  const uint8_t* buffer, size_t size);
546 
605  const JxlEncoderFrameSettings* frame_settings,
606  const JxlPixelFormat* pixel_format, const void* buffer, size_t size);
607 
632  const JxlEncoderFrameSettings* frame_settings,
633  const JxlPixelFormat* pixel_format, const void* buffer, size_t size,
634  uint32_t index);
635 
705  const JxlBoxType type,
706  const uint8_t* contents,
707  size_t size,
708  JXL_BOOL compress_box);
709 
722 
738 JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder* enc);
739 
752 JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder* enc);
753 
768 JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder* enc);
769 
783 JXL_EXPORT JxlEncoderStatus
785 
800  const uint8_t* icc_profile,
801  size_t size);
802 
812 JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo* info);
813 
824 JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader* frame_header);
825 
833 JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo* blend_info);
834 
851  const JxlBasicInfo* info);
852 
864  JxlExtraChannelInfo* info);
865 
877  JxlEncoder* enc, size_t index, const JxlExtraChannelInfo* info);
878 
894  size_t index,
895  const char* name,
896  size_t size);
897 
913  JxlEncoderFrameSettings* frame_settings, JxlEncoderFrameSettingId option,
914  int32_t value);
915 
935  JXL_BOOL use_container);
936 
951 JXL_EXPORT JxlEncoderStatus
953 
989  int level);
990 
1011 
1031  JxlEncoderFrameSettings* frame_settings, JXL_BOOL lossless);
1032 
1035 JXL_EXPORT JxlEncoderStatus
1037 
1048 JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus
1050 
1062  JxlEncoderFrameSettings* frame_settings, int tier);
1063 
1079  JxlEncoderFrameSettings* frame_settings, float distance);
1080 
1083 JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus
1085 
1102  JxlEncoder* enc, const JxlEncoderFrameSettings* source);
1103 
1108 
1115 JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding* color_encoding,
1116  JXL_BOOL is_gray);
1117 
1125  JxlColorEncoding* color_encoding, JXL_BOOL is_gray);
1126 
1127 #if defined(__cplusplus) || defined(c_plusplus)
1128 }
1129 #endif
1130 
1131 #endif /* JXL_ENCODE_H_ */
1132 
Definitions of structs and enums for the metadata from the JPEG XL codestream headers (signature,...
Decoding API for JPEG XL.
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
JxlExtraChannelType
Definition: codestream_header.h:46
#define JXL_BOOL
Definition: types.h:31
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)
JxlEncoderFrameSettings JxlEncoderOptions
Definition: encode.h:55
JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus JxlEncoderOptionsSetEffort(JxlEncoderFrameSettings *frame_settings, int effort)
struct JxlEncoderStruct JxlEncoder
Definition: encode.h:41
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 void JxlEncoderInitFrameHeader(JxlFrameHeader *frame_header)
JXL_EXPORT void JxlEncoderReset(JxlEncoder *enc)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameLossless(JxlEncoderFrameSettings *frame_settings, JXL_BOOL lossless)
JXL_EXPORT JxlEncoderFrameSettings * JxlEncoderFrameSettingsCreate(JxlEncoder *enc, const JxlEncoderFrameSettings *source)
JXL_EXPORT JxlEncoderStatus JxlEncoderUseBoxes(JxlEncoder *enc)
JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderFrameSettingsSetOption(JxlEncoderFrameSettings *frame_settings, JxlEncoderFrameSettingId option, int32_t value)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetBasicInfo(JxlEncoder *enc, const JxlBasicInfo *info)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetColorEncoding(JxlEncoder *enc, const JxlColorEncoding *color)
JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetLossless(JxlEncoderFrameSettings *, JXL_BOOL)
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:60
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameHeader(JxlEncoderFrameSettings *frame_settings, const JxlFrameHeader *frame_header)
JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
JXL_EXPORT JXL_DEPRECATED JxlEncoderFrameSettings * JxlEncoderOptionsCreate(JxlEncoder *, const JxlEncoderFrameSettings *)
JXL_EXPORT void JxlEncoderInitExtraChannelInfo(JxlExtraChannelType type, JxlExtraChannelInfo *info)
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 JXL_DEPRECATED JxlEncoderStatus JxlEncoderOptionsSetDecodingSpeed(JxlEncoderFrameSettings *frame_settings, int tier)
JXL_EXPORT JxlEncoderStatus JxlEncoderSetFrameName(JxlEncoderFrameSettings *frame_settings, const char *frame_name)
JXL_EXPORT uint32_t JxlEncoderVersion(void)
JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus JxlEncoderOptionsSetDistance(JxlEncoderFrameSettings *, float)
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
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:51
JXL_EXPORT JxlEncoderStatus JxlEncoderAddBox(JxlEncoder *enc, const JxlBoxType type, const uint8_t *contents, size_t size, JXL_BOOL compress_box)
JxlEncoderError
Definition: encode.h:88
JxlEncoderFrameSettingId
Definition: encode.h:131
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:68
@ JXL_ENC_NEED_MORE_OUTPUT
Definition: encode.h:72
@ JXL_ENC_NOT_SUPPORTED
Definition: encode.h:79
@ JXL_ENC_SUCCESS
Definition: encode.h:64
@ JXL_ENC_ERR_NOT_SUPPORTED
Definition: encode.h:115
@ JXL_ENC_ERR_JBRD
Definition: encode.h:105
@ JXL_ENC_ERR_API_USAGE
Definition: encode.h:121
@ JXL_ENC_ERR_OOM
Definition: encode.h:100
@ JXL_ENC_ERR_OK
Definition: encode.h:91
@ JXL_ENC_ERR_GENERIC
Definition: encode.h:95
@ JXL_ENC_ERR_BAD_INPUT
Definition: encode.h:109
@ JXL_ENC_FRAME_SETTING_DECODING_SPEED
Definition: encode.h:143
@ JXL_ENC_FRAME_SETTING_MODULAR_GROUP_SIZE
Definition: encode.h:295
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_DC
Definition: encode.h:253
@ JXL_ENC_FRAME_SETTING_EXTRA_CHANNEL_RESAMPLING
Definition: encode.h:158
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_X
Definition: encode.h:225
@ JXL_ENC_FRAME_SETTING_NOISE
Definition: encode.h:182
@ JXL_ENC_FRAME_SETTING_ALREADY_DOWNSAMPLED
Definition: encode.h:169
@ JXL_ENC_FRAME_SETTING_RESPONSIVE
Definition: encode.h:235
@ JXL_ENC_FRAME_SETTING_JPEG_RECON_CFL
Definition: encode.h:321
@ JXL_ENC_FRAME_SETTING_PATCHES
Definition: encode.h:192
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER
Definition: encode.h:219
@ JXL_ENC_FRAME_SETTING_EPF
Definition: encode.h:197
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GLOBAL_PERCENT
Definition: encode.h:259
@ JXL_ENC_FRAME_SETTING_RESAMPLING
Definition: encode.h:151
@ JXL_ENC_FRAME_SETTING_DOTS
Definition: encode.h:187
@ JXL_ENC_FRAME_SETTING_COLOR_TRANSFORM
Definition: encode.h:282
@ JXL_ENC_FRAME_SETTING_EFFORT
Definition: encode.h:137
@ JXL_ENC_FRAME_SETTING_MODULAR
Definition: encode.h:208
@ JXL_ENC_FRAME_SETTING_MODULAR_COLOR_SPACE
Definition: encode.h:291
@ JXL_ENC_FRAME_SETTING_KEEP_INVISIBLE
Definition: encode.h:213
@ JXL_ENC_FRAME_SETTING_PHOTON_NOISE
Definition: encode.h:176
@ JXL_ENC_FRAME_SETTING_BROTLI_EFFORT
Definition: encode.h:339
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_Y
Definition: encode.h:230
@ JXL_ENC_FRAME_SETTING_GABORISH
Definition: encode.h:202
@ JXL_ENC_FRAME_SETTING_QPROGRESSIVE_AC
Definition: encode.h:247
@ JXL_ENC_FRAME_SETTING_MODULAR_NB_PREV_CHANNELS
Definition: encode.h:316
@ JXL_ENC_FRAME_SETTING_FILL_ENUM
Definition: encode.h:344
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_AC
Definition: encode.h:241
@ JXL_ENC_FRAME_SETTING_MODULAR_MA_TREE_LEARNING_PERCENT
Definition: encode.h:308
@ JXL_ENC_FRAME_SETTING_LOSSY_PALETTE
Definition: encode.h:275
@ JXL_ENC_FRAME_SETTING_MODULAR_PREDICTOR
Definition: encode.h:302
@ JXL_ENC_FRAME_SETTING_PALETTE_COLORS
Definition: encode.h:270
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GROUP_PERCENT
Definition: encode.h:265
@ JXL_ENC_FRAME_INDEX_BOX
Definition: encode.h:332
Abstraction functions used by JPEG XL to allocate memory.
Definition: codestream_header.h:106
Definition: codestream_header.h:339
Definition: cms_interface.h:209
Definition: color_encoding.h:118
Definition: codestream_header.h:274
Definition: codestream_header.h:398
Definition: memory_manager.h:51
Definition: types.h:87