From 4fccb0b5e777713c8a2cb5f24b462525a781719a Mon Sep 17 00:00:00 2001 From: David Manthey Date: Fri, 15 Jan 2021 08:59:48 -0500 Subject: [PATCH] Let the glymur library multiple cpus for decoding. --- sources/openjpeg/large_image_source_openjpeg/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/openjpeg/large_image_source_openjpeg/__init__.py b/sources/openjpeg/large_image_source_openjpeg/__init__.py index 0f7c54894..dc6e17c36 100644 --- a/sources/openjpeg/large_image_source_openjpeg/__init__.py +++ b/sources/openjpeg/large_image_source_openjpeg/__init__.py @@ -18,6 +18,7 @@ import glymur import math +import multiprocessing import PIL.Image import six import warnings @@ -96,6 +97,7 @@ def __init__(self, path, **kwargs): self._openjpeg = glymur.Jp2k(largeImagePath) except glymur.jp2box.InvalidJp2kError: raise TileSourceException('File cannot be opened via Glymur and OpenJPEG.') + glymur.set_option('lib.num_threads', multiprocessing.cpu_count()) self._openjpegHandles = queue.LifoQueue() for _ in range(self._maxOpenHandles - 1): self._openjpegHandles.put(None)