FS#10177 - core jpeg decoder

Attached to Project: Rockbox
Opened by Andrew Mahone (Unhelpful) - Thursday, 30 April 2009, 02:14 GMT
Last edited by Andrew Mahone (Unhelpful) - Saturday, 02 May 2009, 01:38 GMT
Task Type Patches
Category Themes
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Version 3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Core JPEG decoder for all targets with >1bit LCD. This is a port of the plugin jpeg decoder to work in core, along with some other changes. Data is read from disk as needed, IDCT have been split into separate horizontal and vertical passes, allowing different IDCT scaling on each axis, and 16-wide IDCT output is added, allowing for upscaling by 2x during decode (or upscaling chroma channels during IDCT when decoding at 1x). Output is fed to the scaler, and read_jpeg_file and read_jpeg_fd functions are added with call signatures identical to the similar functions for BMP files. Callers for these functions must pass a buffer in the struct bmp that is large enough for decoded image data, the struct jpeg used by the decoder, decode buffers (variable based on scaling and output width) and scaler buffers (variable based on output width). read_jpeg_file is exported in the plugin API, and a test_core_jpeg plugin is provided which will act as a viewer to decode and display one image (use the select button to exit). I have tested on images with 1x2-, 2x1-, 2x2-, and non-subsampled chroma, as well as Y-only images and ones with varying sizes above or below display size and various reset marker intervals.

The test_core_jpeg plugin will need to be enabled by editing apps/plugins/SOURCES. There seems to be some extra blockiness at the borders of 16-wide IDCT blocks - this should be tracked down before commit, these IDCT routines are possibly not ported correctly from the jpeg-7-pre sources.

The compiled object file for the loader is ~22KiB on an ARM color target (Gigabeat S).
This task depends upon

View Dependency Graph

This task blocks these from closing
 FS#10178 - JPEG album art 
Closed by  Andrew Mahone (Unhelpful)
Saturday, 02 May 2009, 01:38 GMT
Reason for closing:  Accepted
Additional comments about closing:  Committed as r20836
Comment by Andrew Mahone (Unhelpful) - Thursday, 30 April 2009, 03:37 GMT
Add API entries correctly (at the end of the struct), bump plugin API version, move huffman table setup to after struct jpeg is moved, so that pointers in huffman tables do not need to be updated as a separate step.
Comment by Andrew Mahone (Unhelpful) - Thursday, 30 April 2009, 10:54 GMT
Apply the pre-round optimization from the 16-point IDCT to the others, saving a few adds in each routine, for a total of ~70B on ARM.