From e2539b04e12289cbfb2f9dbc44abd06ba139028c Mon Sep 17 00:00:00 2001 From: jevans Date: Tue, 11 Feb 2014 19:59:35 -0500 Subject: [PATCH] Added deprecated rreq descriptions. #173 --- glymur/jp2box.py | 49 +++++++++++++++++++++----------------- glymur/jp2k.py | 2 +- glymur/test/fixtures.py | 2 +- glymur/test/test_jp2box.py | 2 +- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/glymur/jp2box.py b/glymur/jp2box.py index a6ea821..03adce0 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -1721,19 +1721,21 @@ class PaletteBox(Jp2kBox): # Map rreq codes to display text. _READER_REQUIREMENTS_DISPLAY = { 0: 'File not completely understood', - 1: 'Deprecated', + 1: 'Deprecated - contains no extensions', 2: 'Contains multiple composition layers', - 3: 'Deprecated', + 3: 'Deprecated - codestream is compressed using JPEG 2000 and requires ' + + 'at least a Profile 0 decoder as defind in ITU-T Rec. T.800 ' + + '| ISO/IEC 15444-1, A.10 Table A.45', 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', + 8: 'Deprecated - does not contain opacity', 9: 'Non-premultiplied opacity channel', 10: 'Premultiplied opacity channel', 11: 'Chroma-key based opacity', - 12: 'Deprecated', + 12: 'Deprecated - codestream is contiguous', 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', @@ -1743,21 +1745,24 @@ _READER_REQUIREMENTS_DISPLAY = { + 'only through a URL specified network connection', 17: 'Compositing required to produce rendered result from multiple ' + 'compositing layers', - 18: 'Deprecated', - 19: 'Deprecated', - 20: 'Deprecated', + 18: 'Deprecated - support for compositing is not required', + 19: 'Deprecated - contains multiple, discrete layers that should not ' + + 'be combined through either animation or compositing', + 20: 'Deprecated - compositing layers each contain only a single ' + + 'codestream', 21: 'At least one compositing layer consists of multiple codestreams', - 22: 'Deprecated', + 22: 'Deprecated - all compositing layers are in the same colourspace', 23: 'Colourspace transformations are required to combine compositing ' + 'layers; not all compositing layers are in the same colourspace', - 24: 'Deprecated', - 25: 'Deprecated', + 24: 'Deprecated - rendered result created without using animation', + 25: 'Deprecated - animated, but first layer covers entire area and is ' + + 'opaque', 26: 'First animation layer does not cover entire rendered result', - 27: 'Deprecated', + 27: 'Deprecated - animated, and no layer is reused', 28: 'Reuse of animation layers', - 29: 'Deprecated', + 29: 'Deprecated - animated, but layers are reused', 30: 'Some animated frames are non-persistent', - 31: 'Deprecated', + 31: 'Deprecated - rendered result created without using scaling', 32: 'Rendered result involves scaling within a layer', 33: 'Rendered result involves scaling between layers', 34: 'ROI metadata', @@ -1768,11 +1773,11 @@ _READER_REQUIREMENTS_DISPLAY = { 39: 'JPX digital signatures', 40: 'JPX checksums', 41: 'Desires Graphics Arts Reproduction specified', - 42: 'Deprecated', - 43: '(Deprecated) compositing layer uses restricted ICC profile', + 42: 'Deprecated - compositing layer uses palettized colour', + 43: 'Deprecated - compositing layer uses restricted ICC profile', 44: 'Compositing layer uses Any ICC profile', - 45: 'Deprecated', - 46: 'Deprecated', + 45: 'Deprecated - compositing layer uses sRGB enumerated colourspace', + 46: 'Deprecated - compositing layer uses sRGB-grey enumerated colourspace', 47: 'BiLevel 1 enumerated colourspace', 48: 'BiLevel 2 enumerated colourspace', 49: 'YCbCr 1 enumerated colourspace', @@ -1789,14 +1794,14 @@ _READER_REQUIREMENTS_DISPLAY = { 60: 'e-sRGB enumerated colorspace', 61: 'ROMM_RGB enumerated colorspace', 62: 'Non-square samples', - 63: 'Deprecated', - 64: 'Deprecated', - 65: 'Deprecated', - 66: 'Deprecated', + 63: 'Deprecated - compositing layers have labels', + 64: 'Deprecated - codestreams have labels', + 65: 'Deprecated - compositing layers have different colour spaces', + 66: 'Deprecated - compositing layers have different metadata', 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', + 70: 'Deprecated - compositing layer uses sYCC enumerated colour space', 71: 'e-sYCC enumerated colourspace', 72: 'JPEG 2000 Part 2 codestream as restricted by baseline conformance ' + 'requirements in M.9.2.3', diff --git a/glymur/jp2k.py b/glymur/jp2k.py index cd1a6eb..fbbf999 100644 --- a/glymur/jp2k.py +++ b/glymur/jp2k.py @@ -1211,7 +1211,7 @@ def _validate_channel_definition(jp2h, colr): raise IOError(msg) -JP2H_CHILDREN = set(['bpcc', 'cmap', 'ihdr', 'pclr']) +JP2H_CHILDREN = set(['bpcc', 'cdef', 'cmap', 'ihdr', 'pclr']) def _check_jp2h_child_boxes(boxes, parent_box_name): """Certain boxes can only reside in the JP2 header.""" box_ids = set([box.box_id for box in boxes]) diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 5f7d77a..9b40a25 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -692,5 +692,5 @@ file7_rreq = r"""Reader Requirements Box (rreq) @ (44, 24) Standard Features: Feature 005: Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 | ISO/IEC 15444-1 Feature 060: e-sRGB enumerated colorspace - Feature 043: (Deprecated) compositing layer uses restricted ICC profile + Feature 043: Deprecated - compositing layer uses restricted ICC profile Vendor Features:""" diff --git a/glymur/test/test_jp2box.py b/glymur/test/test_jp2box.py index ea1fddb..feffec9 100644 --- a/glymur/test/test_jp2box.py +++ b/glymur/test/test_jp2box.py @@ -315,7 +315,7 @@ class TestChannelDefinition(unittest.TestCase): boxes = [self.jp2b, self.ftyp, self.jp2h, cdef, self.jp2c] with tempfile.NamedTemporaryFile(suffix=".jp2") as tfile: - with self.assertRaises(IOError): + with self.assertRaises((IOError, OSError)): j2k.wrap(tfile.name, boxes=boxes) def test_bad_type(self):