diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-04 15:46:41 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-05-04 15:46:41 +0000 |
commit | 20f76d61ae58bd47b647d79e40beebbbe747e480 (patch) | |
tree | d37569a127b02fdd051c6a3da77c70ac2d72e8ab /apps | |
parent | dfb24d6ceee703361b8120d689d8d77cfc15830d (diff) | |
download | rockbox-20f76d61ae58bd47b647d79e40beebbbe747e480.tar.gz rockbox-20f76d61ae58bd47b647d79e40beebbbe747e480.zip |
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
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 8 | ||||
-rw-r--r-- | apps/buffering.c | 4 | ||||
-rw-r--r-- | apps/plugin.c | 2 | ||||
-rw-r--r-- | apps/plugin.h | 2 | ||||
-rw-r--r-- | apps/plugins/lib/SOURCES | 12 | ||||
-rw-r--r-- | apps/plugins/lib/feature_wrappers.h | 17 | ||||
-rw-r--r-- | apps/plugins/lib/pluginlib_bmp.c | 12 | ||||
-rw-r--r-- | apps/plugins/lib/read_image.c | 4 | ||||
-rw-r--r-- | apps/plugins/pictureflow.c | 5 | ||||
-rw-r--r-- | apps/recorder/albumart.c | 22 | ||||
-rw-r--r-- | apps/recorder/bmp.c | 86 | ||||
-rw-r--r-- | apps/recorder/resize.c | 19 | ||||
-rw-r--r-- | apps/recorder/resize.h | 6 |
13 files changed, 120 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 | |||
88 | 88 | ||
89 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 89 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
90 | gui/backdrop.c | 90 | gui/backdrop.c |
91 | recorder/resize.c | ||
92 | recorder/jpeg_load.c | ||
93 | #endif | 91 | #endif |
94 | 92 | ||
95 | #ifdef HAVE_LCD_CHARCELLS | 93 | #ifdef HAVE_LCD_CHARCELLS |
@@ -101,6 +99,12 @@ recorder/bmp.c | |||
101 | recorder/icons.c | 99 | recorder/icons.c |
102 | recorder/keyboard.c | 100 | recorder/keyboard.c |
103 | recorder/peakmeter.c | 101 | recorder/peakmeter.c |
102 | #if defined(HAVE_ALBUMART) || defined(HAVE_JPEG) | ||
103 | recorder/resize.c | ||
104 | #endif | ||
105 | #ifdef HAVE_JPEG | ||
106 | recorder/jpeg_load.c | ||
107 | #endif | ||
104 | #ifdef HAVE_ALBUMART | 108 | #ifdef HAVE_ALBUMART |
105 | recorder/albumart.c | 109 | recorder/albumart.c |
106 | #endif | 110 | #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) | |||
834 | static int load_image(int fd, const char *path) | 834 | static int load_image(int fd, const char *path) |
835 | { | 835 | { |
836 | int rc; | 836 | int rc; |
837 | int pathlen = strlen(path); | ||
838 | struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx]; | 837 | struct bitmap *bmp = (struct bitmap *)&buffer[buf_widx]; |
839 | /* FIXME: alignment may be needed for the data buffer. */ | 838 | /* FIXME: alignment may be needed for the data buffer. */ |
840 | bmp->data = &buffer[buf_widx + sizeof(struct bitmap)]; | 839 | bmp->data = &buffer[buf_widx + sizeof(struct bitmap)]; |
@@ -848,10 +847,13 @@ static int load_image(int fd, const char *path) | |||
848 | 847 | ||
849 | get_albumart_size(bmp); | 848 | get_albumart_size(bmp); |
850 | 849 | ||
850 | #ifdef HAVE_JPEG | ||
851 | int pathlen = strlen(path); | ||
851 | if (strcmp(path + pathlen - 4, ".bmp")) | 852 | if (strcmp(path + pathlen - 4, ".bmp")) |
852 | rc = read_jpeg_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| | 853 | rc = read_jpeg_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| |
853 | FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); | 854 | FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); |
854 | else | 855 | else |
856 | #endif | ||
855 | rc = read_bmp_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| | 857 | rc = read_bmp_fd(fd, bmp, free, FORMAT_NATIVE|FORMAT_DITHER| |
856 | FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); | 858 | FORMAT_RESIZE|FORMAT_KEEP_ASPECT, NULL); |
857 | return rc + (rc > 0 ? sizeof(struct bitmap) : 0); | 859 | 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 = { | |||
644 | #endif | 644 | #endif |
645 | #endif | 645 | #endif |
646 | #ifdef HAVE_LCD_BITMAP | 646 | #ifdef HAVE_LCD_BITMAP |
647 | #if LCD_DEPTH > 1 | 647 | #ifdef HAVE_JPEG |
648 | read_jpeg_file, | 648 | read_jpeg_file, |
649 | read_jpeg_fd, | 649 | read_jpeg_fd, |
650 | #endif | 650 | #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 { | |||
805 | #endif | 805 | #endif |
806 | 806 | ||
807 | #ifdef HAVE_LCD_BITMAP | 807 | #ifdef HAVE_LCD_BITMAP |
808 | #if LCD_DEPTH > 1 | 808 | #ifdef HAVE_JPEG |
809 | int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize, | 809 | int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize, |
810 | int format, const struct custom_format *cformat); | 810 | int format, const struct custom_format *cformat); |
811 | int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize, | 811 | 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 | |||
5 | playback_control.c | 5 | playback_control.c |
6 | rgb_hsv.c | 6 | rgb_hsv.c |
7 | buflib.c | 7 | buflib.c |
8 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | 8 | #if !defined(HAVE_BMP_SCALING) || !defined(HAVE_JPEG) |
9 | /* | ||
10 | The scaler is not provided in core on mono targets, but is built in | ||
11 | pluginlib for use with greylib overlay output | ||
12 | */ | ||
13 | #if LCD_DEPTH == 1 | ||
14 | pluginlib_resize.c | 9 | pluginlib_resize.c |
10 | #endif | ||
11 | #ifndef HAVE_JPEG | ||
15 | pluginlib_jpeg_load.c | 12 | pluginlib_jpeg_load.c |
16 | #endif | 13 | #endif |
14 | #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) | ||
17 | grey_core.c | 15 | grey_core.c |
18 | grey_draw.c | 16 | grey_draw.c |
19 | grey_parm.c | 17 | grey_parm.c |
@@ -45,7 +43,7 @@ read_image.c | |||
45 | #ifdef HAVE_LCD_COLOR | 43 | #ifdef HAVE_LCD_COLOR |
46 | bmp_smooth_scale.c | 44 | bmp_smooth_scale.c |
47 | #endif | 45 | #endif |
48 | #ifndef HAVE_ALBUMART | 46 | #if !defined(HAVE_ALBUMART) || !defined(HAVE_JPEG) |
49 | pluginlib_albumart.c | 47 | pluginlib_albumart.c |
50 | #endif | 48 | #endif |
51 | #endif | 49 | #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 @@ | |||
30 | * but can easily be implement in pluginlib as long as the database is | 30 | * but can easily be implement in pluginlib as long as the database is |
31 | * available. | 31 | * available. |
32 | */ | 32 | */ |
33 | #ifdef HAVE_ALBUMART | 33 | #if defined(HAVE_ALBUMART) && defined(HAVE_JPEG) |
34 | #define search_albumart_files rb->search_albumart_files | 34 | #define search_albumart_files rb->search_albumart_files |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* This should only be used when loading scaled bitmaps, or using custom output | 37 | /* This should only be used when loading scaled bitmaps, or using custom output |
38 | * plugins. The pluginlib loader does not support loading bitmaps unscaled in | 38 | * plugins. A native output plugin for the scaler is available as format_native |
39 | * native format, so rb->read_bmp_file should always be used directly to load | 39 | * on targets with LCD_DEPTH > 1 |
40 | * such images. | ||
41 | */ | 40 | */ |
42 | #if LCD_DEPTH > 1 | 41 | #ifdef HAVE_BMP_SCALING |
43 | #define scaled_read_bmp_file rb->read_bmp_file | 42 | #define scaled_read_bmp_file rb->read_bmp_file |
44 | #define scaled_read_bmp_fd rb->read_bmp_fd | 43 | #define scaled_read_bmp_fd rb->read_bmp_fd |
45 | #define read_jpeg_file rb->read_jpeg_file | ||
46 | #define read_jpeg_fd rb->read_jpeg_fd | ||
47 | #else | 44 | #else |
48 | #define scaled_read_bmp_file read_bmp_file | 45 | #define scaled_read_bmp_file read_bmp_file |
49 | #define scaled_read_bmp_fd read_bmp_fd | 46 | #define scaled_read_bmp_fd read_bmp_fd |
50 | #endif | 47 | #endif |
51 | 48 | ||
49 | #ifdef HAVE_JPEG | ||
50 | #define read_jpeg_file rb->read_jpeg_file | ||
51 | #define read_jpeg_fd rb->read_jpeg_fd | ||
52 | #else | ||
53 | #endif | ||
54 | |||
52 | #endif | 55 | #endif |
53 | 56 | ||
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) | |||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | #else /* LCD_DEPTH == 1 */ | 125 | #endif /* LCD_DEPTH > 1 */ |
126 | |||
127 | #ifndef HAVE_BMP_SCALING | ||
126 | #include "wrappers.h" | 128 | #include "wrappers.h" |
127 | 129 | ||
128 | /* import the core bmp loader */ | 130 | /* import the core bmp loader */ |
129 | #include "../../recorder/bmp.c" | 131 | #include "recorder/bmp.c" |
130 | 132 | #else | |
133 | /* the full 16x16 Bayer dither matrix may be calculated quickly with this table | ||
134 | */ | ||
135 | const unsigned char dither_table[16] = | ||
136 | { 0,192, 48,240, 12,204, 60,252, 3,195, 51,243, 15,207, 63,255 }; | ||
131 | #endif | 137 | #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 @@ | |||
28 | int read_image_file(const char* filename, struct bitmap *bm, int maxsize, | 28 | int read_image_file(const char* filename, struct bitmap *bm, int maxsize, |
29 | int format, const struct custom_format *cformat) | 29 | int format, const struct custom_format *cformat) |
30 | { | 30 | { |
31 | #if LCD_DEPTH > 1 | ||
32 | int namelen = rb->strlen(filename); | 31 | int namelen = rb->strlen(filename); |
33 | if (rb->strcmp(filename + namelen - 4, ".bmp")) | 32 | if (rb->strcmp(filename + namelen - 4, ".bmp")) |
34 | return read_jpeg_file(filename, bm, maxsize, format, cformat); | 33 | return read_jpeg_file(filename, bm, maxsize, format, cformat); |
35 | else | 34 | else |
36 | #endif | ||
37 | return scaled_read_bmp_file(filename, bm, maxsize, format, cformat); | 35 | return scaled_read_bmp_file(filename, bm, maxsize, format, cformat); |
38 | } | 36 | } |
39 | 37 | ||
@@ -46,11 +44,9 @@ int read_image_file_offset(int offset, const char* filename, struct bitmap *bm, | |||
46 | return fd; | 44 | return fd; |
47 | if (offset != rb->lseek(fd, offset, SEEK_SET)) | 45 | if (offset != rb->lseek(fd, offset, SEEK_SET)) |
48 | return -1; | 46 | return -1; |
49 | #if LCD_DEPTH > 1 | ||
50 | int namelen = rb->strlen(filename); | 47 | int namelen = rb->strlen(filename); |
51 | if (rb->strcmp(filename + namelen - 4, ".bmp")) | 48 | if (rb->strcmp(filename + namelen - 4, ".bmp")) |
52 | return read_jpeg_fd(fd, bm, maxsize, format, cformat); | 49 | return read_jpeg_fd(fd, bm, maxsize, format, cformat); |
53 | else | 50 | else |
54 | #endif | ||
55 | return scaled_read_bmp_fd(fd, bm, maxsize, format, cformat); | 51 | return scaled_read_bmp_fd(fd, bm, maxsize, format, cformat); |
56 | } | 52 | } |
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) | |||
927 | input_bmp.data = buf; | 927 | input_bmp.data = buf; |
928 | input_bmp.width = DISPLAY_WIDTH; | 928 | input_bmp.width = DISPLAY_WIDTH; |
929 | input_bmp.height = DISPLAY_HEIGHT; | 929 | input_bmp.height = DISPLAY_HEIGHT; |
930 | #if PLUGIN_BUFFER_SIZE > 0x10000 | ||
930 | ret = read_image_file(albumart_file, &input_bmp, | 931 | ret = read_image_file(albumart_file, &input_bmp, |
931 | buf_size, format, &format_transposed); | 932 | buf_size, format, &format_transposed); |
933 | #else | ||
934 | ret = scaled_read_bmp_file(albumart_file, &input_bmp, | ||
935 | buf_size, format, &format_transposed); | ||
936 | #endif | ||
932 | if (ret <= 0) { | 937 | if (ret <= 0) { |
933 | rb->splash(HZ, "Could not read bmp"); | 938 | rb->splash(HZ, "Could not read bmp"); |
934 | continue; /* skip missing/broken files */ | 939 | 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) | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | #if LCD_DEPTH > 1 | 94 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
95 | const char * extensions[] = { "jpeg", "jpg", "bmp" }; | 95 | const char * extensions[] = { "jpeg", "jpg", "bmp" }; |
96 | int extension_lens[] = { 4, 3, 3 }; | 96 | int extension_lens[] = { 4, 3, 3 }; |
97 | /* Try checking for several file extensions, return true if a file is found and | 97 | /* 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, | |||
134 | const char *artist; | 134 | const char *artist; |
135 | int dirlen; | 135 | int dirlen; |
136 | int albumlen; | 136 | int albumlen; |
137 | #if LCD_DEPTH > 1 | 137 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
138 | int pathlen; | 138 | int pathlen; |
139 | #endif | 139 | #endif |
140 | 140 | ||
@@ -153,7 +153,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
153 | /* the first file we look for is one specific to the track playing */ | 153 | /* the first file we look for is one specific to the track playing */ |
154 | strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); | 154 | strip_extension(path, sizeof(path) - strlen(size_string) - 4, trackname); |
155 | strcat(path, size_string); | 155 | strcat(path, size_string); |
156 | #if LCD_DEPTH > 1 | 156 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
157 | strcat(path, "."); | 157 | strcat(path, "."); |
158 | pathlen = strlen(path); | 158 | pathlen = strlen(path); |
159 | found = try_exts(path, pathlen); | 159 | found = try_exts(path, pathlen); |
@@ -165,7 +165,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
165 | { | 165 | { |
166 | /* if it doesn't exist, | 166 | /* if it doesn't exist, |
167 | * we look for a file specific to the track's album name */ | 167 | * we look for a file specific to the track's album name */ |
168 | #if LCD_DEPTH > 1 | 168 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
169 | pathlen = snprintf(path, sizeof(path), | 169 | pathlen = snprintf(path, sizeof(path), |
170 | "%s%s%s.", dir, id3->album, size_string); | 170 | "%s%s%s.", dir, id3->album, size_string); |
171 | fix_path_part(path, dirlen, albumlen); | 171 | fix_path_part(path, dirlen, albumlen); |
@@ -181,7 +181,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
181 | if (!found) | 181 | if (!found) |
182 | { | 182 | { |
183 | /* if it still doesn't exist, we look for a generic file */ | 183 | /* if it still doesn't exist, we look for a generic file */ |
184 | #if LCD_DEPTH > 1 | 184 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
185 | pathlen = snprintf(path, sizeof(path), | 185 | pathlen = snprintf(path, sizeof(path), |
186 | "%scover%s.", dir, size_string); | 186 | "%scover%s.", dir, size_string); |
187 | found = try_exts(path, pathlen); | 187 | found = try_exts(path, pathlen); |
@@ -192,7 +192,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
192 | #endif | 192 | #endif |
193 | } | 193 | } |
194 | 194 | ||
195 | #if LCD_DEPTH > 1 | 195 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
196 | if (!found) | 196 | if (!found) |
197 | { | 197 | { |
198 | snprintf (path, sizeof(path), "%sfolder.jpg", dir); | 198 | snprintf (path, sizeof(path), "%sfolder.jpg", dir); |
@@ -205,7 +205,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
205 | if (!found && artist && id3->album) | 205 | if (!found && artist && id3->album) |
206 | { | 206 | { |
207 | /* look in the albumart subdir of .rockbox */ | 207 | /* look in the albumart subdir of .rockbox */ |
208 | #if LCD_DEPTH > 1 | 208 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
209 | pathlen = snprintf(path, sizeof(path), | 209 | pathlen = snprintf(path, sizeof(path), |
210 | ROCKBOX_DIR "/albumart/%s-%s%s.", | 210 | ROCKBOX_DIR "/albumart/%s-%s%s.", |
211 | artist, | 211 | artist, |
@@ -241,7 +241,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
241 | { | 241 | { |
242 | /* we look in the parent directory | 242 | /* we look in the parent directory |
243 | * for a file specific to the track's album name */ | 243 | * for a file specific to the track's album name */ |
244 | #if LCD_DEPTH > 1 | 244 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
245 | pathlen = snprintf(path, sizeof(path), | 245 | pathlen = snprintf(path, sizeof(path), |
246 | "%s%s%s.", dir, id3->album, size_string); | 246 | "%s%s%s.", dir, id3->album, size_string); |
247 | fix_path_part(path, dirlen, albumlen); | 247 | fix_path_part(path, dirlen, albumlen); |
@@ -258,7 +258,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
258 | { | 258 | { |
259 | /* if it still doesn't exist, we look in the parent directory | 259 | /* if it still doesn't exist, we look in the parent directory |
260 | * for a generic file */ | 260 | * for a generic file */ |
261 | #if LCD_DEPTH > 1 | 261 | #if defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) |
262 | pathlen = snprintf(path, sizeof(path), | 262 | pathlen = snprintf(path, sizeof(path), |
263 | "%scover%s.", dir, size_string); | 263 | "%scover%s.", dir, size_string); |
264 | found = try_exts(path, pathlen); | 264 | found = try_exts(path, pathlen); |
@@ -278,7 +278,7 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, | |||
278 | return true; | 278 | return true; |
279 | } | 279 | } |
280 | 280 | ||
281 | #ifdef HAVE_ALBUMART | 281 | #ifndef PLUGIN |
282 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. | 282 | /* Look for albumart bitmap in the same dir as the track and in its parent dir. |
283 | * Stores the found filename in the buf parameter. | 283 | * Stores the found filename in the buf parameter. |
284 | * Returns true if a bitmap was found, false otherwise */ | 284 | * Returns true if a bitmap was found, false otherwise */ |
@@ -386,4 +386,4 @@ void get_albumart_size(struct bitmap *bmp) | |||
386 | bmp->width = data->albumart_max_width; | 386 | bmp->width = data->albumart_max_width; |
387 | bmp->height = data->albumart_max_height; | 387 | bmp->height = data->albumart_max_height; |
388 | } | 388 | } |
389 | #endif /* HAVE_ALBUMART */ | 389 | #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 { | |||
184 | short depth; | 184 | short depth; |
185 | unsigned char buf[BM_MAX_WIDTH * 4]; | 185 | unsigned char buf[BM_MAX_WIDTH * 4]; |
186 | struct uint8_rgb *palette; | 186 | struct uint8_rgb *palette; |
187 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 187 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
188 | defined(PLUGIN) | 188 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
189 | int cur_row; | 189 | int cur_row; |
190 | int cur_col; | 190 | int cur_col; |
191 | struct img_part part; | 191 | struct img_part part; |
@@ -198,8 +198,8 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
198 | const int read_width = ba->read_width; | 198 | const int read_width = ba->read_width; |
199 | const int width = ba->width; | 199 | const int width = ba->width; |
200 | const int depth = ba->depth; | 200 | const int depth = ba->depth; |
201 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 201 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
202 | defined(PLUGIN) | 202 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
203 | int cur_row = ba->cur_row; | 203 | int cur_row = ba->cur_row; |
204 | int cur_col = ba->cur_col; | 204 | int cur_col = ba->cur_col; |
205 | #endif | 205 | #endif |
@@ -211,8 +211,8 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
211 | int ret; | 211 | int ret; |
212 | int i, cols, len; | 212 | int i, cols, len; |
213 | 213 | ||
214 | #if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ | 214 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
215 | defined(PLUGIN) | 215 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
216 | cols = MIN(width - cur_col,(int)BM_MAX_WIDTH); | 216 | cols = MIN(width - cur_col,(int)BM_MAX_WIDTH); |
217 | BDEBUGF("reading %d cols (width: %d, max: %d)\n",cols,width,BM_MAX_WIDTH); | 217 | BDEBUGF("reading %d cols (width: %d, max: %d)\n",cols,width,BM_MAX_WIDTH); |
218 | len = (cols * (depth == 15 ? 16 : depth) + 7) >> 3; | 218 | len = (cols * (depth == 15 ? 16 : depth) + 7) >> 3; |
@@ -227,8 +227,8 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
227 | { | 227 | { |
228 | DEBUGF("read_part_line: error reading image, read returned %d " | 228 | DEBUGF("read_part_line: error reading image, read returned %d " |
229 | "expected %d\n", ret, len); | 229 | "expected %d\n", ret, len); |
230 | #if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) || \ | 230 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
231 | defined(PLUGIN) | 231 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
232 | BDEBUGF("cur_row: %d cur_col: %d cols: %d len: %d\n", cur_row, cur_col, | 232 | BDEBUGF("cur_row: %d cur_col: %d cols: %d len: %d\n", cur_row, cur_col, |
233 | cols, len); | 233 | cols, len); |
234 | #endif | 234 | #endif |
@@ -290,17 +290,17 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | #if (!defined(HAVE_LCD_COLOR) && \ | 293 | #if !defined(HAVE_LCD_COLOR) && \ |
294 | (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))) || \ | 294 | ((LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ |
295 | defined(PLUGIN) | 295 | defined(PLUGIN)) |
296 | ibuf = ba->buf; | 296 | ibuf = ba->buf; |
297 | buf = (struct uint8_rgb*)ba->buf; | 297 | buf = (struct uint8_rgb*)ba->buf; |
298 | while (ibuf < ba->buf + cols) | 298 | while (ibuf < ba->buf + cols) |
299 | *ibuf++ = brightness(*buf++); | 299 | *ibuf++ = brightness(*buf++); |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 302 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
303 | defined(PLUGIN) | 303 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
304 | cur_col += cols; | 304 | cur_col += cols; |
305 | if (cur_col == width) | 305 | if (cur_col == width) |
306 | { | 306 | { |
@@ -311,8 +311,8 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
311 | BDEBUGF("seeking %d bytes to next line\n",pad); | 311 | BDEBUGF("seeking %d bytes to next line\n",pad); |
312 | lseek(fd, pad, SEEK_CUR); | 312 | lseek(fd, pad, SEEK_CUR); |
313 | } | 313 | } |
314 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 314 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
315 | defined(PLUGIN) | 315 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
316 | cur_col = 0; | 316 | cur_col = 0; |
317 | BDEBUGF("read_part_line: completed row %d\n", cur_row); | 317 | BDEBUGF("read_part_line: completed row %d\n", cur_row); |
318 | cur_row += 1; | 318 | cur_row += 1; |
@@ -324,8 +324,8 @@ static unsigned int read_part_line(struct bmp_args *ba) | |||
324 | return cols; | 324 | return cols; |
325 | } | 325 | } |
326 | 326 | ||
327 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 327 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
328 | defined(PLUGIN) | 328 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
329 | static struct img_part *store_part_bmp(void *args) | 329 | static struct img_part *store_part_bmp(void *args) |
330 | { | 330 | { |
331 | struct bmp_args *ba = (struct bmp_args *)args; | 331 | struct bmp_args *ba = (struct bmp_args *)args; |
@@ -375,10 +375,13 @@ int read_bmp_fd(int fd, | |||
375 | struct uint8_rgb palette[256]; | 375 | struct uint8_rgb palette[256]; |
376 | struct rowset rset; | 376 | struct rowset rset; |
377 | struct dim src_dim; | 377 | struct dim src_dim; |
378 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) \ | 378 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ |
379 | || defined(PLUGIN) | 379 | defined(PLUGIN) |
380 | unsigned int resize = IMG_NORESIZE; | ||
381 | bool dither = false; | 380 | bool dither = false; |
381 | #endif | ||
382 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ | ||
383 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) | ||
384 | unsigned int resize = IMG_NORESIZE; | ||
382 | bool transparent = false; | 385 | bool transparent = false; |
383 | 386 | ||
384 | #ifdef HAVE_REMOTE_LCD | 387 | #ifdef HAVE_REMOTE_LCD |
@@ -398,14 +401,16 @@ int read_bmp_fd(int fd, | |||
398 | if (format & FORMAT_TRANSPARENT) { | 401 | if (format & FORMAT_TRANSPARENT) { |
399 | transparent = true; | 402 | transparent = true; |
400 | } | 403 | } |
401 | if (format & FORMAT_DITHER) { | ||
402 | dither = true; | ||
403 | } | ||
404 | #else | 404 | #else |
405 | 405 | ||
406 | (void)format; | 406 | (void)format; |
407 | #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ | 407 | #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ |
408 | 408 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) || \ | |
409 | defined(PLUGIN) | ||
410 | if (format & FORMAT_DITHER) { | ||
411 | dither = true; | ||
412 | } | ||
413 | #endif | ||
409 | /* read fileheader */ | 414 | /* read fileheader */ |
410 | ret = read(fd, &bmph, sizeof(struct bmp_header)); | 415 | ret = read(fd, &bmph, sizeof(struct bmp_header)); |
411 | if (ret < 0) { | 416 | if (ret < 0) { |
@@ -444,8 +449,11 @@ int read_bmp_fd(int fd, | |||
444 | bm->format = format & 1; | 449 | bm->format = format & 1; |
445 | if ((format & 1) == FORMAT_MONO) | 450 | if ((format & 1) == FORMAT_MONO) |
446 | { | 451 | { |
452 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ | ||
453 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) | ||
447 | resize &= ~IMG_RESIZE; | 454 | resize &= ~IMG_RESIZE; |
448 | resize |= IMG_NORESIZE; | 455 | resize |= IMG_NORESIZE; |
456 | #endif | ||
449 | #ifdef HAVE_REMOTE_LCD | 457 | #ifdef HAVE_REMOTE_LCD |
450 | remote = 0; | 458 | remote = 0; |
451 | #endif | 459 | #endif |
@@ -455,8 +463,8 @@ int read_bmp_fd(int fd, | |||
455 | return -6; | 463 | return -6; |
456 | #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ | 464 | #endif /*(LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)*/ |
457 | 465 | ||
458 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 466 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
459 | defined(PLUGIN) | 467 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
460 | if (resize & IMG_RESIZE) { | 468 | if (resize & IMG_RESIZE) { |
461 | if(format & FORMAT_KEEP_ASPECT) { | 469 | if(format & FORMAT_KEEP_ASPECT) { |
462 | /* keep aspect ratio.. */ | 470 | /* keep aspect ratio.. */ |
@@ -471,19 +479,19 @@ int read_bmp_fd(int fd, | |||
471 | } | 479 | } |
472 | } | 480 | } |
473 | 481 | ||
474 | format &= 1; | ||
475 | |||
476 | if (!(resize & IMG_RESIZE)) { | 482 | if (!(resize & IMG_RESIZE)) { |
477 | #endif | 483 | #endif |
478 | /* returning image size */ | 484 | /* returning image size */ |
479 | bm->width = src_dim.width; | 485 | bm->width = src_dim.width; |
480 | bm->height = src_dim.height; | 486 | bm->height = src_dim.height; |
481 | 487 | ||
482 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 488 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
483 | defined(PLUGIN) | 489 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
484 | } | 490 | } |
485 | #endif | 491 | #endif |
486 | 492 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) | |
493 | format &= 1; | ||
494 | #endif | ||
487 | if (rset.rowstep > 0) { /* Top-down BMP file */ | 495 | if (rset.rowstep > 0) { /* Top-down BMP file */ |
488 | rset.rowstart = 0; | 496 | rset.rowstart = 0; |
489 | rset.rowstop = bm->height; | 497 | rset.rowstop = bm->height; |
@@ -581,15 +589,15 @@ int read_bmp_fd(int fd, | |||
581 | struct bmp_args ba = { | 589 | struct bmp_args ba = { |
582 | .fd = fd, .padded_width = padded_width, .read_width = read_width, | 590 | .fd = fd, .padded_width = padded_width, .read_width = read_width, |
583 | .width = src_dim.width, .depth = depth, .palette = palette, | 591 | .width = src_dim.width, .depth = depth, .palette = palette, |
584 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 592 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
585 | defined(PLUGIN) | 593 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
586 | .cur_row = 0, .cur_col = 0, .part = {0,0} | 594 | .cur_row = 0, .cur_col = 0, .part = {0,0} |
587 | #endif | 595 | #endif |
588 | }; | 596 | }; |
589 | 597 | ||
590 | #if LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) || \ | 598 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) && \ |
591 | defined(PLUGIN) | 599 | defined(HAVE_BMP_SCALING) || defined(PLUGIN) |
592 | #if LCD_DEPTH > 1 | 600 | #if LCD_DEPTH > 1 && defined(HAVE_BMP_SCALING) |
593 | if (resize || cformat) | 601 | if (resize || cformat) |
594 | #endif | 602 | #endif |
595 | { | 603 | { |
@@ -600,12 +608,12 @@ int read_bmp_fd(int fd, | |||
600 | else | 608 | else |
601 | return 0; | 609 | return 0; |
602 | } | 610 | } |
603 | #ifndef PLUGIN | ||
604 | int fb_width = BM_WIDTH(bm->width,bm->format,remote); | ||
605 | #endif | ||
606 | #endif /* LCD_DEPTH */ | 611 | #endif /* LCD_DEPTH */ |
607 | 612 | ||
608 | #ifndef PLUGIN | 613 | #ifndef PLUGIN |
614 | #if (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1)) | ||
615 | int fb_width = BM_WIDTH(bm->width,bm->format,remote); | ||
616 | #endif | ||
609 | int col, row; | 617 | int col, row; |
610 | 618 | ||
611 | /* loop to read rows and put them to buffer */ | 619 | /* 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, | |||
516 | } | 516 | } |
517 | #endif /* HAVE_UPSCALER */ | 517 | #endif /* HAVE_UPSCALER */ |
518 | 518 | ||
519 | #ifndef PLUGIN | 519 | #if !defined(PLUGIN) || LCD_DEPTH > 1 |
520 | static void output_row_native(uint32_t row, void * row_in, struct scaler_context *ctx) | 520 | void output_row_native(uint32_t row, void * row_in, |
521 | struct scaler_context *ctx) | ||
521 | { | 522 | { |
522 | int col; | 523 | int col; |
523 | int fb_width = BM_WIDTH(ctx->bm->width,FORMAT_NATIVE,0); | 524 | 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 | |||
606 | } | 607 | } |
607 | #endif | 608 | #endif |
608 | 609 | ||
610 | #if defined(PLUGIN) && LCD_DEPTH > 1 | ||
611 | unsigned int get_size_native(struct bitmap *bm) | ||
612 | { | ||
613 | return BM_SIZE(bm->width,bm->height,FORMAT_NATIVE,FALSE); | ||
614 | } | ||
615 | |||
616 | const struct custom_format format_native = { | ||
617 | .output_row = output_row_native, | ||
618 | .get_size = get_size_native | ||
619 | }; | ||
620 | #endif | ||
621 | |||
609 | int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | 622 | int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, |
610 | struct rowset *rset, unsigned char *buf, unsigned int len, | 623 | struct rowset *rset, unsigned char *buf, unsigned int len, |
611 | const struct custom_format *format, | 624 | const struct custom_format *format, |
@@ -669,7 +682,7 @@ int resize_on_load(struct bitmap *bm, bool dither, struct dim *src, | |||
669 | ctx.bm = bm; | 682 | ctx.bm = bm; |
670 | ctx.src = src; | 683 | ctx.src = src; |
671 | ctx.dither = dither; | 684 | ctx.dither = dither; |
672 | #ifndef PLUGIN | 685 | #if !defined(PLUGIN) |
673 | ctx.output_row = output_row_native; | 686 | ctx.output_row = output_row_native; |
674 | if (format) | 687 | if (format) |
675 | #endif | 688 | #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 { | |||
149 | }; | 149 | }; |
150 | 150 | ||
151 | struct rowset; | 151 | struct rowset; |
152 | |||
153 | void output_row_native(uint32_t row, void * row_in, | ||
154 | struct scaler_context *ctx); | ||
155 | |||
156 | extern const struct custom_format format_native; | ||
157 | |||
152 | int recalc_dimension(struct dim *dst, struct dim *src); | 158 | int recalc_dimension(struct dim *dst, struct dim *src); |
153 | 159 | ||
154 | int resize_on_load(struct bitmap *bm, bool dither, | 160 | int resize_on_load(struct bitmap *bm, bool dither, |