A quick overview of JPEG2000
JPEG 2000 is an image compression standard, which was created by the Joint Photographic Experts Group committee in the year 2000.
(512x512 RGB), lossy JPEG2000 compression with CUJ2K, at several bit rates. (click to enlarge)
Commandlines: cuj2k -cb 64 -irrev -hq -size 50K/20K/10K lena-512.bmp
|15:1 (50 KB)
||38:1 (20 KB)
||77:1 (10 KB)
Compared to JPEG, JPEG2000 has several advantages: It provides better image quality for a given file size. Especially there are no block artifacts, because in contrast to JPEG it is based on discrete wavelet transform and not on discrete cosine transform (which is performed on 8x8blocks).
Both lossy and lossless compression is included in one common file format; for photos, lossless compression ratio is usually better than PNG.
But the problem with JPEG2000 is that it is very computation-intensive. So we wanted to use CUDA to combine the advantages with high-speed compression.
JPEG2000 consists of several encoding steps that are done consecutively. The first one is the optional preprocessing. Here the picture may be tiled, which means that it is cut into rectangualar, same-sized areas which are further processed independently.
To improve compression, there may also be a DC-shift, which centers the samples around zero, and a multi-component color transform, which transforms images form RGB-color-space to YCBCR-color-space.
Then follows the discrete wavelet transform (DWT) that generates several subbands in different detail levels out of the image. For lossy compression, the wavelet coefficients can be quantized.
The next step is the entropy coder which encodes the DWT coefficients bit plane-wise and does arithmetic encoding. This is the proper compression-step. After the entropy coder (or in some implementations, before it), a rate control algorithm may be run. Rate control reduces the file size by truncating some data while keeping the distortion low.
Afterwards, the data must be ordered correctly according to the standard, where several progression orders (spatial progression, quality progression, ...) are allowed. Then the data is written to the final codestream.