Research on Image Compression Coding Technology

Absrtact. Image compression technology is the basis of all kinds of media compression and transmission, and its compression effect is directly related to the compression effect of media. In this paper, four commonly used image compression coding methods, namely, undistorted Huffman coding, run-length coding, finite distortion predictive coding and transform coding, are used to compress still images, and the efficiency of each coding method is analyzed. The experimental results show that the two lossless compression coding methods have remarkable compression effect, but the compression efficiency is low. Although the compression ratio of lossy compression coding method is high, the decompressed image has certain distortion.


1.Introduction
The contradiction between the large amount of data and the limited channel capacity of digital images reflects the importance of image compression, and usually there must be some correlation between the pixels of most images. The information contained between images belongs to image redundancy. In order to ensure image quality, data compression must eliminate image redundancy. Different compression methods are usually used to process images to eliminate different types of redundancy. There are many compression and coding methods for digital images. From the perspective of information theory, image compression and coding methods can be divided into two kinds: distortion-free compression and finite distortion coding. The principle of lossless compression coding is to reduce the data redundancy of image information source by variable length coding, which makes the encoding image data close to its information entropy and thus does not produce distortion. The principle of finite distortion coding is based on the unique visual characteristics of the human eye. Without forcing the image to be undistorted, the correlation of the image information source in space and time can be eliminated and the variance of the signal can be reduced by a certain signal transformation to achieve the requirement of compression coding [1][2].

Huffman coding
In variable length coding method, information symbols with high probability are coded into short codewords, while information symbols with low probability are coded into long codewords. Huffman coding is a combination of Huffman algorithm and variable length optimal coding theorem. It is a coding algorithm that utilizes the probability distribution of information symbols. The specific coding method is as follows [3].
(1) First, the probability of source symbols is sorted in descending order. (2) Then add up the two minimum probabilities and repeat the step, always arranging the high probabilistic branches on the right until they finally become probabilistic 1.
(3) Next, the path from probability 1 to each source symbol is marked, and the 0 and 1 along the path are recorded in sequence. Thus, the Hoffman codeword of the symbol is obtained.
(4) Finally, the left side of each pair of combinations is designated as 0, and the right side is designated as 1 (or vice versa).
The specific implementation of the encoding is shown in Table 1 and Table 2.

Run length coding
Usually, computer image is composed of a large number of color blocks of the same color. When storing the image, many consecutive scanning lines or continuous pixels on the same scanning line carry the same color value in the process of scanning the color blocks. Run-length coding is a coding method that stores a pixel value and the number of pixels with the same color instead of storing the same color blocks in the image one by one. Simply put, the color values and count values are used to represent the same color pixel values in a row.
Run-length coding has a high compression rate when an image contains a large number of the same color blocks. When the color value of the image is rich, the run-length value of the image is very short, and run-length coding will cause greater redundancy [4].

Predictive coding
The adjacent pixels of the image are correlated in gray level. Predictive coding uses this feature to predict the current signal through the previous signal, and then differential coding through the prediction error. Linear prediction is the most widely used prediction method, which is called Different Pulse Code Modulation.
DPCM encoder consists of linear predictor and quantizer.The output of the encoder is not the sample value of the image pixel, but the difference between the sample value and the predicted value, that is, the quantized value of the predicted error.According to the analysis of the statistical characteristics of the image signal, some appropriate prediction coefficients can be obtained, so that the distribution of prediction errors is mainly concentrated in the vicinity of "0". Through non-uniform quantization, the image data can be compressed by using fewer quantization layers [5,6].

Transform coding
Transform coding is to encode the transform coefficients of an image by making use of the gray correlation of all the pixels in the whole image. Because of the strong correlation of image data, image data will enter a new transform domain after special transformation. The original scattered image data can be centrally distributed in this new coordinate space. Because the transform coefficients of most images are small, compression coding can be realized by eliminating the coefficients approximating "0". After the image is reconstructed by inverse transform, the loss of irrelevant data will be negligible [7].
The effect of transform coding is related to the selection of transform method, image type and sub-image size. After the transformation method is decided, the choice of sub-image size will affect the amount of computation needed for transformation. Usually sub-images are divided into 8*8 or 16*16 sizes. The larger the sub-images used, the larger the computational complexity.
Image compression does not lie in transformation. The function of transformation is to map image data into a new spatial domain, so that the image can be compressed. Quantization process will cause errors in image data, and the effect of image compression mainly depends on the selection of quantizer.
Specific coding implementation steps are as follows: (1) The first step is to segment the sub-image, generally dividing the N*n size image into (N/n) 2.
(2) Select the appropriate image transformation to transform the sub-image.

Huffman Coding Simulation
When Huffman coding is used to compress and encode image data, the probability statistics of the data in figure 1 (a) are carried out first, and the probability of each symbol is obtained. Then the probability is sorted and coded to realize image data compression. The compressed image is shown in figure  1(b).From the parameters in Table 3, the data after compression and decoding are consistent with the original data bits.
(a) original image (b) decompressed image Figure 1. Huffman codec simulation results

Run-length coding simulation
Run-length encoding first binarizes figure 2 (a). The binarized image is shown in figure 2 (b). Then the binarized image is coded and decoded. The decompressed image is shown in figure 2 (c). The decompressed binary figure 2 (c) is basically undistorted compared with the original binary figure 2 (b). Compression parameters are shown in Table 4. The compression ratio of run-length encoding is very high, and there is no loss compared with the original image after encoding and decompression.

Predictive coding simulation
Predictive coding achieves image compression by predictive error, and the effect of image compression is judged by predictive error. After reading gray figure 3 (a), the image is predicted and coded. As can be seen from figure 3 (b) and figure 4, the gray level of the image after predicted coding is greatly reduced and the image is obviously distorted.    Figure 5(a) is divided into 8 *8 blocks, and then two-dimensional DCT transform is performed on each block. Then each image is inversely transformed by DCT. Finally, figure 5 (b) is stitched together figure 5 of the simulation results shows that the image coded by DCT has obvious distortion compared with the original image, but it does not affect the overall visual effect of the image.

Conclusion
The simulation results show that the compressed image obtained by Huffman coding and run-length coding is almost the same as the original image after decompression. The coding algorithm is simple, but the coding compression ratio is relatively low. If the user does not require high quality of the image and pays little attention to the compression ratio, this coding method can be used. The main advantage of predictive coding is that it can achieve high coding compression ratio. The disadvantage of predictive coding is that its error resilience is too poor. When processing images, if there is a certain requirement for coding efficiency and low requirement for image quality, it can use predictive coding to process images. Transform coding mainly solves the problem of redundancy of correlation, but it leads to the decrease of image resolution, the increase of block effect and image noise, which will affect human visual effect.