Sunteți pe pagina 1din 6

J. Vis. Commun. Image R.

59 (2019) 33–38

Contents lists available at ScienceDirect

J. Vis. Commun. Image R.


journal homepage: www.elsevier.com/locate/jvci

Research on image compression technology based on Huffman coding q


Shuyun Yuan a,b, Jianbo Hu a,⇑
a
Equipment Management and UAV Engineering College, Air Force Engineering University, Xi’an, ShaanXi, China
b
Institute 706, Second Academy of China Aerospace and Industry Corporation, Beijing 100854, China

a r t i c l e i n f o a b s t r a c t

Article history: With the development of information technology, image has become the mainstream of information
Received 10 November 2018 transmission. Compared with character, image contains more information, but because image and char-
Revised 23 December 2018 acter need more storage capacity, it will occupy more bandwidth in network transmission. In order to
Accepted 24 December 2018
transmit image information more quickly, image compression is a good choice. This paper is based on
Available online 26 December 2018
an eye of image compression. The method of image compression in this paper is that firstly, the image
is filtered by wavelet transform to remove the redundant information in the image, and then the
Keywords:
Huffman method is used to encode the image. The simulation results of JPEG format image show that
Image compression
Wavelet transform
the size of the image can be reduced in the same image effect.
Huffman coding Ó 2019 Elsevier Inc. All rights reserved.
JPEG picture

1. Introduction At present, common multimedia compression methods are


divided into lossless compression methods and lossy compression
The development of modern computers, especially multimedia methods [3]. Lossless compression compresses redundant parts of
computer systems, has become a mainstream direction. Especially the original data. Using lossless compression, the original data can
in current computer applications, many videos and audios have be completely recovered without any errors or distortions, that is,
taken the form of digitization, leading to a large amount of data after compression and decompression, a copy of the original data is
storage. However, the current development of science and technol- generated. Its compression ratio is generally 2:1–5:1. As the typical
ogy is limited, and many hardware technologies cannot fully sat- Double Space technology, the compression ratio of various types of
isfy the requirements of computer storage resources, and the gap data and files on the hard disk is about 2:1. Due to the limitation of
between the bandwidth and the bandwidth is still large [1], so the compression ratio, the use of lossless compression alone can-
the data must be compressed before the data storage and transmis- not handle the storage and transmission problems of digital sound
sion, otherwise the storage and transfer of the computer system and video images in real time. Lossy compression is at the expense
cannot be effectively carried out. Due to the existence of encoding of certain information, so that a higher compression ratio can be
redundancy, redundancy between pixels, and visual information achieved [4]. The lossy compression method is mostly used for
redundancy in multimedia data, the original data can be com- images with higher pixels, video, or sound quality files. For this
pressed. Data compression technology is actually a series of type of data compression, the compression ratio can be increased
re-encoding of the original data, eliminating redundant data in by tens or hundreds of times. Most image compression methods
the original data, reducing the amount of data to a minimum, so can take this approach, mainly JPEG, MPFG and other types of files.
as to achieve the purpose of compressing various media data such The common coding methods used in lossy compression are pre-
as images, audio, and video [2]. dictive coding and transform coding, which allow information to
be lost in the compression process. Although all data cannot be
Abbreviations: DCT, Discrete Cosine Transform; ISO, International Organization fully recovered after decompression, but the lost part of the image,
for Standardization; CCITT, International Telegraph and Telephone Consultative whether the original image or the sound, has little effect on the
Committee; MCU, Minimum Coded Unit; DU, Data Unit; AC, Alternating Current; understanding of the whole file, it can obtain a good compression
DCPM, Differential predictive coding modulation; DC, Direct; SNR, signal-to-noise
ratio [5].
ratio.
q In order to make products of different manufacturers compati-
This article is part of the Special Issue on TIUSM.
⇑ Corresponding author. ble, all countries have attached great importance to the establish-
E-mail addresses: 18S103149@stu.hit.edu.cn (S. Yuan), jbhu@iipc.zju.edu.cn ment of universal data compression standards. Currently, three
(J. Hu).

https://doi.org/10.1016/j.jvcir.2018.12.043
1047-3203/Ó 2019 Elsevier Inc. All rights reserved.
34 S. Yuan, J. Hu / J. Vis. Commun. Image R. 59 (2019) 33–38

