Lossless Image Compression Using The Discrete Cosine Transform
Lossless Image Compression Using The Discrete Cosine Transform
2. THE ALGORITHM
In this paper, a new method to achieve lossless compression of
two-dimensional images based on the discrete cosine transform The DCT has long been used as a method for image
(DCT) is proposed. This method quantizes the high-energy coding and has now become the standard for video coding
DCT coefficients in each block, finds an inverse DCT from [2]. Its energy compaction capability makes it ideal for
only these quantized coefficients, and forms an error residual efficient representation of images. Given a square image
sequence to be coded. The number of coefficients used in this block F of size m by m, an m by m matrix C is defined by
scheme is determined by using a performance metric for com- the equation:
pression. Furthermore, a simple differencing scheme is per-
formed on the coefficients that exploits correlation between 1
high energy DCT coefficients in neighboring blocks of an image. Cij 5 i50 j50...m21
The resulting sequence is compressed by using an entropy coder, Ïm
and simulations show the results to be comparable to the differ-
ent modes of the lossless JPEG standard. 1997 Academic Press 5 !n2 cos (2i 12m1) jf i 5 1 . . . m 2 1 j 5 0 . . . m 2 1.
Thus the DCT of F is defined as
1. INTRODUCTION
f 5 CFCT (1)
Compression of images is of great interest in applications
where efficiency with respect to data storage or transmis- The DCT is a unitary transform, meaning that the inversion
sion bandwidth is sought. Traditional transform-based can be accomplished by
methods for compression, while effective, are lossy. In
certain applications, even slight compression losses can F 5 CTfC. (2)
have enormous impact. Biomedical images or synthetic-
aperture radar images are examples of imagery in which Unfortunately, the DCT coefficients, i.e., the entries in f,
compression losses can be serious. are evaluated to infinite precision. In traditional coding
The discrete cosine transform (DCT) has been applied methods based on the DCT, all compression and all losses
extensively to the area of image compression. It has excel- are determined by quantization of the DCT coefficients.
lent energy-compaction properties, and as a result has been Even for lossless image compression, this problem cannot
chosen as the basis for the Joint Photography Experts’ be avoided, because storing the coefficients to their full
Group (JPEG) still-picture compression standard. How- precision (which is determined by the machine one is using)
ever, losses usually result from the quantization of DCT would not yield any compression. What is proposed is to
coefficients, where this quantization is necessary to achieve evaluate all entries of the DCT matrix out to only B digits
compression. In this paper, an alternative lossless method past the decimal point. This means that the DCT coeffi-
is proposed which takes advantage of not only the energy cients will have precision out to 2B digits past the decimal
compaction properties of the DCT, but also the correlation point. A major consequence of this action is that the re-
that exists between high-energy coefficients in neighboring sulting DCT matrix is no longer unitary, and the inverses
transformed blocks of data. of the DCT matrix and its transpose must be evaluated
explicitly, i.e.,
* Supported by NASA Grant NAGW 3293 obtained through the Mi-
croelectronics Research Center, The University of New Mexico.
F 5 C21f(CT)21. (3)
21
1047-3203/97 $25.00
Copyright 1997 by Academic Press
All rights of reproduction in any form reserved.
22 MANDYAM, AHMED, AND MAGOTRA
to 8 bits per pixel. The original images are shown in Figs. experiments it was found that after deriving the DCT coef-
2–4. An 8 by 8 block was used to obtain the DCT coeffi- ficients for each block, the precision of these coefficients
cients. By using the potential compression statistic, it was could be reduced by a factor of 1000 (i.e. three decimal
found that the optimal value for w was 3 for all of the digits) without affecting the first-order entropy of the error
test images. The value for B was two; moreover, in all residuals; the advantage of this is a reduction in first-order
entropy of the DCT coefficients. The proposed method
was compared to seven fixed filters for the present lossless
JPEG standard (given in Table 1) [10], with the first-order
entropy of the error residuals for both methods given Table
2, where the proposed method is designated by ‘‘MDCT,’’
denoting modified DCT. There are three overhead values
per block for the MDCT method; for a 256 by 256 image,
this implies that there are 3072 overhead values assuming
a block size of 8 by 8. For the JPEG lossless filters, the
overhead is practically nothing, except for a handful of
TABLE 1
Prediction Modes for Lossless JPEG (a Is a Left-Neighboring
Pixel, b Is an Upper-Neighboring Pixel, and c Is an Upper-
Left-Neighboring Pixel)
Lossless JPEG filter Method of prediction
JPEG 1 a
JPEG 2 b
JPEG 3 c
JPEG 4 a1b2c
JPEG 5 a 1 (b 2 c)/2
JPEG 6 b 1 (a 2 c)/2
JPEG 7 (a 1 b)/2
FIG. 3. Baboon.
24 MANDYAM, AHMED, AND MAGOTRA
TABLE 2 TABLE 4
Entropy Results for Test Images (bits/value) Compression Results for Rice Coding
Cameraman Baboon Moon Cameraman Baboon Moon
TABLE 3 TABLE 5
Projected Compression Results for Test Images Compression Results for Adaptive Huffman Coding
Cameraman Baboon Moon Cameraman Baboon Moon
4. CONCLUSIONS