Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#5697 - bmp resize patch

Attached to Project: Rockbox
Opened by takka (takka) - Sunday, 23 July 2006, 03:05 GMT+2
Last edited by Matthias Mohr (aka Massa) (mmohr) - Monday, 23 October 2006, 11:10 GMT+2
Task Type Patches
Category LCD
Status Assigned
Assigned To Matthias Mohr (aka Massa) (mmohr)
Player type All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 90%
Private No

Details

This patch adds the ability to automatically resize bitmaps to a given size when loading from disk.
With this patch the caller of the function "read_bmp_file" is able to tell the function if a resizing
is wanted and for which dimension it is wanted.

The original patch was made by takka - who doesn't seem to be around anymore..
Since version v0.99.6 I maintain it completely and in that version I rewrote the resizing algorithm.
It's now really simple (but with our small LCDs it should not have any noticeable affect):
if a bitmap dimension is bigger than the given max-size, it will just skip some pixels.
if a bitmap dimension is smaller than the given size, it will duplicate some pixels.
If you think that's not good enough, point me to a page where a good resizing algorithm
is described in detail (without floating point calculations) and I'll try to implement
this - although I assume that algorithms which give better looking results are
also more complicated to implement and also consume more CPU time...
So I'm not sure if it would be worth the effort!

The current implementation limits the maximum bitmap width to 1024 pixel
(the height is not limited)!
This may change in future (but only if needed)...

takka initially also added a BMP viewer as an usage example -
I put it in a separate patch because it's only an example which lacks some features, is not
necessary for the usage of the resizing feature and it had not been maintained since takka's initial release!

Currently the resize patch (but not the bmpviewer) is used (and needed) by the albumart patch ( FS#3045 )!

Enjoy and tell me if something does not work ;-)
(the newest patch can always be found at the end of this page...)
This task depends upon

Comment by takka (takka) - Sunday, 23 July 2006, 22:15 GMT+2
"album art wps" need album_art_v5.00.patch
http://www.rockbox.org/tracker/task/3045
Comment by Nicolas Pennequin (nicolas_p) - Monday, 24 July 2006, 02:46 GMT+2
This patch looks great !
I've just played around a bit with it and it seems to work just fine.
The BMP viewer is pretty nice too, but it could use a few improvements if it were to become Rockbox's main bitmap viewer.
Comment by Linus Nielsen Feltzing (linusnielsen) - Monday, 24 July 2006, 10:03 GMT+2
Looks interesting. I know that the BMP reader is almost uncommented, but I would appreciate if your scaling code would have at least one or two comments telling what the code does.

Also, it might be better if the ROCKPAINT_* macros in the bmpviewer would be renamed to BMPVIEWER_x.
Comment by takka (takka) - Monday, 24 July 2006, 15:00 GMT+2
bmp resize patch var.0.99
clean up source code.
add a few comments.

bmpviewer.c
ROCKPAINT_* macro rename BMPVIEWER_*
Comment by Antoine Cellerier (dionoea) - Monday, 24 July 2006, 16:01 GMT+2
Looks neat :)

I haven't tested it yet but i have some questions/comments:
* does the change in rockpaint.c mean that smaller than screen bmp.c will be resized when opened ?
* your scaling patch seems to work on all targets but the bmpviewer doesn't have button definitions for all targets. You might want to add some.
* if loading the bmp fails in the viewer, you should quit instead of displaying a white screen.
* In the long run it might be better to have 1 image viewer with support for all image formats (jpeg, gif(i saw a patch somewhere in the tracker), bmp, png(i'm planing on porting libpng), ...)

Btw, copyright for rockpaint is 2006 and not 2005 (and please use my real name instead of my nick, or better, keep the real name + the email address).
Comment by takka (takka) - Monday, 24 July 2006, 16:25 GMT+2
>>* does the change in rockpaint.c mean that smaller than screen bmp.c will be resized when opened ?
yes.Please change as follows if you do not want to resize it.
ret = rb->read_bmp_file( file, &bm, ROWS*COLS*sizeof( fb_data ),
FORMAT_NATIVE, 0, 0);

>>* your scaling patch seems to work on all targets but the bmpviewer doesn't have button definitions for all targets. You might want to add some.
>>* if loading the bmp fails in the viewer, you should quit instead of displaying a white screen.
It is a test version of the resize. It will improve it in the future.

>>* In the long run it might be better to have 1 image viewer with support for all image formats (jpeg, gif(i saw a patch somewhere in the tracker), bmp, png(i'm planing on porting libpng), ...)
I also think so.

>>Btw, copyright for rockpaint is 2006 and not 2005 (and please use my real name instead of my nick, or better, keep the real name + the email address).
Sorry.Is it good in this though corrected?

Comment by Antoine Cellerier (dionoea) - Monday, 24 July 2006, 16:39 GMT+2
About the resize thing in rockpaint, i think that the best way to handle it would be to not resize smaller than screen bmps (i have to add code to make it possible to save non screen sized bitmaps) and maybe resize bigger than screen bitmaps ... but in the long run i'd want to handle bigger than screen bitmaps without rescaling in rockpaint (i'm not sure what they'd be usefull for on rockbox though).
Comment by takka (takka) - Monday, 24 July 2006, 16:54 GMT+2
To the read_bmp_file() function in the upcoming version, ExpansionOnly/ReductionOnly/Automatic select argument add.
It is thought that it is possible to display it without changing if it is smaller than the screen.
Comment by takka (takka) - Monday, 24 July 2006, 19:15 GMT+2
Ver.0.99.1
BUG fix:Mono bmp some pixels missing

THANKS Ashen.
Comment by takka (takka) - Thursday, 27 July 2006, 00:55 GMT+2
Ver.0.99.2
buffer over fix.
include buffer_Xtension.

I am newly rewriting the source now.
Please wait for Ver.2

Comment by Antoine Cellerier (dionoea) - Friday, 28 July 2006, 16:36 GMT+2
I just though about something that could be usefull: make it possible to know if the bitmap was scaled or not when loading it (like in the return value or a flag in the bitmap structure).
Comment by Max Weninger (maxwen) - Saturday, 12 August 2006, 16:55 GMT+2
Updated patch to compile against CVS HEAD 12.08.2006
Comment by Matthias Mohr (aka Massa) (mmohr) - Sunday, 13 August 2006, 13:43 GMT+2
takka, I have also a wish:
could you please add two additional parameters to read_bmp_file
with which it is possible to tell the resize mechanism to only
resize if
1.) bitmap dimension is bigger than given display dimension
or
2.) bitmap dimension is smaller than given display dimension
or
3.) combination of 1.) and 2.) will resize if smaller or bigger

e.g. define additional flags in gwps.h:
#define WPS_RESIZE_INCREASE 8
#define WPS_RESIZE_DECREASE 16
a call to read_bmp_file could then look like follows:
rc = read_bmp_file(filepath, &temp_bmp, sizeof(temp_bmp),
FORMAT_ANY|FORMAT_TRANSPARENT,
maxwidth, WPS_RESIZE_INCREASE|WPS_RESIZE_DECREASE,
maxheight, WPS_RESIZE_INCREASE|WPS_RESIZE_DECREASE);
(I'm currently in progress of a small update to albumart
and could need such a feature ;-)
Comment by Matthias Mohr (aka Massa) (mmohr) - Sunday, 13 August 2006, 14:11 GMT+2
another thing:
IMHO it's not correct to check against LCD_WIDTH/LCD_HEIGHT
inside read_bmp_file.
Why?
Because you could (theoretically) load bitmaps to different
screens with different sizes.
e.g. it should be possible to load a greyscale image to an
iRiver LCD-remote (which definitely has other dimensions
than LCD_WIDTH/LCD_HEIGHT ;-)
Although I don't know if somebody is really loading bitmaps
to the remote screen...

And I second the suggestion of Antoine that we should know
if the bitmap has been resized during load or not
(for each direction)
how about "width_orig" and "height_orig" elements inside
the bitmap structure?

P.S.: maxwen, thanks that you synced the patch to newer
CVS! But IMHO it should only change its version number
if something changed...
So for CVS-syncs it would be much better if you just use a
timestamp addition to the original version.
(e.g. bmp_resize_v0.99.2_20060812.patch)
Comment by Max Weninger (maxwen) - Sunday, 13 August 2006, 14:17 GMT+2
Sorry for that!
I will do it correct next time :-)
Comment by takka (takka) - Sunday, 13 August 2006, 21:44 GMT+2
I have such an idea.

int read_bmp_file(char* filename, /* file name */
struct bitmap *bm, /* return data */
int maxsize, /* return data size */
int format, /* FORMAT_MONO/FORMAT_NATIVE/FORMAT_ANY | FORMAT_TRANSPARENT */
int src_x1, /* sorce start x */
int src_y1, /* sorce start y */
int src_x2, /* sorce end x */
int src_y2, /* sorce end y */
int dst_width, /* destination width */
int dst_height, /* destination height */
int dst_x1, /* destination start x */
int dst_y1, /* destination start y */
int dst_x2, /* destination end x */
int dst_y2, /* destination end y */
int ratio, /* resize ratio * 1024 (ex. ratio=2.0 -> 2048, ratio=0.5 -> 512) */
int resize_mode /* AUTO(Ratio preservation)/FIT/REDUCE_ONLY/NO_RESIZE */
)
   bmp1.JPG (19.5 KiB)
Comment by Matthias Mohr (aka Massa) (mmohr) - Sunday, 20 August 2006, 11:17 GMT+2
Sorry to say that - but your idea seems way to complicated to me.

Why should positioning of the bitmap be part of the bitmap loading?

And what sense does the ratio make?
Normally there is a bitmap size and a size to which the bitmap should fit.
I would be able to calculate a ration when I know about both sizes.
But
a) the bitmap dimensions are not known before you load the bitmap.
b) why should I want to calculate a ratio? The loading routine could take care of it.
So I can't see any advantage for a ratio...
Maybe I misinterpreted your idea???

And I still like my idea to differentiate between width resizing and height resizing
and enable the possibility to only resize one dimension...
Comment by Matthias Mohr (aka Massa) (mmohr) - Sunday, 20 August 2006, 18:13 GMT+2
I implemented my suggestion and created a new patch version.
The read_bmp_file function has now the following signature:
int read_bmp_File(char *filename,
struct bitmap *bm,
int maxsize,
int format,
int dst_xsize,
int dst_x_resize,
int dst_ysize,
int dst_y_resize);

the resize parameters may be set to:
BMP_RESIZE_NONE - don't resize
BMP_RESIZE_INCREASE - only resize if bitmap size is smaller than given size
BMP_RESIZE_DECREASE - only resize if bitmap size is bigger than given size
BMP_RESIZE_INCREASE | BMP_RESIZE_DECREASE - resize if bitmap size != given size

What do you think about?
Comment by Norbert Preining (norbusan) - Monday, 21 August 2006, 09:54 GMT+2
Build failure with current cvs:
make[2]: *** No rule to make target `/src/iriver/rockbox/bla/build/apps/plugins/bmpviewer.rock', needed by `all'. Stop.
make[1]: *** [rocks] Error 2

I have
- current cvs
- bmp_resize_v0.99.4-MM.20060820
- wps_preload_tags_20060820
- album_art_v5.1.0_TEST-MM_20060820

Any ideas?

Ciao Norbert
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 21 August 2006, 11:55 GMT+2
my failure - I forget to add the new file bmpviewer.c to the patch...

Here is an update version (nothing else changed)
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 21 August 2006, 17:43 GMT+2
Here is another version which fixes a small bug
when either dst_x < 0 or dst_y < 0.
Shouldn't be noticed by anybody (except myself :-)

@takka: could it be that the resizing does not work always?
I tested it with several bitmap sizes and destination sizes
and sometimes I got strange behaviour (no resize at all or
a resize to another size as I set in dst_x, dst_y)
The resulting dst_x and dst_y (which will be set in the bmp
structure as width and height) are always set to the given
sizes, even if the bitmap (after resizing) is smaller than
dst_x and dst_y!
BTW, why _IS_ it smaller?

Increasing smaller bitmaps also seems not to work.
Is this on intend or is it a bug?
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 21 August 2006, 17:47 GMT+2
Ooops - I forgot to attach the file.
Comment by Matthias Mohr (aka Massa) (mmohr) - Friday, 01 September 2006, 23:58 GMT+2
Because I needed a completely working bmp_resize patch
and takka did not answer I had a deeper look at the sources.
I did not understand takka's code (I'm no graphics specialist)
I decided to rewrite the complete resizing code.

So although I call it v0.99.6 it's my first version with completely
different resize code!
The read_bmp_file function looks as follows:
int read_bmp_file(char* filename,
struct bitmap *bm,
int maxsize,
int format,
int dst_maxwidth,
int dst_width_resize, // BMP_RESIZE_INCREASE | BMP_RESIZE_DECREASE
int dst_maxheight,
int dst_height_resize); // BMP_RESIZE_INCREASE | BMP_RESIZE_DECREASE
(actually the same as in v0.99.5 :-)
the given maxwidth/maxheight are (as the name says) only maximum width/heights which
may not be exceeded when resizing.
It are _not_ the sizes which the resized bitmap will get!
The width/height ratio of the original bitmap will always be kept -
so normally only one dimension of the resized bitmap will be the given maxsize,
the other will calculated accordingly to the original width/height ratio...

Increasing and Decreasing should both work and the correct bitmap dimensions will
be given back in the bitmap structure.

I also hope the source code is easy enough to be understandable by other developers ;)
The only thing missing is to optimize and hopefully combine some code parts.
But that can wait...

Tell me if it's working for you or not...
Comment by Matthias Mohr (aka Massa) (mmohr) - Wednesday, 13 September 2006, 23:43 GMT+2
Here's the same version as above.
Synched with today's CVS and splitted into two patches:
One for the resizing code and the other to add the bmpviewer.
The resizing code is (and was) platform independent, but the
bmpviewer code is missing keycode defintions for several platforms.
So it will currently not compile for several platforms (e.g. H10).
The bmpviewer is only example code and not necessary needed so I decided
to put it in an extra patch which has been applied on top of the resize
patch if wanted.

IMHO it should somehow be integrated in the jpegviewer...
(which then would extend it into a "pictureviewer" ;)
Comment by david (dave.d.x) - Wednesday, 11 October 2006, 19:28 GMT+2
bmp_resize_v0.99.6-MM.20060913.patch do not work with current CVS (20061011) :(
Comment by Frederik (freqmod) - Wednesday, 11 October 2006, 22:18 GMT+2
My bmp.c synced from cvs with bmp_resize patch bmp_resize_v0.99.6-MM.20060913.patch and 64 bit datatype fix.
   bmp.c (18.5 KiB)
Comment by david (dave.d.x) - Thursday, 12 October 2006, 20:54 GMT+2
Frederik, pls, how apply it? Thanks.
Comment by Max Weninger (maxwen) - Thursday, 12 October 2006, 21:41 GMT+2
Just replace the bmp.c file after applying the previous patch
Comment by david (dave.d.x) - Thursday, 12 October 2006, 22:33 GMT+2
Sorry, but do not work... pls, update...
Comment by Sacha (Angyman) - Friday, 13 October 2006, 21:34 GMT+2
I get strange colors... brown gets purple... Can someone commit this or is it my fault and the patch is working now again???
Comment by Max Weninger (maxwen) - Friday, 13 October 2006, 21:42 GMT+2
I also discovered that the image quality is lower as with
bmp_resize_v0.99.3.patch when resizing to a lower resolution
e.g. resizing 120x120 to 66x66
The result is much more "pixelated" (best descriptions I can give :))

Comment by Frederik (freqmod) - Saturday, 14 October 2006, 16:21 GMT+2
Patch between bmp.c (cvs) and bmp.c (bmpresize), cd to <rockboxroot> and apply after bmp_resize_v0.99.6-MM.20060913.patch .
   bmp.diff (25.8 KiB)
Comment by Frederik (freqmod) - Saturday, 14 October 2006, 16:21 GMT+2
tested with iPod
Comment by Sacha (Angyman) - Saturday, 14 October 2006, 21:47 GMT+2
Commit: iriver H10 works... (but it looks not like 100% perfect. Cpu consumption raised and one WPS isnt able to update the current time anymore)
Comment by Matthias Mohr (aka Massa) (mmohr) - Sunday, 15 October 2006, 12:26 GMT+2
Here is a sync to today's CVS
- sorry that it took a while - at the moment I'm really busy
with payed work and therefore nearly have no spare time for
rockbox :-(

@maxwen: v0.99.6 uses a complete different algorithm for the resizing.
(as I wrote above, I needed a complete working resizing algorithm
for the albumart; takka's version did not work properly in certain
situations and was unable to understand his algorithm. And it seems
he is no longer available)
I don't have any knowledge of graphical resizing algorithms so I choosed
the easiest which came to my mind: just duplicate pixels when increasing
and remove pixels when decreasing.
I know it's a really lame algorithm but I don't thought it could be noticed
with that small bitmaps...

@Angyman: what do you mean with "Cpu consumption raised"? Compared to what?
If you mean compared to using bitmaps which do not need to be resized it's
normal.
The bigger the original bitmaps are, the more CPU work has to be done...
Maybe another resize algorithm would take less CPU - I don't know one!

@all: point me to the description of resizing algorithms (without floating
point calculations of course) and I'll try to implement them -
although I assume that algorithms which give better looking results are
also more complicated to implement and also consume more CPU time...
So I'm not sure if it would be worth the effort!
Comment by Norbert Preining (norbusan) - Monday, 16 October 2006, 11:57 GMT+2
Hi Matthias!
Umpf, the change 15 Oct 17:50 Mike Sevakis did break it again. Could you resync onc more? Thanks a lot.
Bye
Norbert
Comment by Jon (ace214) - Tuesday, 17 October 2006, 05:30 GMT+2
sync
Comment by Jon (ace214) - Tuesday, 17 October 2006, 08:03 GMT+2
sorry i was dumb and sloppy and broke/didn't update some stuff in that one- it patches but doesnt compile. this one works.
Comment by Sacha (Angyman) - Thursday, 19 October 2006, 00:56 GMT+2
Sorr for the wrong statement... bmpr_resize works perfect... the higher processing time was produced by a bug in another patch. Sorry.
Comment by Douglas Valentine (Dwyloc) - Friday, 20 October 2006, 03:19 GMT+2
With my ipod nano no matter what I do I can’t quit the BMPVIEWER without resorting to rebooting my ipod.
If I read the code correctly pressing the select and menu buttons at the same time should quit but it dose not work here.
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 23 October 2006, 10:52 GMT+2
@Dwyloc: bmpviewer was just a "goodie" from takka - just meant as an example.
It has not been maintained since his initial release...
(that was one of the reasons why I keep it separate from the resize patch)

Sync to todays CVS...
Comment by Douglas Valentine (Dwyloc) - Tuesday, 31 October 2006, 18:38 GMT+2
bmp_resize_v0.99.6-MM.20061023.patch brakes the h120 build.
Comment by Matthias Mohr (aka Massa) (mmohr) - Thursday, 02 November 2006, 10:54 GMT+2
Sync to todays CVS and small fix for targets with LCD_DEPTH != 16
(should now be able to build again...)
Comment by Jakub Matoušek (kubiix) - Saturday, 25 November 2006, 09:48 GMT+2
After the complete rework of apps/recorder/bmp.c the patch need to be synced :/
Comment by Sacha (Angyman) - Thursday, 30 November 2006, 01:02 GMT+2
Yep... the little idiot (sitting here <- ME) is not able to get the bmp.c to get properly patched ;-)
Comment by Matthias Mohr (aka Massa) (mmohr) - Saturday, 02 December 2006, 10:22 GMT+2
The big changes in bmp.c makes it necessary to reimplement the resize patch :-(
I started to do this - but it's more complicated than I thought and my spare
time is currently _very_ limited, so it may still take some time...

@Angyman: it's not your failure, it's currently not possible to use the patch.
Comment by Tan Yu Sheng (Farpenoodle) - Sunday, 03 December 2006, 10:06 GMT+2
In the meantime, it's possible to simply download an older version of bmp.c from cvs and use that instead.
Comment by Jakub Matoušek (kubiix) - Saturday, 20 January 2007, 18:10 GMT+2
any news about syncing ?
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 22 January 2007, 22:51 GMT+2
Sorry, I still had not enough spare time to reimplement it on
base of a newer bmp.c.
Maybe somebody else (Nicolas :-) could find some time to do it...
(or you have to wait a bit longer until I find some more time)
Comment by Nicolas Pennequin (nicolas_p) - Monday, 22 January 2007, 23:26 GMT+2
I did think about it but I won't have time before a while. Currently there's talk of committing the AA patch and that'll most certainly be without bmp resizing. The main devs don't like the approach used in this patch and they want it done another way so AA will use the best way when it comes. I'm focusing on other things like cuesheet support and trying to get some other patches committed.

Matthias, if you plan on rewriting the patch, i suggest you ask the main devs how they want it done rather than simply redoing it the same way as before :)
Comment by Alex Gerchanovsky (shoora) - Friday, 02 February 2007, 10:45 GMT+2
Here is new bmp reader with resize patch. For Gigabeat owners gbpviewer.c created to read proprietary Gigabeat files.
In addition to originally implemented increase/decrease feature flags implemented two more - "fill area" and "ignore aspect ratio". Firest option will make sure that area will be used. Some portions of image can be stripped in process. With "ignore aspect" flag on entire screen area will be used, but image can be stretched(or squezed, if you want :-) in one direction. To see how it works you can use bmpviewer.c, where you can control all that options.
Comment by Norbert Preining (norbusan) - Friday, 02 February 2007, 13:44 GMT+2
Hi Alex!
I tried to compile with these patches but found three things:
- First in gwps-common.c two times the read_bmp_file is called in the wrong way, around line 209 and 323
- (out of sync) the bmpviewer.c should remove the flags at line 141 in the call to rb->creat (see http://svn.rockbox.org/viewvc.cgi/trunk/firmware/font.c?r1=12178&r2=12179)
- finally, something is going wrong with the prototyping/headers, because *within* a plugin the read_bmp_file seems to be defined in a different way, compiling bmpviewer.c gives an error: Too many arguments, but they are right.

But thanks a lot for the update and all the best

Norbert
Comment by Alex Gerchanovsky (shoora) - Saturday, 03 February 2007, 12:11 GMT+2
SVN DIFF did not picked up new files. Here is tested version of patch.
Comment by Jon (ace214) - Monday, 05 February 2007, 02:46 GMT+2
you missed a hunk in gwps-common.c @ line 373. i fixed it in this attachment but i got this error at compiling that i don't know what to do with.

OBJCOPY viewer.rock
make[2]: *** No rule to make target `/home/rockbox/build-video/apps/plugins/
bmpviewer.rock', needed by `all'. Stop.
Comment by takka (takka) - Monday, 05 February 2007, 03:02 GMT+2
Fix for album art resize.
Comment by Matthias Mohr (aka Massa) (mmohr) - Monday, 05 February 2007, 22:07 GMT+2
@shoora: thanks for reimplementing it again. What resize algorithm did you implement?
- I didn't have time to have a look at, but I'll do it sooner or later :-)
Did you talk with the main devs (as Nicolas suggested) what their concerns about my older version were
and how they want it do be done?