data compression coding standards commonly used in multimedia coding unit MCU. When the JPEG image is encoded and decoded,
systems are [6]: ① JPEG standard (ISO CD 10918) for digital com- the smallest data block processed is an 8  s data block, that is, a
pression coding of continuous-tone still images; ② MPEG standard DU.
(ISO/IEC 11172), suitable for compression coding of moving pic-
tures and accompanying sounds on digital storage media; ➂ (3) DCT (Discrete Cosine Transform)
CCITTH.261 standard, suitable for digital compression coding in
application systems such as video telephony and conference televi- JPGE is a two-dimensional discrete cosine transform algorithm
sion. At present, with the rapid development of the network, the using an 8x8 sub-block [10]. The algorithm first divides the original
diverse needs of users, such as the real-time transmission of image sequentially into a series of 8  8 sub-blocks. In an 8  8
streaming media, the compression and transmission of high reso- image block, pixel values generally change more gently, so the
lution images, are largely dependent on the multimedia compres- image has a lower spatial frequency. Then discrete cosine trans-
sion technology. The current image data compression technology form is performed on the image block, so that the energy of the
cannot meet the needs of all kinds of network multimedia applica- image block can be concentrated on a few coefficients in the upper
tions. Therefore, the research and application of multimedia tech- left corner and the absolute value of these coefficients is very
nology in network transmission has become more and more small. This is conducive to the subsequent compression process.
active and attracted much attention, especially the focus of image
data compression. JPEG2000 is the latest achievement of image (4) Quantification
compression technology in this form. JPEG2000 can facilitate pro-
gressive transmission, JPEG200O support lossy compression, also 8  8 image block after DCT transform, the low-frequency com-
support lossless compression, good low bit rate compression per- ponents are concentrated in the upper left corner, high-frequency
formance and the protection of image security through watermark, components in the lower right corner. Quantification is to discard
markup, killings and encryption. It has been widely used in image the information that has little effect on the visual effect under
compression on the network. Based on the JPEG2000 standard, this the premise of maintaining a certain quality. Linear uniform quan-
paper proposes a JPEG2000 compression method based on wavelet tizer is used in JPGE standard. The quantification process is to
transform, which can well overcome the ‘‘square” effect caused by divide 64 DCT coefficients by quantification step size and rounding.
DCT transform in the JPEG. Finally, compare the JPEG2000 of this The frequency component is kept and the high frequency compo-
paper with the compression effect of JPEG standard and JPEG2000 nent is suppressed by quantification processing. That is to say,
standard respectively. the compression ratio can be further improved by using fine quan-
tification for Y and coarse quantification for CbCr. In decoding,
inverse quantification is used, that is, the value to be processed is
2. Image compression technology multiplied by the corresponding position value of the correspond-
ing quantification table.
2.1. JPEG compression method
(5) Zigzag scan
JPEG is a compression standard proposed by the ISO (Interna-
tional Organization for Standardization) and the CCITT (Interna- In order to ensure that low-frequency components appear first,
tional Telegraph and Telephone Consultative Committee) for high-frequency components appear afterwards to increase the
color and monochrome multiple grayscale or continuous-tone still number of continuous ‘‘0” in the run length, and the AC (Alternat-
digital images [7]. There are several modes of JPEG, the most com- ing Current) coefficient of the other 63 elements of 8  8 except
mon of which is the sequential mode based on the DCT transform. the DC coefficient F (0,0), the ‘‘Zigzag” (219-Zag) arrangement
In general, the JPEG compression algorithm operation can be method is used, and then run-length encoding is performed.
divided into the following steps [8]: ➀ color change; ② MCU (Min-
imum Coded Unit), DU (Data Unit) and image sampling; ➂ DCT; ④ (6) Run-length coding
quantification; ⑤ zigzag scan; ⑥ run-length coding; ⑦ differential
coding in the intermediate format; ⑧ Huffman coding. The principle of run-length coding: The neighboring pixels with
the same color value in a row are replaced with a count value and
(1) color change the color value. When the data is quantized, a large number of gen-
erated ‘‘0” can describe their length with only one data.
JPEG uses YCbCr color space. It is generally necessary to trans-
form the color space of RBG. The RBG information in the original (7) Differential coding in the intermediate format
bitmap is converted to the Y representing brightness and Cb, Cr
values representing chroma, which facilitates the following series Since the DC coefficients of the two adjacent 8x8 blocks are very
of processing. small, differential coding DCPM (Differential predictive coding
modulation) is used to increase the compression ratio.
(2) MCU (Minimum Coded Unit), DU (Data Unit) and image
sampling (8) Huffman coding

