mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Fixed behaviour change from #5901 endian fix
This commit is contained in:
parent
a04d6919e1
commit
950d0ad1d3
BIN
Tests/images/issue_6194.j2k
Normal file
BIN
Tests/images/issue_6194.j2k
Normal file
Binary file not shown.
|
@ -298,6 +298,11 @@ def test_16bit_jp2_roundtrips():
|
|||
assert_image_equal(im, jp2)
|
||||
|
||||
|
||||
def test_issue_6194():
|
||||
with Image.open("Tests/images/issue_6194.j2k") as im:
|
||||
assert im.getpixel((5, 5)) == 31
|
||||
|
||||
|
||||
def test_unbound_local():
|
||||
# prepatch, a malformed jp2 file could cause an UnboundLocalError exception.
|
||||
with pytest.raises(OSError):
|
||||
|
|
|
@ -180,11 +180,13 @@ j2ku_gray_i(
|
|||
case 2:
|
||||
for (y = 0; y < h; ++y) {
|
||||
const UINT16 *data = (const UINT16 *)&tiledata[2 * y * w];
|
||||
UINT8 *row = (UINT8 *)im->image[y0 + y] + x0;
|
||||
UINT16 *row = (UINT16 *)im->image[y0 + y] + x0;
|
||||
for (x = 0; x < w; ++x) {
|
||||
UINT16 pixel = j2ku_shift(offset + *data++, shift);
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
pixel = (pixel >> 8) | (pixel << 8);
|
||||
#endif
|
||||
*row++ = pixel;
|
||||
*row++ = pixel >> 8;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user