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
11#ifndef JXL_ENCODE_H_
12#define JXL_ENCODE_H_
13
14#include "jxl/decode.h"
15#include "jxl/jxl_export.h"
16#include "jxl/memory_manager.h"
17#include "jxl/parallel_runner.h"
18
19#if defined(__cplusplus) || defined(c_plusplus)
20 extern "C" {
21#endif
22
30JXL_EXPORT uint32_t JxlEncoderVersion(void);
31
38 typedef struct JxlEncoderStruct JxlEncoder;
39
48 typedef struct JxlEncoderOptionsStruct JxlEncoderOptions;
49
53 typedef enum {
57 JXL_ENC_SUCCESS = 0,
58
61 JXL_ENC_ERROR = 1,
62
65 JXL_ENC_NEED_MORE_OUTPUT = 2,
66
69 JXL_ENC_NOT_SUPPORTED = 3,
70
71} JxlEncoderStatus;
72
85JXL_EXPORT JxlEncoder* JxlEncoderCreate(const JxlMemoryManager* memory_manager);
86
94JXL_EXPORT void JxlEncoderReset(JxlEncoder* enc);
95
101JXL_EXPORT void JxlEncoderDestroy(JxlEncoder* enc);
102
115JXL_EXPORT JxlEncoderStatus
116 JxlEncoderSetParallelRunner(JxlEncoder* enc, JxlParallelRunner parallel_runner,
117 void* parallel_runner_opaque);
118
138JXL_EXPORT JxlEncoderStatus JxlEncoderProcessOutput(JxlEncoder* enc,
139 uint8_t** next_out,
140 size_t* avail_out);
141
163JXL_EXPORT JxlEncoderStatus JxlEncoderAddJPEGFrame(
164 const JxlEncoderOptions* options, const uint8_t* buffer, size_t size);
165
191JXL_EXPORT JxlEncoderStatus JxlEncoderAddImageFrame(
192 const JxlEncoderOptions* options, const JxlPixelFormat* pixel_format,
193 const void* buffer, size_t size);
194
204JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder* enc);
205
218JXL_EXPORT JxlEncoderStatus
219 JxlEncoderSetColorEncoding(JxlEncoder* enc, const JxlColorEncoding* color);
220
233JXL_EXPORT JxlEncoderStatus JxlEncoderSetICCProfile(JxlEncoder* enc,
234 const uint8_t* icc_profile,
235 size_t size);
236
246JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo* info);
247
257JXL_EXPORT JxlEncoderStatus JxlEncoderSetBasicInfo(JxlEncoder* enc,
258 const JxlBasicInfo* info);
259
275JXL_EXPORT JxlEncoderStatus
276 JxlEncoderStoreJPEGMetadata(JxlEncoder* enc, JXL_BOOL store_jpeg_metadata);
277
292JXL_EXPORT JxlEncoderStatus JxlEncoderUseContainer(JxlEncoder* enc,
293 JXL_BOOL use_container);
294
303JXL_EXPORT JxlEncoderStatus
304 JxlEncoderOptionsSetLossless(JxlEncoderOptions* options, JXL_BOOL lossless);
305
316JXL_EXPORT JxlEncoderStatus
317 JxlEncoderOptionsSetDecodingSpeed(JxlEncoderOptions* options, int tier);
318
330JXL_EXPORT JxlEncoderStatus
331 JxlEncoderOptionsSetEffort(JxlEncoderOptions* options, int effort);
332
349JXL_EXPORT JxlEncoderStatus
350 JxlEncoderOptionsSetDistance(JxlEncoderOptions* options, float distance);
351
367JXL_EXPORT JxlEncoderOptions* JxlEncoderOptionsCreate(
368 JxlEncoder* enc, const JxlEncoderOptions* source);
369
376JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding* color_encoding,
377 JXL_BOOL is_gray);
378
385JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(
386 JxlColorEncoding* color_encoding, JXL_BOOL is_gray);
387
388#if defined(__cplusplus) || defined(c_plusplus)
389}
390#endif
391
392#endif /* JXL_ENCODE_H_ */
decode.h
Decoding API for JPEG XL.
JxlEncoderAddJPEGFrame
JXL_EXPORT JxlEncoderStatus JxlEncoderAddJPEGFrame(const JxlEncoderOptions *options, const uint8_t *buffer, size_t size)
JxlEncoderCloseInput
JXL_EXPORT void JxlEncoderCloseInput(JxlEncoder *enc)
JxlEncoderSetParallelRunner
JXL_EXPORT JxlEncoderStatus JxlEncoderSetParallelRunner(JxlEncoder *enc, JxlParallelRunner parallel_runner, void *parallel_runner_opaque)
JxlEncoderOptionsCreate
JXL_EXPORT JxlEncoderOptions * JxlEncoderOptionsCreate(JxlEncoder *enc, const JxlEncoderOptions *source)
JxlEncoder
struct JxlEncoderStruct JxlEncoder
Definition: encode.h:38
JxlEncoderCreate
JXL_EXPORT JxlEncoder * JxlEncoderCreate(const JxlMemoryManager *memory_manager)
JxlEncoderProcessOutput
JXL_EXPORT JxlEncoderStatus JxlEncoderProcessOutput(JxlEncoder *enc, uint8_t **next_out, size_t *avail_out)
JxlEncoderUseContainer
JXL_EXPORT JxlEncoderStatus JxlEncoderUseContainer(JxlEncoder *enc, JXL_BOOL use_container)
JxlEncoderOptionsSetLossless
JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetLossless(JxlEncoderOptions *options, JXL_BOOL lossless)
JxlColorEncodingSetToSRGB
JXL_EXPORT void JxlColorEncodingSetToSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
JxlEncoderOptionsSetDecodingSpeed
JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetDecodingSpeed(JxlEncoderOptions *options, int tier)
JxlEncoderAddImageFrame
JXL_EXPORT JxlEncoderStatus JxlEncoderAddImageFrame(const JxlEncoderOptions *options, const JxlPixelFormat *pixel_format, const void *buffer, size_t size)
JxlEncoderReset
JXL_EXPORT void JxlEncoderReset(JxlEncoder *enc)
JxlEncoderInitBasicInfo
JXL_EXPORT void JxlEncoderInitBasicInfo(JxlBasicInfo *info)
JxlEncoderSetBasicInfo
JXL_EXPORT JxlEncoderStatus JxlEncoderSetBasicInfo(JxlEncoder *enc, const JxlBasicInfo *info)
JxlEncoderSetColorEncoding
JXL_EXPORT JxlEncoderStatus JxlEncoderSetColorEncoding(JxlEncoder *enc, const JxlColorEncoding *color)
JxlEncoderOptions
struct JxlEncoderOptionsStruct JxlEncoderOptions
Definition: encode.h:48
JxlEncoderStatus
JxlEncoderStatus
Definition: encode.h:53
JXL_ENC_ERROR
@ JXL_ENC_ERROR
Definition: encode.h:61
JXL_ENC_NEED_MORE_OUTPUT
@ JXL_ENC_NEED_MORE_OUTPUT
Definition: encode.h:65
JXL_ENC_NOT_SUPPORTED
@ JXL_ENC_NOT_SUPPORTED
Definition: encode.h:69
JXL_ENC_SUCCESS
@ JXL_ENC_SUCCESS
Definition: encode.h:57
JxlColorEncodingSetToLinearSRGB
JXL_EXPORT void JxlColorEncodingSetToLinearSRGB(JxlColorEncoding *color_encoding, JXL_BOOL is_gray)
JxlEncoderOptionsSetEffort
JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetEffort(JxlEncoderOptions *options, int effort)
JxlEncoderOptionsSetDistance
JXL_EXPORT JxlEncoderStatus JxlEncoderOptionsSetDistance(JxlEncoderOptions *options, float distance)
JxlEncoderSetICCProfile
JXL_EXPORT JxlEncoderStatus JxlEncoderSetICCProfile(JxlEncoder *enc, const uint8_t *icc_profile, size_t size)
JxlEncoderVersion
JXL_EXPORT uint32_t JxlEncoderVersion(void)
JxlEncoderDestroy
JXL_EXPORT void JxlEncoderDestroy(JxlEncoder *enc)
JxlEncoderStoreJPEGMetadata
JXL_EXPORT JxlEncoderStatus JxlEncoderStoreJPEGMetadata(JxlEncoder *enc, JXL_BOOL store_jpeg_metadata)
memory_manager.h
Abstraction functions used by JPEG XL to allocate memory.
parallel_runner.h
JxlParallelRunner
JxlParallelRetCode(* JxlParallelRunner)(void *runner_opaque, void *jpegxl_opaque, JxlParallelRunInit init, JxlParallelRunFunction func, uint32_t start_range, uint32_t end_range)
Definition: parallel_runner.h:116
JxlBasicInfo
Definition: codestream_header.h:95
JxlColorEncoding
Definition: color_encoding.h:101
JxlMemoryManagerStruct
Definition: memory_manager.h:48
JxlPixelFormat
Definition: types.h:85
JXL_BOOL
#define JXL_BOOL
Definition: types.h:27