The Y component data is important, and the data of the CbCr After getting the middle format, the number of parentheses in
component is relatively insignificant, so only a portion of CbCr the example above is encoded by Huffman. Figs. 1 and 2 show
may be taken to increase the compression ratio. Currently, soft- the core contents of the processing steps of the encoder and
ware that supports the JPEG format usually provides two sampling decoder based on DCT in JPEG [11].
methods, YbCC4rn and YCbCr422 [9], meaning the data sampling In the encoding process, the source image data is divided into
ratio of the three components of YCbCr. Taking into account the 8  8 blocks. The forward DCT transforms each block into 64 DCT
factors of image quality, the JPEG standard specifies the minimum coefficients. The amplitude of the spatial frequency transform
S. Yuan, J. Hu / J. Vis. Commun. Image R. 59 (2019) 33–38 35

Fig. 1. The encoding process based on the DCT encoder.

Fig. 2. The decoding process based on DCT decoder.

coefficients is mostly zero or tends to zero. Thus it is possible to true color image reconstructed by JPEG is hardly different from the
compress data. The forward DCT formula is [12]: original image stored in one pixel. The facts show that [16] the
" # JPEG method can achieve satisfactory compression for most types
1 X 7 X 7
ð2x þ 1Þup ð2y þ 1Þv p
Fðu; v Þ ¼ CðuÞCðv Þ f ðx;yÞcos cos ð1Þ of images. But the main disadvantage of JPEG based on block DCT
4 x¼0 y¼0
16 16 transform is to produce ‘‘square” effect, which seriously affects
 pffiffiffi the visual effect of decoded images.
where CðuÞ; Cðv Þ ¼ 1= 2; ðu; v ¼ 0Þ .
CðuÞ; Cðv Þ ¼ 1; ðotherÞ

After outputting from the forward DCT, the quantizer quantizes 2.2. JPEG2000 compression standard
the coefficient values according to the quantification table. Its pur-
pose is to determine the step size Q(u, v) of the quantizer according JPGE2000 is a new image compression standard [17], whose
to the quality of the desired image, and to represent the DCT coef- goal is to allow the use of different image models (such as client/
ficient F(u,v) with the corresponding precision to achieve further server, real-time transmission and bandwidth resources, and so
compression. Its quantification formula is [13]: on) in a unified integrated system, the static images of different
 