@takka: Hey, you're back again - that's really good :-)
Now you could describe your resizing method or even better
write a new patch based on your algorithm...

I also suggest to change the jpegviewer to also support bmp files instead of writing an own bmpviewer
But this is only my suggestion - the main devs should be asked about this, too...
Comment by Alex Gerchanovsky (shoora) - Monday, 05 February 2007, 23:26 GMT+2
Actually, I made hybrid of new bmp reader and old resizing algorithm. May be this resize algorithm far from perfect because it does not make antialiasing, but it looks reasonably well on small screen.
No, I have not talk to anyone in main devs team. I guess they does not care much about album art anyway.
Personally, I need AlbumArt from id3 tags support. So, in background I am moving JPEG decoder in the kernel.
Then BMP reader as is can handle read from mp3 file, because core function accept open file handle from current position, so you can set position in mp3 file to start of image data and ask BMP reader to get theat image.
Comment by leejongchul (crazyman9916) - Friday, 09 February 2007, 00:44 GMT+2
Takka I apply your patch 2/4 build... apply faild..

help me..

with faild message file send it..

24.patch = bmpresize_20070204-broken.patch

25.patch1 = bmpresize_20070204-broken2.patch
Comment by leejongchul (crazyman9916) - Friday, 09 February 2007, 01:29 GMT+2
I apply 2/8 build.. but apply faild..

um..


Comment by Norbert Preining (norbusan) - Friday, 09 February 2007, 01:35 GMT+2
@leejongchul: first: you cannot apply *both* the broken and broken2 patch. And second, what about checking the created .rej file, maybe it is easy to fix yourself.
Comment by leejongchul (crazyman9916) - Friday, 09 February 2007, 01:45 GMT+2
Norbert.. now I apply bmprezie_20070204-broken2.patch..

and making gwps-common.c.rej

