From c7c8417dd561021e00c80b7570dac0c8344d8163 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 8 Oct 2020 16:54:33 +0200 Subject: [PATCH] Re-enable multi-threading support for OpenJPEG decoder and allow total number of CPUs threads --- indra/llimagej2coj/llimagej2coj.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index 56b975f15e..ede8ae3709 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -335,10 +335,12 @@ bool LLImageJ2COJ::decodeImpl(LLImageJ2C &base, LLImageRaw &raw_image, F32 decod /* setup the decoder decoding parameters using user parameters */ opj_setup_decoder(opj_decoder_p, ¶meters); - //if ( (opj_has_thread_support()) && (s_numDecodeThreads > 1) ) - //{ - // opj_codec_set_threads(opj_decoder_p, s_numDecodeThreads); - //} + + /* allow multi-threading */ + if (opj_has_thread_support()) + { + opj_codec_set_threads(opj_decoder_p, opj_get_num_cpus()); + } /* open a byte stream */ LLJp2StreamReader streamReader(&base);