You are on page 1of 4

An Efficient Lossless ECG Compression Method Using

Delta Coding and Optimal Selective Huffman Coding


G.C. Chang1 and Y.D. Lin2
1
Department of Information Engineering, I-Shou University, Kaohsiung, Taiwan, ROC
2
Department of Automatic Control Engineering & Master Program of Biomedical Informatics and Biomedical Engineering,
Feng-Chia University, Taichung, Taiwan, ROC

Abstract—In this study, we develop an efficient lossless ECG Huffman code is an optimal statistical code that is veri-
compression based on delta coding and optimal selective fied to generate the shortest average codeword length
Huffman coding and implement the proposed algorithm in the
among all uniquely decodable variable length codes [4].
S3C2440 development board. The delta coding is applied to
reduce the dynamic range of the original ECG signals. The However, the compression of canonical Huffman coding
optimal selective Huffman coding is used to enhance the com- needs a full predefined probability distribution table. This
putation efficiency of canonical Huffman coding. In order to makes canonical Huffman coding not practical for encoding
evaluate the effectiveness of the proposed algorithm, a 10-min time varying data in real-time. To alleviate this problem,
ECG recordings (MIT100) which is a normal sinus rhythm optimal selective Huffman coding was proposed in [5]
taken from the MIT/BIH database were applied to the coding
which just needs a partial probability distribution table but it
experiments. Comparing with the canonical Huffman coding
algorithm, the proposed algorithm has gained much improve- may slightly sacrifice the compression ratio. Optimal selec-
ment on the computation efficiency by 211.2% when the first tive Huffman is a more efficient algorithm that allows the
63 frequently occurring codewords are selected, although utilization of the compression advantages of canonical
slightly sacrificing the compression rate by 0.34%. Huffman coding in the lossless ECG compression.
Considering practical applications, ECG compression al-
Keywords—Lossless ECG Compression, Delta Coding, Op-
timal Selective Huffman Coding. gorithm should have an adequate compression rate and must
be operated in real-time. In this paper, delta coding is firstly
used to transform the original ECG sequence into a new
I. INTRODUCTION sequence which has a smaller variance and dynamic range.
Next, we employ optimal selective Huffman coding to
An electrocardiogram (ECG) contains useful physiologi- compress the delta encoded ECG signal. Subsequently, we
cal information on the physical condition of the heart. A implement the proposed algorithm in the S3C2440 devel-
portable ECG recorder is common used to measure transient opment board.
responses of cardiac electrical activity for a period of time
24 hours or longer. The memory requirements for such a
long ECG signal are very huge and can significantly in- II. METHODS
crease the recorder’s size and cost. Therefore, ECG signal
compression is required to reduce the size of the stored data.
A. Delta Coding
Moreover, the decompressed ECG signals must contain
sufficient message for clinical doctors to be able to diagnose ECG is a waveform signal. The successive samples of
electrical activities in the heart and further data processing. ECG signal have a very high correction and small differ-
Lossy compression algorithms likely neglect some features
ences between them. This small difference signal will have
that may be desired for further analysis of ECG signals. On
the other hand, lossless compression algorithms can keep a much lower dynamic range than the original ECG signal,
the signal exactly as measured. so it can be effectively quantized using a smaller number of
Several researches of lossless ECG compression were in- bits by some coding methods, like delta coding. Fig. 1
vestigated. Koski [1] used LZ77, complex extraction, and shows an example of how delta coding is performed. The
Huffman coding for lossless ECG compression. Giurcâne- first sample in the encoded signal is equal to the first sample
anu et al. [2] proposed a lossless scheme using contexts and of the original ECG signal. Subsequent encoded samples are
R-R interval estimation. Miaou and Chao [3] proposed a
lossless ECG compression method based on wavelet trans- equal to the difference between the current sample and the
form and vector quantization. previous sample of the original ECG signal.

C.T. Lim and J.C.H. Goh (Eds.): WCB 2010, IFMBE Proceedings 31, pp. 1327–1330, 2010.
www.springerlink.com
1328 G.C. Chang and Y.D. Lin

Table 2 Compressed data set using full Huffman coding

Fig. 1 Delta coding example

