diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-01-04 23:42:38 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-01-04 23:42:38 +0000 |
commit | feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240 (patch) | |
tree | d854c9a6fbbb3263537071fb02df349fdfa62361 /apps/plugins/jpeg.c | |
parent | d3586837fa9221a7ef104550b4c0aadc1a6ea77c (diff) | |
download | rockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.tar.gz rockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.zip |
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
Diffstat (limited to 'apps/plugins/jpeg.c')
-rw-r--r-- | apps/plugins/jpeg.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index 9e11ca431b..adb76cdd3c 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -11,8 +11,7 @@ | |||
11 | * (This is a real mess if it has to be coded in one single C file) | 11 | * (This is a real mess if it has to be coded in one single C file) |
12 | * | 12 | * |
13 | * File scrolling addition (C) 2005 Alexander Spyridakis | 13 | * File scrolling addition (C) 2005 Alexander Spyridakis |
14 | * Copyright (C) 2004 J�g Hohensohn aka [IDC]Dragon | 14 | * Copyright (C) 2004 Jörg Hohensohn aka [IDC]Dragon |
15 | * Grayscale framework (C) 2004 Jens Arnold | ||
16 | * Heavily borrowed from the IJG implementation (C) Thomas G. Lane | 15 | * Heavily borrowed from the IJG implementation (C) Thomas G. Lane |
17 | * Small & fast downscaling IDCT (C) 2002 by Guido Vollbeding JPEGclub.org | 16 | * Small & fast downscaling IDCT (C) 2002 by Guido Vollbeding JPEGclub.org |
18 | * | 17 | * |
@@ -30,7 +29,7 @@ | |||
30 | #include "helper.h" | 29 | #include "helper.h" |
31 | 30 | ||
32 | #ifdef HAVE_LCD_BITMAP | 31 | #ifdef HAVE_LCD_BITMAP |
33 | #include "gray.h" | 32 | #include "grey.h" |
34 | #include "xlcd.h" | 33 | #include "xlcd.h" |
35 | 34 | ||
36 | #ifdef HAVE_LCD_COLOR | 35 | #ifdef HAVE_LCD_COLOR |
@@ -185,9 +184,9 @@ PLUGIN_HEADER | |||
185 | /* different graphics libraries */ | 184 | /* different graphics libraries */ |
186 | #if LCD_DEPTH < 8 | 185 | #if LCD_DEPTH < 8 |
187 | #define USEGSLIB | 186 | #define USEGSLIB |
188 | #define MYLCD(fn) gray_ub_ ## fn | 187 | #define MYLCD(fn) grey_ub_ ## fn |
189 | #define MYLCD_UPDATE() | 188 | #define MYLCD_UPDATE() |
190 | #define MYXLCD(fn) gray_ub_ ## fn | 189 | #define MYXLCD(fn) grey_ub_ ## fn |
191 | #else | 190 | #else |
192 | #define MYLCD(fn) rb->lcd_ ## fn | 191 | #define MYLCD(fn) rb->lcd_ ## fn |
193 | #define MYLCD_UPDATE() rb->lcd_update(); | 192 | #define MYLCD_UPDATE() rb->lcd_update(); |
@@ -2409,7 +2408,7 @@ void cleanup(void *parameter) | |||
2409 | { | 2408 | { |
2410 | (void)parameter; | 2409 | (void)parameter; |
2411 | #ifdef USEGSLIB | 2410 | #ifdef USEGSLIB |
2412 | gray_show(false); | 2411 | grey_show(false); |
2413 | #endif | 2412 | #endif |
2414 | } | 2413 | } |
2415 | 2414 | ||
@@ -2791,13 +2790,13 @@ int scroll_bmp(struct t_disp* pdisp) | |||
2791 | #endif | 2790 | #endif |
2792 | case JPEG_MENU: | 2791 | case JPEG_MENU: |
2793 | #ifdef USEGSLIB | 2792 | #ifdef USEGSLIB |
2794 | gray_show(false); /* switch off grayscale overlay */ | 2793 | grey_show(false); /* switch off greyscale overlay */ |
2795 | #endif | 2794 | #endif |
2796 | if (show_menu() == 1) | 2795 | if (show_menu() == 1) |
2797 | return PLUGIN_OK; | 2796 | return PLUGIN_OK; |
2798 | 2797 | ||
2799 | #ifdef USEGSLIB | 2798 | #ifdef USEGSLIB |
2800 | gray_show(true); /* switch on grayscale overlay */ | 2799 | grey_show(true); /* switch on greyscale overlay */ |
2801 | #else | 2800 | #else |
2802 | yuv_bitmap_part( | 2801 | yuv_bitmap_part( |
2803 | pdisp->bitmap, pdisp->csub_x, pdisp->csub_y, | 2802 | pdisp->bitmap, pdisp->csub_x, pdisp->csub_y, |
@@ -3222,7 +3221,7 @@ int load_and_show(char* filename) | |||
3222 | MYLCD_UPDATE(); | 3221 | MYLCD_UPDATE(); |
3223 | 3222 | ||
3224 | #ifdef USEGSLIB | 3223 | #ifdef USEGSLIB |
3225 | gray_show(true); /* switch on grayscale overlay */ | 3224 | grey_show(true); /* switch on greyscale overlay */ |
3226 | #endif | 3225 | #endif |
3227 | 3226 | ||
3228 | /* drawing is now finished, play around with scrolling | 3227 | /* drawing is now finished, play around with scrolling |
@@ -3260,7 +3259,7 @@ int load_and_show(char* filename) | |||
3260 | } | 3259 | } |
3261 | 3260 | ||
3262 | #ifdef USEGSLIB | 3261 | #ifdef USEGSLIB |
3263 | gray_show(false); /* switch off overlay */ | 3262 | grey_show(false); /* switch off overlay */ |
3264 | #endif | 3263 | #endif |
3265 | rb->lcd_clear_display(); | 3264 | rb->lcd_clear_display(); |
3266 | } | 3265 | } |
@@ -3280,8 +3279,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3280 | 3279 | ||
3281 | int condition; | 3280 | int condition; |
3282 | #ifdef USEGSLIB | 3281 | #ifdef USEGSLIB |
3283 | int grayscales; | 3282 | long greysize; /* helper */ |
3284 | long graysize; /* helper */ | ||
3285 | #endif | 3283 | #endif |
3286 | #if LCD_DEPTH > 1 | 3284 | #if LCD_DEPTH > 1 |
3287 | old_backdrop = rb->lcd_get_backdrop(); | 3285 | old_backdrop = rb->lcd_get_backdrop(); |
@@ -3311,16 +3309,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3311 | #endif | 3309 | #endif |
3312 | 3310 | ||
3313 | #ifdef USEGSLIB | 3311 | #ifdef USEGSLIB |
3314 | /* initialize the grayscale buffer: 32 bitplanes for 33 shades of gray. */ | 3312 | if (!grey_init(rb, buf, buf_size, false, LCD_WIDTH, LCD_HEIGHT, &greysize)) |
3315 | grayscales = gray_init(rb, buf, buf_size, false, LCD_WIDTH, LCD_HEIGHT, | ||
3316 | 32, 2<<8, &graysize) + 1; | ||
3317 | buf += graysize; | ||
3318 | buf_size -= graysize; | ||
3319 | if (grayscales < 33 || buf_size <= 0) | ||
3320 | { | 3313 | { |
3321 | rb->splash(HZ, "gray buf error"); | 3314 | rb->splash(HZ, "grey buf error"); |
3322 | return PLUGIN_ERROR; | 3315 | return PLUGIN_ERROR; |
3323 | } | 3316 | } |
3317 | buf += greysize; | ||
3318 | buf_size -= greysize; | ||
3324 | #else | 3319 | #else |
3325 | xlcd_init(rb); | 3320 | xlcd_init(rb); |
3326 | #endif | 3321 | #endif |
@@ -3364,7 +3359,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | |||
3364 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ | 3359 | backlight_use_settings(rb); /* backlight control in lib/helper.c */ |
3365 | 3360 | ||
3366 | #ifdef USEGSLIB | 3361 | #ifdef USEGSLIB |
3367 | gray_release(); /* deinitialize */ | 3362 | grey_release(); /* deinitialize */ |
3368 | #endif | 3363 | #endif |
3369 | 3364 | ||
3370 | return condition; | 3365 | return condition; |