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 
78 
80 
86 typedef enum {
93 
99 
107 
114 
125 
132 
138 
143 
148 
153 
158 
164 
169 
175 
181 
186 
191 
197 
203 
209 
215 
221 
226 
231 
238 
244 
248 
255 
261 
269 
274 
285 
292 
297 
299 
312 JXL_EXPORT JxlEncoder* JxlEncoderCreate(const JxlMemoryManager* memory_manager);
313 
321 JXL_EXPORT void JxlEncoderReset(JxlEncoder* enc);
322 
328 JXL_EXPORT void JxlEncoderDestroy(JxlEncoder* enc);
329 
339 JXL_EXPORT void JxlEncoderSetCms(JxlEncoder* enc, JxlCmsInterface cms);
340 
353 JXL_EXPORT JxlEncoderStatus
355  void* parallel_runner_opaque);
356 
383  uint8_t** next_out,
384  size_t* avail_out);
385 
419 JXL_EXPORT JxlEncoderStatus
421  const JxlFrameHeader* frame_header);
422 
435  JxlEncoderFrameSettings* frame_settings, size_t index,
436  const JxlBlendInfo* blend_info);
437 
458  JxlEncoderFrameSettings* frame_settings, const char* frame_name);
459 
486 JXL_EXPORT JxlEncoderStatus
488  const uint8_t* buffer, size_t size);
489 
548  const JxlEncoderFrameSettings* frame_settings,
549  const JxlPixelFormat* pixel_format, const void* buffer, size_t size);
550 
575  const JxlEncoderFrameSettings* frame_settings,
576  const JxlPixelFormat* pixel_format, const void* buffer, size_t size,
577  uint32_t index);
578 
688  const JxlBoxType type,
689  const uint8_t* contents,
690  size_t size,
691  JXL_BOOL compress_box);
692 
705 
721 JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder* enc);
722 
735 JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder* enc);
736 
751 JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder* enc);
752 
765 JXL_EXPORT JxlEncoderStatus
767 
781  const uint8_t* icc_profile,
782  size_t size);
783 
793 JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo* info);
794 
805 JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader* frame_header);
806 
814 JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo* blend_info);
815 
832  const JxlBasicInfo* info);
833 
845  JxlExtraChannelInfo* info);
846 
858  JxlEncoder* enc, size_t index, const JxlExtraChannelInfo* info);
859 
875  size_t index,
876  const char* name,
877  size_t size);
878 
894  JxlEncoderFrameSettings* frame_settings, JxlEncoderFrameSettingId option,
895  int32_t value);
896 
916  JXL_BOOL use_container);
917 
932 JXL_EXPORT JxlEncoderStatus
934 
967  int level);
968 
989 
1009  JxlEncoderFrameSettings* frame_settings, JXL_BOOL lossless);
1010 
1013 JXL_EXPORT JxlEncoderStatus
1015 
1026 JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus
1028 
1040  JxlEncoderFrameSettings* frame_settings, int tier);
1041 
1057  JxlEncoderFrameSettings* frame_settings, float distance);
1058 
1061 JXL_EXPORT JxlEncoderStatus
1063 
1080  JxlEncoder* enc, const JxlEncoderFrameSettings* source);
1081 
1086 
1093 JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding* color_encoding,
1094  JXL_BOOL is_gray);
1095 
1103  JxlColorEncoding* color_encoding, JXL_BOOL is_gray);
1104 
1105 #if defined(__cplusplus) || defined(c_plusplus)
1106 }
1107 #endif
1108 
1109 #endif /* JXL_ENCODE_H_ */
1110 
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:29
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 JxlEncoderStatus JxlEncoderOptionsSetDistance(JxlEncoderFrameSettings *, float)
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 JxlEncoderFrameSettings * JxlEncoderOptionsCreate(JxlEncoder *, const JxlEncoderFrameSettings *)
JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
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 JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
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)
JxlEncoderFrameSettingId
Definition: encode.h:86
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:77
@ JXL_ENC_SUCCESS
Definition: encode.h:64
@ JXL_ENC_FRAME_SETTING_DECODING_SPEED
Definition: encode.h:98
@ JXL_ENC_FRAME_SETTING_MODULAR_GROUP_SIZE
Definition: encode.h:247
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_DC
Definition: encode.h:208
@ JXL_ENC_FRAME_SETTING_EXTRA_CHANNEL_RESAMPLING
Definition: encode.h:113
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_X
Definition: encode.h:180
@ JXL_ENC_FRAME_SETTING_NOISE
Definition: encode.h:137
@ JXL_ENC_FRAME_SETTING_ALREADY_DOWNSAMPLED
Definition: encode.h:124
@ JXL_ENC_FRAME_SETTING_RESPONSIVE
Definition: encode.h:190
@ JXL_ENC_FRAME_SETTING_JPEG_RECON_CFL
Definition: encode.h:273
@ JXL_ENC_FRAME_SETTING_PATCHES
Definition: encode.h:147
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER
Definition: encode.h:174
@ JXL_ENC_FRAME_SETTING_EPF
Definition: encode.h:152
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GLOBAL_PERCENT
Definition: encode.h:214
@ JXL_ENC_FRAME_SETTING_RESAMPLING
Definition: encode.h:106
@ JXL_ENC_FRAME_SETTING_DOTS
Definition: encode.h:142
@ JXL_ENC_FRAME_SETTING_COLOR_TRANSFORM
Definition: encode.h:237
@ JXL_ENC_FRAME_SETTING_EFFORT
Definition: encode.h:92
@ JXL_ENC_FRAME_SETTING_MODULAR
Definition: encode.h:163
@ JXL_ENC_FRAME_SETTING_MODULAR_COLOR_SPACE
Definition: encode.h:243
@ JXL_ENC_FRAME_SETTING_KEEP_INVISIBLE
Definition: encode.h:168
@ JXL_ENC_FRAME_SETTING_PHOTON_NOISE
Definition: encode.h:131
@ JXL_ENC_FRAME_SETTING_BROTLI_EFFORT
Definition: encode.h:291
@ JXL_ENC_FRAME_SETTING_GROUP_ORDER_CENTER_Y
Definition: encode.h:185
@ JXL_ENC_FRAME_SETTING_GABORISH
Definition: encode.h:157
@ JXL_ENC_FRAME_SETTING_QPROGRESSIVE_AC
Definition: encode.h:202
@ JXL_ENC_FRAME_SETTING_MODULAR_NB_PREV_CHANNELS
Definition: encode.h:268
@ JXL_ENC_FRAME_SETTING_FILL_ENUM
Definition: encode.h:296
@ JXL_ENC_FRAME_SETTING_PROGRESSIVE_AC
Definition: encode.h:196
@ JXL_ENC_FRAME_SETTING_MODULAR_MA_TREE_LEARNING_PERCENT
Definition: encode.h:260
@ JXL_ENC_FRAME_SETTING_LOSSY_PALETTE
Definition: encode.h:230
@ JXL_ENC_FRAME_SETTING_MODULAR_PREDICTOR
Definition: encode.h:254
@ JXL_ENC_FRAME_SETTING_PALETTE_COLORS
Definition: encode.h:225
@ JXL_ENC_FRAME_SETTING_CHANNEL_COLORS_GROUP_PERCENT
Definition: encode.h:220
@ JXL_ENC_FRAME_INDEX_BOX
Definition: encode.h:284
Abstraction functions used by JPEG XL to allocate memory.
Definition: codestream_header.h:106
Definition: codestream_header.h:335
Definition: cms_interface.h:209
Definition: color_encoding.h:118
Definition: codestream_header.h:270
Definition: codestream_header.h:394
Definition: memory_manager.h:51
Definition: types.h:87