B. Huffman Coding
Huffman coding is an entropy encoding algorithm used
for lossless data compression. It uses the most frequently
occurring symbols with short codewords and the less fre-
quently occurring ones with long codewords. A Huffman C. Optimal Selective Huffman Coding
code is created by constructing a binary tree. The path from
Assume k different symbols, s1, s2, …, sk, with frequen-
the root to each leaf gives the codeword of different symbol
cies of occurrence p1 ≥ p2 ≥ … ≥ pk, respectively. The opti-
for the bit sequence of the edges passing through the path.
mal selective Huffman coding only uses m+1 Huffman
An example of constructing a Huffman code can be shown
in Table 1 and Figs. 2. Table I shows the frequency of oc- codewords, m for encoding the m most frequently occurring
currence of each of the possible symbols. Fig. 2 displays the symbols, s1, s2, …, sm (m < k), and 1 for indicating the rest,
full Huffman tree. Table II presents the compressed data sm+1, …, sk, unencoded symbols. The occurrence probability
given in Table 1. of the latter codeword is equal to the sum of the occurrence
probabilities of all the unencoded different symbols.
Table 1 Data Set, Occurrence Frequency, and Codewords Consider the data set of Table 1 and let m = 3, that is,
0001 and 0010 are the unencoded symbols. The sum of the
occurrence probabilities of 0001 and 0010 is equal to 3/20.
Fig. 3 shows the optimal selective Huffman tree. Table 3
presents the compressed data using optimal selective Huff-
man coding.

Fig. 3 The optimal selective Huffman tree

Table 3 Compressed data set using optimal selective Huffman coding

Fig. 2 The full Huffman tree

IFMBE Proceedings Vol. 31


An Efficient Lossless ECG Compression Method Using Delta Coding and Optimal Selective Huffman Coding 1329

III. EXPERIMENTAL RESULTS Table 4 The probability of occurrence of each distinct symbol in MIT100
ECG signal
In order to analyze the performance of the proposed algo-
rithm described here, a 10-min ECG recordings (MIT100)
which is a normal sinus rhythm taken from the MIT/BIH [6]
database were applied in the coding experiments. The sam-
pling frequency is 360 Hz with 12 bits per sample. Fig. 4(a)
shows the original ECG signal selected from record
MIT100. Fig. 4(b) presents the delta encoded ECG signal. It
can be seen that the dynamic range of the original ECG
signal has been limited between -100 and 100 which can be
represented by 8-bit per sample.

Next, the optimal selective Huffman coding is used to


Fig. 4 (a) The first 5 seconds original ECG signal (b) The delta encoded compress the delta encoded ECG signal. Table 5 shows the
ECG signal of Fig. 4(a) number of selected Huffman codeword, compression rate,
and computation time. It can be observed from Table 5 that
After delta encoding, the probability of occurrence of when the number of selected Huffman codeword decreases,
each distinct symbol in MIT100 ECG signal is calculated the computation time significantly shortens but the com-
and is presented in Fig. 5 and Table 4. According to the pression rate slightly decreases.
probability of occurrence of all distinct symbols, we obtain
168 Huffman codewords. The compression rate using the Table 5 The number of selected Huffman codeword, compression rate, and
full Huffman coding achieves 3.109155. computation time

Fig. 5 The probability of occurrence of each distinct symbol

IFMBE Proceedings Vol. 31


1330 G.C. Chang and Y.D. Lin

IV. CONCLUSION REFERENCES


This paper develops and implements an efficient lossless 1. Koski A (1997) Lossless ECG encoding. Comput Meth Prog Biomed
ECG compression based on delta coding and optimal selec- 52:23–33.
tive Huffman coding. Comparing with the canonical Huff- 2. Duda K, Turcza P, Zielinski TP (2001) Lossless ECG encoding with
man coding algorithm, the proposed algorithm has obtained lifting wavelet transform. IEEE International Conf. on Instrumentation
much improvement on the computation efficiency by and Measurement Technology, Budapest, Hungary, 2001, pp. 640–
644.
211.2% when the first 63 frequently occurring codewords
3. Miaou S and Chao S (2005) Wavelet-based lossy-to-lossless ECG
are selected, although slightly sacrificing the compression compression in a unified vector quantization framework. IEEE Trans.
rate by 0.34%. It can be observed that the proposed algo- Biomed. Eng., 52:539–543.
rithm is an efficient, feasible, and practical for compressing 4. Huffman DA (1952) A Method for the Construction of Minimum Re-
EMG signals in real-time. dundancy Codes. Proceedings of the Inst. Radio Engineers 40:1098-
1101.
5. Kavousianos X, Kalligeros E, Nikolos D (2007) Optimal Selective
ACKNOWLEDGMENT Huffman Coding for Test-Data Compression. IEEE Trans. on Com-
puters 56:1146-1152.
The authors gratefully acknowledge the funding provided 6. MIT-BIH Arrhythmia Database CD-ROM, Third ed. Cambridge, MI:
to this project by the National Science Council (NSC 98- Harvard-MIT Division of Health Sciences and Technology, May 1997.
2221-E-214-020), Taiwan, ROC.

IFMBE Proceedings Vol. 31

You might also like