From feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 4 Jan 2008 23:42:38 +0000 Subject: All-new greyscale library, replacing the old one. Features: (1) Drawing/updating is faster than the old grayscale lib at full depth. (2) Always 129 shades instead of 2..33 shades. (3) No graininess caused by frequent updates (mpegplayer, doom, ...). (4) Needs less memory than the old grayscale lib at full depth. * The tradeoff is slightly higher CPU load in the ISR (frames are calculated 'live') and an extra function in the core. * Ported all plugins which used the graylib to use the new one. * Some slight optimisations for archos and H1x0 LCD update. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15998 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/mpegplayer/mpegplayer.c | 2 +- apps/plugins/mpegplayer/mpegplayer.h | 12 ++++++------ apps/plugins/mpegplayer/stream_mgr.c | 29 +++++++++++++---------------- apps/plugins/mpegplayer/video_out_rockbox.c | 2 +- 4 files changed, 21 insertions(+), 24 deletions(-) (limited to 'apps/plugins/mpegplayer') diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 8ea4ee3abd..48bb73065c 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -868,7 +868,7 @@ static void wvs_refresh(int hint) vo_unlock(); #else - gray_deferred_lcd_update(); + grey_deferred_lcd_update(); #endif } diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h index ae1234d39d..4ebf321fce 100644 --- a/apps/plugins/mpegplayer/mpegplayer.h +++ b/apps/plugins/mpegplayer/mpegplayer.h @@ -85,12 +85,12 @@ enum mpeg_malloc_reason_t #define GRAY_VIDEO_FLUSH_ICACHE() #define GRAY_VIDEO_INVALIDATE_ICACHE() #else -#include "gray.h" -#define DRAW_BLACK GRAY_BLACK -#define DRAW_DARKGRAY GRAY_DARKGRAY -#define DRAW_LIGHTGRAY GRAY_LIGHTGRAY -#define DRAW_WHITE GRAY_WHITE -#define lcd_(fn) gray_##fn +#include "grey.h" +#define DRAW_BLACK GREY_BLACK +#define DRAW_DARKGRAY GREY_DARKGRAY +#define DRAW_LIGHTGRAY GREY_LIGHTGRAY +#define DRAW_WHITE GREY_WHITE +#define lcd_(fn) grey_##fn #define GRAY_FLUSH_ICACHE() \ IF_COP(flush_icache()) diff --git a/apps/plugins/mpegplayer/stream_mgr.c b/apps/plugins/mpegplayer/stream_mgr.c index 8d2e42f62b..c473db3ce3 100644 --- a/apps/plugins/mpegplayer/stream_mgr.c +++ b/apps/plugins/mpegplayer/stream_mgr.c @@ -20,7 +20,7 @@ ****************************************************************************/ #include "plugin.h" #include "mpegplayer.h" -#include "gray.h" +#include "grey.h" #include "mpeg_settings.h" static struct event_queue stream_mgr_queue NOCACHEBSS_ATTR; @@ -712,7 +712,7 @@ bool stream_show_vo(bool show) GRAY_VIDEO_INVALIDATE_ICACHE(); GRAY_INVALIDATE_ICACHE(); - gray_show(show); + grey_show(show); GRAY_FLUSH_ICACHE(); #endif @@ -801,11 +801,10 @@ bool stream_set_gray_rect(const struct vo_rect *rc) vo_lock(); - gray_init(rb, stream_mgr.graymem, stream_mgr.graysize, - false, rc_gray.r - rc_gray.l, rc_gray.b - rc_gray.t, - 32, 2<<8, NULL); + grey_init(rb, stream_mgr.graymem, stream_mgr.graysize, false, + rc_gray.r - rc_gray.l, rc_gray.b - rc_gray.t, NULL); - gray_set_position(rc_gray.l, rc_gray.t); + grey_set_position(rc_gray.l, rc_gray.t); vo_unlock(); @@ -818,7 +817,7 @@ bool stream_set_gray_rect(const struct vo_rect *rc) if (vis) { - gray_show(true); + grey_show(true); parser_send_video_msg(VIDEO_DISPLAY_SHOW, true); } } @@ -836,7 +835,7 @@ void stream_gray_show(bool show) GRAY_VIDEO_INVALIDATE_ICACHE(); GRAY_INVALIDATE_ICACHE(); - gray_show(show); + grey_show(show); GRAY_FLUSH_ICACHE(); @@ -1095,16 +1094,14 @@ int stream_init(void) /* Initialize non-allocator blocks first */ #ifndef HAVE_LCD_COLOR - int grayscales; + bool success; /* This can run on another processor - align data */ memsize = CACHEALIGN_BUFFER(&mem, memsize); stream_mgr.graymem = mem; - /* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */ - grayscales = gray_init(rb, mem, memsize, false, - LCD_WIDTH, LCD_HEIGHT, - 32, 2<<8, &stream_mgr.graysize) + 1; + success = grey_init(rb, mem, memsize, false, LCD_WIDTH, + LCD_HEIGHT, &stream_mgr.graysize); /* This can run on another processor - align size */ stream_mgr.graysize = CACHEALIGN_UP(stream_mgr.graysize); @@ -1112,9 +1109,9 @@ int stream_init(void) mem += stream_mgr.graysize; memsize -= stream_mgr.graysize; - if (grayscales < 33 || (ssize_t)memsize <= 0) + if (!success || (ssize_t)memsize <= 0) { - rb->splash(HZ, "graylib init failed!"); + rb->splash(HZ, "greylib init failed!"); stream_mgr.graymem = NULL; return STREAM_ERROR; } @@ -1188,6 +1185,6 @@ void stream_exit(void) #ifndef HAVE_LCD_COLOR if (stream_mgr.graymem != NULL) - gray_release(); + grey_release(); #endif } diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index 39d0e82c3b..12431bef4a 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c @@ -107,7 +107,7 @@ static inline void yuv_blit(uint8_t * const * buf, int src_x, int src_y, #ifdef HAVE_LCD_COLOR rb->lcd_yuv_blit(buf, src_x, src_y, stride, x, y , width, height); #else - gray_ub_gray_bitmap_part(buf[0], src_x, src_y, stride, x, y, width, height); + grey_ub_gray_bitmap_part(buf[0], src_x, src_y, stride, x, y, width, height); #endif video_unlock(); -- cgit v1.2.3