FS#6571 - Load WPS .bmp files from a tar file

Attached to Project: Rockbox
Opened by Dave Chapman (linuxstb) - Wednesday, 24 January 2007, 18:46 GMT
Last edited by Dave Chapman (linuxstb) - Monday, 24 March 2008, 09:38 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This is a first, proof-of-concept patch to load wps .bmp files from a .tar file.

This doesn't include patches to the build system, so to create an appropriate .tar file, you need to do something like:

cd wps/iCatcher
awk -vFS="|" '(/^%x[l]?\\|/) {print $3}' ../iCatcher.220x176x16.wps | tar cvf ../iCatcher.tar -T -

and then copy the resulting iCatcher.tar file to the .rockbox/wps/ directory on your player.

As you can see from the above command, this only places the %x[l] bitmaps into the .tar file. The background .bmp file, and the progress bar .bmp files (if they exist) should still go in the normal directory.

The patch has very little error checking at the moment, and has one major limitation which we may or may not wish to retain - the .bmp files in the .tar file must be in the same order as they are referenced in the .wps file.

But if you test, you will see it vastly reduces the loading time for a bitmap-heavy wps.
This task depends upon

Closed by  Dave Chapman (linuxstb)
Monday, 24 March 2008, 09:38 GMT
Reason for closing:  Rejected
Additional comments about closing:  Bitmap strips have achieved the required speed-up and are easier for WPS authors to use than tar files.
Comment by Dominik Riebeling (bluebrother) - Wednesday, 24 January 2007, 19:43 GMT
I worked on tarred themes some months ago (and lost the time for working on it, but not the interest). Looks like I missed posting my results to the tracker, but the main problem was a noticeably speed penalty (which was also discussed on IRC). I guess this was caused because I didn't rely on a specific order of the files inside of the tar file, and as there is no index in tar files itself that slowed down seeking. You can still find my (outdated) patch here:

I think the loading needs to be enhanced to load the image files directly instead of opening every file separately to overcome that speed problem.

I also created an installer for my proposed theme file format, it simply unpacks the theme file to the standard location. See  FS#6156  -- my idea was to use this as intermediate solution to establish our own theme format until it gets implemented in the core.

I'm really interested in single-file themes, but unfortunately won't find the time working on it myself until may. Too much work at uni ...
Comment by Dave Chapman (linuxstb) - Saturday, 27 January 2007, 11:38 GMT
Attached is a patch to wps/ to package the .bmp files in a tar file instead of copying them individually.
Comment by Dave Chapman (linuxstb) - Saturday, 27 January 2007, 11:43 GMT
Oops, I've just realised that my wpsbuild.diff would attempt to create a .tar file even if there are no .bmp files. Here's a corrected version.
Comment by Nicolas Pennequin (nicolas_p) - Wednesday, 09 May 2007, 17:50 GMT
I've updated this patch to work with the new WPS code. Because the bitmap loading in the new code is done at the end of the WPS source parsing, it is now possible to get rid of the original order limitation. This patch reads the tarball in order but there is no requirement on this order anymore.
Comment by Dave Chapman (linuxstb) - Wednesday, 09 May 2007, 19:57 GMT
Here's a synced version of my patch to to build a .tar file. I've noticed one remaining bug though - it creates a directory for bitmaps even if there aren't any.
Comment by Nicolas Pennequin (nicolas_p) - Sunday, 13 May 2007, 16:16 GMT
This script has a problem on targets that have an LCD remote : the tar created with the bitmaps for the RWPS replaces the one with the bitmaps for the WPS, making the WPS lack all its pictures.
Comment by Nicolas Pennequin (nicolas_p) - Saturday, 19 January 2008, 00:24 GMT
Here is an updated version of the patch.
One thing that I think still needs fixing is the backdrop, as it is still loaded from a bmp file. Maybe it would be worth adding code to allow loading a backdrop from an fd.
Also I'd like to remove the duplication between load_wps_bitmaps and load_wps_bitmaps_tar, but I'm not sure it will be possible.

I'd like to know whether this patches improves WPS loading time over regular WPS loading with separate bitmaps.
Comment by Nicolas Pennequin (nicolas_p) - Monday, 21 January 2008, 15:21 GMT
Here is a version with support for loading the backdrop from the tar file.

I think the patch is ready for committing, but still needs some work for remote targets.
Comment by Nicolas Pennequin (nicolas_p) - Monday, 21 January 2008, 16:50 GMT
This version makes the WPS and RWPS use different tar files.

e.g. for iCatcher the tar files will be iCatcher-wps.tar and iCatcher-rwps.tar.