summaryrefslogtreecommitdiff
path: root/src/lib/openjp2/openjpeg.h
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2016-05-25 16:36:47 +0200
committerEven Rouault <even.rouault@spatialys.com>2016-05-25 21:02:07 +0200
commitd4b7f03cfa4732132767188782683f3d957da912 (patch)
tree47ae5bbd2694e2df24c80d3f4779a25f07345181 /src/lib/openjp2/openjpeg.h
parent54179fe1d53156c6b440166fe71a10f238a6ea56 (diff)
Add opj_codec_set_threads() in public API and propagate resulting thread pool to tcd level
By default, only the main thread is used. If opj_codec_set_threads() 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.
Diffstat (limited to 'src/lib/openjp2/openjpeg.h')
-rw-r--r--src/lib/openjp2/openjpeg.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h
index 369693df..7912c236 100644
--- a/src/lib/openjp2/openjpeg.h
+++ b/src/lib/openjp2/openjpeg.h
@@ -1263,6 +1263,25 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
opj_dparameters_t *parameters );
/**
+ * 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.
+ *
+ * Note: currently only has effect on the decompressor.
+ *
+ * @param p_codec decompressor handler
+ * @param num_threads number of threads.
+ *
+ * @return OPJ_TRUE if the decoder is correctly set
+ */
+OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec,
+ int num_threads);
+
+/**
* Decodes an image header.
*
* @param p_stream the jpeg2000 stream.