explained, covering both the one-level variant and the
high-and-low-level variant. For each, the proposed
packet for the compressed data before transmission is
also presented. Furthermore, an overview of Huffman
encoding will also be given.
3.1 Delta Coding
ECG is a waveform signal and successive samples
mostly have small differences between them. Hav-
ing this in mind, delta coding can be applied to re-
duce the dynamic range of original ECG signals. With
delta coding, proposed for the first time in (Fang and
Lu, 2018), subsequent encoded samples are gener-
ated from the difference between the current sample
and the previous sample of the original ECG signal.
This difference signal will have a much lower dy-
namic range than the original ECG signal, so it can
be effectively quantized using a smaller number of
bits. An ECG signal contains the P–QRS–T and U
waves, where the minimal dynamic range is the P–Q
or T–U wave, and the maximal dynamic range is the
QRS complex. This compression method has been
extensively used for ECG, commonly combined with
other techniques, such as zero-separation (Fang and
Lu, 2018) and most often Huffman coding (Chang
and Lin, 2010).
In the specific case of the Savvy ECG signals, it
was shown that the maximal difference can be en-
coded with 9 bits, due to the higher level of noise and
relatively low frequency of 256 samples/s. In the case
of the cleaner MIT-BIH recordings, with lower fre-
quency of 360 samples/s, the largest delta could be
encoded with as few as 8 bits. Having this in mind,
we can conclude that, in general, for each actual dif-
ference in the original analogue signal, for the Savvy
recordings we will always need 1 bit more than for the
MIT-BIH database recordings. The calculation of the
value differences is very simple, requiring only one
pass over all values, which makes it suitable for im-
plementation on an embedded low-power device such
as Savvy.
In the following two sections, different variants of
delta encoding will be presented, with the proposed
packet format for the Savvy sensor.
3.1.1 Single Category
In single-level delta coding, each difference is en-
coded with the same number of bits, i.e., the number
needed to code the largest difference that could ap-
pear in the signal. In the case of the Savvy example
data, this is 9 bits. With higher frequencies, this num-
ber decreases. In the case of simple delta coding, each
packet is 140-bit long. The first 10 bits are the anchor
value – the value in the original signal. After that, 130
bits remain, in which around 14 9-bit differences can
fit, making a total of 15 signal samples in one packet,
as opposed to the original 14. This means that the
compression ratio we can expect from this method is
around 1.07.
The anchor value can also be transmitted only
once in the first packet, with the following ones trans-
mitting only delta values. This case does not allow for
lost packets, since one lost packet will make all of the
following incorrect. Due to this, we decided to send
an anchor with each packet.
3.1.2 Low and High Categories
In this paper, additional experiments were done with
a variant of delta coding, where two levels of differ-
ences are introduced, as proposed in (Hatim et al.,
2016). The main idea of this scheme is to utilize the
parts of the ECG signal with smaller dynamic range,
by encoding those differences with less bits. This
way two coding categories are created: low encod-
ing, where lower differences in the signal are encoded
with as few bits as possible, and high encoding for the
remaining differences. For each data sample, the dif-
ference is calculated and it is determined whether it
belongs to the low category (lower than some thresh-
old value) or to the high one. The number of bits for
the high category is the same as the one used in single-
category delta encoding – 9-bits in the case of Savvy.
To determine the low-encoding bits, an analysis of
the delta values present in the signal needs to be per-
formed. In Figure 2, the distribution of the absolute
values of the differences present in one Savvy record-
ing is shown. Each bar corresponds to the values that
can be coded with the same minimal number of bits,
in order to see which difference bit-widths are most
common. For example, the sixth bar ranges from 32
to 64, meaning the actual differences falling in that
interval are [-64,-32) and [32,64) and can be repre-
sented with a minimum of 7 bits (2
5
= 32 + one sign
bit). From the distribution graph, we can see that pos-
sible low encoding bit-widths are 3, 4 and 5. In addi-
tion, we can see that the large delta values very rarely
appear in the signal, which could mean they are a re-
sult of noise. Due to this, it is possible to decrease
the number of bits representing the high category, by
introducing a very small error (loss) in the decom-
pressed signal. This is also true for single-level delta
encoding and this possibility for lossy delta compres-
sion will be explored in Section 5.
In order to differentiate between different coding
categories, the transmitted packet must be structured
with specific fields. In Figure 3, the proposed packet
format for 2-level delta encoding is shown. Each
Data Compression for Wireless ECG Devices
17