diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-03-25 19:43:08 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-03-25 19:43:08 +0000 |
commit | 9a7978aeabadc50c6049c5cd150b572ec9bd9e87 (patch) | |
tree | 2d22815d61277d495957ced0d1b25ceb19adac08 /apps/plugins/lib/grey_core.c | |
parent | 38ed90128439bd7cd20038a69032f1f3eddaca04 (diff) | |
download | rockbox-9a7978aeabadc50c6049c5cd150b572ec9bd9e87.tar.gz rockbox-9a7978aeabadc50c6049c5cd150b572ec9bd9e87.zip |
Cabbiev2 gigabeat background: reduce WPS backdrop filesize by storing it as 24 bit BMP instead of unnecessary 32 bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16802 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/grey_core.c')
-rw-r--r-- | apps/plugins/lib/grey_core.c | 87 |
1 files changed, 78 insertions, 9 deletions
diff --git a/apps/plugins/lib/grey_core.c b/apps/plugins/lib/grey_core.c index caa7af2f25..ad8f306dea 100644 --- a/apps/plugins/lib/grey_core.c +++ b/apps/plugins/lib/grey_core.c | |||
@@ -26,7 +26,8 @@ | |||
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | #include "grey.h" | 27 | #include "grey.h" |
28 | 28 | ||
29 | #if defined(CPU_PP) && defined(HAVE_ADJUSTABLE_CPU_FREQ) | 29 | #if defined(HAVE_ADJUSTABLE_CPU_FREQ) && \ |
30 | (defined(CPU_PP) || (CONFIG_LCD == LCD_TL0350A)) | ||
30 | #define NEED_BOOST | 31 | #define NEED_BOOST |
31 | #endif | 32 | #endif |
32 | 33 | ||
@@ -143,6 +144,42 @@ static const unsigned char lcdlinear[256] = { | |||
143 | 203, 206, 209, 212, 215, 219, 222, 226, | 144 | 203, 206, 209, 212, 215, 219, 222, 226, |
144 | 229, 233, 236, 240, 244, 248, 251, 255 | 145 | 229, 233, 236, 240, 244, 248, 251, 255 |
145 | }; | 146 | }; |
147 | #elif CONFIG_LCD == LCD_TL0350A | ||
148 | /* generic linear curve - not yet measured */ | ||
149 | static const unsigned char lcdlinear[256] = { | ||
150 | 0, 1, 2, 3, 4, 5, 6, 7, | ||
151 | 8, 9, 10, 11, 12, 13, 14, 15, | ||
152 | 16, 17, 18, 19, 20, 21, 22, 23, | ||
153 | 24, 25, 26, 27, 28, 29, 30, 31, | ||
154 | 32, 33, 34, 35, 36, 37, 38, 39, | ||
155 | 40, 41, 42, 43, 44, 45, 46, 47, | ||
156 | 48, 49, 50, 51, 52, 53, 54, 55, | ||
157 | 56, 57, 58, 59, 60, 61, 62, 63, | ||
158 | 64, 65, 66, 67, 68, 69, 70, 71, | ||
159 | 72, 73, 74, 75, 76, 77, 78, 79, | ||
160 | 80, 81, 82, 83, 84, 85, 86, 87, | ||
161 | 88, 89, 90, 91, 92, 93, 94, 95, | ||
162 | 96, 97, 98, 99, 100, 101, 102, 103, | ||
163 | 104, 105, 106, 107, 108, 109, 110, 111, | ||
164 | 112, 113, 114, 115, 116, 117, 118, 119, | ||
165 | 120, 121, 122, 123, 124, 125, 126, 127, | ||
166 | 128, 129, 130, 131, 132, 133, 134, 135, | ||
167 | 136, 137, 138, 139, 140, 141, 142, 143, | ||
168 | 144, 145, 146, 147, 148, 149, 150, 151, | ||
169 | 152, 153, 154, 155, 156, 157, 158, 159, | ||
170 | 160, 161, 162, 163, 164, 165, 166, 167, | ||
171 | 168, 169, 170, 171, 172, 173, 174, 175, | ||
172 | 176, 177, 178, 179, 180, 181, 182, 183, | ||
173 | 184, 185, 186, 187, 188, 189, 190, 191, | ||
174 | 192, 193, 194, 195, 196, 197, 198, 199, | ||
175 | 200, 201, 202, 203, 204, 205, 206, 207, | ||
176 | 208, 209, 210, 211, 212, 213, 214, 215, | ||
177 | 216, 217, 218, 219, 220, 221, 222, 223, | ||
178 | 224, 225, 226, 227, 228, 229, 230, 231, | ||
179 | 232, 233, 234, 235, 236, 237, 238, 239, | ||
180 | 240, 241, 242, 243, 244, 245, 246, 247, | ||
181 | 248, 249, 250, 251, 252, 253, 254, 255 | ||
182 | }; | ||
146 | #endif | 183 | #endif |
147 | #else /* SIMULATOR */ | 184 | #else /* SIMULATOR */ |
148 | /* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */ | 185 | /* undo a (generic) PC display gamma of 2.0 to simulate target behaviour */ |
@@ -225,7 +262,7 @@ static unsigned long _grey_get_pixel(int x, int y) | |||
225 | int yg = y - _grey_info.y; | 262 | int yg = y - _grey_info.y; |
226 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | 263 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING |
227 | int idx = _grey_info.width * yg + xg; | 264 | int idx = _grey_info.width * yg + xg; |
228 | #else | 265 | #else /* vertical packing or vertical interleaved */ |
229 | int idx = _grey_info.width * (yg & ~_GREY_BMASK) | 266 | int idx = _grey_info.width * (yg & ~_GREY_BMASK) |
230 | + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK); | 267 | + (xg << _GREY_BSHIFT) + (~yg & _GREY_BMASK); |
231 | #endif | 268 | #endif |
@@ -243,7 +280,7 @@ static void _timer_isr(void) | |||
243 | _grey_info.bx, _grey_info.y, | 280 | _grey_info.bx, _grey_info.y, |
244 | _grey_info.bwidth, _grey_info.height, | 281 | _grey_info.bwidth, _grey_info.height, |
245 | _grey_info.width); | 282 | _grey_info.width); |
246 | #else | 283 | #else /* vertical packing or vertical interleaved */ |
247 | _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases, | 284 | _grey_info.rb->lcd_blit_grey_phase(_grey_info.values, _grey_info.phases, |
248 | _grey_info.x, _grey_info.by, | 285 | _grey_info.x, _grey_info.by, |
249 | _grey_info.width, _grey_info.bheight, | 286 | _grey_info.width, _grey_info.bheight, |
@@ -355,8 +392,8 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
355 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | 392 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING |
356 | bdim = (width + 7) >> 3; | 393 | bdim = (width + 7) >> 3; |
357 | width = bdim << 3; | 394 | width = bdim << 3; |
358 | #else /* vertical packing */ | 395 | #else /* vertical packing or vertical interleaved */ |
359 | #if LCD_DEPTH == 1 | 396 | #if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) |
360 | bdim = (height + 7) >> 3; | 397 | bdim = (height + 7) >> 3; |
361 | height = bdim << 3; | 398 | height = bdim << 3; |
362 | #elif LCD_DEPTH == 2 | 399 | #elif LCD_DEPTH == 2 |
@@ -408,7 +445,7 @@ bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, | |||
408 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING | 445 | #if LCD_PIXELFORMAT == HORIZONTAL_PACKING |
409 | _grey_info.bx = 0; | 446 | _grey_info.bx = 0; |
410 | _grey_info.bwidth = bdim; | 447 | _grey_info.bwidth = bdim; |
411 | #else | 448 | #else /* vertical packing or vertical interleaved */ |
412 | _grey_info.by = 0; | 449 | _grey_info.by = 0; |
413 | _grey_info.bheight = bdim; | 450 | _grey_info.bheight = bdim; |
414 | #endif | 451 | #endif |
@@ -491,6 +528,9 @@ void grey_show(bool enable) | |||
491 | _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); | 528 | _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); |
492 | #elif CONFIG_LCD == LCD_MROBE100 | 529 | #elif CONFIG_LCD == LCD_MROBE100 |
493 | _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */ | 530 | _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 83, 1, _timer_isr); /* not calibrated/tested */ |
531 | #elif CONFIG_LCD == LCD_TL0350A | ||
532 | _grey_info.rb->timer_register(1, NULL, TIMER_FREQ / 75, 1, _timer_isr); /* verified */ | ||
533 | /* This is half of the actual frame frequency, but 150Hz is too much */ | ||
494 | #endif /* CONFIG_LCD */ | 534 | #endif /* CONFIG_LCD */ |
495 | #endif /* !SIMULATOR */ | 535 | #endif /* !SIMULATOR */ |
496 | _grey_info.rb->screen_dump_set_hook(grey_screendump_hook); | 536 | _grey_info.rb->screen_dump_set_hook(grey_screendump_hook); |
@@ -607,8 +647,11 @@ static void grey_screendump_hook(int fd) | |||
607 | #elif LCD_DEPTH == 2 | 647 | #elif LCD_DEPTH == 2 |
608 | int shift; | 648 | int shift; |
609 | #endif | 649 | #endif |
610 | #endif /* LCD_PIXELFORMAT == VERTICAL_PACKING */ | 650 | #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED |
611 | unsigned char *lcdptr; | 651 | unsigned data; |
652 | int shift; | ||
653 | #endif /* LCD_PIXELFORMAT */ | ||
654 | fb_data *lcdptr; | ||
612 | unsigned char *clut_entry; | 655 | unsigned char *clut_entry; |
613 | unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; | 656 | unsigned char linebuf[MAX(4*BMP_VARCOLORS,BMP_LINESIZE)]; |
614 | 657 | ||
@@ -660,7 +703,7 @@ static void grey_screendump_hook(int fd) | |||
660 | lcdptr++; | 703 | lcdptr++; |
661 | } | 704 | } |
662 | #endif /* LCD_DEPTH */ | 705 | #endif /* LCD_DEPTH */ |
663 | #else /* LCD_PIXELFORMAT == VERTICAL_PACKING */ | 706 | #elif LCD_PIXELFORMAT == VERTICAL_PACKING |
664 | #if LCD_DEPTH == 1 | 707 | #if LCD_DEPTH == 1 |
665 | mask = 1 << (y & 7); | 708 | mask = 1 << (y & 7); |
666 | lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); | 709 | lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); |
@@ -708,6 +751,32 @@ static void grey_screendump_hook(int fd) | |||
708 | lcdptr++; | 751 | lcdptr++; |
709 | } | 752 | } |
710 | #endif /* LCD_DEPTH */ | 753 | #endif /* LCD_DEPTH */ |
754 | #elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED | ||
755 | #if LCD_DEPTH == 2 | ||
756 | shift = y & 7; | ||
757 | lcdptr = _grey_info.rb->lcd_framebuffer + _GREY_MULUQ(LCD_WIDTH, y >> 3); | ||
758 | |||
759 | for (x = 0; x < LCD_WIDTH; x++) | ||
760 | { | ||
761 | gx = x - _grey_info.x; | ||
762 | |||
763 | if (((unsigned)gy < (unsigned)_grey_info.height) | ||
764 | && ((unsigned)gx < (unsigned)_grey_info.width)) | ||
765 | { | ||
766 | linebuf[x] = BMP_FIXEDCOLORS | ||
767 | + _grey_info.values[_GREY_MULUQ(_grey_info.width, | ||
768 | gy & ~_GREY_BMASK) | ||
769 | + (gx << _GREY_BSHIFT) | ||
770 | + (~gy & _GREY_BMASK)]; | ||
771 | } | ||
772 | else | ||
773 | { | ||
774 | data = (*lcdptr >> shift) & 0x0101; | ||
775 | linebuf[x] = ((data >> 7) | data) & 3; | ||
776 | } | ||
777 | lcdptr++; | ||
778 | } | ||
779 | #endif /* LCD_DEPTH */ | ||
711 | #endif /* LCD_PIXELFORMAT */ | 780 | #endif /* LCD_PIXELFORMAT */ |
712 | 781 | ||
713 | _grey_info.rb->write(fd, linebuf, BMP_LINESIZE); | 782 | _grey_info.rb->write(fd, linebuf, BMP_LINESIZE); |