diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-08-19 06:29:23 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-08-19 06:29:23 +0000 |
commit | bd7248d1062b7423cd1d47d0255c23683f420cfc (patch) | |
tree | d690a05759983deb4010b2580dcb59d4c48e29b7 /apps/plugins/lib/gray_core.c | |
parent | 46ae870feb2e213b1548753ac54dbc921d38cdf1 (diff) | |
download | rockbox-bd7248d1062b7423cd1d47d0255c23683f420cfc.tar.gz rockbox-bd7248d1062b7423cd1d47d0255c23683f420cfc.zip |
* 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
Diffstat (limited to 'apps/plugins/lib/gray_core.c')
-rw-r--r-- | apps/plugins/lib/gray_core.c | 17 |
1 files changed, 8 insertions, 9 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, | |||
403 | #ifdef SIMULATOR | 403 | #ifdef SIMULATOR |
404 | if (!buffered) | 404 | if (!buffered) |
405 | { | 405 | { |
406 | long orig_size = depth * plane_size + (depth + 1) * sizeof(long); | 406 | long orig_size = MULU16(depth, plane_size) + (depth + 1) * sizeof(long); |
407 | 407 | ||
408 | plane_size = MULU16(width, height); | 408 | plane_size = MULU16(width, height); |
409 | if (plane_size > orig_size) | 409 | if (plane_size > orig_size) |
@@ -420,7 +420,7 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
420 | } | 420 | } |
421 | else | 421 | else |
422 | #endif | 422 | #endif |
423 | buftaken += depth * plane_size + (depth + 1) * sizeof(long); | 423 | buftaken += MULU16(depth, plane_size) + (depth + 1) * sizeof(long); |
424 | 424 | ||
425 | _gray_info.x = 0; | 425 | _gray_info.x = 0; |
426 | _gray_info.y = 0; | 426 | _gray_info.y = 0; |
@@ -439,8 +439,8 @@ int gray_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
439 | _gray_info.cur_plane = 0; | 439 | _gray_info.cur_plane = 0; |
440 | _gray_info.plane_size = plane_size; | 440 | _gray_info.plane_size = plane_size; |
441 | _gray_info.plane_data = gbuf; | 441 | _gray_info.plane_data = gbuf; |
442 | _gray_rb->memset(gbuf, 0, depth * plane_size); | 442 | _gray_rb->memset(gbuf, 0, MULU16(depth, plane_size)); |
443 | gbuf += depth * plane_size; | 443 | gbuf += MULU16(depth, plane_size); |
444 | _gray_info.bitpattern = (unsigned long *)gbuf; | 444 | _gray_info.bitpattern = (unsigned long *)gbuf; |
445 | 445 | ||
446 | i = depth - 1; | 446 | i = depth - 1; |
@@ -1072,11 +1072,11 @@ void gray_update_rect(int x, int y, int width, int height) | |||
1072 | 1072 | ||
1073 | #if CONFIG_CPU == SH7034 | 1073 | #if CONFIG_CPU == SH7034 |
1074 | asm volatile ( | 1074 | asm volatile ( |
1075 | "mov.l @%[cbuf], r1 \n" | ||
1076 | "mov.l @%[bbuf], r2 \n" | 1075 | "mov.l @%[bbuf], r2 \n" |
1076 | "mov.l @%[cbuf], r1 \n" | ||
1077 | "mov.l @(4,%[bbuf]), %[chg]\n" | ||
1077 | "xor r1, r2 \n" | 1078 | "xor r1, r2 \n" |
1078 | "mov.l @(4,%[cbuf]), r1 \n" | 1079 | "mov.l @(4,%[cbuf]), r1 \n" |
1079 | "mov.l @(4,%[bbuf]), %[chg]\n" | ||
1080 | "xor r1, %[chg] \n" | 1080 | "xor r1, %[chg] \n" |
1081 | "or r2, %[chg] \n" | 1081 | "or r2, %[chg] \n" |
1082 | : /* outputs */ | 1082 | : /* outputs */ |
@@ -1110,11 +1110,10 @@ void gray_update_rect(int x, int y, int width, int height) | |||
1110 | "cmp/eq r0, r1 \n" /* no change? */ | 1110 | "cmp/eq r0, r1 \n" /* no change? */ |
1111 | "bt .ur_skip \n" /* -> skip */ | 1111 | "bt .ur_skip \n" /* -> skip */ |
1112 | 1112 | ||
1113 | "mov #75, r1 \n" | ||
1114 | "mulu r1, %[rnd] \n" /* multiply by 75 */ | ||
1113 | "shll2 r0 \n" /* pixel value -> pattern offset */ | 1115 | "shll2 r0 \n" /* pixel value -> pattern offset */ |
1114 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ | 1116 | "mov.l @(r0,%[bpat]), r4 \n" /* r4 = bitpattern[byte]; */ |
1115 | |||
1116 | "mov #75, r0 \n" | ||
1117 | "mulu r0, %[rnd] \n" /* multiply by 75 */ | ||
1118 | "sts macl, %[rnd] \n" | 1117 | "sts macl, %[rnd] \n" |
1119 | "add #74, %[rnd] \n" /* add another 74 */ | 1118 | "add #74, %[rnd] \n" /* add another 74 */ |
1120 | /* Since the lower bits are not very random: */ | 1119 | /* Since the lower bits are not very random: */ |