Updated through r2651. #139

This commit is contained in:
John Evans 2014-03-08 15:23:35 -05:00
commit 8827908b28
4 changed files with 38 additions and 59 deletions

View file

@ -13,7 +13,7 @@ both read and write JPEG 2000 files, but you may wish to install version 2.0
or the 2.0+ version from OpenJPEG's development trunk for better performance. or the 2.0+ version from OpenJPEG's development trunk for better performance.
If you do that, you should compile it as a shared library (named *openjp2* If you do that, you should compile it as a shared library (named *openjp2*
instead of *openjpeg*) from the developmental source that you can retrieve instead of *openjpeg*) from the developmental source that you can retrieve
via subversion. As of this time of writing, svn revision r2451 works. via subversion. As of this time of writing, svn revision r2651 works.
You should also download the test data for the purpose of configuring You should also download the test data for the purpose of configuring
and running OpenJPEG's test suite, check their instructions for all this. and running OpenJPEG's test suite, check their instructions for all this.
You should set the **OPJ_DATA_ROOT** environment variable for the purpose You should set the **OPJ_DATA_ROOT** environment variable for the purpose

View file

@ -31,7 +31,7 @@ class TestICC(unittest.TestCase):
"""basic ICC profile""" """basic ICC profile"""
filename = opj_data_file('input/conformance/file5.jp2') filename = opj_data_file('input/conformance/file5.jp2')
j = Jp2k(filename) j = Jp2k(filename)
profile = j.box[3].box[1].icc_profile profile = j.box[2].box[1].icc_profile
self.assertEqual(profile['Size'], 546) self.assertEqual(profile['Size'], 546)
self.assertEqual(profile['Preferred CMM Type'], 0) self.assertEqual(profile['Preferred CMM Type'], 0)
self.assertEqual(profile['Version'], '2.2.0') self.assertEqual(profile['Version'], '2.2.0')

View file

