Revert "Fix data abort introduced by ef92ed4a."

This reverts commit 61a096499b.

The original issue was caused by a new structure member which caused
bmp_args::buf to be unaligned for 2-byte reads. Enforcing that alignment
should be the faster fix. Aligning to cache (while at it) should
improve bmp loading times even more.

Change-Id: I58a2caaf08c0ce46e2fb9666de628a30a36ea5f4
This commit is contained in:
Thomas Martitz 2014-01-05 01:14:14 +01:00
parent 61a096499b
commit 042d8bf9eb

View file

@ -175,13 +175,15 @@ enum color_order {
}; };
struct bmp_args { struct bmp_args {
/* needs to be at least 2byte aligned for faster 16bit reads.
* but aligning to cache should be even faster */
unsigned char buf[BM_MAX_WIDTH * 4] CACHEALIGN_AT_LEAST_ATTR(2);
int fd; int fd;
short padded_width; short padded_width;
short read_width; short read_width;
short width; short width;
short depth; short depth;
enum color_order order; enum color_order order;
unsigned char buf[BM_MAX_WIDTH * 4];
struct uint8_rgb *palette; struct uint8_rgb *palette;
#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
defined(HAVE_BMP_SCALING) || defined(PLUGIN) defined(HAVE_BMP_SCALING) || defined(PLUGIN)
@ -276,7 +278,7 @@ static unsigned int read_part_line(struct bmp_args *ba)
break; break;
case 15: case 15:
case 16: case 16:
data = ibuf[0] | (ibuf[1]<<8); data = letoh16(*(uint16_t*)ibuf);
component = (data << 3) & 0xf8; component = (data << 3) & 0xf8;
component |= component >> 5; component |= component >> 5;
buf->blue = component; buf->blue = component;