Fðu; v Þ types (such as binary, grayscale, and so on) having different char-
F Q ðu; v Þ ¼ round ð2Þ acteristics (such as natural images, medical images, remote sensing
Q ðu; v Þ
images, and so on) are compressed. Because JPEG2000 uses
After quantification, the DC coefficients are differentially advanced encoding technology [18], JPEG2000 can facilitate pro-
encoded, and the AC coefficients are arranged in ‘‘Z” shape, and gressive transmission, JPEG200O supports both lossy and lossless
then entropy coding is performed. The step is to perform lossless compression, has good low bit rate compression performance,
compact coding according to the statistical characteristics of quan- and watermarking, marking, twisting and encryption can be used
tized coefficients, and the available entropy coding methods are to achieve image security protection. The biggest difference
Huffman coding and arithmetic coding. Among them, Huffman between the JPEG2000 and the JPEG standards proposed in this
encoding [14] requires one or more Huffman table statements that paper is that it abandons the block coding method based on DCT
are determined by application. Each 8  8 sample data block, after (Discrete Cosine Transform) used in JPEG, and adopts a multi-
the above processing steps, finally outputs compressed image data resolution coding method based on wavelet transform. The basic
for storage or transmission. idea of the image coding method based on wavelet transform
The decoding process is the reverse of the encoding process. The [19] is to decompose the image into a low frequency sub-graph,
entropy decoder performs Huffman or arithmetic decoding. The a high frequency sub-graph in a horizontal direction, a high fre-
inverse quantification process uses the approximate value quency sub-graph in a vertical direction and a high frequency
obtained from the decoded data as the input of the inverse DCT. sub-graph in the direction of diagonal lines by using the Mallat
The inverse DCT transforms 64 coefficients by inverse transforma- algorithm. After wavelet transform, each level of wavelet decom-
tion to reconstruct a 64 point output image. position of the image data always divides the upper-level low-
The JPGE static image compression standard has been widely frequency data into finer frequency bands. This method not only
used in many different fields. The DCT transform encoding and can obtain better compression effect, but also can overcome the
entropy encoding it uses are moderately computationally complex ‘‘square” effect produced by DCT transformation in the JPGE. The
and easy to implement in hardware [15]. Because it can provide JPEG2000 image encoding and decoding flow chart proposed in
high compression ratio under the premise of guaranteeing image this paper is shown in Figs. 3 and 4.
quality, JPEG can even be used for continuous image transmission Before the compression is performed, the source image data
under higher baud rate by using a dedicated compression chip. The needs to be divided into tile rectangular units, and each tile is
36 S. Yuan, J. Hu / J. Vis. Commun. Image R. 59 (2019) 33–38

Fig. 3. The encoding process based on wavelet transform.

Fig. 4. The decoding process based on wavelet transform.

considered as a small source image. The specific encoding process wavelet transform fast algorithm can be used. The use of a
steps are: lifting wavelet transform is faster, requires less computa-
tional complexity, and requires less storage space.
(1) DC (Direct) level shift. The purpose of the DC level shift is to (4) Quantification. After each tile-component is decomposed by
subtract these unsigned component sample values. N-level wavelet, (3  N + l) subbands are obtained. Each sub-
(2) Component transformation. JPEG2000 encoding provides band is quantized using different quantification steps, and
two kinds of component transformation: reversible compo- the quantized wavelet coefficients are represented by sign
nent transformation and irreversible component transfor- and amplitude values.
mation. The reversible component transformation can be (5) Entropy coding. Entropy coding is divided into two steps
used for lossless compression and lossy compression. The [21]: embedded block coding and hierarchical organization
irreversible component transformation is only used for lossy embedded block bit stream. The quantized sub-band is
compression. The reversible component transformation and divided into small code blocks, and the coded blocks are
irreversible component transformation formula are formula used as the units for embedded coding. Then the block bit
(3) and formula (4), respectively [20]: stream is encoded to calculate the cut-off point of the block
8 Rþ2GþB bit stream on each layer. All block bit streams are organized
< Yr ¼
> 4 according to cut-off points to form compressed code streams
Ur ¼ R  G ð3Þ with different quality levels. The code stream is hierarchi-
>
:
Vr ¼ B  G cally organized, each layer contains certain quality informa-
8 tion, and on the basis of the previous layer, the image quality
< Yr ¼ 0:299  R þ 0:587  G þ 0:144  B
> is improved. In this way, when browsing an image on the
Ur ¼ 0:16875  R  0:33126  G þ 0:5  B ð4Þ network, the first layer may be transmitted first, the user
>
: may be given a coarser image, and then the second layer
Vr ¼ 0:5  R  0:41859  G  0:08131  B
may be transmitted, and the image quality may be improved
where R, G, B represent three color components, Yr, Ur, Vr represent on the basis of the first layer. With such transmission layer
three color components after the transformation. by layer, different quality reconstructed images can be
obtained.
(3) Wavelet transform. A tile may consist of multiple compo- (6) The compressed code stream of PJEG2000 bit stream is
nents. Each component becomes a tile-component. Discrete formed. In order to be suitable for image exchange,
wavelet transform is performed in units of tile-component. JPEG200O specifies the format for storing compressed bit
The number of decomposition stages depends on the specific stream and decoding required parameters. The compressed
application. The Mallat tower wavelet decomposition is per- code stream is organized in packets to form the final code
formed for each tile. In the wavelet decomposition, a lifting stream.
S. Yuan, J. Hu / J. Vis. Commun. Image R. 59 (2019) 33–38 37

