C++ helpers

group libjxl_cpp

Typedefs

typedef std::unique_ptr<JxlDecoder, JxlDecoderDestroyStruct> JxlDecoderPtr

std::unique_ptr<> type that calls JxlDecoderDestroy() when releasing the decoder.

Use this helper type from C++ sources to ensure the decoder is destroyed and their internal resources released.

typedef std::unique_ptr<JxlEncoder, JxlEncoderDestroyStruct> JxlEncoderPtr

std::unique_ptr<> type that calls JxlEncoderDestroy() when releasing the encoder.

Use this helper type from C++ sources to ensure the encoder is destroyed and their internal resources released.

typedef std::unique_ptr<void, JxlResizableParallelRunnerDestroyStruct> JxlResizableParallelRunnerPtr

std::unique_ptr<> type that calls JxlResizableParallelRunnerDestroy() when releasing the runner.

Use this helper type from C++ sources to ensure the runner is destroyed and their internal resources released.

typedef std::unique_ptr<void, JxlThreadParallelRunnerDestroyStruct> JxlThreadParallelRunnerPtr

std::unique_ptr<> type that calls JxlThreadParallelRunnerDestroy() when releasing the runner.

Use this helper type from C++ sources to ensure the runner is destroyed and their internal resources released.

Functions

static inline JxlDecoderPtr JxlDecoderMake(const JxlMemoryManager *memory_manager)

Creates an instance of JxlDecoder into a JxlDecoderPtr and initializes it.

This function returns a unique_ptr that will call JxlDecoderDestroy() when releasing the pointer. See JxlDecoderCreate for details on the instance creation.

Parameters:

memory_manager – custom allocator function. It may be NULL. The memory manager will be copied internally.

Returns:

a NULL JxlDecoderPtr if the instance can not be allocated or initialized

Returns:

initialized JxlDecoderPtr instance otherwise.

static inline JxlEncoderPtr JxlEncoderMake(const JxlMemoryManager *memory_manager)

Creates an instance of JxlEncoder into a JxlEncoderPtr and initializes it.

This function returns a unique_ptr that will call JxlEncoderDestroy() when releasing the pointer. See JxlEncoderCreate for details on the instance creation.

Parameters:

memory_manager – custom allocator function. It may be NULL. The memory manager will be copied internally.

Returns:

a NULL JxlEncoderPtr if the instance can not be allocated or initialized

Returns:

initialized JxlEncoderPtr instance otherwise.

static inline JxlResizableParallelRunnerPtr JxlResizableParallelRunnerMake(const JxlMemoryManager *memory_manager)

Creates an instance of JxlResizableParallelRunner into a JxlResizableParallelRunnerPtr and initializes it.

This function returns a unique_ptr that will call JxlResizableParallelRunnerDestroy() when releasing the pointer. See JxlResizableParallelRunnerCreate for details on the instance creation.

Parameters:

memory_manager – custom allocator function. It may be NULL. The memory manager will be copied internally.

Returns:

a NULL JxlResizableParallelRunnerPtr if the instance can not be allocated or initialized

Returns:

initialized JxlResizableParallelRunnerPtr instance otherwise.

static inline JxlThreadParallelRunnerPtr JxlThreadParallelRunnerMake(const JxlMemoryManager *memory_manager, size_t num_worker_threads)

Creates an instance of JxlThreadParallelRunner into a JxlThreadParallelRunnerPtr and initializes it.

This function returns a unique_ptr that will call JxlThreadParallelRunnerDestroy() when releasing the pointer. See JxlThreadParallelRunnerCreate for details on the instance creation.

Parameters:
  • memory_manager – custom allocator function. It may be NULL. The memory manager will be copied internally.

  • num_worker_threads – the number of worker threads to create.

Returns:

a NULL JxlThreadParallelRunnerPtr if the instance can not be allocated or initialized

Returns:

initialized JxlThreadParallelRunnerPtr instance otherwise.

struct JxlDecoderDestroyStruct
#include <decode_cxx.h>

Struct to call JxlDecoderDestroy from the JxlDecoderPtr unique_ptr.

Public Functions

inline void operator()(JxlDecoder *decoder)

Calls JxlDecoderDestroy() on the passed decoder.

struct JxlEncoderDestroyStruct
#include <encode_cxx.h>

Struct to call JxlEncoderDestroy from the JxlEncoderPtr unique_ptr.

Public Functions

inline void operator()(JxlEncoder *encoder)

Calls JxlEncoderDestroy() on the passed encoder.

struct JxlResizableParallelRunnerDestroyStruct
#include <resizable_parallel_runner_cxx.h>

Struct to call JxlResizableParallelRunnerDestroy from the JxlResizableParallelRunnerPtr unique_ptr.

Public Functions

inline void operator()(void *runner)

Calls JxlResizableParallelRunnerDestroy() on the passed runner.

struct JxlThreadParallelRunnerDestroyStruct
#include <thread_parallel_runner_cxx.h>

Struct to call JxlThreadParallelRunnerDestroy from the JxlThreadParallelRunnerPtr unique_ptr.

Public Functions

inline void operator()(void *runner)

Calls JxlThreadParallelRunnerDestroy() on the passed runner.