mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-27 18:36:17 +03:00
Merge pull request #6197 from radarhere/endian
Fixed behaviour change from endian fix
This commit is contained in:
commit
f7ec22f518
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)
|
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():
|
def test_unbound_local():
|
||||||
# prepatch, a malformed jp2 file could cause an UnboundLocalError exception.
|
# prepatch, a malformed jp2 file could cause an UnboundLocalError exception.
|
||||||
with pytest.raises(OSError):
|
with pytest.raises(OSError):
|
||||||
|
|
|
@ -180,11 +180,13 @@ j2ku_gray_i(
|
||||||
case 2:
|
case 2:
|
||||||
for (y = 0; y < h; ++y) {
|
for (y = 0; y < h; ++y) {
|
||||||
const UINT16 *data = (const UINT16 *)&tiledata[2 * y * w];
|
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) {
|
for (x = 0; x < w; ++x) {
|
||||||
UINT16 pixel = j2ku_shift(offset + *data++, shift);
|
UINT16 pixel = j2ku_shift(offset + *data++, shift);
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
pixel = (pixel >> 8) | (pixel << 8);
|
||||||
|
#endif
|
||||||
*row++ = pixel;
|
*row++ = pixel;
|
||||||
*row++ = pixel >> 8;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user