LIBJXL: Common API concepts

LIBJXL |

Loading...
Searching...
No Matches
Files | Classes | Macros | Typedefs | Enumerations
Common API concepts
JPEG XL library (libjxl)
Collaboration diagram for Common API concepts:

## Files
file | memory_manager.h
| Abstraction functions used by JPEG XL to allocate memory.
file | types.h
| Data types for the JPEG XL API, for both encoding and decoding.

## Classes
struct | JxlMemoryManagerStruct
struct | JxlPixelFormat
struct | JxlBitDepth

## Macros
#define | JXL_BOOL int
#define | JXL_TRUE 1
#define | JXL_FALSE 0
#define | TO_JXL_BOOL(C)
#define | FROM_JXL_BOOL(C)

## Typedefs
typedef void *(* | jpegxl_alloc_func) (void *opaque, size_t size)
typedef void(* | jpegxl_free_func) (void *opaque, void *address)
typedef struct JxlMemoryManagerStruct | JxlMemoryManager
typedef char | JxlBoxType[4]

## Enumerations
enum | JxlDataType { JXL_TYPE_FLOAT = 0 , JXL_TYPE_UINT8 = 2 , JXL_TYPE_UINT16 = 3 , JXL_TYPE_FLOAT16 = 5 }
enum | JxlEndianness { JXL_NATIVE_ENDIAN = 0 , JXL_LITTLE_ENDIAN = 1 , JXL_BIG_ENDIAN = 2 }
enum | JxlBitDepthType { JXL_BIT_DEPTH_FROM_PIXEL_FORMAT = 0 , JXL_BIT_DEPTH_FROM_CODESTREAM = 1 , JXL_BIT_DEPTH_CUSTOM = 2 }

## Detailed Description

## Macro Definition Documentation

## ◆ FROM_JXL_BOOL

#define FROM_JXL_BOOL | ( |  | C | ) |

Value:
(static_cast<bool>(C))

Converts JXL_BOOL to C++ bool.

## ◆ JXL_BOOL

#define JXL_BOOL int

A portable `bool` replacement.

JXL_BOOL is a "documentation" type: actually it is `int`, but in API it denotes a type, whose only values are JXL_TRUE and JXL_FALSE.

## ◆ JXL_FALSE

#define JXL_FALSE 0

Portable `false` replacement.

## ◆ JXL_TRUE

#define JXL_TRUE 1

Portable `true` replacement.

## ◆ TO_JXL_BOOL

#define TO_JXL_BOOL | ( |  | C | ) |

Value:
(!!(C) ? JXL_TRUE : JXL_FALSE)
JXL_FALSE
#define JXL_FALSE
Definition types.h:33
JXL_TRUE
#define JXL_TRUE
Definition types.h:31

Converts of bool-like value to either JXL_TRUE or JXL_FALSE.

## Typedef Documentation

## ◆ jpegxl_alloc_func

typedef void *(* jpegxl_alloc_func) (void *opaque, size_t size)

Allocating function for a memory region of a given size.

Allocates a contiguous memory region of size `size` bytes. The returned memory may not be aligned to a specific size or initialized at all.

Parameters

  opaque | custom memory manager handle provided by the caller.
  size | in bytes of the requested memory region.

Returns
  `NULL` if the memory can not be allocated,
  pointer to the memory otherwise.

## ◆ jpegxl_free_func

typedef void(* jpegxl_free_func) (void *opaque, void *address)

Deallocating function pointer type.

This function MUST do nothing if `address` is `NULL`.

Parameters

  opaque | custom memory manager handle provided by the caller.
  address | memory region pointer returned by jpegxl_alloc_func, or `NULL`.

## ◆ JxlBoxType

typedef char JxlBoxType[4]

Data type holding the 4-character type name of an ISOBMFF box.

## ◆ JxlMemoryManager

typedef struct JxlMemoryManagerStruct JxlMemoryManager

Memory Manager struct. These functions, when provided by the caller, will be used to handle memory allocations.

## Enumeration Type Documentation

## ◆ JxlBitDepthType

enum JxlBitDepthType

Settings for the interpretation of UINT input and output buffers. (buffers using a FLOAT data type are not affected by this)

Enumerator
JXL_BIT_DEPTH_FROM_PIXEL_FORMAT | This is the default setting, where the encoder expects the input pixels to use the full range of the pixel format data type (e.g. for UINT16, the input range is 0 .. 65535 and the value 65535 is mapped to 1.0 when converting to float), and the decoder uses the full range to output pixels. If the bit depth in the basic info is different from this, the encoder expects the values to be rescaled accordingly (e.g. multiplied by 65535/4095 for a 12-bit image using UINT16 input data type).
JXL_BIT_DEPTH_FROM_CODESTREAM | If this setting is selected, the encoder expects the input pixels to be in the range defined by the bits_per_sample value of the basic info (e.g. for 12-bit images using UINT16 input data types, the allowed range is 0 .. 4095 and the value 4095 is mapped to 1.0 when converting to float), and the decoder outputs pixels in this range.
JXL_BIT_DEPTH_CUSTOM | This setting can only be used in the decoder to select a custom range for pixel output

## ◆ JxlDataType

enum JxlDataType

Data type for the sample values per channel per pixel.

Enumerator
JXL_TYPE_FLOAT | Use 32-bit single-precision floating point values, with range 0.0-1.0 (within gamut, may go outside this range for wide color gamut). Floating point output, either JXL_TYPE_FLOAT or JXL_TYPE_FLOAT16, is recommended for HDR and wide gamut images when color profile conversion is required.
JXL_TYPE_UINT8 | Use type uint8_t. May clip wide color gamut data.
JXL_TYPE_UINT16 | Use type uint16_t. May clip wide color gamut data.
JXL_TYPE_FLOAT16 | Use 16-bit IEEE 754 half-precision floating point values

## ◆ JxlEndianness

enum JxlEndianness

Ordering of multi-byte data.

Enumerator
JXL_NATIVE_ENDIAN | Use the endianness of the system, either little endian or big endian, without forcing either specific endianness. Do not use if pixel data should be exported to a well defined format.
JXL_LITTLE_ENDIAN | Force little endian
JXL_BIG_ENDIAN | Force big endian