Removed one read statement, using struct.unpack_from. #130
This commit is contained in:
parent
4e19e688a0
commit
828abe942a
1 changed files with 5 additions and 5 deletions
|
|
@ -380,13 +380,13 @@ class Codestream(object):
|
||||||
COD segment instance.
|
COD segment instance.
|
||||||
"""
|
"""
|
||||||
offset = fptr.tell() - 2
|
offset = fptr.tell() - 2
|
||||||
offset = fptr.tell() - 2
|
|
||||||
|
|
||||||
read_buffer = fptr.read(3)
|
read_buffer = fptr.read(2)
|
||||||
length, scod = struct.unpack('>HB', read_buffer)
|
length, = struct.unpack('>H', read_buffer)
|
||||||
|
|
||||||
numbytes = offset + 2 + length - fptr.tell()
|
read_buffer = fptr.read(length - 2)
|
||||||
spcod = fptr.read(numbytes)
|
scod, = struct.unpack_from('>B', read_buffer, offset=0)
|
||||||
|
spcod = read_buffer[1:]
|
||||||
spcod = np.frombuffer(spcod, dtype=np.uint8)
|
spcod = np.frombuffer(spcod, dtype=np.uint8)
|
||||||
if spcod[0] not in [LRCP, RLCP, RPCL, PCRL, CPRL]:
|
if spcod[0] not in [LRCP, RLCP, RPCL, PCRL, CPRL]:
|
||||||
msg = "Invalid progression order in COD segment: {0}."
|
msg = "Invalid progression order in COD segment: {0}."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue