FS#8308 - Port of a imlib2 based smooth scaling algorithm for bitmaps.

Attached to Project: Rockbox
Opened by Jonas Hurrelmann (jott) - Wednesday, 12 December 2007, 10:37 GMT
Last edited by Nicolas Pennequin (nicolas_p) - Sunday, 06 April 2008, 22:31 GMT
Task Type Patches
Category LCD
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


This patch will add support for smooth scaling of bitmaps based on a imlib2
algorithm. The main code is placed under bmp_smooth_scale.c and made visible
via bmp.h.

It is a drop-in replacement for the just introduced "simple_resize_bitmap":

int smooth_resize_bitmap(struct bitmap *src, struct bitmap *dst);

The algorithm performs a bilinear scaling with different code-pathes, depending
on scaling directions (up or down) as well as scaling down only horizontally or
vertically. Currently the maximum source size is LCD_WIDTHxLCD_HEIGHT, due to
static allocation of some lookup tables.

The patch also renames the plugin based test case from resize_test.c to
test_resize.c, to make it consistent with the other tests and adds it to the
apps CATEGORIES (you still have to add it to SOURCES). The test expects a
bitmap "/test.bmp" for now (which can be up to 200x200px).
This task depends upon

Closed by  Nicolas Pennequin (nicolas_p)
Sunday, 06 April 2008, 22:31 GMT
Reason for closing:  Accepted
Comment by Thomas Martitz (kugel.) - Wednesday, 12 December 2007, 14:00 GMT
Is this meant be an alternative to the bmp_resize patch? Also, what's do you mean with the "just introduced simple_resize_bitmap"?
Comment by Jonas Hurrelmann (jott) - Wednesday, 12 December 2007, 14:11 GMT
This scaling algorithm can be used on runtime, not on load-time of a
bmp file, so it can be used dynamically (e.g. image viewer).
It also gives a much higher quality due to the bilinear interpolation.
But it is clearly related to the bmp_resize patch and open for further
As for "just introduced simple_resize_bitmap" see r15913, the nearest
neighbour algorithm is in SVN now.
Comment by Jacob Brooks (jac0b) - Thursday, 13 December 2007, 13:23 GMT
If we want to use this patch do we need to also apply the bmp-resize patch and then this patch or just use this patch instead of the bmp-resize patch?
Comment by Nicolas Pennequin (nicolas_p) - Thursday, 13 December 2007, 13:28 GMT
jac0b: It's a bit more complicated than that. This patch isn't designed the same way as  FS#5697 . Making use of the functionality provided by this patch requires code changes, not just applying patches.
Comment by Jonas Hurrelmann (jott) - Thursday, 13 December 2007, 17:46 GMT
I updated the patch. Now the algorithm does not need look-up tables anymore
and hence there is no need for static allocations.
Comment by Jacob Brooks (jac0b) - Monday, 14 January 2008, 17:32 GMT
How do you change the picture height and width?
Comment by Nicolas Pennequin (nicolas_p) - Saturday, 26 January 2008, 01:40 GMT
Sync. I also included a change to the slide puzzle plugin to make it use the smooth resize. Apply with -p1.
Comment by David Maliniak (major_works) - Tuesday, 05 February 2008, 02:16 GMT
I'm easily confused, so bear with me. Is this latest "smooth_resize.patch" posted by nicolas_p a new version of the original patch on this tracker page (port of a imlib2-based...)? Or is it instead of the smooth resize patch in  FS#5697 ?
Comment by Nicolas Pennequin (nicolas_p) - Tuesday, 05 February 2008, 13:50 GMT
The patch I posted here is an updated version of the original one from this task.