Skip to content

Commit

Permalink
Fixed behaviour change from python-pillow#5901 endian fix
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Apr 11, 2022
1 parent 98e8e6d commit 12efedf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libImaging/Jpeg2KDecode.c
Expand Up @@ -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;
Expand Down

0 comments on commit 12efedf

Please sign in to comment.