1
0
Fork 0
forked from len0rd/rockbox

* 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
This commit is contained in:
Jens Arnold 2006-08-19 06:29:23 +00:00
parent 46ae870feb
commit bd7248d106
2 changed files with 10 additions and 12 deletions

View file

@ -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: */

View file

@ -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: */