0% found this document useful (0 votes)
114 views6 pages

Lossless Image Compression Using The Discrete Cosine Transform

Uploaded by

Tushar Shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views6 pages

Lossless Image Compression Using The Discrete Cosine Transform

Uploaded by

Tushar Shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

JOURNAL OF VISUAL COMMUNICATION AND IMAGE REPRESENTATION

Vol. 8, No. 1, March, pp. 21–26, 1997


ARTICLE NO. VC970323

Lossless Image Compression Using the Discrete Cosine Transform


Giridhar Mandyam,*,† Nasir Ahmed,‡ and Neeraj Magotra‡
†Texas Instruments Inc., P.O. Box 660199, Dallas, Texas 75266-0199, ‡Department of Electrical and Computer Engineering,
University of New Mexico, Albuquerque, New Mexico 87131

Received March 6, 1995; accepted March 14, 1996

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

boring block; in this paper, the block immediately to the


left is chosen, except for any of the leftmost blocks in the
image, which use the block immediately above. As a result,
the high energy coefficients are decorrelated between
blocks, and the overall first-order entropy of the resulting
data is decreased. In addition, the entropy of the entries
of E are of lower entropy than the original data matrix;
therefore, a suitable entropy coder can be used, such as an
adaptive Huffman coder or an arithmetic coder. Moreover,
since we are transmitting error residuals, the choice of
the parameter B, which determines the precision of the
transmitted DCT coefficients, becomes less crucial, as in-
creasing B will result in little decrease of E in many cases.
For instance, in the 8 by 8 case, experimentation showed
that B 5 2 was adequate to achieve maximal compression
FIG. 1. Highest to lowest energy coefficients.
(as stated before, for B 5 1 the DCT matrix inverses do
not exist in the 8 by 8 case). The minimum choice of B is
case-dependent.

Of course, one must choose B such that these inverses


2.1. Determination of w
exist. For instance, in the case where B is 1, i.e., the entries
of C are evaluated to only one place beyond the decimal As one increases the number of high-energy coefficients
point, the inverse matrix does not exist in the 8 by 8 pixel retained, the first-order entropy of the entries of E steadily
block case. Since the entire operation involves matrix decreases. Unfortunately, a tradeoff exists in that the mem-
multiplications, a total of 2m 3 multiplications and 2m 2 ory required to store the high-energy coefficients increases,
(m 2 1) additions are required to evaluate all the entries since, even with differencing, these coefficients are still of
of F in (3). relatively high entropy. So one must find a middle point,
Once the DCT coefficients have been computed, we and to do so, the following performance metric called the
retain only w high energy coefficients to be used for the potential compression statistic, p, is proposed:
calculation of an approximation to the original data matrix
F. One needs to choose w such that a desired amount of
energy compaction is obtained. The high-energy coeffi- p(w) 5 O hNo. of bits needed to store w
i
cients in general will appear in the same locations inside (5)
coefficients at block i 1
f; e.g. the three highest-energy coefficients always appear
in f00 , f01 , and f11 , the upper-left corner of f (for a detailed First Order entropy of E at block ij. (6)
discussion, see [3]). In Fig. 1, the high to low energy coeffi-
cients are scanned for an 8 by 8 DCT block. The remaining
DCT coefficients are assumed to be zero. Then the inverse- As w increases from 1 to m 2 (each data block being m by
DCT is calculated (without assuming unitarity) and a re- m pixels), p(w) will reach a global minimum. The value of
sulting matrix Fn results. From this, an error residual ma- w at that minimal p(w) is the value used for that particular
trix E can be defined: image. The main reason that p would vary from one image
to another is that a particular scan (Fig. 1) of the high to
low energy coefficients in each block has been chosen, and
Eij 5 Fij 2 Fnij . (4)
this scan may not correspond to the actual ordering of
these coefficients in a particular block [6]. However, the
By retaining E and the w quantized DCT coefficients,
scan that has been chosen has been shown to be optimal
perfect reconstruction of F can be achieved.
under the assumption that the data follows a first-order
After selecting the high energy DCT coefficients, we
Markov process [7].
perform linear prediction on the nonzero DCT coefficients
by using a simple differencing scheme. Between neigh-
boring blocks there exists some correlation between the 3. EXPERIMENTS
corresponding high energy coefficients. After specifying w
of these high energy coefficients, each of these coefficients The algorithm was tested on three standard grayscale
can be encoded as the error residual resulting from sub- 256 by 256 pixel images (from the University of Southern
tracting the corresponding DCT coefficient from a neigh- California’s image processing database), each quantized
LOSSLESS IMAGE COMPRESSION USING THE DCT 23