original image CR=65:1,PSNR=30.9dB

CR=116.5:1,PSNR=30.9dB CR=180.6:1,PSNR=27.01dB

Fig. 5. Effect of different compression ratios of the original image through JPEG2000.

JPEG(CR=3.5:1,54.8kb) JPEG2000(CR=3.45:1,55.3kb)

JPEG(CR=54.9,3.5kb)
JPEG2000(CR=54.1,3.56kb)

Fig. 6. Effect of image compression using JPEG and JPEG2000 with different compression ratios.

3. Experimental results and analysis this paper is used to compress the file with different compression
ratios, the effect of image comparison is shown in Fig. 5. Fig. 5
In the experiment, we chose a bitmap format picture file pic- shows the corresponding image effect after compression and the
ture1.bmp. After the JPEG2000 compression method proposed in SNR (signal-to-noise ratio) of the image at different compression
38 S. Yuan, J. Hu / J. Vis. Commun. Image R. 59 (2019) 33–38

ratios for JPEG2000 images. Where CR is the compression ratio and [4] W. Hardman, A. Hess, J. Sheaffer, SH-60 helicopter integrated diagnostic
system (HIDS) program-diagnostic and prognostic development experience,
PSNR is the peak SNR. From the image effect, the JPEG2000 image
Aerospace Conference, 1999. Proceedings, vol. 2, IEEE, 1999, pp. 473–491.
maintains a good SNR at different compression ratios. With a [5] S.J. Engel, B.J. Gilmartin, K. Bongort, et al., Prognostics, the real issues involved
higher compression ratio, the image of JPEG2000 compression is with predicting life remaining, Aerospace Conference Proceedings, vol. 6, IEEE,
smooth and clear. 2002, pp. 457–469.
[6] W.J. Staszewski, Wavelet based compression and feature selection for
In addition, a JPGE image picture2.jpg is compressed by differ- vibration analysis, J. Sound Vib. 211 (5) (1998) 735–760.
ent compression ratios according to the JPEG2000 compression [7] Y. Liu, X. Bai, Z. Yu, et al., Extraction and separation of transient components
method and JPEG compression method introduced in this paper. based on wavelet package, International Conference on Power System
Technology, 2002. Proceedings. Powercon, vol. 1, IEEE, 2002, pp. 471–474.
The effect of image contrast is shown in Fig. 6. [8] L.B. Jack, A.K. Nandi, Genetic algorithms for feature selection in machine
As can be seen from Fig. 6, in the case of low compression ratio, condition monitoring with vibration signals, IEE Proc. – Vis. Image Signal
there is no significant difference between the two compression Process. 147 (3) (2000) 205–212.
[9] Q. Zhang, Regressor selection and wavelet network construction, Proceedings
methods, but as the compression ratio increases, the difference of the, IEEE Conference on Decision and Control, 1993, vol. 4, IEEE, 1993, pp.
becomes apparent. The ‘‘square” effect of the JPEG image is obvi- 3688–3693.
ous, with a large white patch. The JPEG2000 has not been signifi- [10] Z. He, L. Wu, H. Xu, Vibration signal compression by an ADPCM encoder, IEEE
Pacific Rim Conference on Communications, Computers and Signal Processing,
cantly distorted. 1991, vol. 1, IEEE, 1991, pp. 343–346.
[11] Z. He, L. Wu, H. Xu, Periodic prediction and switched-adaptation in vibration
signal compression, IEEE Pacific Rim Conference on Communications,
4. Conclusion Computers and Signal Processing, 1991, vol.1, IEEE, 1991, pp. 53–56.
[12] P.J. Smyth, Hidden Markov Models for Fault Detection in Dynamic Systems:
With the rapid development of the network, the diversified NASA STI/Recon Technical Report N, US 5465321 A[P], 1995.
[13] L. Atlas, M. Ostendorf, G.D. Bernard, Hidden Markov models for monitoring
needs of users rely heavily on multimedia compression technology. machining tool-wear, IEEE International Conference on Acoustics, Speech, and
The current image data compression technology can not longer Signal Processing, 2000. ICASSP ’00. Proceedings, vol. 6, IEEE, 2000, pp. 3887–
meet the needs of a wide variety of network multimedia applica- 3890.
[14] G.K. Wallace, The JPEG still picture compression standard, Commun. Acm 38
tions. Therefore, more and more attention has been paid to the (1) (1992) xviii–xxxiv.
research on multimedia compression technology, especially the [15] J.F. Barda, JPEG 2000, the next millennium compression standard for still
compression of image data is the focus of research. And JPEG2000 images, IEEE International Conference on Multimedia Computing and
Systems., vol. 2, IEEE, 1999, pp. 1126–1127.
is the latest result of this type of image compression technology. [16] D. Taubman, High performance scalable image compression with EBCOT., IEEE
JPEG2000 can facilitate progressive transmission, JPEG200O sup- Trans. Image Process. A Publ. IEEE Signal Process. Soc. 9 (7) (2000) 1158.
ports both lossy and lossless compression, has good low bit rate [17] Jerome M. Shapiro, Embedded image coding using Zerotrees of wavelet
coefficients, IEEE Trans. Signal Process. 41 (12) (2002) 124–141.
compression performance, and watermarking, marking, twisting [18] P. Hao, Q. Shi, Proposal of reversible integer implementation for multiple
and encryption can be used to achieve image security protection. component transforms, Meeting of Iso/iec Jtc/sc/wg 4115 (1) (2000) 396.
It has been widely used in image compression on the network. [19] J.D. Gibson, Adaptive prediction in speech differential encoding systems, Proc.
IEEE 68 (4) (2005) 488–525.
Based on the JPEG2000 standard, this paper proposes a JPEG2000
[20] N. Criterion, Adaptive differential pulse-code modulation, AEU Int. J. Electron.
compression method based on wavelet transform, which can well Commun. 29 (6) (2010) 251–256.
overcome the ‘‘square” effect caused by DCT transform in the JPEG. [21] J.D. Villasenor, B. Belzer, J. Liao, Wavelet filter evaluation for image
Finally, the compression effect of JPEG2000 proposed in this paper compression., IEEE Trans. Image Process. A Publ. IEEE Signal Process. Soc. 4
(8) (1995) 1053–1060.
is compared with that of JPEG and JPEG2000.

