Beispiel #1
0
    def test_parameters(self):
        """Test getting the parameters for a JPEG2K codestream."""
        base = b'\xff\x4f\xff\x51' + b'\x00' * 38
        # Signed
        for ii in range(135, 143):
            params = get_j2k_parameters(base + bytes([ii]))
            assert ii - 127 == params['precision']
            assert params['is_signed']

        # Unsigned
        for ii in range(7, 17):
            params = get_j2k_parameters(base + bytes([ii]))
            assert ii + 1 == params['precision']
            assert not params['is_signed']
Beispiel #2
0
 def test_short_bytestream(self):
     """Test result when no SIZ box present"""
     assert {} == get_j2k_parameters(b'')
     assert {} == get_j2k_parameters(b'\xff\x4f\xff\x51' + b'\x00' * 20)
Beispiel #3
0
 def test_no_siz(self):
     """Test result when no SIZ box present"""
     base = b'\xff\x4f\xff\x52' + b'\x00' * 38
     assert {} == get_j2k_parameters(base + b'\x8F')
Beispiel #4
0
 def test_not_j2k(self):
     """Test result when no JPEG2K SOF marker present"""
     base = b'\xff\x4e\xff\x51' + b'\x00' * 38
     assert {} == get_j2k_parameters(base + b'\x8F')