From 762b09cdb5b5ee24a38ae7e60cf2c7ff2863041f Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 18 Aug 2017 01:13:50 +0300 Subject: [PATCH] unroll ImagingPackRGB --- libImaging/Pack.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/libImaging/Pack.c b/libImaging/Pack.c index 621936351..b624f1956 100644 --- a/libImaging/Pack.c +++ b/libImaging/Pack.c @@ -227,13 +227,17 @@ packLAL(UINT8* out, const UINT8* in, int pixels) void ImagingPackRGB(UINT8* out, const UINT8* in, int pixels) { - int i; + int i = 0; /* RGB triplets */ - for (i = 0; i < pixels; i++) { - out[0] = in[R]; - out[1] = in[G]; - out[2] = in[B]; - out += 3; in += 4; + for (; i < pixels-1; i++) { + ((UINT32*)out)[0] = ((UINT32*)in)[i]; + out += 3; + } + for (; i < pixels; i++) { + out[0] = in[i*4+R]; + out[1] = in[i*4+G]; + out[2] = in[i*4+B]; + out += 3; } }