From 20f76d61ae58bd47b647d79e40beebbbe747e480 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Mon, 4 May 2009 15:46:41 +0000 Subject: Make JPEG and BMP scaler optional with HAVE_JPEG and HAVE_BMP_SCALING, both defined for all targets that have HAVE_ALBUMART. Disable JPEG in PictureFlow and pluginlib album art search with 32KiB plugin buffer until PictureFlow gets overlay support. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20851 a1c6a512-1295-4272-9138-f99709370657 --- apps/SOURCES | 8 +++- apps/buffering.c | 4 +- apps/plugin.c | 2 +- apps/plugin.h | 2 +- apps/plugins/lib/SOURCES | 12 +++-- apps/plugins/lib/feature_wrappers.h | 17 ++++--- apps/plugins/lib/pluginlib_bmp.c | 12 +++-- apps/plugins/lib/read_image.c | 4 -- apps/plugins/pictureflow.c | 5 +++ apps/recorder/albumart.c | 22 ++++----- apps/recorder/bmp.c | 86 ++++++++++++++++++++---------------- apps/recorder/resize.c | 19 ++++++-- apps/recorder/resize.h | 6 +++ firmware/export/config-c200.h | 6 +++ firmware/export/config-c200v2.h | 6 +++ firmware/export/config-cowond2.h | 6 +++ firmware/export/config-e200.h | 6 +++ firmware/export/config-e200v2.h | 6 +++ firmware/export/config-fuze.h | 6 +++ firmware/export/config-gigabeat-s.h | 6 +++ firmware/export/config-gigabeat.h | 6 +++ firmware/export/config-h10.h | 6 +++ firmware/export/config-h100.h | 6 +++ firmware/export/config-h10_5gb.h | 6 +++ firmware/export/config-h120.h | 6 +++ firmware/export/config-h300.h | 6 +++ firmware/export/config-hdd1630.h | 6 +++ firmware/export/config-iaudio7.h | 6 +++ firmware/export/config-iaudiom3.h | 6 +++ firmware/export/config-iaudiom5.h | 6 +++ firmware/export/config-iaudiox5.h | 6 +++ firmware/export/config-ipod1g2g.h | 6 +++ firmware/export/config-ipod3g.h | 6 +++ firmware/export/config-ipod4g.h | 6 +++ firmware/export/config-ipodcolor.h | 6 +++ firmware/export/config-ipodmini.h | 6 +++ firmware/export/config-ipodmini2g.h | 6 +++ firmware/export/config-ipodnano.h | 6 +++ firmware/export/config-ipodvideo.h | 6 +++ firmware/export/config-lyre_proto1.h | 6 +++ firmware/export/config-meizu-m3.h | 6 +++ firmware/export/config-meizu-m6sl.h | 6 +++ firmware/export/config-meizu-m6sp.h | 6 +++ firmware/export/config-mrobe500.h | 6 +++ firmware/export/config-ondavx747.h | 6 +++ firmware/export/config-sa9200.h | 6 +++ 46 files changed, 318 insertions(+), 79 deletions(-) diff --git a/apps/SOURCES b/apps/SOURCES index 13ca913a39..62bb78a473 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -88,8 +88,6 @@ gui/viewport.c #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) gui/backdrop.c -recorder/resize.c -recorder/jpeg_load.c #endif #ifdef HAVE_LCD_CHARCELLS @@ -101,6 +99,12 @@ recorder/bmp.c recorder/icons.c recorder/keyboard.c recorder/peakmeter.c +#if defined(HAVE_ALBUMART) || defined(HAVE_JPEG) +recorder/resize.c +#endif +#ifdef HAVE_JPEG +recorder/jpeg_load.c +#endif #ifdef HAVE_ALBUMART recorder/albumart.c #endif diff --git a/apps/buffering.c b/apps/buffering.c index 66bd22f12d..3bcd790c35 100644 --- a/apps/buffering.c +++ b/apps/buffering.c @@ -834,7 +834,6 @@ static bool fill_buffer(void) static int load_image(int fd, const char *path) { int rc; - int pathlen = strlen(path); struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx]; /* FIXME: alignment may be needed for the data buffer. */ bmp->data = &buffer[buf_widx + sizeof(struct bitmap)]; @@ -848,10 +847,13 @@ static int load_image(int fd, const char *path) get_albumart_size(bmp); +#ifdef HAVE_JPEG + int pathlen = strlen(path); if (strcmp(path + pathlen - 4, ".bmp")) rc = read_jpeg_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); else +#endif rc = read_bmp_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); return rc + (rc > 0 ? sizeof(struct bitmap) : 0); diff --git a/apps/plugin.c b/apps/plugin.c index 33a6194c53..2d996a404e 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -644,7 +644,7 @@ static const struct plugin_api rockbox_api = { #endif #endif #ifdef HAVE_LCD_BITMAP -#if LCD_DEPTH > 1 +#ifdef HAVE_JPEG read_jpeg_file, read_jpeg_fd, #endif diff --git a/apps/plugin.h b/apps/plugin.h index 19eb962588..72d71b6e93 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -805,7 +805,7 @@ struct plugin_api { #endif #ifdef HAVE_LCD_BITMAP -#if LCD_DEPTH > 1 +#ifdef HAVE_JPEG int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize, int format, const struct custom_format *cformat); int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize, diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index dfdd569843..dc4d41c35c 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -5,15 +5,13 @@ fixedpoint.c playback_control.c rgb_hsv.c buflib.c -#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) -/* - The scaler is not provided in core on mono targets, but is built in - pluginlib for use with greylib overlay output -*/ -#if LCD_DEPTH == 1 +#if !defined(HAVE_BMP_SCALING) || !defined(HAVE_JPEG) pluginlib_resize.c +#endif +#ifndef HAVE_JPEG pluginlib_jpeg_load.c #endif +#if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) grey_core.c grey_draw.c grey_parm.c @@ -45,7 +43,7 @@ read_image.c #ifdef HAVE_LCD_COLOR bmp_smooth_scale.c #endif -#ifndef HAVE_ALBUMART +#if !defined(HAVE_ALBUMART) || !defined(HAVE_JPEG) pluginlib_albumart.c #endif #endif diff --git a/apps/plugins/lib/feature_wrappers.h b/apps/plugins/lib/feature_wrappers.h index 3f47f23c00..50552fbda4 100644 --- a/apps/plugins/lib/feature_wrappers.h +++ b/apps/plugins/lib/feature_wrappers.h @@ -30,24 +30,27 @@ * but can easily be implement in pluginlib as long as the database is * available. */ -#ifdef HAVE_ALBUMART +#if defined(HAVE_ALBUMART) && defined(HAVE_JPEG) #define search_albumart_files rb->search_albumart_files #endif /* This should only be used when loading scaled bitmaps, or using custom output - * plugins. The pluginlib loader does not support loading bitmaps unscaled in - * native format, so rb->read_bmp_file should always be used directly to load - * such images. + * plugins. A native output plugin for the scaler is available as format_native + * on targets with LCD_DEPTH > 1 */ -#if LCD_DEPTH > 1 +#ifdef HAVE_BMP_SCALING #define scaled_read_bmp_file rb->read_bmp_file #define scaled_read_bmp_fd rb->read_bmp_fd -#define read_jpeg_file rb->read_jpeg_file -#define read_jpeg_fd rb->read_jpeg_fd #else #define scaled_read_bmp_file read_bmp_file #define scaled_read_bmp_fd read_bmp_fd #endif +#ifdef HAVE_JPEG +#define read_jpeg_file rb->read_jpeg_file +#define read_jpeg_fd rb->read_jpeg_fd +#else +#endif + #endif diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c index b9cfc4ded3..110e534be0 100644 --- a/apps/plugins/lib/pluginlib_bmp.c +++ b/apps/plugins/lib/pluginlib_bmp.c @@ -122,10 +122,16 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) } } -#else /* LCD_DEPTH == 1 */ +#endif /* LCD_DEPTH > 1 */ + +#ifndef HAVE_BMP_SCALING #include "wrappers.h" /* import the core bmp loader */ -#include "../../recorder/bmp.c" - +#include "recorder/bmp.c" +#else +/* the full 16x16 Bayer dither matrix may be calculated quickly with this table +*/ +const unsigned char dither_table[16] = + { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }; #endif diff --git a/apps/plugins/lib/read_image.c b/apps/plugins/lib/read_image.c index 8b6d784213..5b07882764 100644 --- a/apps/plugins/lib/read_image.c +++ b/apps/plugins/lib/read_image.c @@ -28,12 +28,10 @@ int read_image_file(const char* filename, struct bitmap *bm, int maxsize, int format, const struct custom_format *cformat) { -#if LCD_DEPTH > 1 int namelen = rb->strlen(filename); if (rb->strcmp(filename + namelen - 4, ".bmp")) return read_jpeg_file(filename, bm, maxsize, format, cformat); else -#endif return scaled_read_bmp_file(filename, bm, maxsize, format, cformat); } @@ -46,11 +44,9 @@ int read_image_file_offset(int offset, const char* filename, struct bitmap *bm, return fd; if (offset != rb->lseek(fd, offset, SEEK_SET)) return -1; -#if LCD_DEPTH > 1 int namelen = rb->strlen(filename); if (rb->strcmp(filename + namelen - 4, ".bmp")) return read_jpeg_fd(fd, bm, maxsize, format, cformat); else -#endif return scaled_read_bmp_fd(fd, bm, maxsize, format, cformat); } diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index f0931820d5..b78b953f13 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c @@ -927,8 +927,13 @@ bool create_albumart_cache(void) input_bmp.data = buf; input_bmp.width = DISPLAY_WIDTH; input_bmp.height = DISPLAY_HEIGHT; +#if PLUGIN_BUFFER_SIZE > 0x10000 ret = read_image_file(albumart_file, &input_bmp, buf_size, format, &format_transposed); +#else + ret = scaled_read_bmp_file(albumart_file, &input_bmp, + buf_size, format, &format_transposed); +#endif if (ret <= 0) { rb->splash(HZ, "Could not read bmp"); continue; /* skip missing/broken files */ diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index 3adedc8159..da85f99bbc 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c @@ -91,7 +91,7 @@ static void fix_path_part(char* path, int offset, int count) } } -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) const char * extensions[] = { "jpeg", "jpg", "bmp" }; int extension_lens[] = { 4, 3, 3 }; /* Try checking for several file extensions, return true if a file is found and @@ -134,7 +134,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, const char *artist; int dirlen; int albumlen; -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) int pathlen; #endif @@ -153,7 +153,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, /* the first file we look for is one specific to the track playing */ strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); strcat(path, size_string); -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) strcat(path, "."); pathlen = strlen(path); found = try_exts(path, pathlen); @@ -165,7 +165,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* if it doesn't exist, * we look for a file specific to the track's album name */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) pathlen = snprintf(path, sizeof(path), "%s%s%s.", dir, id3->album, size_string); fix_path_part(path, dirlen, albumlen); @@ -181,7 +181,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, if (!found) { /* if it still doesn't exist, we look for a generic file */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) pathlen = snprintf(path, sizeof(path), "%scover%s.", dir, size_string); found = try_exts(path, pathlen); @@ -192,7 +192,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, #endif } -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) if (!found) { snprintf (path, sizeof(path), "%sfolder.jpg", dir); @@ -205,7 +205,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, if (!found && artist && id3->album) { /* look in the albumart subdir of .rockbox */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) pathlen = snprintf(path, sizeof(path), ROCKBOX_DIR "/albumart/%s-%s%s.", artist, @@ -241,7 +241,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* we look in the parent directory * for a file specific to the track's album name */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) pathlen = snprintf(path, sizeof(path), "%s%s%s.", dir, id3->album, size_string); fix_path_part(path, dirlen, albumlen); @@ -258,7 +258,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, { /* if it still doesn't exist, we look in the parent directory * for a generic file */ -#if LCD_DEPTH > 1 +#if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) pathlen = snprintf(path, sizeof(path), "%scover%s.", dir, size_string); found = try_exts(path, pathlen); @@ -278,7 +278,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, return true; } -#ifdef HAVE_ALBUMART +#ifndef PLUGIN /* Look for albumart bitmap in the same dir as the track and in its parent dir. * Stores the found filename in the buf parameter. * Returns true if a bitmap was found, false otherwise */ @@ -386,4 +386,4 @@ void get_albumart_size(struct bitmap *bmp) bmp->width = data->albumart_max_width; bmp->height = data->albumart_max_height; } -#endif /* HAVE_ALBUMART */ +#endif /* PLUGIN */ diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index 3fb8a4d6c1..403c34d951 100644 --- a/apps/recorder/bmp.c +++ b/apps/recorder/bmp.c @@ -184,8 +184,8 @@ struct bmp_args { short depth; unsigned char buf[BM_MAX_WIDTH * 4]; struct uint8_rgb *palette; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) int cur_row; int cur_col; struct img_part part; @@ -198,8 +198,8 @@ static unsigned int read_part_line(struct bmp_args *ba) const int read_width = ba->read_width; const int width = ba->width; const int depth = ba->depth; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) int cur_row = ba->cur_row; int cur_col = ba->cur_col; #endif @@ -211,8 +211,8 @@ static unsigned int read_part_line(struct bmp_args *ba) int ret; int i, cols, len; -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cols = MIN(width - cur_col,(int)BM_MAX_WIDTH); BDEBUGF("reading %d cols (width: %d, max: %d)\n",cols,width,BM_MAX_WIDTH); len = (cols * (depth == 15 ? 16 : depth) + 7) >> 3; @@ -227,8 +227,8 @@ static unsigned int read_part_line(struct bmp_args *ba) { DEBUGF("read_part_line: error reading image, read returned %d " "expected %d\n", ret, len); -#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) BDEBUGF("cur_row: %d cur_col: %d cols: %d len: %d\n", cur_row, cur_col, cols, len); #endif @@ -290,17 +290,17 @@ static unsigned int read_part_line(struct bmp_args *ba) } } -#if (!defined(HAVE_LCD_COLOR) && \ - (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))) || \ - defined(PLUGIN) +#if !defined(HAVE_LCD_COLOR) && \ + ((LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN)) ibuf = ba->buf; buf = (struct uint8_rgb*)ba->buf; while (ibuf < ba->buf + cols) *ibuf++ = brightness(*buf++); #endif -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cur_col += cols; if (cur_col == width) { @@ -311,8 +311,8 @@ static unsigned int read_part_line(struct bmp_args *ba) BDEBUGF("seeking %d bytes to next line\n",pad); lseek(fd, pad, SEEK_CUR); } -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) cur_col = 0; BDEBUGF("read_part_line: completed row %d\n", cur_row); cur_row += 1; @@ -324,8 +324,8 @@ static unsigned int read_part_line(struct bmp_args *ba) return cols; } -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) static struct img_part *store_part_bmp(void *args) { struct bmp_args *ba = (struct bmp_args *)args; @@ -375,10 +375,13 @@ int read_bmp_fd(int fd, struct uint8_rgb palette[256]; struct rowset rset; struct dim src_dim; -#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) \ - || defined(PLUGIN) - unsigned int resize = IMG_NORESIZE; +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN) bool dither = false; +#endif +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) + unsigned int resize = IMG_NORESIZE; bool transparent = false; #ifdef HAVE_REMOTE_LCD @@ -398,14 +401,16 @@ int read_bmp_fd(int fd, if (format & FORMAT_TRANSPARENT) { transparent = true; } - if (format & FORMAT_DITHER) { - dither = true; - } #else (void)format; #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ - +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ + defined(PLUGIN) + if (format & FORMAT_DITHER) { + dither = true; + } +#endif /* read fileheader */ ret = read(fd, &bmph, sizeof(struct bmp_header)); if (ret < 0) { @@ -444,8 +449,11 @@ int read_bmp_fd(int fd, bm->format = format & 1; if ((format & 1) == FORMAT_MONO) { +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) resize &= ~IMG_RESIZE; resize |= IMG_NORESIZE; +#endif #ifdef HAVE_REMOTE_LCD remote = 0; #endif @@ -455,8 +463,8 @@ int read_bmp_fd(int fd, return -6; #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) if (resize & IMG_RESIZE) { if(format & FORMAT_KEEP_ASPECT) { /* keep aspect ratio.. */ @@ -471,19 +479,19 @@ int read_bmp_fd(int fd, } } - format &= 1; - if (!(resize & IMG_RESIZE)) { #endif /* returning image size */ bm->width = src_dim.width; bm->height = src_dim.height; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) } #endif - +#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + format &= 1; +#endif if (rset.rowstep > 0) { /* Top-down BMP file */ rset.rowstart = 0; rset.rowstop = bm->height; @@ -581,15 +589,15 @@ int read_bmp_fd(int fd, struct bmp_args ba = { .fd = fd, .padded_width = padded_width, .read_width = read_width, .width = src_dim.width, .depth = depth, .palette = palette, -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) .cur_row = 0, .cur_col = 0, .part = {0,0} #endif }; -#if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ - defined(PLUGIN) -#if LCD_DEPTH > 1 +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ + defined(HAVE_BMP_SCALING) || defined(PLUGIN) +#if LCD_DEPTH > 1 && defined(HAVE_BMP_SCALING) if (resize || cformat) #endif { @@ -600,12 +608,12 @@ int read_bmp_fd(int fd, else return 0; } -#ifndef PLUGIN - int fb_width = BM_WIDTH(bm->width,bm->format,remote); -#endif #endif /* LCD_DEPTH */ #ifndef PLUGIN +#if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) + int fb_width = BM_WIDTH(bm->width,bm->format,remote); +#endif int col, row; /* loop to read rows and put them to buffer */ diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index 79be59804a..7000c448e6 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -516,8 +516,9 @@ static inline bool scale_v_linear(struct rowset *rset, } #endif /* HAVE_UPSCALER */ -#ifndef PLUGIN -static void output_row_native(uint32_t row, void * row_in, struct scaler_context *ctx) +#if !defined(PLUGIN) || LCD_DEPTH > 1 +void output_row_native(uint32_t row, void * row_in, + struct scaler_context *ctx) { int col; int fb_width = BM_WIDTH(ctx->bm->width,FORMAT_NATIVE,0); @@ -606,6 +607,18 @@ static void output_row_native(uint32_t row, void * row_in, struct scaler_context } #endif +#if defined(PLUGIN) && LCD_DEPTH > 1 +unsigned int get_size_native(struct bitmap *bm) +{ + return BM_SIZE(bm->width,bm->height,FORMAT_NATIVE,FALSE); +} + +const struct custom_format format_native = { + .output_row = output_row_native, + .get_size = get_size_native +}; +#endif + int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, struct rowset *rset, unsigned char *buf, unsigned int len, const struct custom_format *format, @@ -669,7 +682,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, ctx.bm = bm; ctx.src = src; ctx.dither = dither; -#ifndef PLUGIN +#if !defined(PLUGIN) ctx.output_row = output_row_native; if (format) #endif diff --git a/apps/recorder/resize.h b/apps/recorder/resize.h index dc93585a08..de9e8a9ab0 100644 --- a/apps/recorder/resize.h +++ b/apps/recorder/resize.h @@ -149,6 +149,12 @@ struct custom_format { }; struct rowset; + +void output_row_native(uint32_t row, void * row_in, + struct scaler_context *ctx); + +extern const struct custom_format format_native; + int recalc_dimension(struct dim *dst, struct dim *src); int resize_on_load(struct bitmap *bm, bool dither, diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h index ed16fb0473..5c2b37dd19 100644 --- a/firmware/export/config-c200.h +++ b/firmware/export/config-c200.h @@ -29,6 +29,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-c200v2.h b/firmware/export/config-c200v2.h index 1e58573a9c..b47ba73610 100644 --- a/firmware/export/config-c200v2.h +++ b/firmware/export/config-c200v2.h @@ -31,6 +31,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-cowond2.h b/firmware/export/config-cowond2.h index 85e46f9b30..bef4bf4992 100644 --- a/firmware/export/config-cowond2.h +++ b/firmware/export/config-cowond2.h @@ -41,6 +41,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index fd481d9e63..59ac564c01 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -29,6 +29,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-e200v2.h b/firmware/export/config-e200v2.h index dbd3b0c0ee..9ee8572fbd 100644 --- a/firmware/export/config-e200v2.h +++ b/firmware/export/config-e200v2.h @@ -31,6 +31,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-fuze.h b/firmware/export/config-fuze.h index 4cef71ed58..4f943580a7 100644 --- a/firmware/export/config-fuze.h +++ b/firmware/export/config-fuze.h @@ -35,6 +35,12 @@ #ifndef BOOTLOADER/* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT diff --git a/firmware/export/config-gigabeat-s.h b/firmware/export/config-gigabeat-s.h index 17ee39352c..d122edbf74 100644 --- a/firmware/export/config-gigabeat-s.h +++ b/firmware/export/config-gigabeat-s.h @@ -23,6 +23,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-gigabeat.h b/firmware/export/config-gigabeat.h index 72b8c3d79d..a6ec25d34f 100644 --- a/firmware/export/config-gigabeat.h +++ b/firmware/export/config-gigabeat.h @@ -22,6 +22,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h10.h b/firmware/export/config-h10.h index 011c1316de..04a61238bf 100644 --- a/firmware/export/config-h10.h +++ b/firmware/export/config-h10.h @@ -34,6 +34,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h index 1a3c75ebf8..e860538ec6 100644 --- a/firmware/export/config-h100.h +++ b/firmware/export/config-h100.h @@ -23,6 +23,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-h10_5gb.h b/firmware/export/config-h10_5gb.h index ef53e02ab4..806ce0cdc3 100644 --- a/firmware/export/config-h10_5gb.h +++ b/firmware/export/config-h10_5gb.h @@ -34,6 +34,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h index bb8e1f7184..b772a36323 100644 --- a/firmware/export/config-h120.h +++ b/firmware/export/config-h120.h @@ -18,6 +18,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h index e6e07e0bbc..91f54f5479 100644 --- a/firmware/export/config-h300.h +++ b/firmware/export/config-h300.h @@ -21,6 +21,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-hdd1630.h b/firmware/export/config-hdd1630.h index 9b33f6a08e..d588b3bb60 100755 --- a/firmware/export/config-hdd1630.h +++ b/firmware/export/config-hdd1630.h @@ -35,6 +35,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-iaudio7.h b/firmware/export/config-iaudio7.h index 601ff5491f..8886b18633 100644 --- a/firmware/export/config-iaudio7.h +++ b/firmware/export/config-iaudio7.h @@ -42,6 +42,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-iaudiom3.h b/firmware/export/config-iaudiom3.h index a09be04c17..5eb7fb891b 100644 --- a/firmware/export/config-iaudiom3.h +++ b/firmware/export/config-iaudiom3.h @@ -30,6 +30,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-iaudiom5.h b/firmware/export/config-iaudiom5.h index d186895b45..0df8414fe9 100644 --- a/firmware/export/config-iaudiom5.h +++ b/firmware/export/config-iaudiom5.h @@ -30,6 +30,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can flip your LCD */ #define HAVE_LCD_FLIP diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h index 218e1657dd..e048ebefb9 100644 --- a/firmware/export/config-iaudiox5.h +++ b/firmware/export/config-iaudiox5.h @@ -36,6 +36,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index b4acd38b5b..e642dfd930 100644 --- a/firmware/export/config-ipod1g2g.h +++ b/firmware/export/config-ipod1g2g.h @@ -30,6 +30,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index 57773750f2..c13070a805 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -31,6 +31,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipod4g.h b/firmware/export/config-ipod4g.h index 7cbe2145f2..599c4c254e 100644 --- a/firmware/export/config-ipod4g.h +++ b/firmware/export/config-ipod4g.h @@ -32,6 +32,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodcolor.h b/firmware/export/config-ipodcolor.h index adb0f0ba1c..11edc9893f 100644 --- a/firmware/export/config-ipodcolor.h +++ b/firmware/export/config-ipodcolor.h @@ -35,6 +35,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodmini.h b/firmware/export/config-ipodmini.h index 76c81bd86d..d4fdc2eb2a 100644 --- a/firmware/export/config-ipodmini.h +++ b/firmware/export/config-ipodmini.h @@ -30,6 +30,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodmini2g.h b/firmware/export/config-ipodmini2g.h index 3f37ce940f..c6a0cfa368 100644 --- a/firmware/export/config-ipodmini2g.h +++ b/firmware/export/config-ipodmini2g.h @@ -30,6 +30,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ #define HAVE_LCD_INVERT diff --git a/firmware/export/config-ipodnano.h b/firmware/export/config-ipodnano.h index 7947997ee0..bd6228b6ff 100644 --- a/firmware/export/config-ipodnano.h +++ b/firmware/export/config-ipodnano.h @@ -35,6 +35,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-ipodvideo.h b/firmware/export/config-ipodvideo.h index e115f2d786..bd93f8fb36 100644 --- a/firmware/export/config-ipodvideo.h +++ b/firmware/export/config-ipodvideo.h @@ -37,6 +37,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN /* define this if you have access to the pitchscreen */ diff --git a/firmware/export/config-lyre_proto1.h b/firmware/export/config-lyre_proto1.h index 58a9350bb9..d157f5be2d 100644 --- a/firmware/export/config-lyre_proto1.h +++ b/firmware/export/config-lyre_proto1.h @@ -52,6 +52,12 @@ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + #define CONFIG_KEYPAD LYRE_PROTO1_PAD /* Define this if you do software codec */ diff --git a/firmware/export/config-meizu-m3.h b/firmware/export/config-meizu-m3.h index 74fe9fd990..2ad20550d0 100644 --- a/firmware/export/config-meizu-m3.h +++ b/firmware/export/config-meizu-m3.h @@ -33,6 +33,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-meizu-m6sl.h b/firmware/export/config-meizu-m6sl.h index b7b50c6dd2..a8e387150d 100644 --- a/firmware/export/config-meizu-m6sl.h +++ b/firmware/export/config-meizu-m6sl.h @@ -33,6 +33,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-meizu-m6sp.h b/firmware/export/config-meizu-m6sp.h index 993c535a92..2325b479b1 100644 --- a/firmware/export/config-meizu-m6sp.h +++ b/firmware/export/config-meizu-m6sp.h @@ -33,6 +33,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you can invert the colours on your LCD */ //#define HAVE_LCD_INVERT diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index f8f3502152..f9e8d9ebf6 100644 --- a/firmware/export/config-mrobe500.h +++ b/firmware/export/config-mrobe500.h @@ -44,6 +44,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-ondavx747.h b/firmware/export/config-ondavx747.h index e47a8c1702..176a35f4e9 100644 --- a/firmware/export/config-ondavx747.h +++ b/firmware/export/config-ondavx747.h @@ -54,6 +54,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have access to the quickscreen */ #define HAVE_QUICKSCREEN diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index cbe92bb99c..e35c27e15e 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h @@ -18,6 +18,12 @@ /* define this if you want album art for this target */ #define HAVE_ALBUMART +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + /* define this if you have a light associated with the buttons */ #define HAVE_BUTTON_LIGHT -- cgit v1.2.3