Merge branch 'issue139' into devel
This commit is contained in:
commit
4a1bba217e
4 changed files with 22 additions and 8 deletions
|
|
@ -20,6 +20,7 @@ from collections import Counter
|
|||
import ctypes
|
||||
import math
|
||||
import os
|
||||
import re
|
||||
import struct
|
||||
from uuid import UUID
|
||||
import warnings
|
||||
|
|
@ -166,7 +167,7 @@ class Jp2k(Jp2kBox):
|
|||
fps : int
|
||||
Frames per second, should be either 24 or 48.
|
||||
"""
|
||||
if version.openjpeg_version_tuple[0] == 1:
|
||||
if re.match("(1.5|2.0)", version.openjpeg_version) is not None:
|
||||
msg = "Writing Cinema2K or Cinema4K files is not supported with "
|
||||
msg += 'openjpeg library versions less than 2.0.1.'
|
||||
raise IOError(msg)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,20 @@ import sys
|
|||
from .config import glymur_config
|
||||
OPENJP2, OPENJPEG = glymur_config()
|
||||
|
||||
def version():
|
||||
"""Wrapper for opj_version library routine."""
|
||||
OPENJP2.opj_version.restype = ctypes.c_char_p
|
||||
library_version = OPENJP2.opj_version()
|
||||
if sys.hexversion >= 0x03000000:
|
||||
return library_version.decode('utf-8')
|
||||
else:
|
||||
return library_version
|
||||
|
||||
if OPENJP2 is not None:
|
||||
_MAJOR, _MINOR, _PATCH = version().split('.')
|
||||
else:
|
||||
_MINOR = 0
|
||||
|
||||
ERROR_MSG_LST = []
|
||||
|
||||
# Map certain atomic OpenJPEG datatypes to the ctypes equivalents.
|
||||
|
|
@ -391,12 +405,10 @@ class ImageCompType(ctypes.Structure):
|
|||
("factor", ctypes.c_uint32),
|
||||
|
||||
# image component data
|
||||
("data", ctypes.POINTER(ctypes.c_int32)),
|
||||
|
||||
# alpha channel
|
||||
# TODO: exclude for 2.0, 1.5
|
||||
("alpha", ctypes.c_uint16)]
|
||||
("data", ctypes.POINTER(ctypes.c_int32))]
|
||||
|
||||
if _MINOR == '1':
|
||||
_fields_.append(("alpha", ctypes.c_uint16))
|
||||
|
||||
class ImageType(ctypes.Structure):
|
||||
"""Defines image data and characteristics.
|
||||
|
|
|
|||
|
|
@ -461,7 +461,9 @@ class TestSuite(unittest.TestCase):
|
|||
def test_NR_DEC_illegalcolortransform_j2k_14_decode(self):
|
||||
# Stream too short, expected SOT.
|
||||
jfile = opj_data_file('input/nonregression/illegalcolortransform.j2k')
|
||||
Jp2k(jfile).read()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore")
|
||||
Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
def test_NR_DEC_j2k32_j2k_15_decode(self):
|
||||
|
|
|
|||
|
|
@ -222,7 +222,6 @@ class TestSuiteWriteCinema(unittest.TestCase):
|
|||
codestream = j.get_codestream()
|
||||
self.check_cinema2k_codestream(codestream, (1998, 1080))
|
||||
|
||||
|
||||
@unittest.skipIf(not _HAS_SKIMAGE_FREEIMAGE_SUPPORT,
|
||||
"Cannot read input image without scikit-image/freeimage")
|
||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue