JPEG bounty captured, parrot unharmed
Posted by Steve Revill Thu, 02 Jun 2016 20:06:00 GMT
JPEG images are most commonly encountered from digital cameras or similar real life pictures. They achieve very high compression ratios by relying on the design of the human eye (the one without a patch over it) where brightness detail is more important than colour detail.
Many of the bounties are by their very nature quite wide reaching – the bounty scheme was set up to tackle larger pieces of work than volunteer developers can manage in their limited shore leave. This one in particular involved working on several components of both the operating system ROM and disc applications where JPEG images are accepted.
This has received most work as it is central to RISC OS’ JPEG decoding. The Risc PC was the first machine to include a SpriteExtend module with JPEG capabilities in RISC OS 3.60, loosely based on libjpeg version 4 released in 1993.
JPEGs come in many different varieties now, but at the time of version 4 this was only the baseline type from the standard.
Later, as processing power increased and people started connecting computers together in a wide area network to share images the progressive JPEG was added. This rapidly delivers a coarse image with finer and finer detail being added as more of the file arrives.
Delivering an image in progressively finer detail
Later still, after the patent expired on the more efficient Arithmetic compression algorithm, both arithmetic and progressive arithmetic encoded images became possible.
The number of colour formats also increased beyond the original YUV used in baseline images to add CMYK, YCCK, and RGB colour spaces. The latter also meant it was now possible to create a lossless JPEG starting from an RGB sprite, since the RGB to RGB transform does not lose any information and the subsequent Huffman or Arithmetic compression is already lossless.
Bringing SpriteExtend up to date means it now supports a sea of different formats:
- Extended sequential using Huffman or Arithmetic
- Progressive using Huffman or Arithmetic
- All valid power-of-two subsampling ratios at 8 bits per sample
- YUV, CMYK, YCCK, and RGB colour spaces
- Lossless encoded using RGB colour space (note, this isn’t JPEG-LS/JPEG-2000 which is a different standard entirely)
Where possible ChangeFSI will use the decoder from SpriteExtend, but where that is not possible (for example some of the more esoteric non-power-of-two resampling ratios) it throws the image overboard to djpeg which is the command line decoder in the reference implementation. Also included is cjpeg which can compress a bitmapped image back into a JPEG. Both of these have been updated to version 8d where previously it was using version 6b circa 1998.
This module, provided inside !System, takes lines of sprite image data and returns a baseline JPEG. A few small bugs have been fixed in the module, and a new SWI ‘CompressJPEG_Comment’ has been added which allows JPEG images such as photos to be tagged with text such as where the photo was taken. Although the text isn’t shown as part of the image, many popular editors will provide this in the image information dialogue box.
Any application which hooks into the JPEG SWIs (such as Paint and Draw) will also benefit immediately, though they themselves haven’t been changed – for example dropping a CMYK format picture into Draw would load it.
For reference, the version numbers are
- ChangeFSI 1.58 or later
- SpriteExtend 1.76 or later
- CompressJPEG 0.08 or later
all three of which are based in part on the work of the Independent JPEG Group.
There are many other bounties on the horizon, so if you’ve got some pieces of 8 to spare be sure to surrender them on the bounties page.