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 
290 
292 
305 JXL_EXPORT JxlEncoder* JxlEncoderCreate(const JxlMemoryManager* memory_manager);
306 
314 JXL_EXPORT void JxlEncoderReset(JxlEncoder* enc);
315 
321 JXL_EXPORT void JxlEncoderDestroy(JxlEncoder* enc);
322 
332 JXL_EXPORT void JxlEncoderSetCms(JxlEncoder* enc, JxlCmsInterface cms);
333 
346 JXL_EXPORT JxlEncoderStatus
348  void* parallel_runner_opaque);
349 
376  uint8_t** next_out,
377  size_t* avail_out);
378 
412 JXL_EXPORT JxlEncoderStatus
414  const JxlFrameHeader* frame_header);
415 
428  JxlEncoderFrameSettings* frame_settings, size_t index,
429  const JxlBlendInfo* blend_info);
430 
451  JxlEncoderFrameSettings* frame_settings, const char* frame_name);
452 
479 JXL_EXPORT JxlEncoderStatus
481  const uint8_t* buffer, size_t size);
482 
538  const JxlEncoderFrameSettings* frame_settings,
539  const JxlPixelFormat* pixel_format, const void* buffer, size_t size);
540 
564  const JxlEncoderFrameSettings* frame_settings,
565  const JxlPixelFormat* pixel_format, const void* buffer, size_t size,
566  uint32_t index);
567 
677  const JxlBoxType type,
678  const uint8_t* contents,
679  size_t size,
680  JXL_BOOL compress_box);
681 
694 
710 JXL_EXPORT void JxlEncoderCloseBoxes(JxlEncoder* enc);
711 
724 JXL_EXPORT void JxlEncoderCloseFrames(JxlEncoder* enc);
725 
740 JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder* enc);
741 
754 JXL_EXPORT JxlEncoderStatus
756 
770  const uint8_t* icc_profile,
771  size_t size);
772 
782 JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo* info);
783 
794 JXL_EXPORT void JxlEncoderInitFrameHeader(JxlFrameHeader* frame_header);
795 
803 JXL_EXPORT void JxlEncoderInitBlendInfo(JxlBlendInfo* blend_info);
804 
821  const JxlBasicInfo* info);
822 
835  JxlExtraChannelInfo* info);
836 
848  JxlEncoder* enc, size_t index, const JxlExtraChannelInfo* info);
849 
865  size_t index,
866  const char* name,
867  size_t size);
868 
884  JxlEncoderFrameSettings* frame_settings, JxlEncoderFrameSettingId option,
885  int32_t value);
886 
906  JXL_BOOL use_container);
907 
922 JXL_EXPORT JxlEncoderStatus
924 
957  int level);
958 
979 
999  JxlEncoderFrameSettings* frame_settings, JXL_BOOL lossless);
1000 
1003 JXL_EXPORT JxlEncoderStatus
1005 
1016 JXL_EXPORT JXL_DEPRECATED JxlEncoderStatus
1018 
1030  JxlEncoderFrameSettings* frame_settings, int tier);
1031 
1047  JxlEncoderFrameSettings* frame_settings, float distance);
1048 
1051 JXL_EXPORT JxlEncoderStatus
1053 
1070  JxlEncoder* enc, const JxlEncoderFrameSettings* source);
1071 
1076 
1083 JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding* color_encoding,
1084  JXL_BOOL is_gray);
1085 
1093  JxlColorEncoding* color_encoding, JXL_BOOL is_gray);
1094 
1095 #if defined(__cplusplus) || defined(c_plusplus)
1096 }
1097 #endif
1098 
1099 #endif /* JXL_ENCODE_H_ */
1100 
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_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:289
@ 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:333
Definition: cms_interface.h:209
Definition: color_encoding.h:118
Definition: codestream_header.h:268
Definition: codestream_header.h:392
Definition: memory_manager.h:51
Definition: types.h:87