From 661f5bfadb1b671c40396a65b2e86e74922f7a48 Mon Sep 17 00:00:00 2001 From: jevans Date: Tue, 18 Mar 2014 20:04:50 -0400 Subject: [PATCH] Cinema 2K and Cinema 4K profiles are printed as such. #201 --- glymur/codestream.py | 4 ++-- glymur/test/fixtures.py | 11 +++++++++++ glymur/test/test_printing.py | 11 ++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/glymur/codestream.py b/glymur/codestream.py index 2e9184a..2f9d37a 100644 --- a/glymur/codestream.py +++ b/glymur/codestream.py @@ -55,8 +55,8 @@ _CAPABILITIES_DISPLAY = _Keydefaultdict(_factory, { _NO_PROFILE: 'no profile', _PROFILE_0: '0', _PROFILE_1: '1', - _PROFILE_3: '3', - _PROFILE_4: '4'} ) + _PROFILE_3: 'Cinema 2K', + _PROFILE_4: 'Cinema 4K'} ) # Need a catch-all list of valid markers. # See table A-1 in ISO/IEC FCD15444-1. diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 1ac2af9..1ee7aa1 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -611,3 +611,14 @@ issue_186_progression_order = """COD marker segment @ (174, 12) Vertically stripe causal context: False Predictable termination: False Segmentation symbols: False""" + +# Cinema 2K profile +cinema2k_profile = """SIZ marker segment @ (2, 47) + Profile: Cinema 2K + Reference Grid Height, Width: (1080 x 1920) + Vertical, Horizontal Reference Grid Offset: (0 x 0) + Reference Tile Height, Width: (1080 x 1920) + Vertical, Horizontal Reference Tile Offset: (0 x 0) + Bitdepth: (12, 12, 12) + Signed: (False, False, False) + Vertical, Horizontal Subsampling: ((1, 1), (1, 1), (1, 1))""" diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 65b181e..a6f1862 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -653,6 +653,16 @@ class TestPrintingOpjDataRoot(unittest.TestCase): def tearDown(self): pass + def test_cinema_profile(self): + """Should print Cinema 2K when the profile is 3.""" + filename = opj_data_file('input/nonregression/_00042.j2k') + j2k = Jp2k(filename) + with patch('sys.stdout', new=StringIO()) as fake_out: + c = j2k.get_codestream() + print(c.segment[1]) + actual = fake_out.getvalue().strip() + self.assertEqual(actual, fixtures.cinema2k_profile) + def test_invalid_colorspace(self): """An invalid colorspace shouldn't cause an error.""" filename = opj_data_file('input/nonregression/edf_c2_1103421.jp2') @@ -662,7 +672,6 @@ class TestPrintingOpjDataRoot(unittest.TestCase): with patch('sys.stdout', new=StringIO()) as fake_out: print(jp2) - def test_bad_rsiz(self): """Should still be able to print if rsiz is bad, issue196""" filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')