pub type RunnerFn = unsafe extern "C" fn(runner_opaque: *mut c_void, jpegxl_opaque: *mut c_void, init_func: InitFn, run_func: RunFn, start_range: u32, end_range: u32) -> JxlParallelRetCode;
Expand description
FFI runner function.
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_func
in the
same thread that called it and then call the passed run_func
once for every
number in the range [start_range
, end_range
) (including start_range
ge 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_func
or
run_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 @p 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.- Return the return value of
init_func
if non-zero.