FIG. 2. Cameraman. FIG. 4. Moon.

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

Original image 6.90 6.78 6.81 MDCT 32.19% 16.35% 32.43%


MDCT error residuals 5.71 6.57 5.17 JPEG 1 31.21% 15.32% 30.42%
MDCT overhead 4.89 5.45 4.48 JPEG 2 34.02% 14.43% 33.95%
JPEG 1 5.44 5.78 5.50 JPEG 3 29.13% 12.72% 30.10%
JPEG 2 5.31 5.93 5.23 JPEG 4 30.04% 11.70% 29.39%
JPEG 3 5.66 6.02 5.52 JPEG 5 32.00% 15.00% 32.17%
JPEG 4 5.53 6.18 5.58 JPEG 6 32.94% 14.63% 33.26%
JPEG 5 5.38 6.86 5.35 JPEG 7 34.18% 17.67% 35.99%
JPEG 6 5.31 6.90 5.27
JPEG 7 5.22 6.62 5.05

plied to the seven JPEG modes. An adaptive Huffman


startup values for prediction. Knowing this, projected com- coder on the other hand was used to code the overhead
pression performance was evaluated using the entropy val- associated with the proposed DCT-based method; this was
ues of Table 2; the results are given in Table 3, where the due to the fact that the Rice coder chooses a ‘‘winner’’
performance criterion used is the percentage size reduction out of several fixed entropy coders to compress a sequence,
(with respect to the number of bytes) of the original file, and for each 8 by 8 image data block, the three low fre-
given by quency coefficients retained for reconstruction are uncor-
related and do not in general follow a distribution corre-
Original File Size 2 Compressed File Size sponding to these fixed entropy coders. The compression
3 100%. (7) results are given in Table 4, from which it can be seen that
Original File Size
the proposed method provides very close performance to
It can be seen from the results in Table 3 that the new most of the JPEG lossless modes. It must be noted here
algorithm can be expected to perform approximately as that if a Rice coder was to be run in conjunction with any
well as the seven lossless modes of JPEG. However, upon of the lossless JPEG modes, one would most likely not
application of a standard entropy coder, compression re- use such a large block size, as what is gained in reduction
sults could end up different than what was predicted. As in overhead is lost by a reduction in adaptability. Therefore,
an example, a Rice coder ([11, 12]) was used for entropy in accordance with the recommendations of the JPEG com-
coding the error residuals for both the proposed method mittee, an adaptive Huffman coder was used to do all the
and the lossless JPEG modes. The advantage of the Rice coding for each method, with the results given in Table 5.
coder is that it is an adaptive coder which conforms appro- Although the performance of the proposed method wors-
priately to different data blocks without using codebooks; ens under this kind of entropy coding and the lossless
this also yields an efficient hardware implementation [12]. JPEG modes’ performance improves when compared to
The data block size used was 64; this was to take advantage the previous Rice coding example, the proposed method
of the possible differences in entropy between different still outperforms several lossless JPEG modes for each of
DCT error residual blocks. This same block size was ap- the three images.

TABLE 3 TABLE 5
Projected Compression Results for Test Images Compression Results for Adaptive Huffman Coding
Cameraman Baboon Moon Cameraman Baboon Moon

MDCT 26.87% 16.12% 33.62% MDCT 24.41% 13.66% 31.98%


JPEG 1 32.00% 27.75% 31.25% JPEG 1 26.59% 26.75% 30.37%
JPEG 2 33.62% 25.87% 34.62% JPEG 2 31.09% 24.14% 33.91%
JPEG 3 29.25% 24.75% 31.00% JPEG 3 22.65% 22.78% 30.21%
JPEG 4 30.87% 22.75% 30.25% JPEG 4 28.32% 18.55% 29.57%
JPEG 5 32.75% 14.25% 33.12% JPEG 5 30.63% 12.35% 32.29%
JPEG 6 33.62% 13.75% 34.12% JPEG 6 31.72% 11.71% 33.30%
JPEG 7 34.75% 17.25% 36.87% JPEG 7 33.12% 16.32% 36.30%
LOSSLESS IMAGE COMPRESSION USING THE DCT 25

4. CONCLUSIONS

A new lossless image compression scheme based on the


DCT was developed. This method caused a significant re-
duction in entropy, thus making it possible to achieve com-
pression using a traditional entropy coder. The method
performed well when compared to the popular lossless
JPEG method. Future work will focus on finding an effi-
cient hardware implementation, possibly taking advantage GIRIDHAR MANDYAM was born in Dallas, Texas on October 15,
of commonality between the new method and the existing 1967. He received the B.S.E.E. degree Magna Cum Laude from Southern
Methodist University in 1989. From 1989 to 1991 he was employed with
DCT-based lossy JPEG method.
Rockwell International in Dallas. From 1991 to 1993 he was a teaching
assistant in the Signal and Image Processing Institute (SIPI) at the Univer-
sity of Southern California, where he obtained the M.S.E.E. degree in
ACKNOWLEDGMENTS May 1993. In May 1993, he joined Qualcomm, Inc., in San Diego, CA
as an engineer in the Systems Group. In January 1994, he took a leave
The authors thank Mr. Jack Venbrux of the NASA Microelectronics of absence to pursue doctoral studies at the University of New Mexico
Research Center at the University of New Mexico for his help with the under a fellowship provided by the NASA Microelectronics Research
Rice coding algorithm. The authors also thank the anonymous reviewers Center (MRC) at UNM. He defended his dissertation in December, 1995.
for their constructive comments and suggestions. He has organized and chaired sessions at the IEEE ISE ’95 Conference
in Albuquerque, New Mexico; the IEEE Asilomar ’95 Conference in
Asilomar, California; and the IEEE ISCAS ’96 Conference in Atlanta,
Georgia. His interests are image coding, image restoration, adaptive algo-
REFERENCES rithms, spectral estimation, orthogonal transforms, systolic architectures,
and spread spectrum communications. He joined the Wireless R & D
1. G. Mandyam, N. Ahmed, and N. Magotra, A DCT-based scheme group at Texas Instruments in Dallas, Texas in April, 1996.
for lossless image compression, IS&T/SPIE Electronic Imaging Con-
ference, San Jose, CA, February, 1995.
2. N. Ahmed, T. Natarajan, and K. R. Rao, Discrete Cosine Transform,
IEEE Trans. Comput. C23, January 1974, 90–93.
3. K. R. Rao and P. Yip, Discrete Cosine Transform: Algorithms, Advan-
tages, and Applications. Academic Press, San Diego, 1990.
4. A. K. Jain, Fundamentals of Digital Image Processing, Prentice–Hall,
Englewood Cliffs, NJ, 1989.
5. M. F. Barnsley, and L. Hurd, Fractal Image Compression, A. K.
Peters, Wellesley, MA, 1993.
6. W. H. Chen and C. H. Smith, Adaptive coding of monochrome and
NASIR AHMED (Fellow, IEEE 1985), was born in Bangalore, India,
color images. IEEE Trans. Commun. 25(11), November 1977, 1285–
in 1940. He received the B.S. degree in electrical engineering from the
1292.
University of Mysore, India, in 1961, and the M.S. and Ph.D. degrees
7. P. Yip and K. R. Rao, Energy packing efficiency for the generalized from the University of New Mexico in 1963 and 1966, respectively. From
discrete transforms, IEEE Trans. Commun. 26(8), August 1978, 1966 to 1968 he worked as a Principal Research Engineer in the area of
1257–1262. information processing at the Systems and Research Center, Honeywell,
8. I. H. Witten, R. M. Neal, and J. G. Cleary, Arithmetic coding Inc., St. Paul, Minnesota. He was at Kansas State University, Manhattan,
for data compression, Commun. ACM. 30(6), June 1987, 520– from 1968 to 1983. Since 1983 he has been a Professor of Electrical
540. and Computer Engineering (EECE) at the University of New Mexico,
9. R. E. Blahut, Principles and Practice of Information Theory, Addi- Albuquerque. In August 1985 he was awarded one of twelve Presidential
son–Wesley, Menlo Park, CA, 1990. Professorships at the University of New Mexico, and was also elected
Fellow of the Institute of Electrical and Electronic Engineers for his
10. P. E. Tischer, R. T. Worley, and A. J. Maeder, Context based lossless
contributions to digital signal processing and engineering education. He
image compression, Comput. J. 36(1), January 1993, 68–77.
became the Chairman of the EECE Department in July 1989. He is
11. R. F. Rice, P. S. Yeh, and W. H. Miller, Algorithms for a very the leading author Orthogonal Transforms for Digital Signal Processing
high speed university noiseless coding module, JPL Publication (Springer Verlag, 1975), and Discrete-Time Signals and Systems (Reston,
91-1, Pasadena, CA, JPL Publication Office, February 15, 1991. 1983), and co-author of Computer Science Fundamentals (Merrill, 1979).
12. J. Venbrux, P. S. Yeh, and M. N. Liu, A VLSI chip set for high- Dr. Ahmed is also the author of numerous technical papers in the area
speed lossless data compression. IEEE Trans. Circuits Syst. Video of digital signal processing. He was an Associate Editor for the IEEE
Technol. 2(4), December 1992, 381–391. Transactions on Acoustics, Speech, and Signal Processing (1982–1984)
13. R. B. Arps and T. K. Truong, Comparison of international standards and is currently an Associate Editor for the IEEE Transactions on Electro-
for lossless still image compression, Proceedings of the IEEE. Vol. magnetic Compatibility (Walsh Functions Applications). Dr. Ahmed
82. No. 6. June, 1994. pp. 889–899. served as the Interim Dean of Engineering at the University of New
14. N. D. Memon and K. Sayood, Lossless image compression: A compar- Mexico from October 1994 to January 1996. He is now the Interim
Associate Provost for Research and Dean of Graduate Studies at the
ative study, IS&T/SPIE Electronic Imaging Conference. San Jose,
University of New Mexico.
CA, February, 1995.
26 MANDYAM, AHMED, AND MAGOTRA