Funding Shuyun Yuan was born in Nenjiang, Heilongjiang P.R.


China, in 1975. She received the Master degree from
Harbin Engineering University, P.R. China. Now, he
This work was supported by the National Key Basic Research studies in Engineering College, Air Force Engineering
Program (No. 2014CB744900) and National Basic Research Pro- University, Xi’an, P.R. China. His research interests
gram of Philosophy and Social Science (No. 17GGL270). include information security and big data analysis.
E-mail:18S103149@stu.hit.edu.cn.

Conflict of interest

There is no conflict of interest.

Acknowledgements
Jianbo Hu received the B.Sc. and M.Sc. degree from
The authors thank the editor and anonymous reviewers for Engineering College, Air Force Engineering University,
their helpful comments and valuable suggestions. Xi’an, China, in 1987 and 1990, and received the Ph.D.
degree from Northwestern Polytechnical University,
Xi’an, China, in 1998. From 1998 to 2001, he did his
References postdoctoral research in Institute of Advanced Process
Control, Zhejiang University. Now he is a professor in
[1] W.J. Wang, P.D. Mcfadden, Early detection of gear failure by vibration analysis Equipment Management and UAV Engineering, Air
i. Calculation of the time-frequency distribution, Mech. Syst. Sig. Process. 7 (3) Force Engineering University. His research interests
(1993) 193–203. include robust adaptive control, UAV flight control
[2] V. Giurgiutiu, A. Cuc, P. Goodman, Review of vibration-based helicopters health system, and safety engineering. E-mail: jbhu@iipc.zju
and usage monitoring methods, Proceedings of Meeting of the Society for edu.cn, jian_bo_h@163.com.
Machinery Failure Prevention Technology, 2001.
[3] V. Polimac, J. Polimac, Assessment of present maintenance practices and future
trends, Transmission and Distribution Conference and Exposition, 2001 IEEE/
PES, vol. 2, IEEE, 2001, pp. 891–894.

S-ar putea să vă placă și