mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
mb_shuffle big endian
This commit is contained in:
parent
ed15ed9737
commit
fb7702f638
28
src/decode.c
28
src/decode.c
|
@ -303,7 +303,33 @@ shuffle_mb_unavail(UINT8 *dst, const UINT8 *src, int pixels) {
|
|||
|
||||
static void
|
||||
mb_shuffle(UINT8 *dst, const UINT8 *src, Imaging im, ImagingCodecState state) {
|
||||
memcpy(dst, src, state->xsize * im->pixelsize);
|
||||
int size = state->xsize * im->pixelsize;
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
switch (im->depth) {
|
||||
default:
|
||||
abort();
|
||||
return;
|
||||
case 4 * CHAR_BIT: {
|
||||
for (int i = 0; i < size; i += 4) {
|
||||
dst[i] = src[i + 3];
|
||||
dst[i + 1] = src[i + 2];
|
||||
dst[i + 2] = src[i + 1];
|
||||
dst[i + 3] = src[i];
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 2 * CHAR_BIT: {
|
||||
for (int i = 0; i < size; i += 2) {
|
||||
dst[i] = src[i + 1];
|
||||
dst[i + 1] = src[i];
|
||||
}
|
||||
return;
|
||||
case CHAR_BIT:
|
||||
// fallthrough
|
||||
}
|
||||
}
|
||||
#endif
|
||||
memcpy(dst, src, size);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Reference in New Issue
Block a user