diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-03-05 22:14:13 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-03-05 22:14:13 +0000 |
commit | 37d43f49f4e26b7df912adcb8894e52544533bef (patch) | |
tree | a1f8484ccfccfcd1a2ef2788e7e2a1edb5b0d377 /apps | |
parent | d6c23b4dd4b887bac02ba88cff6f3b52e87e16ac (diff) | |
download | rockbox-37d43f49f4e26b7df912adcb8894e52544533bef.tar.gz rockbox-37d43f49f4e26b7df912adcb8894e52544533bef.zip |
Greyscale library: Assembler optimised update function for SH1 (Archos recorders, Ondios), giving ~50% speedup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16532 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/lib/grey_draw.c | 5 | ||||
-rw-r--r-- | apps/plugins/lib/grey_sh.S | 135 |
3 files changed, 140 insertions, 2 deletions
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index b638740b0e..6a44c80ffa 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES | |||
@@ -10,6 +10,8 @@ grey_parm.c | |||
10 | grey_scroll.c | 10 | grey_scroll.c |
11 | #ifdef CPU_COLDFIRE | 11 | #ifdef CPU_COLDFIRE |
12 | grey_coldfire.S | 12 | grey_coldfire.S |
13 | #elif CONFIG_CPU == SH7034 | ||
14 | grey_sh.S | ||
13 | #endif | 15 | #endif |
14 | #endif | 16 | #endif |
15 | highscore.c | 17 | highscore.c |
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c index 6df5556ec8..7b24ba4c70 100644 --- a/apps/plugins/lib/grey_draw.c +++ b/apps/plugins/lib/grey_draw.c | |||
@@ -635,8 +635,9 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
635 | + (~yc & _GREY_BMASK); | 635 | + (~yc & _GREY_BMASK); |
636 | #endif /* LCD_PIXELFORMAT */ | 636 | #endif /* LCD_PIXELFORMAT */ |
637 | 637 | ||
638 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) && (LCD_DEPTH == 2) \ | 638 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) && \ |
639 | && defined(CPU_COLDFIRE) | 639 | ((LCD_DEPTH == 2) && defined(CPU_COLDFIRE) \ |
640 | || (LCD_DEPTH == 1) && (CONFIG_CPU == SH7034)) | ||
640 | _grey_line1(width, dst + idx, src, _grey_info.gvalue); | 641 | _grey_line1(width, dst + idx, src, _grey_info.gvalue); |
641 | #else | 642 | #else |
642 | unsigned char *dst_row = dst + idx; | 643 | unsigned char *dst_row = dst + idx; |
diff --git a/apps/plugins/lib/grey_sh.S b/apps/plugins/lib/grey_sh.S new file mode 100644 index 0000000000..c59c09eaf2 --- /dev/null +++ b/apps/plugins/lib/grey_sh.S | |||
@@ -0,0 +1,135 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * New greyscale framework | ||
11 | * SH1 assembler routines | ||
12 | * | ||
13 | * This is a generic framework to display 129 shades of grey on low-depth | ||
14 | * bitmap LCDs (Archos b&w, Iriver & Ipod 4-grey) within plugins. | ||
15 | * | ||
16 | * Copyright (C) 2008 Jens Arnold | ||
17 | * | ||
18 | * All files in this archive are subject to the GNU General Public License. | ||
19 | * See the file COPYING in the source tree root for full license agreement. | ||
20 | * | ||
21 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
22 | * KIND, either express or implied. | ||
23 | * | ||
24 | ****************************************************************************/ | ||
25 | |||
26 | #include "config.h" | ||
27 | /* Plugins should not normally do this, but we need to check a macro, and | ||
28 | * plugin.h would confuse the assembler. */ | ||
29 | |||
30 | .text | ||
31 | .global __grey_line1 | ||
32 | .type __grey_line1, @function | ||
33 | |||
34 | #if (LCD_PIXELFORMAT == VERTICAL_PACKING) && (LCD_DEPTH == 1) | ||
35 | |||
36 | /**************************************************************************** | ||
37 | * void _grey_line1(int width, r4 | ||
38 | * unsigned char *dst, r5 | ||
39 | * const unsigned char *src, r6 | ||
40 | * const unsigned char *lut); r7 | ||
41 | */ | ||
42 | |||
43 | __grey_line1: | ||
44 | mov #1, r0 | ||
45 | tst r0, r6 | ||
46 | bt .p1_h_end | ||
47 | |||
48 | mov.b @r6+, r0 | ||
49 | extu.b r0, r0 | ||
50 | mov.b @(r0, r7), r0 | ||
51 | add #-1, r4 | ||
52 | mov.b r0, @r5 | ||
53 | add #8, r5 | ||
54 | .p1_h_end: | ||
55 | |||
56 | mov #2, r0 | ||
57 | cmp/hs r0, r4 | ||
58 | bf .p2_t_end | ||
59 | tst r0, r6 | ||
60 | bt .p2_h_end | ||
61 | |||
62 | mov.w @r6+, r1 | ||
63 | extu.b r1, r0 | ||
64 | mov.b @(r0, r7), r0 | ||
65 | shlr8 r1 | ||
66 | mov.b r0, @(8, r5) | ||
67 | extu.b r1, r0 | ||
68 | mov.b @(r0, r7), r0 | ||
69 | add #-2, r4 | ||
70 | mov.b r0, @r5 | ||
71 | add #16, r5 | ||
72 | .p2_h_end: | ||
73 | |||
74 | add #-4, r4 | ||
75 | cmp/pz r4 | ||
76 | bf .p4_end | ||
77 | |||
78 | add r6, r4 | ||
79 | |||
80 | .p4_loop: | ||
81 | mov.l @r6+, r1 | ||
82 | swap.w r1, r2 | ||
83 | extu.b r2, r0 | ||
84 | mov.b @(r0, r7), r0 | ||
85 | shlr8 r2 | ||
86 | mov.b r0, @(8, r5) | ||
87 | extu.b r2, r0 | ||
88 | mov.b @(r0, r7), r2 | ||
89 | extu.b r1, r0 | ||
90 | mov.b r2, @r5 | ||
91 | add #16, r5 | ||
92 | mov.b @(r0, r7), r0 | ||
93 | shlr8 r1 | ||
94 | mov.b r0, @(8, r5) | ||
95 | extu.b r1, r0 | ||
96 | mov.b @(r0, r7), r0 | ||
97 | cmp/hs r6, r4 | ||
98 | mov.b r0, @r5 | ||
99 | add #16, r5 | ||
100 | bt .p4_loop | ||
101 | |||
102 | sub r6, r4 | ||
103 | |||
104 | .p4_end: | ||
105 | mov #2, r0 | ||
106 | tst r0, r4 | ||
107 | bt .p2_t_end | ||
108 | |||
109 | mov.w @r6+, r1 | ||
110 | extu.b r1, r0 | ||
111 | mov.b @(r0, r7), r0 | ||
112 | shlr8 r1 | ||
113 | mov.b r0, @(8, r5) | ||
114 | extu.b r1, r0 | ||
115 | mov.b @(r0, r7), r0 | ||
116 | mov.b r0, @r5 | ||
117 | add #16, r5 | ||
118 | .p2_t_end: | ||
119 | |||
120 | mov #1, r0 | ||
121 | tst r0, r4 | ||
122 | bt .p1_t_end | ||
123 | |||
124 | mov.b @r6+, r0 | ||
125 | extu.b r0, r0 | ||
126 | mov.b @(r0, r7), r0 | ||
127 | rts | ||
128 | mov.b r0, @r5 | ||
129 | .p1_t_end: | ||
130 | |||
131 | rts | ||
132 | nop | ||
133 | .size _grey_line1, . - _grey_line1 | ||
134 | |||
135 | #endif | ||