From bd7248d1062b7423cd1d47d0255c23683f420cfc Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 19 Aug 2006 06:29:23 +0000 Subject: * Use fast multiplication macro in some more places. * Better pipelining on SH1. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10652 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/gray_core.c | 17 ++++++++--------- apps/plugins/lib/gray_draw.c | 5 ++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/apps/plugins/lib/gray_core.c b/apps/plugins/lib/gray_core.c index 413b66c65d..2f5f165fbd 100644 --- a/apps/plugins/lib/gray_core.c +++ b/apps/plugins/lib/gray_core.c @@ -403,7 +403,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, #ifdef SIMULATOR if (!buffered) { - long orig_size = depth * plane_size + (depth + 1) * sizeof(long); + long orig_size = MULU16(depth, plane_size) + (depth + 1) * sizeof(long); plane_size = MULU16(width, height); if (plane_size > orig_size) @@ -420,7 +420,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, } else #endif - buftaken += depth * plane_size + (depth + 1) * sizeof(long); + buftaken += MULU16(depth, plane_size) + (depth + 1) * sizeof(long); _gray_info.x = 0; _gray_info.y = 0; @@ -439,8 +439,8 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, _gray_info.cur_plane = 0; _gray_info.plane_size = plane_size; _gray_info.plane_data = gbuf; - _gray_rb->memset(gbuf, 0, depth * plane_size); - gbuf += depth * plane_size; + _gray_rb->memset(gbuf, 0, MULU16(depth, plane_size)); + gbuf += MULU16(depth, plane_size); _gray_info.bitpattern = (unsigned long *)gbuf; i = depth - 1; @@ -1072,11 +1072,11 @@ void gray_update_rect(int x, int y, int width, int height) #if CONFIG_CPU == SH7034 asm volatile ( - "mov.l @%[cbuf], r1 \n" "mov.l @%[bbuf], r2 \n" + "mov.l @%[cbuf], r1 \n" + "mov.l @(4,%[bbuf]), %[chg]\n" "xor r1, r2 \n" "mov.l @(4,%[cbuf]), r1 \n" - "mov.l @(4,%[bbuf]), %[chg]\n" "xor r1, %[chg] \n" "or r2, %[chg] \n" : /* outputs */ @@ -1110,11 +1110,10 @@ void gray_update_rect(int x, int y, int width, int height) "cmp/eq r0, r1 \n" /* no change? */ "bt .ur_skip \n" /* -> skip */ + "mov #75, r1 \n" + "mulu r1, %[rnd] \n" /* multiply by 75 */ "shll2 r0 \n" /* pixel value -> pattern offset */ "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ - - "mov #75, r0 \n" - "mulu r0, %[rnd] \n" /* multiply by 75 */ "sts macl, %[rnd] \n" "add #74, %[rnd] \n" /* add another 74 */ /* Since the lower bits are not very random: */ diff --git a/apps/plugins/lib/gray_draw.c b/apps/plugins/lib/gray_draw.c index bd8ea4f1ce..e501618e8d 100644 --- a/apps/plugins/lib/gray_draw.c +++ b/apps/plugins/lib/gray_draw.c @@ -1303,14 +1303,13 @@ static void _writearray(unsigned char *address, const unsigned char *src, "bf .wa_skip \n" /* skip this pixel */ "mov.b @%[src], r0 \n" /* load src byte */ + "mov #75, r1 \n" "extu.b r0, r0 \n" /* extend unsigned */ "mov.b @(r0,%[trns]), r0 \n" /* idxtable into pattern index */ + "mulu r1, %[rnd] \n" /* multiply by 75 */ "extu.b r0, r0 \n" /* extend unsigned */ "shll2 r0 \n" "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ - - "mov #75, r0 \n" - "mulu r0, %[rnd] \n" /* multiply by 75 */ "sts macl, %[rnd] \n" "add #74, %[rnd] \n" /* add another 74 */ /* Since the lower bits are not very random: */ -- cgit