diff --git a/glymur/codestream.py b/glymur/codestream.py index efdf8c3..ce11e9d 100644 --- a/glymur/codestream.py +++ b/glymur/codestream.py @@ -13,9 +13,9 @@ import warnings import numpy as np from .core import LRCP, RLCP, RPCL, PCRL, CPRL -from .core import WAVELET_TRANSFORM_9x7_IRREVERSIBLE -from .core import WAVELET_TRANSFORM_5x3_REVERSIBLE -from .core import _capabilities_display +from .core import WAVELET_XFORM_9X7_IRREVERSIBLE +from .core import WAVELET_XFORM_5X3_REVERSIBLE +from .core import _CAPABILITIES_DISPLAY from .lib import openjp2 as opj2 _PROGRESSION_ORDER_DISPLAY = { @@ -26,8 +26,8 @@ _PROGRESSION_ORDER_DISPLAY = { CPRL: 'CPRL'} _WAVELET_TRANSFORM_DISPLAY = { - WAVELET_TRANSFORM_9x7_IRREVERSIBLE: '9-7 irreversible', - WAVELET_TRANSFORM_5x3_REVERSIBLE: '5-3 reversible'} + WAVELET_XFORM_9X7_IRREVERSIBLE: '9-7 irreversible', + WAVELET_XFORM_5X3_REVERSIBLE: '5-3 reversible'} # Need a catch-all list of valid markers. # See table A-1 in ISO/IEC FCD15444-1. @@ -1134,7 +1134,7 @@ class SIZsegment(Segment): 'Signed: {10}', 'Vertical, Horizontal Subsampling: {11}'] msg += '\n '.join(lines) - msg = msg.format(_capabilities_display[self.rsiz], + msg = msg.format(_CAPABILITIES_DISPLAY[self.rsiz], self.ysiz, self.xsiz, self.yosiz, self.xosiz, self.ytsiz, self.xtsiz, diff --git a/glymur/core.py b/glymur/core.py index 71c08cd..3959dd0 100644 --- a/glymur/core.py +++ b/glymur/core.py @@ -1,3 +1,5 @@ +"""Core definitions to be shared amongst the modules. +""" # Progression order LRCP = 0 RLCP = 1 @@ -12,8 +14,8 @@ PROGRESSION_ORDER = { 'PCRL': PCRL, 'CPRL': CPRL} -WAVELET_TRANSFORM_9x7_IRREVERSIBLE = 0 -WAVELET_TRANSFORM_5x3_REVERSIBLE = 1 +WAVELET_XFORM_9X7_IRREVERSIBLE = 0 +WAVELET_XFORM_5X3_REVERSIBLE = 1 ENUMERATED_COLORSPACE = 1 RESTRICTED_ICC_PROFILE = 2 @@ -32,7 +34,7 @@ YCC = 18 E_SRGB = 20 ROMM_RGB = 21 -_colorspace_map_display = { +_COLORSPACE_MAP_DISPLAY = { CMYK: 'CMYK', SRGB: 'sRGB', GREYSCALE: 'greyscale', @@ -45,7 +47,7 @@ _COLOR = 0 _OPACITY = 1 _PRE_MULTIPLIED_OPACITY = 2 _UNSPECIFIED = 65535 -_color_type_map_display = { +_COLOR_TYPE_MAP_DISPLAY = { _COLOR: 'color', _OPACITY: 'opacity', _PRE_MULTIPLIED_OPACITY: 'pre-multiplied opacity', @@ -58,103 +60,15 @@ BLUE = 3 GREY = 1 # enumerated color channel associations -_rgb_colorspace = {"R": 1, "G": 2, "B": 3} -_greyscale_colorspace = {"Y": 1} -_ycbcr_colorspace = {"Y": 1, "Cb": 2, "Cr": 3} -_colorspace = {SRGB: _rgb_colorspace, - GREYSCALE: _greyscale_colorspace, - YCC: _ycbcr_colorspace, - E_SRGB: _rgb_colorspace, - ROMM_RGB: _rgb_colorspace} +_COLORSPACE = {SRGB: {"R": 1, "G": 2, "B": 3}, + GREYSCALE: {"Y": 1}, + YCC: {"Y": 1, "Cb": 2, "Cr": 3}, + E_SRGB: {"R": 1, "G": 2, "B": 3}, + ROMM_RGB: {"R": 1, "G": 2, "B": 3}} # How to display the codestream profile. -_capabilities_display = { +_CAPABILITIES_DISPLAY = { 0: '2', 1: '0', 2: '1', 3: '3'} - -# Reader requirements -_reader_requirements_display = { - 0: 'File not completely understood', - 1: 'Deprecated', - 2: 'Contains multiple composition layers', - 3: 'Deprecated', - 4: 'JPEG 2000 Part 1 Profile 1 codestream', - 5: 'Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 ' - + '| ISO/IEC 15444-1', - 6: 'Unrestricted JPEG 2000 Part 2 codestream', - 7: 'JPEG codestream as defined in ISO/IEC 10918-1', - 8: 'Deprecated', - 9: 'Non-premultiplied opacity channel', - 10: 'Premultiplied opacity channel', - 11: 'Chroma-key based opacity', - 12: 'Deprecated', - 13: 'Fragmented codestream where all fragments are in file and in order', - 14: 'Fragmented codestream where all fragments are in file ' - + 'but are out of order', - 15: 'Fragmented codestream where not all fragments are within the file ' - + 'but are all in locally accessible files', - 16: 'Fragmented codestream where some fragments may be accessible ' - + 'only through a URL specified network connection', - 17: 'Compositing required to produce rendered result from multiple ' - + 'compositing layers', - 18: 'Deprecated', - 19: 'Deprecated', - 20: 'Deprecated', - 21: 'At least one compositing layer consists of multiple codestreams', - 22: 'Deprecated', - 23: 'Colourspace transformations are required to combine compositing ' - + 'layers; not all compositing layers are in the same colourspace', - 24: 'Deprecated', - 25: 'Deprecated', - 26: 'First animation layer does not cover entire rendered result', - 27: 'Deprecated', - 28: 'Reuse of animation layers', - 29: 'Deprecated', - 30: 'Some animated frames are non-persistent', - 31: 'Deprecated', - 32: 'Rendered result involves scaling within a layer', - 33: 'Rendered result involves scaling between layers', - 34: 'ROI metadata', - 35: 'IPR metadata', - 36: 'Content metadata', - 37: 'History metadata', - 38: 'Creation metadata', - 39: 'JPX digital signatures', - 40: 'JPX checksums', - 41: 'Desires Graphics Arts Reproduction specified', - 42: 'Deprecated', - 43: '(Deprecated) compositing layer uses restricted ICC profile', - 44: 'Compositing layer uses Any ICC profile', - 45: 'Deprecated', - 46: 'Deprecated', - 47: 'BiLevel 1 enumerated colourspace', - 48: 'BiLevel 2 enumerated colourspace', - 49: 'YCbCr 1 enumerated colourspace', - 50: 'YCbCr 2 enumerated colourspace', - 51: 'YCbCr 3 enumerated colourspace', - 52: 'PhotoYCC enumerated colourspace', - 53: 'YCCK enumerated colourspace', - 54: 'CMY enumerated colourspace', - 55: 'CMYK enumerated colorspace', - 56: 'CIELab enumerated colourspace with default parameters', - 57: 'CIELab enumerated colourspace with non-default parameters', - 58: 'CIEJab enumerated colourspace with default parameters', - 59: 'CIEJab enumerated colourspace with non-default parameters', - 60: 'e-sRGB enumerated colorspace', - 61: 'ROMM_RGB enumerated colorspace', - 62: 'Non-square samples', - 63: 'Deprecated', - 64: 'Deprecated', - 65: 'Deprecated', - 66: 'Deprecated', - 67: 'GIS metadata XML box', - 68: 'JPSEC extensions in codestream as specified by ISO/IEC 15444-8', - 69: 'JP3D extensions in codestream as specified by ISO/IEC 15444-10', - 70: 'Deprecated', - 71: 'e-sYCC enumerated colourspace', - 72: 'JPEG 2000 Part 2 codestream as restricted by baseline conformance ' - + 'requirements in M.9.2.3', - 73: 'YPbPr(1125/60) enumerated colourspace', - 74: 'YPbPr(1250/50) enumerated colourspace'} diff --git a/glymur/jp2box.py b/glymur/jp2box.py index b12af8d..164da61 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -27,9 +27,8 @@ import xml.etree.cElementTree as ET import numpy as np from .codestream import Codestream -from .core import _colorspace_map_display -from .core import _color_type_map_display -from .core import _reader_requirements_display +from .core import _COLORSPACE_MAP_DISPLAY +from .core import _COLOR_TYPE_MAP_DISPLAY from .core import ENUMERATED_COLORSPACE, RESTRICTED_ICC_PROFILE from .core import ANY_ICC_PROFILE, VENDOR_COLOR_METHOD @@ -207,7 +206,7 @@ class ColourSpecificationBox(Jp2kBox): dispvalue = _approximation_display[self.approximation] msg += '\n Approximation: {0}'.format(dispvalue) if self.colorspace is not None: - dispvalue = _colorspace_map_display[self.colorspace] + dispvalue = _COLORSPACE_MAP_DISPLAY[self.colorspace] msg += '\n Colorspace: {0}'.format(dispvalue) else: # 2.7 has trouble pretty-printing ordered dicts so we just have @@ -234,10 +233,10 @@ class ColourSpecificationBox(Jp2kBox): fptr.write('colr'.encode()) read_buffer = struct.pack('>BBBI', - self.method, - self.precedence, - self.approximation, - self.colorspace) + self.method, + self.precedence, + self.approximation, + self.colorspace) fptr.write(read_buffer) @staticmethod @@ -259,7 +258,8 @@ class ColourSpecificationBox(Jp2kBox): """ # Read the brand, minor version. read_buffer = fptr.read(3) - (method, precedence, approximation) = struct.unpack('>BBB', read_buffer) + (method, precedence, approximation) = struct.unpack('>BBB', + read_buffer) if method == 1: # enumerated colour space @@ -445,7 +445,7 @@ class ChannelDefinitionBox(Jp2kBox): def __str__(self): msg = Jp2kBox.__str__(self) for j in range(len(self.association)): - color_type_string = _color_type_map_display[self.channel_type[j]] + color_type_string = _COLOR_TYPE_MAP_DISPLAY[self.channel_type[j]] if self.association[j] == 0: assn = 'whole image' else: @@ -463,9 +463,9 @@ class ChannelDefinitionBox(Jp2kBox): fptr.write(struct.pack('>H', num_components)) for j in range(num_components): fptr.write(struct.pack('>' + 'H' * 3, - self.index[j], - self.channel_type[j], - self.association[j])) + self.index[j], + self.channel_type[j], + self.association[j])) @staticmethod def _parse(fptr, offset, length): @@ -624,7 +624,8 @@ class ContiguousCodestreamBox(Jp2kBox): ContiguousCodestreamBox instance """ main_header = Codestream(fptr, header_only=True) - box = ContiguousCodestreamBox(main_header, length=length, offset=offset) + box = ContiguousCodestreamBox(main_header, length=length, + offset=offset) return box @@ -801,13 +802,13 @@ class ImageHeaderBox(Jp2kBox): bit_depth_signedness = 0x80 if self.signed else 0x00 bit_depth_signedness |= self.bits_per_component - 1 read_buffer = struct.pack('>IIHBBBB', - self.height, - self.width, - self.num_components, - bit_depth_signedness, - self.compression, - 1 if self.colorspace_unknown else 0, - 1 if self.ip_provided else 0) + self.height, + self.width, + self.num_components, + bit_depth_signedness, + self.compression, + 1 if self.colorspace_unknown else 0, + 1 if self.ip_provided else 0) fptr.write(read_buffer) @staticmethod @@ -1135,7 +1136,90 @@ class PaletteBox(Jp2kBox): offset=offset) return box - +# Map rreq codes to display text. +_READER_REQUIREMENTS_DISPLAY = { + 0: 'File not completely understood', + 1: 'Deprecated', + 2: 'Contains multiple composition layers', + 3: 'Deprecated', + 4: 'JPEG 2000 Part 1 Profile 1 codestream', + 5: 'Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 ' + + '| ISO/IEC 15444-1', + 6: 'Unrestricted JPEG 2000 Part 2 codestream', + 7: 'JPEG codestream as defined in ISO/IEC 10918-1', + 8: 'Deprecated', + 9: 'Non-premultiplied opacity channel', + 10: 'Premultiplied opacity channel', + 11: 'Chroma-key based opacity', + 12: 'Deprecated', + 13: 'Fragmented codestream where all fragments are in file and in order', + 14: 'Fragmented codestream where all fragments are in file ' + + 'but are out of order', + 15: 'Fragmented codestream where not all fragments are within the file ' + + 'but are all in locally accessible files', + 16: 'Fragmented codestream where some fragments may be accessible ' + + 'only through a URL specified network connection', + 17: 'Compositing required to produce rendered result from multiple ' + + 'compositing layers', + 18: 'Deprecated', + 19: 'Deprecated', + 20: 'Deprecated', + 21: 'At least one compositing layer consists of multiple codestreams', + 22: 'Deprecated', + 23: 'Colourspace transformations are required to combine compositing ' + + 'layers; not all compositing layers are in the same colourspace', + 24: 'Deprecated', + 25: 'Deprecated', + 26: 'First animation layer does not cover entire rendered result', + 27: 'Deprecated', + 28: 'Reuse of animation layers', + 29: 'Deprecated', + 30: 'Some animated frames are non-persistent', + 31: 'Deprecated', + 32: 'Rendered result involves scaling within a layer', + 33: 'Rendered result involves scaling between layers', + 34: 'ROI metadata', + 35: 'IPR metadata', + 36: 'Content metadata', + 37: 'History metadata', + 38: 'Creation metadata', + 39: 'JPX digital signatures', + 40: 'JPX checksums', + 41: 'Desires Graphics Arts Reproduction specified', + 42: 'Deprecated', + 43: '(Deprecated) compositing layer uses restricted ICC profile', + 44: 'Compositing layer uses Any ICC profile', + 45: 'Deprecated', + 46: 'Deprecated', + 47: 'BiLevel 1 enumerated colourspace', + 48: 'BiLevel 2 enumerated colourspace', + 49: 'YCbCr 1 enumerated colourspace', + 50: 'YCbCr 2 enumerated colourspace', + 51: 'YCbCr 3 enumerated colourspace', + 52: 'PhotoYCC enumerated colourspace', + 53: 'YCCK enumerated colourspace', + 54: 'CMY enumerated colourspace', + 55: 'CMYK enumerated colorspace', + 56: 'CIELab enumerated colourspace with default parameters', + 57: 'CIELab enumerated colourspace with non-default parameters', + 58: 'CIEJab enumerated colourspace with default parameters', + 59: 'CIEJab enumerated colourspace with non-default parameters', + 60: 'e-sRGB enumerated colorspace', + 61: 'ROMM_RGB enumerated colorspace', + 62: 'Non-square samples', + 63: 'Deprecated', + 64: 'Deprecated', + 65: 'Deprecated', + 66: 'Deprecated', + 67: 'GIS metadata XML box', + 68: 'JPSEC extensions in codestream as specified by ISO/IEC 15444-8', + 69: 'JP3D extensions in codestream as specified by ISO/IEC 15444-10', + 70: 'Deprecated', + 71: 'e-sYCC enumerated colourspace', + 72: 'JPEG 2000 Part 2 codestream as restricted by baseline conformance ' + + 'requirements in M.9.2.3', + 73: 'YPbPr(1125/60) enumerated colourspace', + 74: 'YPbPr(1250/50) enumerated colourspace'} class ReaderRequirementsBox(Jp2kBox): """Container for reader requirements box information. @@ -1182,7 +1266,7 @@ class ReaderRequirementsBox(Jp2kBox): msg += '\n Standard Features:' for j in range(len(self.standard_flag)): sfl = self.standard_flag[j] - rrdisp = _reader_requirements_display[self.standard_flag[j]] + rrdisp = _READER_REQUIREMENTS_DISPLAY[self.standard_flag[j]] msg += '\n Feature {0:03d}: {1}'.format(sfl, rrdisp) msg += '\n Vendor Features:' @@ -1803,7 +1887,7 @@ class UUIDBox(Jp2kBox): ---------- the_uuid : uuid.UUID Identifies the type of UUID box. - raw_data : + raw_data : byte array This is the "payload" of data for the specified UUID. length : int length of the box in bytes. diff --git a/glymur/jp2k.py b/glymur/jp2k.py index abc54e2..e1d27cb 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -146,8 +146,8 @@ class Jp2k(Jp2kBox): box_length = values[0] box_id = values[1] signature = values[2:] - if ((box_length != 12) or (box_id != b'jP ') or - (signature != (13, 10, 135, 10))): + if (((box_length != 12) or (box_id != b'jP ') or + (signature != (13, 10, 135, 10)))): msg = '{0} is not a JPEG 2000 file.'.format(self.filename) raise IOError(msg) @@ -378,7 +378,7 @@ class Jp2k(Jp2kBox): else: raise RuntimeError("unhandled datatype") - comptparms = (_opj2.image_comptparm_t * num_comps)() + comptparms = (_opj2.ImageComptParmType * num_comps)() for j in range(num_comps): comptparms[j].dx = cparams.subsampling_dx comptparms[j].dy = cparams.subsampling_dy @@ -551,7 +551,8 @@ class Jp2k(Jp2kBox): else: # OK, I'm a jp2 file. Need to find out where the # raw codestream actually starts. - jp2c = [box for box in self.box if box.box_id == 'jp2c'] + jp2c = [box for box in self.box + if box.box_id == 'jp2c'] jp2c = jp2c[0] ofile.write(struct.pack('>I', jp2c.length + 8)) ofile.write('jp2c'.encode()) @@ -647,10 +648,9 @@ class Jp2k(Jp2kBox): msg += "using OPENJP2 instead." raise RuntimeError(msg) - with ExitStack() as stack: # Set decoding parameters. - dparameters = _opj.dparameters_t() + dparameters = _opj.DecompressionParametersType() _opj.set_default_decoder_parameters(ctypes.byref(dparameters)) dparameters.cp_reduce = rlevel dparameters.decod_format = self._codec_format @@ -662,13 +662,13 @@ class Jp2k(Jp2kBox): dinfo = _opj.create_decompress(dparameters.decod_format) - event_mgr = _opj.event_mgr_t() + event_mgr = _opj.EventMgrType() info_handler = ctypes.cast(_INFO_CALLBACK, ctypes.c_void_p) event_mgr.info_handler = info_handler if verbose else None event_mgr.warning_handler = ctypes.cast(_WARNING_CALLBACK, - ctypes.c_void_p) + ctypes.c_void_p) event_mgr.error_handler = ctypes.cast(_ERROR_CALLBACK, - ctypes.c_void_p) + ctypes.c_void_p) _opj.set_event_mgr(dinfo, ctypes.byref(event_mgr)) _opj.setup_decoder(dinfo, dparameters) @@ -722,7 +722,7 @@ class Jp2k(Jp2kBox): warnings.simplefilter("ignore") nelts = nrows * ncols band = np.ctypeslib.as_array( - (ctypes.c_int32 * nelts).from_address(addr)) + (ctypes.c_int32 * nelts).from_address(addr)) data[:, :, k] = np.reshape(band.astype(dtype), (nrows, ncols)) @@ -909,7 +909,7 @@ class Jp2k(Jp2kBox): with warnings.catch_warnings(): warnings.simplefilter("ignore") band = np.ctypeslib.as_array( - (ctypes.c_int32 * nrows * ncols).from_address(addr)) + (ctypes.c_int32 * nrows * ncols).from_address(addr)) if as_bands: data.append(np.reshape(band.astype(dtype), (nrows, ncols))) else: diff --git a/glymur/lib/config.py b/glymur/lib/config.py index fa9f587..da1c031 100644 --- a/glymur/lib/config.py +++ b/glymur/lib/config.py @@ -5,6 +5,7 @@ import ctypes from ctypes.util import find_library import os import platform +import warnings import sys if sys.hexversion <= 0x03000000: @@ -39,8 +40,10 @@ def glymurrc_fname(): def get_openjpeg_config(): + """ Try to find openjpeg library on the system path first. + """ libopenjpeg_path = find_library('openjpeg') - + # If we could not find it, then look in some likely locations. if libopenjpeg_path is None: if platform.system() == 'Darwin': @@ -56,23 +59,27 @@ def get_openjpeg_config(): try: if os.name == "nt": openjpeg_lib = ctypes.windll.LoadLibrary(libopenjpeg_path) - else: + else: openjpeg_lib = ctypes.CDLL(libopenjpeg_path) except OSError: openjpeg_lib = None - + if openjpeg_lib is not None: # Must be at least 1.5.0 openjpeg_lib.opj_version.restype = ctypes.c_char_p - v = openjpeg_lib.opj_version() - v = v.decode('utf-8') - major, minor, patch = v.split('.') + version = openjpeg_lib.opj_version().decode('utf-8') + _, minor, _ = version.split('.') if minor != '5': openjpeg_lib = None return openjpeg_lib def get_openjp2_config(): + """ + We expect to not find openjp2 on the system path since the only version + that we currently care about is still in the svn trunk at openjpeg.org. + We must use a configuration file that the user must write. + """ filename = glymurrc_fname() if filename is not None: # Read the configuration file for the library location. @@ -106,6 +113,7 @@ def glymur_config(): openjpeg_lib = get_openjpeg_config() return openjp2_lib, openjpeg_lib + def get_configdir(): """Return string representing the configuration directory. @@ -121,4 +129,5 @@ def get_configdir(): if 'USERPROFILE' in os.environ: # Windows? - return os.path.join(os.environ['USERPROFILE'], 'Application Data', 'glymur') + return os.path.join(os.environ['USERPROFILE'], 'Application Data', + 'glymur') diff --git a/glymur/lib/openjp2.py b/glymur/lib/openjp2.py index 0769cbc..be9981b 100644 --- a/glymur/lib/openjp2.py +++ b/glymur/lib/openjp2.py @@ -1,30 +1,23 @@ """ Wraps individual functions in openjp2 library. """ + +# pylint: disable=C0302,R0903 + import ctypes -from ctypes.util import find_library -import warnings from .config import glymur_config OPENJP2, OPENJPEG = glymur_config() -# Progression order -LRCP = 0 -RLCP = 1 -RPCL = 2 -PCRL = 3 -CPRL = 4 - - ERROR_MSG_LST = [] # Map certain atomic OpenJPEG datatypes to the ctypes equivalents. -bool_t = ctypes.c_int32 -codec_t_p = ctypes.c_void_p -prog_order_t_p = ctypes.c_int32 -cinema_mode_t = ctypes.c_int32 -rsiz_capabilities_t = ctypes.c_int32 -stream_t_p = ctypes.c_void_p +BOOL_TYPE = ctypes.c_int32 +CODEC_TYPE = ctypes.c_void_p +PROG_ORDER_TYPE = ctypes.c_int32 +CINEMA_MODE_TYPE = ctypes.c_int32 +RSIZ_CAPABILITIES_TYPE = ctypes.c_int32 +STREAM_TYPE_P = ctypes.c_void_p PATH_LEN = 4096 J2K_MAXRLVLS = 33 @@ -41,18 +34,21 @@ CLRSPC_UNSPECIFIED = 0 CLRSPC_SRGB = 1 CLRSPC_GRAY = 2 CLRSPC_YCC = 3 -color_space_t = ctypes.c_int +COLOR_SPACE_TYPE = ctypes.c_int # supported codec -codec_format_t = ctypes.c_int +CODEC_FORMAT_TYPE = ctypes.c_int CODEC_UNKNOWN = -1 CODEC_J2K = 0 CODEC_JPT = 1 CODEC_JP2 = 2 -class poc_t(ctypes.Structure): - """Progression order changes.""" +class PocType(ctypes.Structure): + """Progression order changes. + + Corresponds to poc_t type in openjp2 headers. + """ # Resolution num start, Component num start, given by POC _fields_ = [ ("resno0", ctypes.c_uint32), @@ -69,8 +65,8 @@ class poc_t(ctypes.Structure): ("precno1", ctypes.c_uint32), # Progression order enum - ("prg1", prog_order_t_p), - ("prg", prog_order_t_p), + ("prg1", PROG_ORDER_TYPE), + ("prg", PROG_ORDER_TYPE), # Progression order string ("progorder", ctypes.c_char * 5), @@ -114,8 +110,11 @@ class poc_t(ctypes.Structure): ("ty0_t", ctypes.c_uint32)] -class dparameters_t(ctypes.Structure): - """Decompression parameters""" +class DecompressionParametersType(ctypes.Structure): + """Decompression parameters. + + Corresponds to dparameters_t type in openjp2 headers. + """ _fields_ = [ # Set the number of highest resolutio levels to be discarded. The # image resolution is effectively divided by 2 to the power of @@ -153,7 +152,7 @@ class dparameters_t(ctypes.Structure): ("DA_y1", ctypes.c_uint32), # verbose mode - ("m_verbose", bool_t), + ("m_verbose", BOOL_TYPE), # tile number of the decoded tile ("tile_index", ctypes.c_uint32), @@ -162,7 +161,7 @@ class dparameters_t(ctypes.Structure): ("nb_tile_to_decode", ctypes.c_uint32), # activates the JPWL correction capabilities - ("jpwl_correct", bool_t), + ("jpwl_correct", BOOL_TYPE), # activates the JPWL correction capabilities ("jpwl_exp_comps", ctypes.c_int32), @@ -174,13 +173,16 @@ class dparameters_t(ctypes.Structure): ("flags", ctypes.c_uint32)] -class cparameters_t(ctypes.Structure): - """Compression parameters""" +class CompressionParametersType(ctypes.Structure): + """Compression parameters. + + Corresponds to cparameters_t type in openjp2 headers. + """ _fields_ = [ # size of tile: # tile_size_on = false (not in argument) or # = true (in argument) - ("tile_size_on", bool_t), + ("tile_size_on", BOOL_TYPE), # XTOsiz, YTOsiz ("cp_tx0", ctypes.c_int), @@ -212,7 +214,7 @@ class cparameters_t(ctypes.Structure): ("prog_order", ctypes.c_int), # progression order changes - ("poc", poc_t * 32), + ("poc", PocType * 32), # number of progression order changes (POC), default to 0 ("numpocs", ctypes.c_uint), @@ -286,7 +288,7 @@ class cparameters_t(ctypes.Structure): # JPWL encoding parameters # enables writing of EPC in MH, thus activating JPWL - ("jpwl_epc_on", bool_t), + ("jpwl_epc_on", BOOL_TYPE), # error protection method for MH (0,1,16,32,37-128) ("jpwl_hprot_mh", ctypes.c_int), @@ -325,14 +327,14 @@ class cparameters_t(ctypes.Structure): ("jpwl_sens_tph", ctypes.c_int * JPWL_MAX_NO_TILESPECS), # Digital Cinema compliance 0-not compliant, 1-compliant - ("cp_cinema", cinema_mode_t), + ("cp_cinema", CINEMA_MODE_TYPE), # Maximum rate for each component. # If == 0, component size limitation is not considered ("max_comp_size", ctypes.c_int), # Profile name - ("cp_rsiz", rsiz_capabilities_t), + ("cp_rsiz", RSIZ_CAPABILITIES_TYPE), # Tile part generation ("tp_on", ctypes.c_uint8), @@ -344,15 +346,18 @@ class cparameters_t(ctypes.Structure): ("tcp_mct", ctypes.c_uint8), # Enable JPIP indexing - ("jpip_on", bool_t), + ("jpip_on", BOOL_TYPE), # Naive implementation of MCT restricted to a single reversible array # based encoding without offset concerning all the components. ("mct_data", ctypes.c_void_p)] -class image_comp_t(ctypes.Structure): - """defines a single image component""" +class ImageCompType(ctypes.Structure): + """Defines a single image component. + + Corresponds to image_comp_t type in openjp2 headers. + """ _fields_ = [ # XRsiz, YRsiz: horizontal, vertical separation of ith component with # respect to the reference grid @@ -387,8 +392,11 @@ class image_comp_t(ctypes.Structure): ("data", ctypes.POINTER(ctypes.c_int32))] -class image_t(ctypes.Structure): - """defines image data and characteristics""" +class ImageType(ctypes.Structure): + """Defines image data and characteristics. + + Corresponds to image_t type in openjp2 headers. + """ _fields_ = [ # XOsiz, YOsiz: horizontal and vertical offset from the origin of the # reference grid to the left side of the image area @@ -403,10 +411,10 @@ class image_t(ctypes.Structure): ("numcomps", ctypes.c_uint32), # color space: should be sRGB, greyscale, or YUV - ("color_space", color_space_t), + ("color_space", COLOR_SPACE_TYPE), # image components - ("comps", ctypes.POINTER(image_comp_t)), + ("comps", ctypes.POINTER(ImageCompType)), # restricted ICC profile buffer ("icc_profile_buf", ctypes.POINTER(ctypes.c_uint8)), @@ -415,8 +423,11 @@ class image_t(ctypes.Structure): ("icc_profile_len", ctypes.c_uint32)] -class image_comptparm_t(ctypes.Structure): - """component parameters structure used by image_create function""" +class ImageComptParmType(ctypes.Structure): + """Component parameters structure used by image_create function. + + Corresponds to image_comptparm_t type in openjp2 headers. + """ _fields_ = [ # XRsiz, YRsiz: horizontal, vertical separation of a sample of ith # component with respect to the reference grid @@ -441,8 +452,11 @@ class image_comptparm_t(ctypes.Structure): ("sgnd", ctypes.c_uint32)] -class tccp_info_t(ctypes.Structure): - """tile-component coding parameters information""" +class TccpInfo(ctypes.Structure): + """Tile-component coding parameters information. + + Corresponds to tccp_info_t type in openjp2 header file. + """ _fields_ = [ # component index ("compno", ctypes.c_uint32), @@ -485,8 +499,11 @@ class tccp_info_t(ctypes.Structure): ("prch", ctypes.c_uint32 * J2K_MAXRLVLS)] -class tile_info_v2_t(ctypes.Structure): - """tile coding parameters information""" +class TileInfoV2(ctypes.Structure): + """Tile coding parameters information + + Corresponds to tile_info_v2_t type in openjp2 headers. + """ _fields_ = [ # number (index) of tile ("tileno", ctypes.c_int32), @@ -495,7 +512,7 @@ class tile_info_v2_t(ctypes.Structure): ("csty", ctypes.c_uint32), # progression order - ("prg", prog_order_t_p), + ("prg", PROG_ORDER_TYPE), # number of layers ("numlayers", ctypes.c_uint32), @@ -504,11 +521,14 @@ class tile_info_v2_t(ctypes.Structure): ("mct", ctypes.c_uint32), # information concerning tile component parameters - ("tccp_info", ctypes.POINTER(tccp_info_t))] + ("tccp_info", ctypes.POINTER(TccpInfo))] -class codestream_info_v2_t(ctypes.Structure): - """information about the codestream""" +class CodestreamInfoV2(ctypes.Structure): + """information about the codestream. + + Corresponds to codestream_info_v2_t type in openjp2 header files. + """ _fields_ = [ # tile info # tile origin in x, y (XTOsiz, YTOsiz) @@ -527,65 +547,65 @@ class codestream_info_v2_t(ctypes.Structure): ("nbcomps", ctypes.c_uint32), # default information regarding tiles inside of image - ("m_default_tile_info", tile_info_v2_t), + ("m_default_tile_info", TileInfoV2), # information regarding tiles inside of image - ("tile_info", ctypes.POINTER(tile_info_v2_t))] + ("tile_info", ctypes.POINTER(TileInfoV2))] # Restrict the input and output argument types for each function used in the # API. if OPENJP2 is not None: - OPENJP2.opj_create_compress.restype = codec_t_p - OPENJP2.opj_create_compress.argtypes = [codec_format_t] + OPENJP2.opj_create_compress.restype = CODEC_TYPE + OPENJP2.opj_create_compress.argtypes = [CODEC_FORMAT_TYPE] - OPENJP2.opj_create_decompress.argtypes = [codec_format_t] - OPENJP2.opj_create_decompress.restype = codec_t_p + OPENJP2.opj_create_decompress.argtypes = [CODEC_FORMAT_TYPE] + OPENJP2.opj_create_decompress.restype = CODEC_TYPE - ARGTYPES = [codec_t_p, stream_t_p, ctypes.POINTER(image_t)] + ARGTYPES = [CODEC_TYPE, STREAM_TYPE_P, ctypes.POINTER(ImageType)] OPENJP2.opj_decode.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, ctypes.c_uint32, + ARGTYPES = [CODEC_TYPE, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint8), ctypes.c_uint32, - stream_t_p] + STREAM_TYPE_P] OPENJP2.opj_decode_tile_data.argtypes = ARGTYPES - ARGTYPES = [ctypes.POINTER(ctypes.POINTER(codestream_info_v2_t))] + ARGTYPES = [ctypes.POINTER(ctypes.POINTER(CodestreamInfoV2))] OPENJP2.opj_destroy_cstr_info.argtypes = ARGTYPES OPENJP2.opj_destroy_cstr_info.restype = ctypes.c_void_p - ARGTYPES = [codec_t_p, stream_t_p] + ARGTYPES = [CODEC_TYPE, STREAM_TYPE_P] OPENJP2.opj_encode.argtypes = ARGTYPES - OPENJP2.opj_get_cstr_info.argtypes = [codec_t_p] - OPENJP2.opj_get_cstr_info.restype = ctypes.POINTER(codestream_info_v2_t) + OPENJP2.opj_get_cstr_info.argtypes = [CODEC_TYPE] + OPENJP2.opj_get_cstr_info.restype = ctypes.POINTER(CodestreamInfoV2) - ARGTYPES = [codec_t_p, - stream_t_p, - ctypes.POINTER(image_t), + ARGTYPES = [CODEC_TYPE, + STREAM_TYPE_P, + ctypes.POINTER(ImageType), ctypes.c_uint32] OPENJP2.opj_get_decoded_tile.argtypes = ARGTYPES ARGTYPES = [ctypes.c_uint32, - ctypes.POINTER(image_comptparm_t), - color_space_t] + ctypes.POINTER(ImageComptParmType), + COLOR_SPACE_TYPE] OPENJP2.opj_image_create.argtypes = ARGTYPES - OPENJP2.opj_image_create.restype = ctypes.POINTER(image_t) + OPENJP2.opj_image_create.restype = ctypes.POINTER(ImageType) ARGTYPES = [ctypes.c_uint32, - ctypes.POINTER(image_comptparm_t), - color_space_t] + ctypes.POINTER(ImageComptParmType), + COLOR_SPACE_TYPE] OPENJP2.opj_image_tile_create.argtypes = ARGTYPES - OPENJP2.opj_image_tile_create.restype = ctypes.POINTER(image_t) + OPENJP2.opj_image_tile_create.restype = ctypes.POINTER(ImageType) - OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(image_t)] + OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] - ARGTYPES = [stream_t_p, codec_t_p, - ctypes.POINTER(ctypes.POINTER(image_t))] + ARGTYPES = [STREAM_TYPE_P, CODEC_TYPE, + ctypes.POINTER(ctypes.POINTER(ImageType))] OPENJP2.opj_read_header.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, - stream_t_p, + ARGTYPES = [CODEC_TYPE, + STREAM_TYPE_P, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_int32), @@ -593,56 +613,56 @@ if OPENJP2 is not None: ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_uint32), - ctypes.POINTER(bool_t)] + ctypes.POINTER(BOOL_TYPE)] OPENJP2.opj_read_tile_header.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, ctypes.POINTER(image_t), ctypes.c_int32, + ARGTYPES = [CODEC_TYPE, ctypes.POINTER(ImageType), ctypes.c_int32, ctypes.c_int32, ctypes.c_int32, ctypes.c_int32] OPENJP2.opj_set_decode_area.argtypes = ARGTYPES - ARGTYPES = [ctypes.POINTER(cparameters_t)] + ARGTYPES = [ctypes.POINTER(CompressionParametersType)] OPENJP2.opj_set_default_encoder_parameters.argtypes = ARGTYPES - ARGTYPES = [ctypes.POINTER(dparameters_t)] + ARGTYPES = [ctypes.POINTER(DecompressionParametersType)] OPENJP2.opj_set_default_decoder_parameters.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, ctypes.c_void_p, ctypes.c_void_p] + ARGTYPES = [CODEC_TYPE, ctypes.c_void_p, ctypes.c_void_p] OPENJP2.opj_set_error_handler.argtypes = ARGTYPES OPENJP2.opj_set_info_handler.argtypes = ARGTYPES OPENJP2.opj_set_warning_handler.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, ctypes.POINTER(dparameters_t)] + ARGTYPES = [CODEC_TYPE, ctypes.POINTER(DecompressionParametersType)] OPENJP2.opj_setup_decoder.argtypes = ARGTYPES - ARGTYPES = [codec_t_p, - ctypes.POINTER(cparameters_t), - ctypes.POINTER(image_t)] + ARGTYPES = [CODEC_TYPE, + ctypes.POINTER(CompressionParametersType), + ctypes.POINTER(ImageType)] OPENJP2.opj_setup_encoder.argtypes = ARGTYPES ARGTYPES = [ctypes.c_char_p, ctypes.c_int32] OPENJP2.opj_stream_create_default_file_stream_v3.argtypes = ARGTYPES - OPENJP2.opj_stream_create_default_file_stream_v3.restype = stream_t_p + OPENJP2.opj_stream_create_default_file_stream_v3.restype = STREAM_TYPE_P - ARGTYPES = [codec_t_p, ctypes.POINTER(image_t), stream_t_p] + ARGTYPES = [CODEC_TYPE, ctypes.POINTER(ImageType), STREAM_TYPE_P] OPENJP2.opj_start_compress.argtypes = ARGTYPES - OPENJP2.opj_end_compress.argtypes = [codec_t_p, stream_t_p] - OPENJP2.opj_end_decompress.argtypes = [codec_t_p, stream_t_p] + OPENJP2.opj_end_compress.argtypes = [CODEC_TYPE, STREAM_TYPE_P] + OPENJP2.opj_end_decompress.argtypes = [CODEC_TYPE, STREAM_TYPE_P] - OPENJP2.opj_stream_destroy_v3.argtypes = [stream_t_p] - OPENJP2.opj_destroy_codec.argtypes = [codec_t_p] + OPENJP2.opj_stream_destroy_v3.argtypes = [STREAM_TYPE_P] + OPENJP2.opj_destroy_codec.argtypes = [CODEC_TYPE] - ARGTYPES = [codec_t_p, + ARGTYPES = [CODEC_TYPE, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint8), ctypes.c_uint32, - stream_t_p] + STREAM_TYPE_P] OPENJP2.opj_write_tile.argtypes = ARGTYPES def check_error(status): """Set a generic function as the restype attribute of all OpenJPEG - functions that return a bool_t value. This way we do not have to check + functions that return a BOOL_TYPE value. This way we do not have to check for error status in each wrapping function and an exception will always be appropriately raised. """ @@ -683,7 +703,7 @@ def create_compress(codec_format): Returns ------- - codec : Reference to codec_t_p instance. + codec : Reference to CODEC_TYPE instance. """ codec = OPENJP2.opj_create_compress(codec_format) return codec @@ -696,11 +716,11 @@ def decode(codec, stream, image): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The JPEG2000 codec - stream : stream_t_p + stream : STREAM_TYPE_P The stream to decode. - image : image_t + image : ImageType Output image structure. Raises @@ -718,7 +738,7 @@ def decode_tile_data(codec, tidx, data, data_size, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The JPEG2000 codec tile_index : int The index of the tile being decoded @@ -726,7 +746,7 @@ def decode_tile_data(codec, tidx, data, data_size, stream): Holds a memory block into which data will be decoded. data_size : int The size of data in bytes - stream : stream_t_p + stream : STREAM_TYPE_P The stream to decode. Raises @@ -755,7 +775,7 @@ def create_decompress(codec_format): Returns ------- - codec : Reference to codec_t_p instance. + codec : Reference to CODEC_TYPE instance. """ codec = OPENJP2.opj_create_decompress(codec_format) return codec @@ -768,7 +788,7 @@ def destroy_codec(codec): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Decompressor handle to destroy. """ OPENJP2.opj_destroy_codec(codec) @@ -781,9 +801,9 @@ def encode(codec, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The jpeg2000 codec. - stream : stream_t_p + stream : STREAM_TYPE_P The stream to which data is written. Raises @@ -801,12 +821,12 @@ def get_cstr_info(codec): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The jpeg2000 codec. Returns ------- - cstr_info_p : codestream_info_v2_t + cstr_info_p : CodestreamInfoV2 Reference to codestream information. """ cstr_info_p = OPENJP2.opj_get_cstr_info(codec) @@ -820,11 +840,11 @@ def get_decoded_tile(codec, stream, imagep, tile_index): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The jpeg2000 codec. - stream : stream_t_p + stream : STREAM_TYPE_P The input stream. - image : image_t + image : ImageType Output image structure. tiler_index : int Index of the tile which will be decoded. @@ -844,7 +864,7 @@ def destroy_cstr_info(cstr_info_p): Parameters ---------- - cstr_info_p : codestream_info_v2_t pointer + cstr_info_p : CodestreamInfoV2 pointer Pointer to codestream info structure. """ OPENJP2.opj_destroy_cstr_info(ctypes.byref(cstr_info_p)) @@ -857,9 +877,9 @@ def end_compress(codec, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Compressor handle. - stream : stream_t_p + stream : STREAM_TYPE_P Output stream buffer. Raises @@ -877,9 +897,9 @@ def end_decompress(codec, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Compressor handle. - stream : stream_t_p + stream : STREAM_TYPE_P Output stream buffer. Raises @@ -897,7 +917,7 @@ def image_destroy(image): Parameters ---------- - image : image_t pointer + image : ImageType pointer Image resource to be disposed. """ OPENJP2.opj_image_destroy(image) @@ -917,12 +937,12 @@ def image_create(comptparms, clrspc): Returns ------- - image : image_t - Reference to image_t instance. + image : ImageType + Reference to ImageType instance. """ image = OPENJP2.opj_image_create(len(comptparms), - comptparms, - clrspc) + comptparms, + clrspc) return image @@ -940,12 +960,12 @@ def image_tile_create(comptparms, clrspc): Returns ------- - image : image_t - Reference to image_t instance. + image : ImageType + Reference to ImageType instance. """ image = OPENJP2.opj_image_tile_create(len(comptparms), - comptparms, - clrspc) + comptparms, + clrspc) return image @@ -956,14 +976,14 @@ def read_header(stream, codec): Parameters ---------- - stream: stream_t_p + stream: STREAM_TYPE_P The JPEG2000 stream. codec: codec_t The JPEG2000 codec to read. Returns ------- - imagep : reference to image_t instance + imagep : reference to ImageType instance The image structure initialized with image characteristics. Raises @@ -971,7 +991,7 @@ def read_header(stream, codec): RuntimeError If the OpenJPEG library routine opj_read_header fails. """ - imagep = ctypes.POINTER(image_t)() + imagep = ctypes.POINTER(ImageType)() OPENJP2.opj_read_header(stream, codec, ctypes.byref(imagep)) return imagep @@ -985,7 +1005,7 @@ def read_tile_header(codec, stream): ---------- codec : codec_t The JPEG2000 codec to read. - stream : stream_t_p + stream : STREAM_TYPE_P The JPEG2000 stream. Returns @@ -1015,17 +1035,17 @@ def read_tile_header(codec, stream): col1 = ctypes.c_int32() row1 = ctypes.c_int32() ncomps = ctypes.c_uint32() - go_on = bool_t() + go_on = BOOL_TYPE() OPENJP2.opj_read_tile_header(codec, - stream, - ctypes.byref(tile_index), - ctypes.byref(data_size), - ctypes.byref(col0), - ctypes.byref(row0), - ctypes.byref(col1), - ctypes.byref(row1), - ctypes.byref(ncomps), - ctypes.byref(go_on)) + stream, + ctypes.byref(tile_index), + ctypes.byref(data_size), + ctypes.byref(col0), + ctypes.byref(row0), + ctypes.byref(col1), + ctypes.byref(row1), + ctypes.byref(ncomps), + ctypes.byref(go_on)) go_on = bool(go_on.value) return (tile_index.value, data_size.value, @@ -1045,9 +1065,9 @@ def set_decode_area(codec, image, start_x=0, start_y=0, end_x=0, end_y=0): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Codec initialized by create_decompress function. - image : image_t pointer + image : ImageType pointer The decoded image previously set by read_header. start_x, start_y : optional, int The left and upper position of the rectangle to decode. @@ -1073,10 +1093,10 @@ def set_default_decoder_parameters(): Returns ------- - dparam : dparameters_t + dparam : DecompressionParametersType Decompression parameters. """ - dparams = dparameters_t() + dparams = DecompressionParametersType() OPENJP2.opj_set_default_decoder_parameters(ctypes.byref(dparams)) return dparams @@ -1108,10 +1128,10 @@ def set_default_encoder_parameters(): Returns ------- - cparameters : cparameters_t + cparameters : CompressionParametersType Compression parameters. """ - cparams = cparameters_t() + cparams = CompressionParametersType() OPENJP2.opj_set_default_encoder_parameters(ctypes.byref(cparams)) return cparams @@ -1123,7 +1143,7 @@ def set_error_handler(codec, handler, data=None): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Codec initialized by create_compress function. handler : python function The callback function to be used. @@ -1145,7 +1165,7 @@ def set_info_handler(codec, handler, data=None): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Codec initialized by create_compress function. handler : python function The callback function to be used. @@ -1167,7 +1187,7 @@ def set_warning_handler(codec, handler, data=None): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Codec initialized by create_compress function. handler : python function The callback function to be used. @@ -1189,9 +1209,9 @@ def setup_decoder(codec, dparams): Parameters ---------- - codec: codec_t_p + codec: CODEC_TYPE Codec initialized by create_compress function. - dparams: dparameters_t + dparams: DecompressionParametersType Decompression parameters. Raises @@ -1210,11 +1230,11 @@ def setup_encoder(codec, cparams, image): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE codec initialized by create_compress function - cparams : cparameters_t + cparams : CompressionParametersType compression parameters - image : image_t + image : ImageType input-filled image Raises @@ -1232,11 +1252,11 @@ def start_compress(codec, image, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE Compressor handle. - image : pointer to image_t + image : pointer to ImageType Input filled image. - stream : stream_t_p + stream : STREAM_TYPE_P Input stream. Raises @@ -1278,7 +1298,7 @@ def stream_destroy_v3(stream): Parameters ---------- - stream : stream_t_p + stream : STREAM_TYPE_P The file stream. """ OPENJP2.opj_stream_destroy_v3(stream) @@ -1291,7 +1311,7 @@ def write_tile(codec, tile_index, data, data_size, stream): Parameters ---------- - codec : codec_t_p + codec : CODEC_TYPE The jpeg2000 codec tile_index : int The index of the tile to write, zero-indexing assumed @@ -1299,7 +1319,7 @@ def write_tile(codec, tile_index, data, data_size, stream): Image data arranged in usual C-order data_size : int Size of a tile in bytes - stream : stream_t_p + stream : STREAM_TYPE_P The stream to write data to Raises @@ -1309,10 +1329,10 @@ def write_tile(codec, tile_index, data, data_size, stream): """ datap = data.ctypes.data_as(ctypes.POINTER(ctypes.c_uint8)) OPENJP2.opj_write_tile(codec, - ctypes.c_uint32(int(tile_index)), - datap, - ctypes.c_uint32(int(data_size)), - stream) + ctypes.c_uint32(int(tile_index)), + datap, + ctypes.c_uint32(int(data_size)), + stream) def set_error_message(msg): diff --git a/glymur/lib/openjpeg.py b/glymur/lib/openjpeg.py index 9b93a54..ef16c0a 100644 --- a/glymur/lib/openjpeg.py +++ b/glymur/lib/openjpeg.py @@ -1,27 +1,30 @@ """Wraps library calls to openjpeg. """ +# pylint: disable=R0903 + import ctypes -from ctypes.util import find_library -import platform -import os from .config import glymur_config _, OPENJPEG = glymur_config() PATH_LEN = 4096 # maximum allowed size for filenames -class event_mgr_t(ctypes.Structure): + +class EventMgrType(ctypes.Structure): """Message handler object. + + Corresponds to event_mgr_t type in openjpeg headers. """ _fields_ = [("error_handler", ctypes.c_void_p), ("warning_handler", ctypes.c_void_p), ("info_handler", ctypes.c_void_p)] -class common_struct_t(ctypes.Structure): + +class CommonStructType(ctypes.Structure): """Common fields between JPEG 2000 compression and decompression contextx. """ - _fields_ = [("event_mgr", ctypes.POINTER(event_mgr_t)), + _fields_ = [("event_mgr", ctypes.POINTER(EventMgrType)), ("client_data", ctypes.c_void_p), ("is_decompressor", ctypes.c_bool), ("codec_format", ctypes.c_int), @@ -30,16 +33,20 @@ class common_struct_t(ctypes.Structure): ("mj2_handle", ctypes.c_void_p)] -class dinfo_t(ctypes.Structure): - """Common fields between JPEG 2000 compression and decompression contextx. - This is for decompression contexts. +class DecompressionInfoType(ctypes.Structure): + """This is for decompression contexts. + + Corresponds to dinfo_t type in openjpeg headers. """ pass -class cio_t(ctypes.Structure): - _fields_ = [# codec context - ("cinfo", ctypes.POINTER(common_struct_t)), +class CioType(ctypes.Structure): + """Byte input-output stream (CIO) + + Corresponds to cio_t in openjpeg headers. + """ + _fields_ = [("cinfo", ctypes.POINTER(CommonStructType)), # codec context # STREAM_READ or STREAM_WRITE ("openmode", ctypes.c_int), # pointer to start of buffer @@ -54,7 +61,11 @@ class cio_t(ctypes.Structure): ("bp", ctypes.c_char_p)] -class dparameters_t(ctypes.Structure): +class DecompressionParametersType(ctypes.Structure): + """Decompression parameters. + + Corresponds to dparameters_t type in openjpeg headers. + """ # cp_reduce: the number of highest resolution levels to be discarded _fields_ = [("cp_reduce", ctypes.c_int), # cp_layer: the maximum number of quality layers to decode @@ -79,8 +90,11 @@ class dparameters_t(ctypes.Structure): ("flags", ctypes.c_uint)] -class image_comp_t(ctypes.Structure): - """Defines a single image component. """ +class ImageCompType(ctypes.Structure): + """Defines a single image component. + + Corresponds to image_comp_t type in openjpeg. + """ _fields_ = [("dx", ctypes.c_int), ("dy", ctypes.c_int), ("w", ctypes.c_int), @@ -95,65 +109,79 @@ class image_comp_t(ctypes.Structure): ("data", ctypes.POINTER(ctypes.c_int))] -class image_t(ctypes.Structure): - """Defines image data and characteristics.""" +class ImageType(ctypes.Structure): + """Defines image data and characteristics. + + Corresponds to image_t type in openjpeg headers. + """ _fields_ = [("x0", ctypes.c_int), ("y0", ctypes.c_int), ("x1", ctypes.c_int), ("y1", ctypes.c_int), ("numcomps", ctypes.c_int), ("color_space", ctypes.c_int), - ("comps", ctypes.POINTER(image_comp_t)), + ("comps", ctypes.POINTER(ImageCompType)), ("icc_profile_buf", ctypes.c_char_p), ("icc_profile_len", ctypes.c_int)] + def cio_open(cinfo, src): """Wrapper for openjpeg library function opj_cio_open.""" - argtypes = [ctypes.POINTER(common_struct_t), ctypes.c_char_p, ctypes.c_int] + argtypes = [ctypes.POINTER(CommonStructType), ctypes.c_char_p, + ctypes.c_int] OPENJPEG.opj_cio_open.argtypes = argtypes - OPENJPEG.opj_cio_open.restype = ctypes.POINTER(cio_t) + OPENJPEG.opj_cio_open.restype = ctypes.POINTER(CioType) - cio = OPENJPEG.opj_cio_open(ctypes.cast(cinfo, ctypes.POINTER(common_struct_t)), + cio = OPENJPEG.opj_cio_open(ctypes.cast(cinfo, + ctypes.POINTER(CommonStructType)), src, len(src)) return cio + def cio_close(cio): """Wraps openjpeg library function cio_close. """ - OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(cio_t)] + OPENJPEG.opj_cio_close.argtypes = [ctypes.POINTER(CioType)] OPENJPEG.opj_cio_close(cio) + def create_decompress(fmt): """Wraps openjpeg library function opj_create_decompress. """ OPENJPEG.opj_create_decompress.argtypes = [ctypes.c_int] - OPENJPEG.opj_create_decompress.restype = ctypes.POINTER(dinfo_t) + restype = ctypes.POINTER(DecompressionInfoType) + OPENJPEG.opj_create_decompress.restype = restype dinfo = OPENJPEG.opj_create_decompress(fmt) return dinfo + def decode(dinfo, cio): """Wrapper for opj_decode. """ - argtypes = [ctypes.POINTER(dinfo_t), ctypes.POINTER(cio_t)] + argtypes = [ctypes.POINTER(DecompressionInfoType), ctypes.POINTER(CioType)] OPENJPEG.opj_decode.argtypes = argtypes - OPENJPEG.opj_decode.restype = ctypes.POINTER(image_t) + OPENJPEG.opj_decode.restype = ctypes.POINTER(ImageType) image = OPENJPEG.opj_decode(dinfo, cio) return image + def destroy_decompress(dinfo): """Wraps openjpeg library function opj_destroy_decompress.""" - OPENJPEG.opj_destroy_decompress.argtypes = [ctypes.POINTER(dinfo_t)] + argtypes = [ctypes.POINTER(DecompressionInfoType)] + OPENJPEG.opj_destroy_decompress.argtypes = argtypes OPENJPEG.opj_destroy_decompress(dinfo) + def image_destroy(image): """Wraps openjpeg library function opj_image_destroy.""" - OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(image_t)] + OPENJPEG.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] OPENJPEG.opj_image_destroy(image) + def set_default_decoder_parameters(dparams_p): """Wrapper for opj_set_default_decoder_parameters. """ - argtypes = [ctypes.POINTER(dparameters_t)] + argtypes = [ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_set_default_decoder_parameters.argtypes = argtypes OPENJPEG.opj_set_default_decoder_parameters(dparams_p) @@ -161,21 +189,25 @@ def set_default_decoder_parameters(dparams_p): def set_event_mgr(dinfo, event_mgr, context=None): """Wrapper for openjpeg library function opj_set_event_mgr. """ - argtypes = [ctypes.POINTER(common_struct_t), - ctypes.POINTER(event_mgr_t), + argtypes = [ctypes.POINTER(CommonStructType), + ctypes.POINTER(EventMgrType), ctypes.c_void_p] + OPENJPEG.opj_set_event_mgr.argtypes = argtypes OPENJPEG.opj_set_event_mgr(ctypes.cast(dinfo, - ctypes.POINTER(common_struct_t)), + ctypes.POINTER(CommonStructType)), event_mgr, context) + def setup_decoder(dinfo, dparams): """Wrapper for openjpeg library function opj_setup_decoder.""" - argtypes = [ctypes.POINTER(dinfo_t), ctypes.POINTER(dparameters_t)] + argtypes = [ctypes.POINTER(DecompressionInfoType), + ctypes.POINTER(DecompressionParametersType)] OPENJPEG.opj_setup_decoder.argtypes = argtypes OPENJPEG.opj_setup_decoder(dinfo, dparams) + def version(): """Wrapper for opj_version library routine.""" OPENJPEG.opj_version.restype = ctypes.c_char_p - v = OPENJPEG.opj_version() - return v.decode('utf-8') + library_version = OPENJPEG.opj_version() + return library_version.decode('utf-8') diff --git a/glymur/lib/test/test_openjp2.py b/glymur/lib/test/test_openjp2.py index 6c4c2cd..61212ab 100644 --- a/glymur/lib/test/test_openjp2.py +++ b/glymur/lib/test/test_openjp2.py @@ -32,7 +32,7 @@ class TestOpenJP2(unittest.TestCase): self.assertEqual(cparams.subsampling_dx, 1) self.assertEqual(cparams.subsampling_dy, 1) self.assertEqual(cparams.mode, 0) - self.assertEqual(cparams.prog_order, glymur.lib._openjp2.LRCP) + self.assertEqual(cparams.prog_order, glymur.core.LRCP) self.assertEqual(cparams.roi_shift, 0) self.assertEqual(cparams.cp_tx0, 0) self.assertEqual(cparams.cp_ty0, 0) @@ -164,9 +164,9 @@ class TestOpenJP2(unittest.TestCase): l_param.numresolution = 6 - l_param.prog_order = glymur.lib._openjp2.LRCP + l_param.prog_order = glymur.core.LRCP - l_params = (glymur.lib._openjp2.image_comptparm_t * num_comps)() + l_params = (glymur.lib._openjp2.ImageComptParmType * num_comps)() for j in range(num_comps): l_params[j].dx = 1 l_params[j].dy = 1 diff --git a/glymur/lib/test/test_openjpeg.py b/glymur/lib/test/test_openjpeg.py index 2bdc5db..65dfeba 100644 --- a/glymur/lib/test/test_openjpeg.py +++ b/glymur/lib/test/test_openjpeg.py @@ -21,7 +21,7 @@ class TestOpenJPEG(unittest.TestCase): def test_set_default_decoder_parameters(self): # Verify that we properly set the default decode parameters. - dp = glymur.lib._openjpeg.dparameters_t() + dp = glymur.lib._openjpeg.DecompressionParametersType() glymur.lib._openjpeg.set_default_decoder_parameters(ctypes.byref(dp)) self.assertEqual(dp.cp_reduce, 0) diff --git a/glymur/test/test_opj_suite.py b/glymur/test/test_opj_suite.py index 763b6e9..4ba12c6 100644 --- a/glymur/test/test_opj_suite.py +++ b/glymur/test/test_opj_suite.py @@ -1569,7 +1569,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcod[7] & 0x0020) self.assertEqual(c.segment[3].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # SOT: start of tile part self.assertEqual(c.segment[4].isot, 0) @@ -1623,7 +1623,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) # COC: Coding style component self.assertEqual(c.segment[3].ccoc, 0) @@ -1643,7 +1643,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -1729,7 +1729,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -1846,7 +1846,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(128, 128), (128, 128), (128, 128), (128, 128), (128, 128), (128, 128), (128, 128)]) @@ -1955,7 +1955,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # COC: Coding style component @@ -1976,7 +1976,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) # COC: Coding style component self.assertEqual(c.segment[4].ccoc, 3) @@ -1996,7 +1996,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[4].spcoc[3] & 0x0020) self.assertEqual(c.segment[4].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -2098,7 +2098,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -2167,7 +2167,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[7].spcoc[3] & 0x0020) self.assertEqual(c.segment[7].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # RGN: region of interest self.assertEqual(c.segment[8].crgn, 0) # component @@ -2235,7 +2235,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -2320,7 +2320,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # COC: Coding style component @@ -2341,7 +2341,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # COC: Coding style component self.assertEqual(c.segment[4].ccoc, 1) @@ -2361,7 +2361,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[4].spcoc[3] & 0x0020) self.assertEqual(c.segment[4].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # COC: Coding style component self.assertEqual(c.segment[5].ccoc, 2) @@ -2381,7 +2381,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[5].spcoc[3] & 0x0020) self.assertEqual(c.segment[5].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -2473,7 +2473,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -2553,7 +2553,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -2694,7 +2694,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(128, 2)]) # QCD: Quantization default @@ -2775,7 +2775,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -2856,7 +2856,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # COC: Coding style component @@ -2876,7 +2876,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -2982,7 +2982,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -3058,7 +3058,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -3212,7 +3212,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -3280,7 +3280,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # COC: Coding style component @@ -3300,7 +3300,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -3381,7 +3381,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(128, 128), (256, 256), (512, 512), (1024, 1024), (2048, 2048), (4096, 4096), (8192, 8192)]) @@ -3495,7 +3495,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # COC: Coding style component @@ -3515,7 +3515,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) # COC: Coding style component self.assertEqual(c.segment[4].ccoc, 3) @@ -3534,7 +3534,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[4].spcoc[3] & 0x0020) self.assertEqual(c.segment[4].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) # QCD: Quantization default # quantization type @@ -3641,7 +3641,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -3768,7 +3768,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(16, 16)] * 8) self.assertEqual(c.segment[3].sqcd & 0x1f, 2) # expounded @@ -3856,7 +3856,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertTrue(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -3949,7 +3949,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(1, 1), (2, 2)]) # COC: Coding style component @@ -3969,7 +3969,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcoc[3] & 0x0020) self.assertEqual(c.segment[3].spcoc[4], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[3]._precinct_size, [(2, 2), (4, 4)]) # QCD: Quantization default @@ -4489,7 +4489,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(c.segment[2]._precinct_size[0], (128, 128)) self.assertEqual(c.segment[2]._precinct_size[1:], [(256, 256)] * 5) @@ -4521,7 +4521,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[4].spcoc[3] & 0x0020) self.assertEqual(c.segment[4].spcoc[4], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) # QCC: Quantization component # associated component @@ -4553,7 +4553,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[6].spcoc[3] & 0x0020) self.assertEqual(c.segment[6].spcoc[4], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) # QCC: Quantization component # associated component @@ -4641,7 +4641,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(16, 16), (32, 32), (64, 64), (128, 128), (128, 128), (128, 128)]) @@ -4698,7 +4698,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) ids = [x.marker_id for x in c.segment] @@ -4751,7 +4751,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) ids = [x.marker_id for x in c.segment] @@ -4813,7 +4813,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -4875,7 +4875,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -4946,7 +4946,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5023,7 +5023,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5083,7 +5083,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5149,7 +5149,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5234,7 +5234,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5294,7 +5294,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5352,7 +5352,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5410,7 +5410,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5471,7 +5471,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5532,7 +5532,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5592,7 +5592,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5662,7 +5662,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5732,7 +5732,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5794,7 +5794,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -5857,7 +5857,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(128, 128)] + [(256, 256)] * 5) @@ -5973,7 +5973,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcod[7] & 0x0020) self.assertEqual(c.segment[3].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[3].spcod), 9) # QCD: Quantization default @@ -6107,7 +6107,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[3].spcod[7] & 0x0020) self.assertEqual(c.segment[3].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[3].spcod), 9) # QCD: Quantization default @@ -6229,7 +6229,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6383,7 +6383,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6484,7 +6484,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6583,7 +6583,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6687,7 +6687,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE) + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6815,7 +6815,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -6930,7 +6930,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -7025,7 +7025,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -7133,7 +7133,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -7233,7 +7233,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default @@ -7342,7 +7342,7 @@ class TestSuiteDump(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # QCD: Quantization default diff --git a/glymur/test/test_opj_suite_write.py b/glymur/test/test_opj_suite_write.py index edbd893..ccdc651 100644 --- a/glymur/test/test_opj_suite_write.py +++ b/glymur/test/test_opj_suite_write.py @@ -125,7 +125,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Bretagne1_ppm_2_encode(self): @@ -183,7 +183,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Bretagne1_ppm_3_encode(self): @@ -242,7 +242,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(2, 2), (4, 4), (8, 8), (16, 16), (32, 32), (64, 64)]) @@ -305,7 +305,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(c.segment[2]._precinct_size, [(16, 16), (32, 32), (64, 64)] + [(128, 128)] * 3) @@ -363,7 +363,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Bretagne2_ppm_6_encode(self): @@ -420,7 +420,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # 18 SOP segments. @@ -480,7 +480,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertTrue(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) # 18 EPH segments. @@ -541,7 +541,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Cevennes1_bmp_9_encode(self): @@ -597,7 +597,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Cevennes2_ppm_10_encode(self): @@ -653,7 +653,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) def test_NR_ENC_Rome_bmp_11_encode(self): @@ -744,7 +744,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) @unittest.skip("Known failure in openjpeg test suite.") @@ -804,7 +804,7 @@ class TestSuiteWrite(unittest.TestCase): # Segmentation symbols, SEGMARK(SEGSYSM) self.assertFalse(c.segment[2].spcod[7] & 0x0020) self.assertEqual(c.segment[2].spcod[8], - glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE) + glymur.core.WAVELET_XFORM_5X3_REVERSIBLE) self.assertEqual(len(c.segment[2].spcod), 9) if __name__ == "__main__":