@ -3297,7 +3297,7 @@ class TestSuiteDump(unittest.TestCase):
def test_NR_file5_dump(self): def test_NR_file5_dump(self):
# Three 8-bit components in the ROMM-RGB colourspace, encapsulated in a # Three 8-bit components in the ROMM-RGB colourspace, encapsulated in a
# JP2 compatible JPX file. The components have been transformed using # JPX file. The components have been transformed using
# the RCT. The colourspace is specified using both a Restricted ICC # the RCT. The colourspace is specified using both a Restricted ICC
# profile and using the JPX-defined enumerated code for the ROMM-RGB # profile and using the JPX-defined enumerated code for the ROMM-RGB
# colourspace. # colourspace.
@ -3305,49 +3305,38 @@ class TestSuiteDump(unittest.TestCase):
jp2 = Jp2k(jfile) jp2 = Jp2k(jfile)
ids = [box.box_id for box in jp2.box] ids = [box.box_id for box in jp2.box]
self.assertEqual(ids, ['jP ', 'ftyp', 'rreq', 'jp2h', 'jp2c']) self.assertEqual(ids, ['jP ', 'ftyp', 'jp2h', 'jp2c'])
ids = [box.box_id for box in jp2.box[3].box] ids = [box.box_id for box in jp2.box[2].box]
self.assertEqual(ids, ['ihdr', 'colr', 'colr']) self.assertEqual(ids, ['ihdr', 'colr'])
# Signature box. Check for corruption. # Signature box. Check for corruption.
self.assertEqual(jp2.box[0].signature, (13, 10, 135, 10)) self.assertEqual(jp2.box[0].signature, (13, 10, 135, 10))
# File type box. # File type box.
self.assertEqual(jp2.box[1].brand, 'jpx ') self.assertEqual(jp2.box[1].brand, 'jp2 ')
self.assertEqual(jp2.box[1].minor_version, 0) self.assertEqual(jp2.box[1].minor_version, 0)
self.assertEqual(jp2.box[1].compatibility_list[1], 'jp2 ') self.assertEqual(jp2.box[1].compatibility_list[1], 'jp2 ')
self.assertEqual(jp2.box[1].compatibility_list[2], 'jpx ')
self.assertEqual(jp2.box[1].compatibility_list[3], 'jpxb')
# Jp2 Header # Jp2 Header
# Image header # Image header
self.assertEqual(jp2.box[3].box[0].height, 512) self.assertEqual(jp2.box[2].box[0].height, 512)
self.assertEqual(jp2.box[3].box[0].width, 768) self.assertEqual(jp2.box[2].box[0].width, 768)
self.assertEqual(jp2.box[3].box[0].num_components, 3) self.assertEqual(jp2.box[2].box[0].num_components, 3)
self.assertEqual(jp2.box[3].box[0].signed, False) self.assertEqual(jp2.box[2].box[0].signed, False)
self.assertEqual(jp2.box[3].box[0].compression, 7) # wavelet self.assertEqual(jp2.box[2].box[0].compression, 7) # wavelet
self.assertEqual(jp2.box[3].box[0].colorspace_unknown, False) self.assertEqual(jp2.box[2].box[0].colorspace_unknown, False)
self.assertEqual(jp2.box[3].box[0].ip_provided, False) self.assertEqual(jp2.box[2].box[0].ip_provided, False)
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[3].box[1].method, self.assertEqual(jp2.box[2].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE) # enumerated glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].precedence, 0)
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546) self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 546)
self.assertIsNone(jp2.box[3].box[1].colorspace) self.assertIsNone(jp2.box[2].box[1].colorspace)
# Jp2 Header
# Colour specification
self.assertEqual(jp2.box[3].box[2].method,
glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(jp2.box[3].box[2].precedence, 1)
self.assertEqual(jp2.box[3].box[2].approximation, 1) # JPX exact
self.assertIsNone(jp2.box[3].box[2].icc_profile)
self.assertEqual(jp2.box[3].box[2].colorspace,
glymur.core.ROMM_RGB)
def test_NR_file6_dump(self): def test_NR_file6_dump(self):
jfile = opj_data_file('input/conformance/file6.jp2') jfile = opj_data_file('input/conformance/file6.jp2')
@ -3398,54 +3387,43 @@ class TestSuiteDump(unittest.TestCase):
jp2 = Jp2k(jfile) jp2 = Jp2k(jfile)
ids = [box.box_id for box in jp2.box] ids = [box.box_id for box in jp2.box]
self.assertEqual(ids, ['jP ', 'ftyp', 'rreq', 'jp2h', 'jp2c']) self.assertEqual(ids, ['jP ', 'ftyp', 'jp2h', 'jp2c'])
ids = [box.box_id for box in jp2.box[3].box] ids = [box.box_id for box in jp2.box[2].box]
self.assertEqual(ids, ['ihdr', 'colr', 'colr']) self.assertEqual(ids, ['ihdr', 'colr'])
# Signature box. Check for corruption. # Signature box. Check for corruption.
self.assertEqual(jp2.box[0].signature, (13, 10, 135, 10)) self.assertEqual(jp2.box[0].signature, (13, 10, 135, 10))
# File type box. # File type box.
self.assertEqual(jp2.box[1].brand, 'jpx ') self.assertEqual(jp2.box[1].brand, 'jp2 ')
self.assertEqual(jp2.box[1].compatibility_list[1], 'jp2 ') self.assertEqual(jp2.box[1].compatibility_list[1], 'jp2 ')
self.assertEqual(jp2.box[1].compatibility_list[2], 'jpx ')
self.assertEqual(jp2.box[1].compatibility_list[3], 'jpxb')
self.assertEqual(jp2.box[1].minor_version, 0) self.assertEqual(jp2.box[1].minor_version, 0)
# Reader requirements talk. # Reader requirements talk.
# e-SRGB enumerated colourspace # e-SRGB enumerated colourspace
self.assertTrue(60 in jp2.box[2].standard_flag) #self.assertTrue(60 in jp2.box[2].standard_flag)
# Jp2 Header # Jp2 Header
# Image header # Image header
self.assertEqual(jp2.box[3].box[0].height, 640) self.assertEqual(jp2.box[2].box[0].height, 640)
self.assertEqual(jp2.box[3].box[0].width, 480) self.assertEqual(jp2.box[2].box[0].width, 480)
self.assertEqual(jp2.box[3].box[0].num_components, 3) self.assertEqual(jp2.box[2].box[0].num_components, 3)
self.assertEqual(jp2.box[3].box[0].bits_per_component, 16) self.assertEqual(jp2.box[2].box[0].bits_per_component, 16)
self.assertEqual(jp2.box[3].box[0].signed, False) self.assertEqual(jp2.box[2].box[0].signed, False)
self.assertEqual(jp2.box[3].box[0].compression, 7) # wavelet self.assertEqual(jp2.box[2].box[0].compression, 7) # wavelet
self.assertEqual(jp2.box[3].box[0].colorspace_unknown, False) self.assertEqual(jp2.box[2].box[0].colorspace_unknown, False)
self.assertEqual(jp2.box[3].box[0].ip_provided, False) self.assertEqual(jp2.box[2].box[0].ip_provided, False)
# Jp2 Header # Jp2 Header
# Colour specification # Colour specification
self.assertEqual(jp2.box[3].box[1].method, self.assertEqual(jp2.box[2].box[1].method,
glymur.core.RESTRICTED_ICC_PROFILE) glymur.core.RESTRICTED_ICC_PROFILE)
self.assertEqual(jp2.box[3].box[1].precedence, 0) self.assertEqual(jp2.box[2].box[1].precedence, 0)
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332) self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 13332)
self.assertIsNone(jp2.box[3].box[1].colorspace) self.assertIsNone(jp2.box[2].box[1].colorspace)
# Jp2 Header
# Colour specification
self.assertEqual(jp2.box[3].box[2].method,
glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(jp2.box[3].box[2].precedence, 1)
self.assertEqual(jp2.box[3].box[2].approximation, 1) # JPX exact
self.assertIsNone(jp2.box[3].box[2].icc_profile)
self.assertEqual(jp2.box[3].box[2].colorspace,
glymur.core.E_SRGB)
def test_NR_file8_dump(self): def test_NR_file8_dump(self):
# One 8-bit component in a gamma 1.8 space. The colourspace is # One 8-bit component in a gamma 1.8 space. The colourspace is

View file

@ -735,6 +735,7 @@ class TestPrinting(unittest.TestCase):
expected = '\n'.join(lines) expected = '\n'.join(lines)
self.assertEqual(actual, expected) self.assertEqual(actual, expected)
@unittest.skip("file7 no longer has a rreq")
@unittest.skipIf(OPJ_DATA_ROOT is None, @unittest.skipIf(OPJ_DATA_ROOT is None,
"OPJ_DATA_ROOT environment variable not set") "OPJ_DATA_ROOT environment variable not set")
def test_rreq(self): def test_rreq(self):