pylint work, issue #71
This commit is contained in:
parent
0162117ee2
commit
38434ee58e
6 changed files with 311 additions and 280 deletions
|
|
@ -19,15 +19,25 @@ from .lib import openjp2 as opj2
|
|||
|
||||
# Need a catch-all list of valid markers.
|
||||
# See table A-1 in ISO/IEC FCD15444-1.
|
||||
_valid_markers = [0xff00, 0xff01, 0xfffe]
|
||||
_VALID_MARKERS = [0xff00, 0xff01, 0xfffe]
|
||||
for _marker in range(0xffc0, 0xffe0):
|
||||
_valid_markers.append(_marker)
|
||||
_VALID_MARKERS.append(_marker)
|
||||
for _marker in range(0xfff0, 0xfff9):
|
||||
_valid_markers.append(_marker)
|
||||
_VALID_MARKERS.append(_marker)
|
||||
for _marker in range(0xff4f, 0xff70):
|
||||
_valid_markers.append(_marker)
|
||||
_VALID_MARKERS.append(_marker)
|
||||
for _marker in range(0xff90, 0xff94):
|
||||
_valid_markers.append(_marker)
|
||||
_VALID_MARKERS.append(_marker)
|
||||
|
||||
|
||||
class InconsistentStartOfTileError(IOError):
|
||||
"""To be raised if bad SOT segment encountered.
|
||||
|
||||
SOT segment offsets are recorded as encountered. The offsets should all be
|
||||
different.
|
||||
"""
|
||||
def __init__(self, msg):
|
||||
IOError.__init__(self, msg)
|
||||
|
||||
|
||||
class Codestream(object):
|
||||
|
|
@ -59,6 +69,10 @@ class Codestream(object):
|
|||
Supplying False may impose a large performance penalty.
|
||||
"""
|
||||
|
||||
# Number of components. Must be kept track of for the processing of
|
||||
# many segments.
|
||||
self._csiz = -1
|
||||
|
||||
# Do we parse the tile part bit stream or not?
|
||||
self._parse_tpart_flag = False
|
||||
|
||||
|
|
@ -70,137 +84,155 @@ class Codestream(object):
|
|||
segment = SOCsegment(offset=fptr.tell() - 2, length=0)
|
||||
self.segment.append(segment)
|
||||
|
||||
tile_offset = []
|
||||
tile_length = []
|
||||
self._tile_offset = []
|
||||
self._tile_length = []
|
||||
|
||||
while True:
|
||||
offset = fptr.tell()
|
||||
|
||||
read_buffer = fptr.read(2)
|
||||
marker_id, = struct.unpack('>H', read_buffer)
|
||||
|
||||
if marker_id >= 0xff30 and marker_id <= 0xff3f:
|
||||
the_id = '0x{0:x}'.format(marker_id)
|
||||
segment = Segment(id=the_id, offset=offset, length=0)
|
||||
|
||||
elif marker_id == 0xff51:
|
||||
# Need to keep track of the number of components from SIZ for
|
||||
# other markers
|
||||
segment = _parse_siz_segment(fptr)
|
||||
self._csiz = len(segment.ssiz)
|
||||
|
||||
elif marker_id == 0xff52:
|
||||
segment = _parse_cod_segment(fptr)
|
||||
|
||||
sop = (segment.scod & 2) > 0
|
||||
eph = (segment.scod & 4) > 0
|
||||
|
||||
if sop or eph:
|
||||
self._parse_tpart_flag = True
|
||||
else:
|
||||
self._parse_tpart_flag = False
|
||||
|
||||
elif marker_id == 0xff53:
|
||||
segment = self._parse_coc_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff55:
|
||||
segment = _parse_tlm_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff58:
|
||||
segment = _parse_plt_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5c:
|
||||
segment = _parse_qcd_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5d:
|
||||
segment = self._parse_qcc_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5e:
|
||||
segment = self._parse_rgn_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5f:
|
||||
segment = self._parse_pod_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff60:
|
||||
segment = _parse_ppm_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff61:
|
||||
segment = _parse_ppt_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff63:
|
||||
segment = _parse_crg_segment(fptr, self._csiz)
|
||||
|
||||
elif marker_id == 0xff64:
|
||||
segment = _parse_cme_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff90:
|
||||
# Need to keep easy access to tile offsets and lengths for when
|
||||
# we encounter start-of-data marker segments.
|
||||
if header_only:
|
||||
# Stop parsing as soon as we hit the first Start Of Tile.
|
||||
return
|
||||
|
||||
segment = _parse_sot_segment(fptr)
|
||||
if segment.offset not in tile_offset:
|
||||
tile_offset.append(segment.offset)
|
||||
tile_length.append(segment.psot)
|
||||
else:
|
||||
msg = "Inconsistent start-of-tile (SOT) marker segment "
|
||||
msg += "encountered in tile with index {0}. "
|
||||
msg += "Codestream parsing terminated."
|
||||
msg = msg.format(segment.isot)
|
||||
warnings.warn(msg)
|
||||
return
|
||||
|
||||
elif marker_id == 0xff93:
|
||||
# start of data. Need to seek past the current tile part.
|
||||
# The last SOT marker segment has the info that we need.
|
||||
segment = _parse_sod_segment(fptr)
|
||||
|
||||
elif marker_id == 0xffd9:
|
||||
# end of codestream
|
||||
segment = _parse_eoc_segment(fptr)
|
||||
self.segment.append(segment)
|
||||
if marker_id == 0xff90 and header_only:
|
||||
# start-of-tile (SOT) means we are out of the main header.
|
||||
# No need to go any further.
|
||||
break
|
||||
|
||||
elif marker_id in _valid_markers:
|
||||
# It's a reserved marker that I don't know anything about.
|
||||
# See table A-1 in ISO/IEC FCD15444-1.
|
||||
segment = _parse_generic_segment(fptr, marker_id)
|
||||
|
||||
elif ((marker_id & 0xff00) >> 8) == 255:
|
||||
# Peek ahead to see if the next two bytes are a marker or not.
|
||||
# Then seek back.
|
||||
msg = "Unrecognized marker id: 0x{0:x}".format(marker_id)
|
||||
try:
|
||||
segment = self._process_marker_segment(fptr, marker_id)
|
||||
except InconsistentStartOfTileError as isote:
|
||||
# Treat this as a warning.
|
||||
msg = str(isote)
|
||||
warnings.warn(msg)
|
||||
cpos = fptr.tell()
|
||||
read_buffer = fptr.read(2)
|
||||
next_item, = struct.unpack('>H', read_buffer)
|
||||
fptr.seek(cpos)
|
||||
if ((next_item & 0xff00) >> 8) == 255:
|
||||
# No segment associated with this marker, so reset
|
||||
# to two bytes after it.
|
||||
segment = Segment(id='0x{0:x}'.format(marker_id),
|
||||
offset=offset, length=0)
|
||||
else:
|
||||
segment = _parse_generic_segment(fptr, marker_id)
|
||||
|
||||
else:
|
||||
msg = 'Invalid marker id encountered at byte {0:d} '
|
||||
msg += 'in codestream: "0x{1:x}"'
|
||||
msg = msg.format(offset, marker_id)
|
||||
raise IOError(msg)
|
||||
break
|
||||
|
||||
self.segment.append(segment)
|
||||
|
||||
if marker_id == 0xffd9:
|
||||
# end of codestream, should break.
|
||||
break
|
||||
|
||||
if marker_id == 0xff93:
|
||||
# If SOD, then we need to seek past the tile part bit stream.
|
||||
if self._parse_tpart_flag:
|
||||
# But first parse the tile part bit stream for SOP and
|
||||
# EPH segments.
|
||||
self._parse_tile_part_bit_stream(fptr, segment,
|
||||
tile_length[-1])
|
||||
self._tile_length[-1])
|
||||
|
||||
fptr.seek(tile_offset[-1] + tile_length[-1])
|
||||
fptr.seek(self._tile_offset[-1] + self._tile_length[-1])
|
||||
|
||||
def _process_marker_segment(self, fptr, marker_id):
|
||||
"""Process and return a segment from the codestream.
|
||||
"""
|
||||
offset = fptr.tell() - 2
|
||||
|
||||
if marker_id >= 0xff30 and marker_id <= 0xff3f:
|
||||
the_id = '0x{0:x}'.format(marker_id)
|
||||
segment = Segment(marker_id=the_id, offset=offset, length=0)
|
||||
|
||||
elif marker_id == 0xff51:
|
||||
# Need to keep track of the number of components from SIZ for
|
||||
# other markers
|
||||
segment = _parse_siz_segment(fptr)
|
||||
self._csiz = len(segment.ssiz)
|
||||
|
||||
elif marker_id == 0xff52:
|
||||
segment = _parse_cod_segment(fptr)
|
||||
|
||||
sop = (segment.scod & 2) > 0
|
||||
eph = (segment.scod & 4) > 0
|
||||
|
||||
if sop or eph:
|
||||
self._parse_tpart_flag = True
|
||||
else:
|
||||
self._parse_tpart_flag = False
|
||||
|
||||
elif marker_id == 0xff53:
|
||||
segment = self._parse_coc_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff55:
|
||||
segment = _parse_tlm_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff58:
|
||||
segment = _parse_plt_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5c:
|
||||
segment = _parse_qcd_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5d:
|
||||
segment = self._parse_qcc_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5e:
|
||||
segment = self._parse_rgn_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff5f:
|
||||
segment = self._parse_pod_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff60:
|
||||
segment = _parse_ppm_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff61:
|
||||
segment = _parse_ppt_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff63:
|
||||
segment = _parse_crg_segment(fptr, self._csiz)
|
||||
|
||||
elif marker_id == 0xff64:
|
||||
segment = _parse_cme_segment(fptr)
|
||||
|
||||
elif marker_id == 0xff90:
|
||||
# Need to keep easy access to tile offsets and lengths for when
|
||||
# we encounter start-of-data marker segments.
|
||||
|
||||
segment = _parse_sot_segment(fptr)
|
||||
if segment.offset not in self._tile_offset:
|
||||
self._tile_offset.append(segment.offset)
|
||||
self._tile_length.append(segment.psot)
|
||||
else:
|
||||
msg = "Inconsistent start-of-tile (SOT) marker segment "
|
||||
msg += "encountered in tile with index {0}. "
|
||||
msg += "Codestream parsing terminated."
|
||||
msg = msg.format(segment.isot)
|
||||
raise InconsistentStartOfTileError(msg)
|
||||
|
||||
elif marker_id == 0xff93:
|
||||
# start of data. Need to seek past the current tile part.
|
||||
# The last SOT marker segment has the info that we need.
|
||||
segment = _parse_sod_segment(fptr)
|
||||
|
||||
elif marker_id == 0xffd9:
|
||||
# end of codestream
|
||||
segment = _parse_eoc_segment(fptr)
|
||||
|
||||
elif marker_id in _VALID_MARKERS:
|
||||
# It's a reserved marker that I don't know anything about.
|
||||
# See table A-1 in ISO/IEC FCD15444-1.
|
||||
segment = _parse_generic_segment(fptr, marker_id)
|
||||
|
||||
elif ((marker_id & 0xff00) >> 8) == 255:
|
||||
# Peek ahead to see if the next two bytes are a marker or not.
|
||||
# Then seek back.
|
||||
msg = "Unrecognized marker id: 0x{0:x}".format(marker_id)
|
||||
warnings.warn(msg)
|
||||
cpos = fptr.tell()
|
||||
read_buffer = fptr.read(2)
|
||||
next_item, = struct.unpack('>H', read_buffer)
|
||||
fptr.seek(cpos)
|
||||
if ((next_item & 0xff00) >> 8) == 255:
|
||||
# No segment associated with this marker, so reset
|
||||
# to two bytes after it.
|
||||
segment = Segment(id='0x{0:x}'.format(marker_id),
|
||||
offset=offset, length=0)
|
||||
else:
|
||||
segment = _parse_generic_segment(fptr, marker_id)
|
||||
|
||||
else:
|
||||
msg = 'Invalid marker id encountered at byte {0:d} '
|
||||
msg += 'in codestream: "0x{1:x}"'
|
||||
msg = msg.format(offset, marker_id)
|
||||
raise IOError(msg)
|
||||
|
||||
return segment
|
||||
|
||||
def _parse_tile_part_bit_stream(self, fptr, sod_marker, tile_length):
|
||||
"""Parse the tile part bit stream for SOP, EPH marker segments."""
|
||||
|
|
@ -380,7 +412,7 @@ class Segment(object):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -388,14 +420,14 @@ class Segment(object):
|
|||
Length of marker segment in bytes. This number does not include the
|
||||
two bytes constituting the marker.
|
||||
"""
|
||||
def __init__(self, id='', offset=-1, length=-1):
|
||||
self.id = id
|
||||
def __init__(self, marker_id='', offset=-1, length=-1, data=None):
|
||||
self.marker_id = marker_id
|
||||
self.offset = offset
|
||||
self.length = length
|
||||
self._data = None
|
||||
self._data = data
|
||||
|
||||
def __str__(self):
|
||||
msg = '{0} marker segment @ ({1}, {2})'.format(self.id,
|
||||
msg = '{0} marker segment @ ({1}, {2})'.format(self.marker_id,
|
||||
self.offset,
|
||||
self.length)
|
||||
return msg
|
||||
|
|
@ -406,7 +438,7 @@ class COCsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -427,7 +459,7 @@ class COCsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, ccoc, scoc, spcoc, length, offset):
|
||||
Segment.__init__(self, id='COC')
|
||||
Segment.__init__(self, marker_id='COC')
|
||||
self.ccoc = ccoc
|
||||
self.scoc = scoc
|
||||
self.spcoc = spcoc
|
||||
|
|
@ -479,7 +511,7 @@ class CODsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -500,7 +532,7 @@ class CODsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, scod, spcod, length, offset):
|
||||
Segment.__init__(self, id='COD')
|
||||
Segment.__init__(self, marker_id='COD')
|
||||
self.scod = scod
|
||||
self.spcod = spcod
|
||||
self.length = length
|
||||
|
|
@ -510,7 +542,7 @@ class CODsegment(Segment):
|
|||
self._layers = params[1]
|
||||
self._numresolutions = params[3]
|
||||
|
||||
if params[3] > opj2._J2K_MAXRLVLS:
|
||||
if params[3] > opj2.J2K_MAXRLVLS:
|
||||
msg = "Invalid number of resolutions ({0})."
|
||||
msg = msg.format(params[3] + 1)
|
||||
warnings.warn(msg)
|
||||
|
|
@ -581,7 +613,7 @@ class CMEsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -601,7 +633,7 @@ class CMEsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, rcme, ccme, length, offset):
|
||||
Segment.__init__(self, id='CME')
|
||||
Segment.__init__(self, marker_id='CME')
|
||||
self.rcme = rcme
|
||||
self.ccme = ccme
|
||||
self.length = length
|
||||
|
|
@ -624,7 +656,7 @@ class CRGsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -635,7 +667,7 @@ class CRGsegment(Segment):
|
|||
Horizontal, vertical offset for each component
|
||||
"""
|
||||
def __init__(self, xcrg, ycrg, length, offset):
|
||||
Segment.__init__(self, id='CRG')
|
||||
Segment.__init__(self, marker_id='CRG')
|
||||
self.xcrg = xcrg
|
||||
self.ycrg = ycrg
|
||||
self.length = length
|
||||
|
|
@ -655,7 +687,7 @@ class EOCsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -671,7 +703,7 @@ class EOCsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, length, offset):
|
||||
Segment.__init__(self, id='EOC')
|
||||
Segment.__init__(self, marker_id='EOC')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
|
|
@ -681,7 +713,7 @@ class PODsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -708,7 +740,7 @@ class PODsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, pod_params, length, offset):
|
||||
Segment.__init__(self, id='POD')
|
||||
Segment.__init__(self, marker_id='POD')
|
||||
|
||||
self.rspod = pod_params[0::6]
|
||||
self.cspod = pod_params[1::6]
|
||||
|
|
@ -748,7 +780,7 @@ class PLTsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -767,7 +799,7 @@ class PLTsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, zplt, iplt, length, offset):
|
||||
Segment.__init__(self, id='PLT')
|
||||
Segment.__init__(self, marker_id='PLT')
|
||||
self.zplt = zplt
|
||||
self.iplt = iplt
|
||||
self.length = length
|
||||
|
|
@ -787,7 +819,7 @@ class PPMsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -804,7 +836,7 @@ class PPMsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, zppm, data, length, offset):
|
||||
Segment.__init__(self, id='PPM')
|
||||
Segment.__init__(self, marker_id='PPM')
|
||||
self.zppm = zppm
|
||||
|
||||
# both Nppm and Ippms information stored in _data
|
||||
|
|
@ -826,7 +858,7 @@ class PPTsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -845,7 +877,7 @@ class PPTsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, zppt, ippt, length, offset):
|
||||
Segment.__init__(self, id='PPT')
|
||||
Segment.__init__(self, marker_id='PPT')
|
||||
self.zppt = zppt
|
||||
self.ippt = ippt
|
||||
self.length = length
|
||||
|
|
@ -864,7 +896,7 @@ class QCCsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -885,7 +917,7 @@ class QCCsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, cqcc, sqcc, spqcc, length, offset):
|
||||
Segment.__init__(self, id='QCC')
|
||||
Segment.__init__(self, marker_id='QCC')
|
||||
self.cqcc = cqcc
|
||||
self.sqcc = sqcc
|
||||
self.spqcc = spqcc
|
||||
|
|
@ -913,7 +945,7 @@ class QCDsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -932,7 +964,7 @@ class QCDsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, sqcd, spqcd, length, offset):
|
||||
Segment.__init__(self, id='QCD')
|
||||
Segment.__init__(self, marker_id='QCD')
|
||||
|
||||
self.sqcd = sqcd
|
||||
self.spqcd = spqcd
|
||||
|
|
@ -961,7 +993,7 @@ class RGNsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -982,7 +1014,7 @@ class RGNsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, length, offset, crgn, srgn, sprgn):
|
||||
Segment.__init__(self, id='RGN')
|
||||
Segment.__init__(self, marker_id='RGN')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
self.crgn = crgn
|
||||
|
|
@ -1005,7 +1037,7 @@ class SIZsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1035,7 +1067,7 @@ class SIZsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, xy_buffer, component_buffer, length, offset):
|
||||
Segment.__init__(self, id='SIZ')
|
||||
Segment.__init__(self, marker_id='SIZ')
|
||||
|
||||
data = struct.unpack('>HIIIIIIIIH', xy_buffer)
|
||||
|
||||
|
|
@ -1107,7 +1139,7 @@ class SOCsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1123,7 +1155,7 @@ class SOCsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
Segment.__init__(self, id='SOC')
|
||||
Segment.__init__(self, marker_id='SOC')
|
||||
self.__dict__.update(**kwargs)
|
||||
|
||||
|
||||
|
|
@ -1132,7 +1164,7 @@ class SODsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1148,7 +1180,7 @@ class SODsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, length, offset):
|
||||
Segment.__init__(self, id='SOD')
|
||||
Segment.__init__(self, marker_id='SOD')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
|
|
@ -1158,7 +1190,7 @@ class EPHsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1174,7 +1206,7 @@ class EPHsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, length, offset):
|
||||
Segment.__init__(self, id='EPH')
|
||||
Segment.__init__(self, marker_id='EPH')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
|
|
@ -1184,7 +1216,7 @@ class SOPsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1201,7 +1233,7 @@ class SOPsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, nsop, length, offset):
|
||||
Segment.__init__(self, id='SOP')
|
||||
Segment.__init__(self, marker_id='SOP')
|
||||
self.nsop = nsop
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
|
|
@ -1217,7 +1249,7 @@ class SOTsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1241,7 +1273,7 @@ class SOTsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, isot, psot, tpsot, tnsot, length, offset):
|
||||
Segment.__init__(self, id='SOT')
|
||||
Segment.__init__(self, marker_id='SOT')
|
||||
self.isot = isot
|
||||
self.psot = psot
|
||||
self.tpsot = tpsot
|
||||
|
|
@ -1269,7 +1301,7 @@ class TLMsegment(Segment):
|
|||
|
||||
Attributes
|
||||
----------
|
||||
id : str
|
||||
marker_id : str
|
||||
Identifier for the segment.
|
||||
offset : int
|
||||
Offset of marker segment in bytes from beginning of file.
|
||||
|
|
@ -1291,7 +1323,7 @@ class TLMsegment(Segment):
|
|||
Core coding system
|
||||
"""
|
||||
def __init__(self, length, offset, ztlm, ttlm, ptlm):
|
||||
Segment.__init__(self, id='TLM')
|
||||
Segment.__init__(self, marker_id='TLM')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
self.ztlm = ztlm
|
||||
|
|
@ -1730,7 +1762,6 @@ def _parse_generic_segment(fptr, marker_id):
|
|||
length, = struct.unpack('>H', read_buffer)
|
||||
data = fptr.read(length-2)
|
||||
|
||||
segment = Segment(id='0x{0:x}'.format(marker_id),
|
||||
offset=offset, length=length)
|
||||
segment._data = data
|
||||
segment = Segment(marker_id='0x{0:x}'.format(marker_id), offset=offset,
|
||||
length=length, data=data)
|
||||
return segment
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@ _rsiz_capabilities_t = ctypes.c_int32
|
|||
_stream_t_p = ctypes.c_void_p
|
||||
|
||||
_PATH_LEN = 4096
|
||||
_J2K_MAXRLVLS = 33
|
||||
_J2K_MAXBANDS = (3 * _J2K_MAXRLVLS - 2)
|
||||
J2K_MAXRLVLS = 33
|
||||
_J2K_MAXBANDS = (3 * J2K_MAXRLVLS - 2)
|
||||
|
||||
_JPWL_MAX_NO_TILESPECS = 16
|
||||
|
||||
|
|
@ -379,10 +379,10 @@ class _cparameters_t(ctypes.Structure):
|
|||
("res_spec", ctypes.c_int),
|
||||
|
||||
# initial precinct width
|
||||
("prcw_init", ctypes.c_int * _J2K_MAXRLVLS),
|
||||
("prcw_init", ctypes.c_int * J2K_MAXRLVLS),
|
||||
|
||||
# initial precinct height
|
||||
("prch_init", ctypes.c_int * _J2K_MAXRLVLS),
|
||||
("prch_init", ctypes.c_int * J2K_MAXRLVLS),
|
||||
|
||||
# input file name
|
||||
("infile", ctypes.c_char * _PATH_LEN),
|
||||
|
|
@ -606,10 +606,10 @@ class _tccp_info_t(ctypes.Structure):
|
|||
("roishift", ctypes.c_int32),
|
||||
|
||||
# precinct width
|
||||
("prcw", ctypes.c_uint32 * _J2K_MAXRLVLS),
|
||||
("prcw", ctypes.c_uint32 * J2K_MAXRLVLS),
|
||||
|
||||
# precinct width
|
||||
("prch", ctypes.c_uint32 * _J2K_MAXRLVLS)]
|
||||
("prch", ctypes.c_uint32 * J2K_MAXRLVLS)]
|
||||
|
||||
|
||||
class _tile_info_v2_t(ctypes.Structure):
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class TestCodestream(unittest.TestCase):
|
|||
j = Jp2k(tfile.name)
|
||||
c = j.get_codestream()
|
||||
|
||||
self.assertEqual(c.segment[2].id, '0xff6f')
|
||||
self.assertEqual(c.segment[2].marker_id, '0xff6f')
|
||||
self.assertEqual(c.segment[2].length, 3)
|
||||
self.assertEqual(c.segment[2]._data, b'\x00')
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ class TestCodestream(unittest.TestCase):
|
|||
j = Jp2k(tfile.name)
|
||||
c = j.get_codestream()
|
||||
|
||||
self.assertEqual(c.segment[2].id, '0xff79')
|
||||
self.assertEqual(c.segment[2].marker_id, '0xff79')
|
||||
self.assertEqual(c.segment[2].length, 3)
|
||||
self.assertEqual(c.segment[2]._data, b'\x00')
|
||||
|
||||
|
|
|
|||
|
|
@ -1515,7 +1515,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
c = Jp2k(jfile).get_codestream(header_only=False)
|
||||
|
||||
# Segment IDs.
|
||||
actual = [x.id for x in c.segment]
|
||||
actual = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'QCD', 'COD', 'SOT', 'SOD', 'EOC']
|
||||
self.assertEqual(actual, expected)
|
||||
|
||||
|
|
@ -1662,7 +1662,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
"Creator: AV-J2K (c) 2000,2001 Algo Vision")
|
||||
|
||||
# One unknown marker
|
||||
self.assertEqual(c.segment[6].id, '0xff30')
|
||||
self.assertEqual(c.segment[6].marker_id, '0xff30')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[7].isot, 0)
|
||||
|
|
@ -1672,16 +1672,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[8].id, 'SOD')
|
||||
self.assertEqual(c.segment[8].marker_id, 'SOD')
|
||||
|
||||
# SOP, EPH
|
||||
sop = [x.id for x in c.segment if x.id == 'SOP']
|
||||
eph = [x.id for x in c.segment if x.id == 'EPH']
|
||||
sop = [x.marker_id for x in c.segment if x.marker_id == 'SOP']
|
||||
eph = [x.marker_id for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(sop), 24)
|
||||
self.assertEqual(len(eph), 24)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_03_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_03.j2k')
|
||||
|
|
@ -1798,7 +1798,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[13].id, 'SOD')
|
||||
self.assertEqual(c.segment[13].marker_id, 'SOD')
|
||||
|
||||
def test_NR_p0_04_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_04.j2k')
|
||||
|
|
@ -1906,7 +1906,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[8].id, 'SOD')
|
||||
self.assertEqual(c.segment[8].marker_id, 'SOD')
|
||||
|
||||
def test_NR_p0_05_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_05.j2k')
|
||||
|
|
@ -2050,7 +2050,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[11].id, 'SOD')
|
||||
self.assertEqual(c.segment[11].marker_id, 'SOD')
|
||||
|
||||
def test_NR_p0_06_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_06.j2k')
|
||||
|
|
@ -2187,7 +2187,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[11].id, 'SOD')
|
||||
self.assertEqual(c.segment[11].marker_id, 'SOD')
|
||||
|
||||
def test_NR_p0_07_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_07.j2k')
|
||||
|
|
@ -2272,7 +2272,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
#self.assertEqual(c.segment[7].iplt), 99)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[8].id, 'SOD')
|
||||
self.assertEqual(c.segment[8].marker_id, 'SOD')
|
||||
|
||||
def test_NR_p0_08_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_08.j2k')
|
||||
|
|
@ -2502,10 +2502,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# SOD: start of data
|
||||
# Just one.
|
||||
self.assertEqual(c.segment[6].id, 'SOD')
|
||||
self.assertEqual(c.segment[6].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[7].id, 'EOC')
|
||||
self.assertEqual(c.segment[7].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_10_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_10.j2k')
|
||||
|
|
@ -2571,7 +2571,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[4].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[5].id, 'SOD')
|
||||
self.assertEqual(c.segment[5].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[6].isot, 1)
|
||||
|
|
@ -2580,7 +2580,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[6].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[7].id, 'SOD')
|
||||
self.assertEqual(c.segment[7].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[8].isot, 2)
|
||||
|
|
@ -2589,7 +2589,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[8].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[9].id, 'SOD')
|
||||
self.assertEqual(c.segment[9].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[10].isot, 3)
|
||||
|
|
@ -2598,7 +2598,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[10].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[11].id, 'SOD')
|
||||
self.assertEqual(c.segment[11].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[12].isot, 0)
|
||||
|
|
@ -2607,7 +2607,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[12].tnsot, 2)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[13].id, 'SOD')
|
||||
self.assertEqual(c.segment[13].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[14].isot, 1)
|
||||
|
|
@ -2616,7 +2616,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[14].tnsot, 2)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[15].id, 'SOD')
|
||||
self.assertEqual(c.segment[15].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[16].isot, 3)
|
||||
|
|
@ -2625,7 +2625,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[16].tnsot, 2)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[17].id, 'SOD')
|
||||
self.assertEqual(c.segment[17].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[18].isot, 2)
|
||||
|
|
@ -2634,7 +2634,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[18].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[19].id, 'SOD')
|
||||
self.assertEqual(c.segment[19].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[20].isot, 2)
|
||||
|
|
@ -2643,10 +2643,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[20].tnsot, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[21].id, 'SOD')
|
||||
self.assertEqual(c.segment[21].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[22].id, 'EOC')
|
||||
self.assertEqual(c.segment[22].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_11_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_11.j2k')
|
||||
|
|
@ -2718,16 +2718,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[5].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[6].id, 'SOD')
|
||||
self.assertEqual(c.segment[6].marker_id, 'SOD')
|
||||
|
||||
# SOP, EPH
|
||||
sop = [x.id for x in c.segment if x.id == 'SOP']
|
||||
eph = [x.id for x in c.segment if x.id == 'EPH']
|
||||
sop = [x.marker_id for x in c.segment if x.marker_id == 'SOP']
|
||||
eph = [x.marker_id for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(sop), 0)
|
||||
self.assertEqual(len(eph), 1)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_12_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_12.j2k')
|
||||
|
|
@ -2800,16 +2800,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[5].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[6].id, 'SOD')
|
||||
self.assertEqual(c.segment[6].marker_id, 'SOD')
|
||||
|
||||
# SOP, EPH
|
||||
sop = [x.id for x in c.segment if x.id == 'SOP']
|
||||
eph = [x.id for x in c.segment if x.id == 'EPH']
|
||||
sop = [x.marker_id for x in c.segment if x.marker_id == 'SOP']
|
||||
eph = [x.marker_id for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(sop), 4)
|
||||
self.assertEqual(len(eph), 0)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_13_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_13.j2k')
|
||||
|
|
@ -2932,10 +2932,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[10].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[11].id, 'SOD')
|
||||
self.assertEqual(c.segment[11].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[12].id, 'EOC')
|
||||
self.assertEqual(c.segment[12].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_14_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_14.j2k')
|
||||
|
|
@ -3008,10 +3008,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[5].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[6].id, 'SOD')
|
||||
self.assertEqual(c.segment[6].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[7].id, 'EOC')
|
||||
self.assertEqual(c.segment[7].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_15_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_15.j2k')
|
||||
|
|
@ -3127,7 +3127,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[12].sprgn, 7)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[13].id, 'SOD')
|
||||
self.assertEqual(c.segment[13].marker_id, 'SOD')
|
||||
|
||||
# 16 SOP markers would be here if we were looking for them
|
||||
|
||||
|
|
@ -3138,7 +3138,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[31].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[32].id, 'SOD')
|
||||
self.assertEqual(c.segment[32].marker_id, 'SOD')
|
||||
|
||||
# 16 SOP markers would be here if we were looking for them
|
||||
|
||||
|
|
@ -3149,7 +3149,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[49].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[50].id, 'SOD')
|
||||
self.assertEqual(c.segment[50].marker_id, 'SOD')
|
||||
|
||||
# 16 SOP markers would be here if we were looking for them
|
||||
|
||||
|
|
@ -3160,12 +3160,12 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[67].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[68].id, 'SOD')
|
||||
self.assertEqual(c.segment[68].marker_id, 'SOD')
|
||||
|
||||
# 16 SOP markers would be here if we were looking for them
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[85].id, 'EOC')
|
||||
self.assertEqual(c.segment[85].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p0_16_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p0_16.j2k')
|
||||
|
|
@ -3230,10 +3230,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[4].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[5].id, 'SOD')
|
||||
self.assertEqual(c.segment[5].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[6].id, 'EOC')
|
||||
self.assertEqual(c.segment[6].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_01_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_01.j2k')
|
||||
|
|
@ -3324,16 +3324,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[6].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[7].id, 'SOD')
|
||||
self.assertEqual(c.segment[7].marker_id, 'SOD')
|
||||
|
||||
# SOP, EPH
|
||||
sop = [x.id for x in c.segment if x.id == 'SOP']
|
||||
eph = [x.id for x in c.segment if x.id == 'EPH']
|
||||
sop = [x.marker_id for x in c.segment if x.marker_id == 'SOP']
|
||||
eph = [x.marker_id for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(sop), 20)
|
||||
self.assertEqual(len(eph), 20)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_02_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_02.j2k')
|
||||
|
|
@ -3440,14 +3440,14 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[7].tnsot, 1)
|
||||
|
||||
# PPT: packed packet headers, tile-part header
|
||||
self.assertEqual(c.segment[8].id, 'PPT')
|
||||
self.assertEqual(c.segment[8].marker_id, 'PPT')
|
||||
self.assertEqual(c.segment[8].zppt, 0)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[9].id, 'SOD')
|
||||
self.assertEqual(c.segment[9].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[10].id, 'EOC')
|
||||
self.assertEqual(c.segment[10].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_03_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_03.j2k')
|
||||
|
|
@ -3576,7 +3576,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
"Creator: AV-J2K (c) 2000,2001 Algo Vision")
|
||||
|
||||
# PPM: packed packet headers, main header
|
||||
self.assertEqual(c.segment[9].id, 'PPM')
|
||||
self.assertEqual(c.segment[9].marker_id, 'PPM')
|
||||
self.assertEqual(c.segment[9].zppm, 0)
|
||||
|
||||
# TLM (tile-part length)
|
||||
|
|
@ -3591,10 +3591,10 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[11].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[12].id, 'SOD')
|
||||
self.assertEqual(c.segment[12].marker_id, 'SOD')
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[13].id, 'EOC')
|
||||
self.assertEqual(c.segment[13].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_04_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_04.j2k')
|
||||
|
|
@ -3679,7 +3679,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[6].tnsot, 1)
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[7].id, 'SOD')
|
||||
self.assertEqual(c.segment[7].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[8].isot, 1)
|
||||
|
|
@ -3698,7 +3698,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
[8, 10, 10, 10, 9, 9, 9, 8, 8, 8])
|
||||
|
||||
# SOD: start of data
|
||||
self.assertEqual(c.segment[10].id, 'SOD')
|
||||
self.assertEqual(c.segment[10].marker_id, 'SOD')
|
||||
|
||||
# SOT: start of tile part
|
||||
self.assertEqual(c.segment[11].isot, 2)
|
||||
|
|
@ -3709,19 +3709,19 @@ class TestSuiteDump(unittest.TestCase):
|
|||
# and so on
|
||||
|
||||
# There should be 64 SOD, SOT, QCD segments.
|
||||
ids = [x.id for x in c.segment if x.id == 'SOT']
|
||||
ids = [x.marker_id for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(len(ids), 64)
|
||||
ids = [x.id for x in c.segment if x.id == 'SOD']
|
||||
ids = [x.marker_id for x in c.segment if x.marker_id == 'SOD']
|
||||
self.assertEqual(len(ids), 64)
|
||||
ids = [x.id for x in c.segment if x.id == 'QCD']
|
||||
ids = [x.marker_id for x in c.segment if x.marker_id == 'QCD']
|
||||
self.assertEqual(len(ids), 64)
|
||||
|
||||
# Tiles should be in order, right?
|
||||
tiles = [x.isot for x in c.segment if x.id == 'SOT']
|
||||
tiles = [x.isot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(tiles, list(range(64)))
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_05_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_05.j2k')
|
||||
|
|
@ -3799,17 +3799,17 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[230].tnsot, 1)
|
||||
|
||||
# 225 total SOT segments
|
||||
isot = [x.isot for x in c.segment if x.id == 'SOT']
|
||||
isot = [x.isot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(isot, list(range(225)))
|
||||
|
||||
# scads of SOP, EPH segments
|
||||
sop = [x.id for x in c.segment if x.id == 'SOP']
|
||||
eph = [x.id for x in c.segment if x.id == 'EPH']
|
||||
sop = [x.marker_id for x in c.segment if x.marker_id == 'SOP']
|
||||
eph = [x.marker_id for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(sop), 26472)
|
||||
self.assertEqual(len(eph), 0)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_06_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_06.j2k')
|
||||
|
|
@ -3884,25 +3884,25 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[5].tnsot, 1)
|
||||
|
||||
# PPT: packed packet headers, tile-part header
|
||||
self.assertEqual(c.segment[6].id, 'PPT')
|
||||
self.assertEqual(c.segment[6].marker_id, 'PPT')
|
||||
self.assertEqual(c.segment[6].zppt, 0)
|
||||
|
||||
# scads of SOP, EPH segments
|
||||
|
||||
# 16 SOD segments
|
||||
sods = [x for x in c.segment if x.id == 'SOD']
|
||||
sods = [x for x in c.segment if x.marker_id == 'SOD']
|
||||
self.assertEqual(len(sods), 16)
|
||||
|
||||
# 16 PPT segments
|
||||
ppts = [x for x in c.segment if x.id == 'PPT']
|
||||
ppts = [x for x in c.segment if x.marker_id == 'PPT']
|
||||
self.assertEqual(len(ppts), 16)
|
||||
|
||||
# 16 SOT segments
|
||||
isots = [x.isot for x in c.segment if x.id == 'SOT']
|
||||
isots = [x.isot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(isots, list(range(16)))
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_p1_07_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/p1_07.j2k')
|
||||
|
|
@ -3995,7 +3995,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
# scads of SOP, EPH segments
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_NR_file1_dump(self):
|
||||
jfile = os.path.join(data_root, 'input/conformance/file1.jp2')
|
||||
|
|
@ -4573,18 +4573,18 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[9].ptlm, (45274, 20838, 8909))
|
||||
|
||||
# 3 tiles, one for each component
|
||||
idx = [x.isot for x in c.segment if x.id == 'SOT']
|
||||
idx = [x.isot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(idx, [0, 0, 0])
|
||||
lens = [x.psot for x in c.segment if x.id == 'SOT']
|
||||
lens = [x.psot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(lens, [45274, 20838, 8909])
|
||||
tpsot = [x.tpsot for x in c.segment if x.id == 'SOT']
|
||||
tpsot = [x.tpsot for x in c.segment if x.marker_id == 'SOT']
|
||||
self.assertEqual(tpsot, [0, 1, 2])
|
||||
|
||||
sods = [x for x in c.segment if x.id == 'SOD']
|
||||
sods = [x for x in c.segment if x.marker_id == 'SOD']
|
||||
self.assertEqual(len(sods), 3)
|
||||
|
||||
# EOC: end of codestream
|
||||
self.assertEqual(c.segment[-1].id, 'EOC')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'EOC')
|
||||
|
||||
def test_Bretagne2_j2k_dump(self):
|
||||
# Profile 3.
|
||||
|
|
@ -4638,7 +4638,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
[(16, 16), (32, 32), (64, 64), (128, 128),
|
||||
(128, 128), (128, 128)])
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
expected += ['SOT', 'COC', 'QCC', 'COC', 'QCC', 'SOD'] * 25
|
||||
expected += ['EOC']
|
||||
|
|
@ -4693,7 +4693,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
glymur.core.WAVELET_TRANSFORM_9x7_IRREVERSIBLE)
|
||||
self.assertEqual(len(c.segment[2].spcod), 9)
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME', 'SOT', 'SOD', 'EOC']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -4746,7 +4746,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
glymur.core.WAVELET_TRANSFORM_5x3_REVERSIBLE)
|
||||
self.assertEqual(len(c.segment[2].spcod), 9)
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME', 'SOT', 'SOD', 'EOC']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -4759,7 +4759,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -4822,7 +4822,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -4893,7 +4893,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -4969,7 +4969,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5030,7 +5030,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5418,7 +5418,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5479,7 +5479,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5539,7 +5539,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5608,7 +5608,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5677,7 +5677,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5739,7 +5739,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5802,7 +5802,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
jp2k = Jp2k(jfile)
|
||||
c = jp2k.get_codestream()
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -5911,7 +5911,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'CME', 'COD', 'QCD', 'QCC', 'QCC']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6044,7 +6044,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'CME', 'COD', 'QCD', 'QCC', 'QCC']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6172,7 +6172,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6325,7 +6325,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[4].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6425,7 +6425,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[4].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6523,7 +6523,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[4].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6626,7 +6626,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'CME']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6753,7 +6753,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[4].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6867,7 +6867,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[4].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -6961,7 +6961,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD', 'POD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -7069,7 +7069,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -7168,7 +7168,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[3].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
@ -7276,7 +7276,7 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
c = jp2.box[8].main_header
|
||||
|
||||
ids = [x.id for x in c.segment]
|
||||
ids = [x.marker_id for x in c.segment]
|
||||
expected = ['SOC', 'SIZ', 'COD', 'QCD']
|
||||
self.assertEqual(ids, expected)
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class TestSuiteNegative(unittest.TestCase):
|
|||
# Verify that the last segment returned in the codestream is SOD,
|
||||
# not EOC. Codestream parsing should stop when we try to jump to
|
||||
# the end of SOT.
|
||||
self.assertEqual(c.segment[-1].id, 'SOD')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'SOD')
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
|
|
@ -109,7 +109,7 @@ class TestSuiteNegative(unittest.TestCase):
|
|||
# Verify that the last segment returned in the codestream is SOD,
|
||||
# not EOC. Codestream parsing should stop when we try to jump to
|
||||
# the end of SOT.
|
||||
self.assertEqual(c.segment[-1].id, 'SOD')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'SOD')
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
|
|
@ -124,7 +124,7 @@ class TestSuiteNegative(unittest.TestCase):
|
|||
# Verify that the last segment returned in the codestream is SOD,
|
||||
# not EOC. Codestream parsing should stop when we try to jump to
|
||||
# the end of SOT.
|
||||
self.assertEqual(c.segment[-1].id, 'SOD')
|
||||
self.assertEqual(c.segment[-1].marker_id, 'SOD')
|
||||
|
||||
def test_code_block_dimensions(self):
|
||||
# opj_compress doesn't allow the dimensions of a codeblock
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ class TestSuiteWrite(unittest.TestCase):
|
|||
self.assertEqual(len(c.segment[2].spcod), 9)
|
||||
|
||||
# 18 SOP segments.
|
||||
nsops = [x.nsop for x in c.segment if x.id == 'SOP']
|
||||
nsops = [x.nsop for x in c.segment if x.marker_id == 'SOP']
|
||||
self.assertEqual(nsops, list(range(18)))
|
||||
|
||||
def test_NR_ENC_Bretagne2_ppm_7_encode(self):
|
||||
|
|
@ -484,7 +484,7 @@ class TestSuiteWrite(unittest.TestCase):
|
|||
self.assertEqual(len(c.segment[2].spcod), 9)
|
||||
|
||||
# 18 EPH segments.
|
||||
ephs = [x for x in c.segment if x.id == 'EPH']
|
||||
ephs = [x for x in c.segment if x.marker_id == 'EPH']
|
||||
self.assertEqual(len(ephs), 18)
|
||||
|
||||
def test_NR_ENC_Bretagne2_ppm_8_encode(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue