pub type JxlParallelRunner = Option<unsafe extern "C" 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 @p init in the same thread that called it and then call the passed @p 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 @p init or @p 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.

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