Research Article | Open Access
Rung-Ching Chen, Pei-Yan Pai, Yung-Kuan Chan, Chin-Chen Chang, "Lossless Image Compression Based on Multiple-Tables Arithmetic Coding", Mathematical Problems in Engineering, vol. 2009, Article ID 128317, 13 pages, 2009. https://doi.org/10.1155/2009/128317
Lossless Image Compression Based on Multiple-Tables Arithmetic Coding
This paper is intended to present a lossless image compression method based on multiple-tables arithmetic coding (MTAC) method to encode a gray-level image . First, the MTAC method employs a median edge detector (MED) to reduce the entropy rate of . The gray levels of two adjacent pixels in an image are usually similar. A base-switching transformation approach is then used to reduce the spatial redundancy of the image. The gray levels of some pixels in an image are more common than those of others. Finally, the arithmetic encoding method is applied to reduce the coding redundancy of the image. To promote high performance of the arithmetic encoding method, the MTAC method first classifies the data and then encodes each cluster of data using a distinct code table. The experimental results show that, in most cases, the MTAC method provides a higher efficiency in use of storage space than the lossless JPEG2000 does.
With the rapid development of image processing and Internet technologies, a great number of digital images are being created every moment. Therefore, it is necessary to develop an effective image-compression method to reduce the storage space required to hold image data and to speed the image transmission over the Internet [1–16].
Image compression reduces the amount of data required to describe a digital image by removing the redundant data in the image. Lossless image compression deals with reducing coding redundancy and spatial redundancy. Coding redundancy consists in using variable-length codewords selected to match the statistics of the original source. The gray levels of some pixels in an image are more common than those of others–-that is, different gray levels occur with different probabilities–-so coding redundancy reduction uses shorter codewords for the more common gray levels and longer codewords for the less common gray levels. We call this process variable-length coding. This type of coding is always reversible and is usually implemented using look-up tables. Examples of image coding schemes that explore coding redundancy are the Huffman coding [4, 5, 7] and arithmetic coding techniques [8, 9].
There exists a significant correlation among the neighbor pixels in an image, which may result spatial redundancy in data. Spatial redundancy reduction exploits the fact that the gray levels of the pixels in an image region are usually the same or almost the same. Methods, such as the LZ77, LZ88, and LZW methods, exploit the spatial redundancy in several ways, one of which is to predict the gray level of a pixel through the gray levels of its neighboring pixels .
To encode an image effectively, a statistical-model-based compression method needs precisely to predict the occurrence probabilities of the data patterns in the image. This paper proposes a lossless image compression method based on multiple-tables arithmetic coding (MTAC) method to encode a gray-level image.
A statistical-model-based compression method generally creates a code table to hold the probabilities of occurrence of all data patterns. The type of data pattern significantly affects the encoding efficiency when minimizing storage space. When the data come from different sources, it is difficult to find an appropriate code table to describe all the data. Therefore, this MTAC method categorizes the data and adopts distinct code tables that record the frequencies which the data patterns occur in different clusters.
2. The MTAC Method
The proposed MTAC method contains three approaches: median edge detector (MED) processing, base-switching transformation, and statistical-model-based compressing. This section introduces these three approaches.
2.1. MED Processing Approach
Shannon's entropy equation can estimate the average minimum number of bits needed to encode a data pattern based on the frequency which the data pattern occurs in a data set [11, 12]. Let l be the total number of different data patterns in a data set and the probability of the th data pattern's occurring in the data set. The entropy rate E of the data set is defined as
It is impossible to encode the data set, in a lossless manner, with a bit rate higher than or equal to E. The bit rate is defined as the ratio of the number of bits holding the compression data to the number of pixels in the compressed image. The higher the entropy rate, the less one can compress it using a statistical-model-based compression method.
Let be the encoded image consisting of pixels, where H and W are the height and the width of f, respectively. MED  estimates the gray level of a pixel by detecting whether there is an edge passing through the pixel. MED scans each pixel in f, starting from the left-top pixel of f, in the order shown in Figure 1. While scanning a pixel , MED estimates the gray level of via the gray-levels , , and of the pixels , , and , where P(i, j) is the pixel located at the coordinates (i, j) in f. Figure 2 shows the spatial relationships of , , , and .
For or , the estimated gray level of is defined as
In addition, for to , and to :
Here, and are the maximum and the minimum between and , respectively. If , MED considers that a horizontal edge passes through or some pixels above . When , MED perceives that one vertical edge passes through or some pixel on the left of .
Let be the difference between and ; we call the estimated error of . Similarly, in the decompressing phrase, based on , , and , the MTAC method can compute through formulas (2.2) or (2.3); then it can get . To recover f without loss, the MTAC method needs to save and the estimated errors of all other pixels in .
The estimated error is within the interval between and . Each can be represented by an 8-bit memory space that describes the absolution value of and one bit b that records the sign of . All the s compose a gray-level image , and all the sign bits bs make up a binary image . We call the error image and the sign bit image of .
Figure 3 shows two gray-level images Airplane and Baboon, and their gray-level histograms. Let , and
According to formula (2.1), the entropy rates of Airplane and Baboon, in theory, reach and bits/pixel, respectively. From Shannon's limit [11, 12], with such an entropy rate, the minimum number of bits required to describe a pixel in Airplane (resp., Baboon) is (resp., ) bits/pixel. Since the numbers of bits are over the acceptable maximum, the MTAC method utilizes MED  to decrease the entropy rate of f before encoding f. Figure 4 demonstrates the error images of Airplane and Baboon shown in Figure 3, and the gray-level histograms of the error images. The gray levels of most pixels in the error images are close to 0; the entropy rates of the error images of Airplane and Baboon are and bits/pixel, respectively, which are far lower than the entropy rates of the original Airplane and Baboon.
Figure 5 shows the sign bit images of Airplane and Baboon. It is clear that both sign bit images are messy, so it is difficult to find a method effectively with which to encode them effectively. To deal with this problem, the MTAC method transforms the error image and sign bit image into a difference image and an MSB (most significant bit) image, respectively. The MTAC method pulls out the MSB of all the s to create an binary image , where the MSB of is given to the pixel located at the coordinates of . We call the binary image the MSB image of f. Meanwhile, the MTAC method concatenates the sign bit b of and the remaining , whose MSB has been drawn out, by appending b to the rightmost bit of the remaining in order to generate another gray-level image. We name the gray-level image the difference image of f. Figure 6 illustrates these actions.
Figure 7 shows the MSB images of Airplane and Baboon. Almost all the pixels on the MSB images are 0. Figure 8 displays the difference images of Airplane and Baboon and their gray-level histograms. Clearly, the gray levels of most pixels in the difference images are equal to 0. The entropy rates of the difference images of Airplane and Baboon are 4.4 and 6.2 bits/pixel, respectively. These entropy rates are higher than the entropy rates of their error images but are much lower than those of the original Airplane and Baboon.
2.2. Base-Switching Transformation Approach
The gray level of a pixel in a gray-level image is generally represented by an 8-bit memory space. However, it is uneconomical if the gray levels of the pixels in a gray-level image are similar. Hence, the MTAC method adopts the base-switching transformation (BST) algorithm [1, 2] to compress a difference image.
The BST algorithm partitions a difference image into small nonoverlapping image blocks, each consisting of pixels. Let and be the minimal and maximal gray levels of the pixels in an image block B. The difference between and the gray level g of each pixel in B can be depicted by bits. The MTAC method uses a 3-bit memory space S to describe , where
For each image block, the BST algorithm needs to hold only , , and the gray-level differences between and the gray levels of all the pixels in B. We call the difference between the gray level of a pixel P and the gray-level difference of P. Figure 9 is a image block B. The bits of memory space are required to store B. However, in the BST algorithm, , , and S of B are 137, 122, and 3, respectively. The BST algorithm uses 8 bits, 3 bits, and bits to hold , S, and the gray-level differences of all the pixels in B; hence, the BST algorithm requires only a total of 75 bits to store .
2.3. Statistical-Model-Based Compressing Approach
After the MED processing approach, image is transformed into an MSB image and a difference image. In the base-switching transformation approach, the difference image is segmented into nonoverlapping small image blocks. The MTAC method then writes down , S, and the gray-level differences of all the pixels in each image block. However, a few pixels may have big gray-level differences in an image block, so each gray-level difference in this image block requires large number of bits to hold it. For example, the maximal gray-level difference of the image block in Figure 9 is 15; therefore, each gray-level difference can be expressed by at least 4 bits. To remedy this problem, the MTAC method takes arithmetic coding algorithm continuously to compress the data obtained in the MED processing and BST approaches.
The arithmetic coding algorithm [8, 15] is one of the statistical-model-based compressing methods that decide the bit length of a code according to the occurrence frequencies of data patterns. These methods give longer codes to the data patterns that occur more frequently and shorter codes to those that occur less often. Hence, the type of data pattern significantly affects the encoding's efficiency in minimizing storage space. The MTAC method will adopt the arithmetic coding algorithm to compress the MSB image, all the s, and all s. Since the MSB image, all the s, and all s have different statistics, the MTAC method will require distinct code tables to record the data patterns of the MSB image, all the s, and all s. Each data pattern of the MSB image, all the s, and all s are described by 8-bits, 8-bits, and 3-bits in length, respectively.
Next, the MTAC method concatenates the gray-level differences of all the image blocks into a binary string , where the bit length of each gray-level difference in the image blocks is S. For example, the gray-level differences in all the image blocks with are concatenated into . The MTAC method then uses an arithmetic coding algorithm to encode each , where the bit length of each data pattern in encoding is S. Finally, the MTAC method needs to hold only the height H and the width W of f, all the code tables, and all the compression data generated by the arithmetic coding algorithm.
After the statistical-model-based compressing approach has been employed, the MTAC method concatenates W, H, , , , , and into the compression data. Here, represents all the code tables; , , , and are the compression data of the MSB image, all s, Ss, and s, respectively.
2.4. Image Decompression
In the decompression phrase, the MTAC method first draws W, H, and from the compression data. The bit length of each data pattern in the MSB image is 8. Hence, the MTAC method can reconstruct the MSB image based on by using the arithmetic decoding method. Since f consists of image blocks, the MTAC method will decompress the s from using the arithmetical decoding method, where the bit length of a data pattern is 8. Similarly, it can decode Ss from , where each data pattern is described by 3 bits. How many data patterns are in each can be easily computed via Ss. Hence, each can be decoded as well.
The purpose of this section is to investigate the performance of the MTAC method by experiments. In these experiments, ten gray-level images Airplane, Lena, Baboon, Gold, Sailboat, Boat, Toy, Barb, Pepper, and Girl, shown in Figure 10, are used as test images. The first experiment explores the effect of the MED processing approach on reducing the entropy rate of the compressed image. Table 1 lists the entropy rates of the ten original test images and the entropy rates of their error images. The experimental results show that most of the entropy rates of the error images are close to half those of the original test images.
In experiment 2, the arithmetic coding method is used to encode the sign bit images of the ten test images, where the bit length of each data pattern is 8 bits. Table 2 shows the sizes of the original sign bit images and their compression data obtained by the arithmetic coding method where the bit length of each data pattern is 8 bits. The experimental results illustrate the difficulty of obtaining a good performance in compressing the sign bit images. Since the sign bit images are very messy, the arithmetic coding method cannot effectively encode it; even for most error images, the sizes of their compression data are larger than the sizes of their original images; that is, there hardly exist the coding and spatial redundancies in the error images. Table 3 lists the entropy rates of the difference images of the ten test images where are set to . Although the entropy rates of the difference images are higher than those of the error images, they are much lower than those of the original images are.
The last experiment compares the performance of the MTAC method with that of the lossless JPEG2000 [3, 6, 13]. Table 4 displays the bit rates obtained by the MTAC method and the lossless JPEG2000 in encoding the test images. Table 4 reveals that the MTAC method is more efficient in storage space use than the lossless JPEG2000, except image Barb. Figure 11 shows that huge gray-level variations among most adjacent pixels in the partial magnified difference image of Barb. The MTAC method obtains better performance in terms of storage space use than that of the lossless JPEG2000 in encoding an image with small gray-level variations among adjacent pixels but performs worse in compressing an image with great gray-level variations among adjacent pixels. Hence, the MTAC method performs worse in terms of storage space use than the lossless JPEG2000 does when encoding Barb.
This paper proposes the MTAC method to encode a gray-level image f. The MTAC method contains the MED processing, BST, and statistical-model-based compressing approaches. The MED processing approach reduces the entropy rate of f. The BST approach decreases the spatial redundancy of the difference image of f based on the similarity among adjacent pixels. The statistical-model-based compressing approach further compresses the data generated in the MED processing and BST approaches, based on their coding redundancy. The data patterns of the data produced by the MED processing approach and the BST approach have different bit lengths and distinct occurrence frequencies. Hence, the MTAC method first classifies the data into clusters before compressing the data in each cluster using the arithmetic coding algorithm via separated code tables.
The experimental results reveal that the MTAC method usually gives a better bit rate than the lossless JPEG2000 does, particularly for the images with small gray-level variations among adjacent pixels. However, when the gray-level variations among adjacent pixels in an image are very large, the MTAC method performs worse in terms of bit rate.
- T. J. Chuang and J. C. Lin, “On the lossless compression of still image,” in Proceedings of the International Computer Symposium-On Image Processing and Character Reognition (ICS '96), pp. 121–128, Kaohsiung, Taiwan, 1996.
- T. J. Chuang and J. C. Lin, “New approach to image encryption,” Journal of Electronic Imaging, vol. 7, no. 2, pp. 350–356, 1998.
- S. C. Diego, G. Raphaël, and E. Touradj, “JPEG 2000 performance evaluation and assessment,” Signal Processing: Image Communication, vol. 17, no. 1, pp. 113–130, 2002.
- Y. C. Hu and C.-C. Chang, “A new lossless compression scheme based on huffman coding scheme for image compression,” Signal Processing: Image Communication, vol. 16, no. 4, pp. 367–372, 2000.
- D. A. Huffman, “A method for the construction of minimum redundancy codes,” in Proceedings of the IRE, vol. 40, pp. 1098–1101, 1952.
- ISO/IEC FCD 155444-1, Information Technology-JPEG 2000 Image Coding System, 2000.
- D. E. Knuth, “Dynamic Huffman coding,” Journal of Algorithms, vol. 6, no. 2, pp. 163–180, 1985.
- G. G. Langdon Jr., “An introduction to arithmetic coding,” IBM Journal of Research and Development, vol. 28, no. 2, pp. 135–149, 1984.
- J. Rissanen and G. G. Langdon Jr., “Arithmetic coding,” IBM Journal of Research and Development, vol. 23, no. 2, pp. 149–162, 1979.
- S. A. Martucci, “Reversible compression of HDTV images using median adaptive prediction and arithmetic coding,” in Proceedings of the IEEE International Symposium on Circuits and Systems, vol. 2, pp. 1310–1313, New York, NY, USA, 1990.
- C. E. Shannon, “A mathematical theory of communication,” Bell System Technical Journal, vol. 27, pp. 379–423, 1948.
- C. E. Shannon, “Prediction and entropy of printed English,” Bell System Technical Journal, vol. 30, pp. 50–64, 1951.
- A. N. Skodras, C. A. Christopoulos, and T. Ebrahimi, “JPEG 2000: the upcoming still image compression standard,” Pattern Recognition Letters, pp. 1337–1345, 2001.
- U. Topaloglu and C. Bayrak, “Polymorphic compression,” in Algorithms and Database Systems, P. Yolum et al., Ed., vol. 3733 of Lecture Notes in Computer Science, pp. 759–767, Springer, New York, NY, USA, 2005.
- T. Welch, “A technique for high-performance data compression,” IEEE Computer, vol. 17, no. 6, pp. 8–19, 1984.
- M. U. Celik, G. Sharma, and A. M. Tekalp, “Gray-level-embedded lossless image compression,” Signal Processing: Image Communication, vol. 18, no. 6, pp. 443–454, 2003.
Copyright © 2009 Rung-Ching Chen et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.