Added another irreversible test to not use OPJ_TEST_SUITE. #238
This commit is contained in:
parent
a719bb4ac9
commit
83755cef0a
2 changed files with 31 additions and 17 deletions
|
|
@ -63,6 +63,22 @@ class TestJp2k(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_irreversible(self):
|
||||
"""Irreversible"""
|
||||
j = Jp2k(self.jp2file)
|
||||
expdata = j.read()
|
||||
with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile:
|
||||
j2 = Jp2k(tfile.name, 'wb')
|
||||
j2.write(expdata, irreversible=True)
|
||||
|
||||
codestream = j2.get_codestream()
|
||||
self.assertEqual(codestream.segment[2].spcod[8],
|
||||
glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE)
|
||||
|
||||
actdata = j2.read()
|
||||
self.assertTrue(fixtures.mse(actdata[0], expdata[0]) < 0.38)
|
||||
|
||||
|
||||
def test_no_cxform_pclr_jpx(self):
|
||||
"""Indices for pclr jpxfile if no color transform"""
|
||||
j = Jp2k(self.jpxfile)
|
||||
|
|
@ -401,23 +417,6 @@ class TestJp2k_write(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_irreversible(self):
|
||||
"""Irreversible"""
|
||||
filename = opj_data_file('input/nonregression/issue141.rawl')
|
||||
expdata = np.fromfile(filename, dtype=np.uint16)
|
||||
expdata.resize((2816, 2048))
|
||||
with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile:
|
||||
j = Jp2k(tfile.name, 'wb')
|
||||
j.write(expdata, irreversible=True)
|
||||
|
||||
codestream = j.get_codestream()
|
||||
self.assertEqual(codestream.segment[2].spcod[8],
|
||||
glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE)
|
||||
|
||||
actdata = j.read()
|
||||
self.assertTrue(fixtures.mse(actdata, expdata) < 250)
|
||||
|
||||
|
||||
def test_cblkh_different_than_width(self):
|
||||
"""Verify that we can set a code block size where height does not equal
|
||||
width.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ import tempfile
|
|||
import unittest
|
||||
import warnings
|
||||
|
||||
import numpy as np
|
||||
|
||||
try:
|
||||
import skimage.io
|
||||
skimage.io.use_plugin('freeimage', 'imread')
|
||||
|
|
@ -271,6 +273,19 @@ class TestSuiteWrite(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
pass
|
||||
|
||||
def test_NR_ENC_issue141_rawl_23_encode(self):
|
||||
filename = opj_data_file('input/nonregression/issue141.rawl')
|
||||
expdata = np.fromfile(filename, dtype=np.uint16)
|
||||
expdata.resize((2816, 2048))
|
||||
with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile:
|
||||
j = Jp2k(tfile.name, 'wb')
|
||||
j.write(expdata, irreversible=True)
|
||||
|
||||
codestream = j.get_codestream()
|
||||
self.assertEqual(codestream.segment[2].spcod[8],
|
||||
glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE)
|
||||
|
||||
|
||||
def test_NR_ENC_Bretagne1_ppm_1_encode(self):
|
||||
"""NR-ENC-Bretagne1.ppm-1-encode"""
|
||||
infile = opj_data_file('input/nonregression/Bretagne1.ppm')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue