JxlParallelRunner

Type Alias JxlParallelRunner 

Source
pub type JxlParallelRunner = unsafe extern "C-unwind" fn(runner_opaque: *mut c_void, jpegxl_opaque: *mut c_void, init: JxlParallelRunInit, func: JxlParallelRunFunction, start_range: u32, end_range: u32) -> JxlParallelRetCode;
Expand description

JxlParallelRunner function type. A parallel runner implementation can be provided by a JPEG XL caller to allow running computations in multiple threads. This function must call the initialization function init in the same thread that called it and then call the passed func once for every number in the range [start_range, end_range) (including start_range but not including end_range) possibly from different multiple threads in parallel.

The JxlParallelRunner function does not need to be re-entrant. This means that the same JxlParallelRunner function with the same runner_opaque provided parameter will not be called from the library from either init or func in the same decoder or encoder instance. However, a single decoding or encoding instance may call the provided JxlParallelRunner multiple times for different parts of the decoding or encoding process.

ยงReturns

  • 0: if the init call succeeded (returned 0) and no other error occurred in the runner code.
  • JXL_PARALLEL_RET_RUNNER_ERROR: if an error occurred in the runner code, for example, setting up the threads.
  • The return value of init() if non-zero.