Function openjpeg_sys::opj_codec_set_threads

source ·
pub unsafe extern "C" fn opj_codec_set_threads(
    p_codec: *mut opj_codec_t,
    num_threads: c_int,
) -> OPJ_BOOL
Expand description

Allocates worker threads for the compressor/decompressor.

By default, only the main thread is used. If this function is not used, but the OPJ_NUM_THREADS environment variable is set, its value will be used to initialize the number of threads. The value can be either an integer number, or “ALL_CPUS”. If OPJ_NUM_THREADS is set and this function is called, this function will override the behaviour of the environment variable.

This function must be called after opj_setup_decoder() and before opj_read_header() for the decoding side, or after opj_setup_encoder() and before opj_start_compress() for the encoding side.

  • p_codec’ — decompressor or compressor handler
  • num_threads’ — number of threads.

@return OPJ_TRUE if the function is successful.