***************
*** 373,379 ****
gwps->state->id3->albumart_path );
rc = read_bmp_file(gwps->state->id3->albumart_path,
&temp_bm, data->img_buf_free,
- FORMAT_ANY|FORMAT_TRANSPARENT);
if (rc <= 0) {
gwps->state->id3->albumart_data = NULL;
strcpy(data->cur_displayed_albumart_path, "");
--- 373,381 ----
gwps->state->id3->albumart_path );
rc = read_bmp_file(gwps->state->id3->albumart_path,
&temp_bm, data->img_buf_free,
+ FORMAT_ANY|FORMAT_TRANSPARENT,
+ gui_wps->data->albumart_max_width, gui_wps->data->albumart_max_height,
+ BMP_RESIZE_INCREASE | BMP_RESIZE_DECREASE);
if (rc <= 0) {
gwps->state->id3->albumart_data = NULL;
strcpy(data->cur_displayed_albumart_path, "");

what's wrong?
Comment by Norbert Preining (norbusan) - Friday, 09 February 2007, 01:52 GMT+2
Arggg ..... YOU MUST FIRST APPLY album_art_v5.2_nobmpresize_20061215.patch!!!
Comment by leejongchul (crazyman9916) - Friday, 09 February 2007, 02:45 GMT+2
Thank you for norbert.... really thank you.. !!!

I solve it..


Comment by leejongchul (crazyman9916) - Friday, 09 February 2007, 04:49 GMT+2
I succed apply album_art_v5.2_nobmpresize_20061215.patch and bmpresize_20070204-broken2.patch ..

but build folder type make.. i see error..

what's wrong?

Comment by Norbert Preining (norbusan) - Friday, 09 February 2007, 13:04 GMT+2
Come on, this is NOT a support forum. If you don't know how to do the stuff, please FIRST make yourself confident with the C code ... Take a look at the patches of my build, they maybe will help you!
Comment by Oleh Hradowy (MadCow15) - Monday, 12 February 2007, 21:26 GMT+2
Just a small suggestion, could you make it resize album art after loading another WPS? What happens to me is it doesn't resize the album art after loading a WPS with a different size album art without reloading the song.

Or would that be a bug with the album art patch?
Comment by Alex Gerchanovsky (shoora) - Wednesday, 14 February 2007, 20:30 GMT+2
I am thinking about universal picture viewer for BMP, JPEG, PNG and GIF(?). Then we can run viewer plugin from WPS when album art is changing.
Otherwise solution is to inject support for different image formats in kernel. I am fine with this, but am I sure core developers will strongly disagree.
Comment by Douglas Valentine (Dwyloc) - Tuesday, 06 March 2007, 12:56 GMT+2
I have re-synced the patch to work with the SVN and the current album art patch.

To use the patch first apply album_art.patch from http://www.rockbox.org/tracker/task/3045#comment13690

Then my attached re-synced patch.
Comment by David Hall (Soap) - Friday, 30 March 2007, 10:44 GMT+2
Removed reference to (and attempted use of) non-existant bmpviewer and gbpviewer.

This should fix a warning on most targets, and an error on the Gigabeats.

(and I'm a couple of days behind - tested on svn r12944.)
Comment by Hepdog (007quick) - Tuesday, 10 April 2007, 20:35 GMT+2
The album art patch has changed, this patch needs a sync. error in apps/gui/gui-common.c Some functions are now missing
Comment by Chris Cooper (Psiuyo) - Friday, 13 April 2007, 20:33 GMT+2
Updated the patch to work with the newer AA patch. Works so far for me...
Had to remove two patches to gwps-common.c and added one to wps_parser.c
(be nice, this is my first flyspray upload)
Comment by Dave Hooper (stripwax) - Saturday, 14 April 2007, 11:21 GMT+2
Hi Psiuyo, this patch doesn't apply cleanly for me. It looks like your patch includes an extensive change to gwps-common.c.orig , which is not a regular source file? Did you generate the patch by using the regular "svn diff" or something else? svn diff should generate the right patch files vs the svn repository and ignore non-repository files
Comment by Dave Hooper (stripwax) - Saturday, 14 April 2007, 12:31 GMT+2
This fixed patch works for me.
Comment by Dave Hooper (stripwax) - Saturday, 14 April 2007, 14:16 GMT+2
Hm. Seems like albumart displayed using this patch will always be scaled up or down regardless of the I/D/S flags in the %Cl tag. (e.g. %Cl|x|y|d100|d100 should mean the albumart is scaled down if it's bigger than 100x100 but left alone if it's smaller - but currently it gets scaled up if it's smaller)
Comment by TheKind (TheKind) - Monday, 16 April 2007, 20:45 GMT+2
Not working for me:

Hunk #4 FAILER at 250
Comment by Hepdog (007quick) - Monday, 16 April 2007, 21:25 GMT+2
They just changed something refereeing to the apps/recorder/icon.c file. I think that they removed the last bit of a function. Unfortunetly, my attempts at syncing didn't work out!
Comment by Akio Idehara (idak) - Tuesday, 17 April 2007, 17:02 GMT+2
I re-synced the patch.
Comment by TheKind (TheKind) - Tuesday, 17 April 2007, 17:45 GMT+2
Thx a lot !
Comment by Dave Hooper (stripwax) - Wednesday, 18 April 2007, 01:18 GMT+2
Akio - Does this sync'ed patch work? It seems that read_bmp_file fails to load customised iconsets because the iconset bitmap is too high. The error I get (on ipod5g sim) is for example: read_bmp_file: error - Bitmap is too big (13 x 384 pixels, screen is 320 x 240). Did I patch incorrectly?
Comment by Akio Idehara (idak) - Wednesday, 18 April 2007, 16:47 GMT+2
I changed the code that compares the output image size and LCD size.
Please look at the patch about details.
I tested customized iconsets, and it works fine...
Comment by Dave Hooper (stripwax) - Wednesday, 18 April 2007, 23:00 GMT+2
Thanks Akiro. I see that in the patch, I apologies - that hunk failed on mine due to other changes and I'd not noticed - your patch works great! sorry!
Comment by Travis Tooke (tdtooke) - Friday, 27 April 2007, 05:10 GMT+2
Needs resync, there isn't a apps/recorder/backdrop.c anymore.
Comment by takka (tfact) - Friday, 27 April 2007, 12:13 GMT+2
apps/recorder/backdrop.c move to apps/gui/backdrop.c
Comment by Travis Tooke (tdtooke) - Saturday, 28 April 2007, 09:42 GMT+2
Thanks, feel kinda silly now since that was so simple.
Comment by Hepdog (007quick) - Monday, 30 April 2007, 19:13 GMT+2
Synced hopefully:) Works for me!
Comment by Peter Nollanger (Elle) - Thursday, 17 May 2007, 00:39 GMT+2
i got an error when patching the current daily source (20070516):
file: /apps/gui/gwps-common.c
Hunk #1 failed at 596

Is there something I can do about that?


Comment by Travis Tooke (tdtooke) - Tuesday, 26 June 2007, 02:21 GMT+2
This might help, this is my personal copy of this patch. Apply it using -p1.
Comment by josh (joshunhappy) - Tuesday, 03 July 2007, 07:33 GMT+2
hello.. [for every one] maybe i'm about to make a silly quiestion but... i need.. i'm new in this and i'm trying to configure mi sansa e250 y instaled rockbox and DockPodAA WPS.. but it said that i need a patch but i donknow now where to put it.. can somebody helpme [sorry].. PLEASE I NEED HELP... by the way.. as you can see i'm not an english speaker so sorry about that too
Comment by josh (joshunhappy) - Tuesday, 03 July 2007, 07:33 GMT+2
hello.. [for every one] maybe i'm about to make a silly quiestion but... i need.. i'm new in this and i'm trying to configure mi sansa e250 y instaled rockbox and DockPodAA WPS.. but it said that i need a patch but i donknow now where to put it.. can somebody helpme [sorry].. PLEASE I NEED HELP... by the way.. as you can see i'm not an english speaker so sorry about that too... you can talkme on joshunhappy@hotmail.com thx
Comment by Cam (GreyhoundGuy) - Sunday, 26 August 2007, 03:43 GMT+2
I got an error while trying to use this patch on today's daily source (20070825):
file: /apps/gui/gwps-common.c
Hunk #1 failed at 592

What could I do to fix this?
Comment by Cam (GreyhoundGuy) - Sunday, 26 August 2007, 06:08 GMT+2
Ok, I figured out what my problem was. I just needed to apply the album art patch first, as was stated earlier on by Douglas.
Comment by benoit (snk4ever) - Wednesday, 03 October 2007, 17:08 GMT+2
I can not apply this patch on the recent SVNs (I tried on the 20071003).
Anybody else being succesful ?
I'd like to make a build for the gigabeat with both Zune Thelme support and the new videoplayer, this patch is the only thing that still prevents me from succeeding.
Thanks for your help !
Comment by Jacob Brooks (jac0b) - Thursday, 04 October 2007, 00:20 GMT+2
It patched fine for me on SVN 14973
Comment by benoit (snk4ever) - Thursday, 04 October 2007, 11:21 GMT+2
It patched on today's svn r14976, sorry for the wrong alert, I probably did something wrong yesterday !
Comment by Akio Idehara (idak) - Friday, 05 October 2007, 18:54 GMT+2
Fix tab mixed indent that brings on a headache.
No functionality changes for the patch...
Comment by Jeton Aliji (jeton) - Tuesday, 30 October 2007, 22:59 GMT+2
Any plans to improve the resizing algorithm?
The current resizing method makes the album art images appear jaggy.
It can be solved if you resize the images with an image editor, but themes don't use a strict width and height and therefore image editing isn't a solution.
Comment by Travis Tooke (tdtooke) - Sunday, 11 November 2007, 04:28 GMT+2
Didn't do a single thing with any algorithms, just synced it:
Comment by JerryLange (psycho_maniac) - Monday, 12 November 2007, 01:33 GMT+2
i think this needs to be fixed. Im getting hunk errors.
Comment by Nicolas Pennequin (nicolas_p) - Monday, 12 November 2007, 01:39 GMT+2
It's no surprise that it's broken due to committing the AA patch... I plan on implementing resizing, but I don't know when I'll do it.
Comment by Travis Tooke (tdtooke) - Monday, 12 November 2007, 07:47 GMT+2
Quick and dirty sync. I don't like the way I handled this, but it works..
Comment by Michael Sevakis (MikeS) - Tuesday, 13 November 2007, 16:34 GMT+2
Here's some faster image stretching/squeezing code that uses no division in the loops and is compact. Will be used for thumbnailing in mpegplayer but I thought I'd share it for this purpose. It uses nearest-neighbor resizing (no fancy interpolation/filtering). Should be easy-as-pie to adapt here.
Comment by Travis Tooke (tdtooke) - Wednesday, 14 November 2007, 01:45 GMT+2
Looks good, thanks! idak, you want to take a stab at this? I just took a good look at bmp.c and my head started hurting.
Comment by Akio Idehara (idak) - Thursday, 15 November 2007, 15:37 GMT+2
I think it looks good too.
But I'm so busy and I have no time to try it...
Comment by Thomas Martitz (kugel.) - Sunday, 18 November 2007, 14:54 GMT+2
Is there any chance to have this patch working with the current album art implementation?
Comment by takka (tfact) - Friday, 07 December 2007, 23:01 GMT+2
sync current album art implementation
Comment by Travis Tooke (tdtooke) - Friday, 07 December 2007, 23:37 GMT+2
@takka, what did you do for top-down bmp support? On my version I have:
if (src_h < 0) { /* Top-down BMP file */
src_h = -src_h;
rowstart = 0;
rowstop = src_h;
rowstep = 1;
} else { /* normal BMP */
rowstart = src_h - 1;
rowstop = -1;
rowstep = -1;
}
and used rowstart etc. as they were originally used in the declaration of the for loop to put it in the buffer in bmp.c.
Comment by JerryLange (psycho_maniac) - Sunday, 16 December 2007, 19:56 GMT+2
I would love to offer testing help with this. I have the sansa e260, ipod5.5g video, and the gigabeat F40. I really think its pointless to convert all my album art to 100x100 when there is a patch in the patch tracker that will automatically resize my art for me. So I would like to help test this. Does the newest patch work in svn and with album art?
Comment by Jacob Brooks (jac0b) - Monday, 17 December 2007, 14:00 GMT+2
I think pictureflow broke this patch. It will not make with this patch applied.
Comment by JerryLange (psycho_maniac) - Monday, 17 December 2007, 21:08 GMT+2
I think your right. I tried compiling last night with this patch and it wouldn't get past the "make rocks" portion of compiling.
Comment by David Maliniak (major_works) - Wednesday, 02 January 2008, 01:49 GMT+2
Anyone up to the task of making this work with current SVN? I would if I could...
Comment by Thomas Martitz (kugel.) - Wednesday, 02 January 2008, 01:59 GMT+2
You need to add 3 parameters (e.g. PREFERRED_IMG_WIDTH, PREFERRED_IMG_HEIGHT and 0 this is what I use) in the call of read_bmp_file (something like that) in apps/plugins/prictureflow.c. It will compile, but it will not resize properly within PictureFlow, at least not with the parameters I gave you.
Comment by David Maliniak (major_works) - Wednesday, 02 January 2008, 16:32 GMT+2
Thanks, Kugel... but in looking through pictureflow.c, I'm not finding a function named read_bmp_file. There is one called create_bmp. I do see the definitions of PREFERRED_IMG_WIDTH and _HEIGHT in lines 88 to 94. Otherwise, I'm unsure as to where in pictureflow.c to add the parameters. Any help would be appreciated.
Comment by Thomas Martitz (kugel.) - Wednesday, 02 January 2008, 16:42 GMT+2
It's line 607 in the latest revision.
Comment by David Maliniak (major_works) - Wednesday, 02 January 2008, 16:48 GMT+2
Yep... just found that moments before you posted. Thanks!
Comment by Akio Idehara (idak) - Sunday, 20 January 2008, 12:11 GMT+2
Here is new albumart resize implementation.
This patch only impacts albumart resize (and not for all bmp function).
Comment by Akio Idehara (idak) - Sunday, 20 January 2008, 12:46 GMT+2
Add some optimization code.
Comment by Travis Tooke (tdtooke) - Sunday, 20 January 2008, 19:53 GMT+2
Very nice. Small, precise, can't beat it with a stick! I think this version is very committable.
Comment by Nicolas Pennequin (nicolas_p) - Sunday, 20 January 2008, 21:01 GMT+2
It does have the problem of a rather big static buffer.
Comment by David Maliniak (major_works) - Monday, 21 January 2008, 07:07 GMT+2
It also has the problem of not working very well, at least for me. Album art is *not* resized with this patch in my own build, it seems.
Comment by david (dave.d.x) - Monday, 21 January 2008, 07:27 GMT+2
Not working.Why?Compiling without problem.
Comment by Akio Idehara (idak) - Monday, 21 January 2008, 13:47 GMT+2
change from static buffer to buffer_alloc() in initialization.
Comment by Akio Idehara (idak) - Monday, 21 January 2008, 14:48 GMT+2
change from buffer_alloc() to wps_data->img_buf.
This patch does not have any specific big buffer...
Comment by Nicolas Pennequin (nicolas_p) - Monday, 21 January 2008, 14:52 GMT+2
That's a better approach, but I see no boundary check on the WPS bitmap buffer, so if the resized bitmap is too big there'll be out of bounds access. output_size needs to be checked against data->img_buf_free before any resizing is done.
Comment by Akio Idehara (idak) - Monday, 21 January 2008, 15:34 GMT+2
Add boundary check for the resized album art size.

@nico: Thank you for these advices.
I can improve my implementation by that.
Comment by Akio Idehara (idak) - Monday, 21 January 2008, 17:17 GMT+2
add tmp value to access fixed struct member.
No functionality changes.
Comment by David Maliniak (major_works) - Tuesday, 22 January 2008, 05:27 GMT+2
FYI... still not working, at least not in a Viewports-enabled build.
Comment by Travis Tooke (tdtooke) - Tuesday, 22 January 2008, 08:54 GMT+2
Interesting, on my iPod 5.5g 30gig it is working.
Comment by Akio Idehara (idak) - Tuesday, 22 January 2008, 13:50 GMT+2
Album art format: %Cl|x|y|[[l|c|r][d|i|s]mwidth]|[[t|c|b][d|i|s]mheight]|

Additional flags are the following.

maxwidth:
- d: decrease image
- i: increase image
- s: decrease or increase image
maxwidth:
- d: decrease image
- i: increase image
- s: decrease or increase image

ex:
%Cl|0|0|s100|s100|
%C

If you try viewport-build with this patch,
please refer to the latest jClix_Night_VP.zip at
http://www.rockbox.org/tracker/task/8385?histring=viewport
Comment by David Maliniak (major_works) - Thursday, 24 January 2008, 03:10 GMT+2
I downloaded and installed the version of jClix_night_VP posted on  FS#8385  on January 5. While I'd agree that it seems to correct the .bmp resizing, the theme has other problems on my Sansa. But I'll poke around in the .wps file for learning purposes. Thanks.