mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
buffering: ensure sufficient buffer size loading bitmaps
Commits5aa0fc3
and32f1418
(g#4451, g#4452) changed the amount of space that was allocated for loading bitmaps used to display album art. Testing revealed that the size of the JPEG decode buffer can reach up to (38 * 1024)B in some cases. When the limit is reached, additional space is required by the resize_on_load function. Change-Id: If93b45754a4f5948b6160f659182e4618e01912e
This commit is contained in:
parent
05b070b0b8
commit
b06073f771
2 changed files with 8 additions and 2 deletions
|
@ -975,8 +975,14 @@ int bufopen(const char *file, off_t offset, enum data_type type,
|
||||||
* TODO: don't add unncessary overhead for .bmp images! */
|
* TODO: don't add unncessary overhead for .bmp images! */
|
||||||
size += JPEG_DECODE_OVERHEAD;
|
size += JPEG_DECODE_OVERHEAD;
|
||||||
#endif
|
#endif
|
||||||
}
|
/* resize_on_load requires space for 1 line + 2 spare lines */
|
||||||
|
#ifdef HAVE_LCD_COLOR
|
||||||
|
size += sizeof(struct uint32_argb) * 3 * aa->dim->width;
|
||||||
|
#else
|
||||||
|
size += sizeof(uint32_t) * 3 * aa->dim->width;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
#endif /* HAVE_ALBUMART */
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
size = filesize(fd);
|
size = filesize(fd);
|
||||||
|
|
|
@ -2231,7 +2231,7 @@ int read_jpeg_fd(int fd,
|
||||||
const size_t JPEG_DECODE_OVERHEAD =
|
const size_t JPEG_DECODE_OVERHEAD =
|
||||||
/* Reserve an arbitrary amount for the decode buffer
|
/* Reserve an arbitrary amount for the decode buffer
|
||||||
* FIXME: Somebody who knows what they're doing should look at this */
|
* FIXME: Somebody who knows what they're doing should look at this */
|
||||||
(32 * 1024)
|
(38 * 1024)
|
||||||
#ifndef JPEG_FROM_MEM
|
#ifndef JPEG_FROM_MEM
|
||||||
/* Unless the struct jpeg is defined statically, we need to allocate
|
/* Unless the struct jpeg is defined statically, we need to allocate
|
||||||
* it in the bitmap buffer as well */
|
* it in the bitmap buffer as well */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue