summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-05 01:14:14 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-05 01:19:44 +0100
commit042d8bf9eb23b4490bab3f13a2e95fc962a42c42 (patch)
tree7e4e7542b21737118bb02a204ab5b8a352cff516
parent61a096499b72f82dd8efc782e30cfeb1a31ef400 (diff)
downloadrockbox-042d8bf9eb23b4490bab3f13a2e95fc962a42c42.tar.gz
rockbox-042d8bf9eb23b4490bab3f13a2e95fc962a42c42.zip
Revert "Fix data abort introduced by ef92ed4a."
This reverts commit 61a096499b72f82dd8efc782e30cfeb1a31ef400. 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
-rw-r--r--apps/recorder/bmp.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 3e7356a500..e4eb588eb3 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -175,13 +175,15 @@ enum color_order {
175}; 175};
176 176
177struct bmp_args { 177struct bmp_args {
178 /* needs to be at least 2byte aligned for faster 16bit reads.
179 * but aligning to cache should be even faster */
180 unsigned char buf[BM_MAX_WIDTH * 4] CACHEALIGN_AT_LEAST_ATTR(2);
178 int fd; 181 int fd;
179 short padded_width; 182 short padded_width;
180 short read_width; 183 short read_width;
181 short width; 184 short width;
182 short depth; 185 short depth;
183 enum color_order order; 186 enum color_order order;
184 unsigned char buf[BM_MAX_WIDTH * 4];
185 struct uint8_rgb *palette; 187 struct uint8_rgb *palette;
186#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ 188#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \
187 defined(HAVE_BMP_SCALING) || defined(PLUGIN) 189 defined(HAVE_BMP_SCALING) || defined(PLUGIN)
@@ -276,7 +278,7 @@ static unsigned int read_part_line(struct bmp_args *ba)
276 break; 278 break;
277 case 15: 279 case 15:
278 case 16: 280 case 16:
279 data = ibuf[0] | (ibuf[1]<<8); 281 data = letoh16(*(uint16_t*)ibuf);
280 component = (data << 3) & 0xf8; 282 component = (data << 3) & 0xf8;
281 component |= component >> 5; 283 component |= component >> 5;
282 buf->blue = component; 284 buf->blue = component;