the University of New Mexico, Albuquerque, New Mexico. He is currently


employed as an Associate Professor in the ECE Department at the
University of New Mexico. He has been involved in signal/image pro-
cessing research in the areas of seismic, speech, and radar (synthetic array
radar imaging) signal processing for the past fourteen years. The research
involved the theoretical design of algorithms as well as their real time
implementation on DSP chips. He has served as past associate editor of
the IEEE transactions on Signal Processing and served on the organizing
committee of ICASSP 1990. He has also helped organize special sessions
NEERAJ MAGOTRA was born in Jamshedpur, India on December for the IEEE Asilomar Conference on Signals, Systems, and Computers,
5, 1958. He obtained his B.Tech. in Electrical Engineering from the Indian the Midwest symposium on Circuits and Systems, and the International
Institute of Technology (Bombay, India) in 1980, his M.S. in Electrical Symposium on Circuits and Systems. He is a member of Sigma Xi, Phi
Engineering from Kansas State University in 1982 and his Ph.D. in Electri- Kappa Phi, Tau Beta Pi, the Institute of Electrical and Electronics Engi-
cal Engineering from the University of New Mexico in 1986. From 1987 neers (IEEE), and the Seismological Society of America. He has
until 1990 he held a joint appointment with Sandia National Laboratories authored/co-authored over 70 technical articles including journal papers,
and the Department of Electrical and Computer Engineering (ECE) at conference papers, and technical reports.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy