Skip to content

Commit

Permalink
Let the glymur library multiple cpus for decoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
manthey committed Jan 15, 2021
1 parent 2b70de7 commit 4fccb0b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sources/openjpeg/large_image_source_openjpeg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import glymur
import math
import multiprocessing
import PIL.Image
import six
import warnings
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4fccb0b

Please sign in to comment.