From 5621fd393a4445645b07bb2e89d89d23bb9a6473 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Thu, 7 May 2009 01:23:13 +0000 Subject: [PATCH] Build pictureflow using overlay on lowmem targets, support JPEG AA in PF on all targets. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20864 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/SOURCES | 5 +- apps/plugins/SUBDIRS | 3 + apps/plugins/pictureflow/SOURCES | 1 + apps/plugins/{ => pictureflow}/pictureflow.c | 9 +-- apps/plugins/pictureflow/pictureflow.make | 58 ++++++++++++++++++++ apps/recorder/albumart.c | 18 +++--- tools/buildzip.pl | 5 ++ 7 files changed, 79 insertions(+), 20 deletions(-) create mode 100644 apps/plugins/pictureflow/SOURCES rename apps/plugins/{ => pictureflow}/pictureflow.c (99%) create mode 100644 apps/plugins/pictureflow/pictureflow.make diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES index e8d76441b5..a695478e40 100644 --- a/apps/plugins/SOURCES +++ b/apps/plugins/SOURCES @@ -55,10 +55,6 @@ text_editor.c wavview.c robotfindskitten.c -#if defined(HAVE_TAGCACHE) -pictureflow.c -#endif - #ifdef HAVE_LCD_COLOR ppmviewer.c #endif @@ -109,6 +105,7 @@ zxbox.c /* overlay loader for Goban */ #if (PLUGIN_BUFFER_SIZE < 0x10000) && !defined(SIMULATOR) goban.c +pictureflow.c #endif /* not support recorder models for now */ diff --git a/apps/plugins/SUBDIRS b/apps/plugins/SUBDIRS index af5e1d0c0e..597df41b8f 100644 --- a/apps/plugins/SUBDIRS +++ b/apps/plugins/SUBDIRS @@ -16,6 +16,9 @@ rockboy /* For all targets with a bitmap display */ #ifdef HAVE_LCD_BITMAP +#ifdef HAVE_TAGCACHE +pictureflow +#endif chessbox jpeg sudoku diff --git a/apps/plugins/pictureflow/SOURCES b/apps/plugins/pictureflow/SOURCES new file mode 100644 index 0000000000..7d21cec526 --- /dev/null +++ b/apps/plugins/pictureflow/SOURCES @@ -0,0 +1 @@ +pictureflow.c diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c similarity index 99% rename from apps/plugins/pictureflow.c rename to apps/plugins/pictureflow/pictureflow.c index 7261d7a402..82dc9748ec 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -957,13 +957,8 @@ 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 */ @@ -1648,7 +1643,7 @@ void render_slide(struct slide_data *slide, const int alpha) pixel -= pixelstep; } } - p = (bmp->height-DISPLAY_OFFS) * PFREAL_ONE; + p = (bmp->height-DISPLAY_OFFS) * PFREAL_ONE; plim = MIN(sh * PFREAL_ONE, p + (LCD_HEIGHT/2) * dy); int plim2 = MIN(MIN(sh + REFLECT_HEIGHT, sh * 2) * PFREAL_ONE, p + (LCD_HEIGHT/2) * dy); @@ -2556,7 +2551,7 @@ enum plugin_status plugin_start(const void *parameter) #ifdef HAVE_ADJUSTABLE_CPU_FREQ rb->cpu_boost(true); #endif -#if PLUGIN_BUFFER_SIZE > 0x10000 +#if PLUGIN_BUFFER_SIZE > 0x10000 && 0 buf = rb->plugin_get_buffer(&buf_size); #else buf = rb->plugin_get_audio_buffer(&buf_size); diff --git a/apps/plugins/pictureflow/pictureflow.make b/apps/plugins/pictureflow/pictureflow.make new file mode 100644 index 0000000000..c1fb1f3957 --- /dev/null +++ b/apps/plugins/pictureflow/pictureflow.make @@ -0,0 +1,58 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# + +PICTUREFLOW_SRCDIR = $(APPSDIR)/plugins/pictureflow +PICTUREFLOW_OBJDIR = $(BUILDDIR)/apps/plugins/pictureflow + +PICTUREFLOW_SRC := $(call preprocess, $(PICTUREFLOW_SRCDIR)/SOURCES) +PICTUREFLOW_OBJ := $(call c2obj, $(PICTUREFLOW_SRC)) + +OTHER_SRC += $(PICTUREFLOW_SRC) + +ifndef SIMVER +ifneq (,$(strip $(foreach tgt,RECORDER ONDIO,$(findstring $(tgt),$(TARGET))))) + ### lowmem targets + ROCKS += $(PICTUREFLOW_OBJDIR)/pictureflow.ovl + PICTUREFLOW_OUTLDS = $(PICTUREFLOW_OBJDIR)/picutreflow.link + PICTUREFLOW_OVLFLAGS = -T$(PICTUREFLOW_OUTLDS) -Wl,--gc-sections -Wl,-Map,$(basename $@).map +else + ### all other targets + ROCKS += $(PICTUREFLOW_OBJDIR)/pictureflow.rock +endif +else + ### simulator + ROCKS += $(PICTUREFLOW_OBJDIR)/pictureflow.rock +endif + +ifeq ($(CPU),sh) +# sh need to retain its' -Os +PICTUREFLOWFLAGS = $(PLUGINFLAGS) +else +PICTUREFLOWFLAGS = $(filter-out -O%,$(PLUGINFLAGS)) -O2 +endif + +$(PICTUREFLOW_OBJDIR)/pictureflow.rock: $(PICTUREFLOW_OBJ) + +$(PICTUREFLOW_OBJDIR)/pictureflow.refmap: $(PICTUREFLOW_OBJ) + +$(PICTUREFLOW_OUTLDS): $(PLUGIN_LDS) $(PICTUREFLOW_OBJDIR)/pictureflow.refmap + $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \ + $(TOOLSDIR)/ovl_offset.pl $(PICTUREFLOW_OBJDIR)/pictureflow.refmap)) + +$(PICTUREFLOW_OBJDIR)/pictureflow.ovl: $(PICTUREFLOW_OBJ) $(PICTUREFLOW_OUTLDS) + $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \ + $(filter %.o, $^) \ + $(filter %.a, $+) \ + -lgcc $(PICTUREFLOW_OVLFLAGS) + $(call PRINTS,LD $(@F))$(OC) -O binary $(basename $@).elf $@ + +# special pattern rule for compiling pictureflow with extra flags +$(PICTUREFLOW_OBJDIR)/%.o: $(PICTUREFLOW_SRCDIR)/%.c $(PLUGINBITMAPLIB) $(PICTUREFLOW_SRCDIR)/pictureflow.make + $(SILENT)mkdir -p $(dir $@) + $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PICTUREFLOWFLAGS) -c $< -o $@ diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index da85f99bbc..24b01f9c52 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) 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 defined(HAVE_JPEG) || (defined(PLUGIN) && PLUGIN_BUFFER_SIZE > 0x10000) +#if defined(HAVE_JPEG) || defined(PLUGIN) pathlen = snprintf(path, sizeof(path), "%scover%s.", dir, size_string); found = try_exts(path, pathlen); diff --git a/tools/buildzip.pl b/tools/buildzip.pl index ea902ddb9a..6b90dfa4a6 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl @@ -326,6 +326,11 @@ STOP if ($line =~ /([^,]*),(.*)/) { my ($plugin, $dir)=($1, $2); move("$rbdir/rocks/${plugin}.rock", "$rbdir/rocks/$dir/${plugin}.rock"); + if(-e "$rbdir/rocks/${plugin}.ovl") { + # if there's an "overlay" file for the .rock, move that as + # well + move("$rbdir/rocks/${plugin}.ovl", "$rbdir/rocks/$dir"); + } } }