A Real Time and Lossless Encoding Scheme for Patch Electrocardiogram Monitors

Cardiovascular diseases are the leading cause of death worldwide. Due to advancements facilitating the integration of electric and adhesive technologies, long-term patch electrocardiogram (ECG) monitors (PEMs) are currently used to conduct daily continuous cardiac function assessments. This paper presents an ECG encoding scheme for joint lossless data compression and heartbeat detection to minimize the circuit footprint size and power consumption of a PEM. The proposed encoding scheme supports two operation modes: fixed-block mode and dynamic-block mode. Both modes compress ECG data losslessly, but only dynamic-block mode supports the heartbeat detection feature. The whole encoding scheme was implemented on a C-platform and tested with ECG data from MIT/BIH arrhythmia databases. A compression ratio of 2.1 could be achieved with a normal heartbeat. Dynamic-block mode provides heartbeat detection accuracy at a rate higher than 98%. Fixed-block mode was also implemented on the field-programmable gate array, and could be used as a chip for using analog-to-digital convertor-ready signals as an operation clock.


Introduction
According to the World Health Organization, cardiovascular diseases (CVD) are the leading cause of death worldwide [1].An estimated 17.7 million people died from CVD in 2015, representing 31% of all global deaths.Of these, an estimated 7.4 million and 6.7 million deaths were caused by coronary heart disease and stroke, respectively.
Of the 16 million people aged under 70 years who died from non-communicable diseases in 2011, 37% of these deaths were caused by CVD, and 82% of them lived in low and middle-income countries, where people often do not have access to integrated primary health care programs for the early detection and treatment of such illnesses.The cost of CVD treatment escalates quickly with the rapidly increasing requirements for supervision and medical management, and traditional health care infrastructures are easily overwhelmed by the demands of effective late-stage treatment.However, such costs can potentially be reduced by using systems that monitor individuals in the course of their daily activities, which would thus reduce the need for inpatient care or visits to the primary physician.
Early detection and prevention are critical for reducing both the direct and indirect costs of CVD, and researchers have responded to this need by focusing on improving techniques that assess cardiac function, including electrocardiogram (ECG) analysis, which helps screen for various cardiac abnormalities.Current ECG monitoring systems provide continuous, simple, risk-free, and inexpensive recordings of the heart's electrical and muscular functions [2], and advances in technology have changed the way that ECG signals are collected, stored, and analyzed to realize "proactive health care".This has enabled continuous health care monitoring through the use of smartphones [3][4][5][6][7], because ECG signals can be easily transmitted through common communication channels (such as phone lines or wireless channels).In addition, wireless body sensor networks (WBSNs) [8,9] promise large-scale solutions and can be used in place of mobile phones.These solutions automatically report cardiac signals to health care providers, which make them extremely useful in ambulatory settings.
To minimize power consumption and enable long-term ECG data logging, a Holter monitor is used to record patients' ECG data offline continuously for 24-72 h.However, the Holter device does not analyze data or detect a disease, and it does not provide calculated diagnosis information to the hospital, doctor, or patient in response to a critical heart condition.Nevertheless, it has emerged as the most common ECG battery-operated platform that does not have cellular or WBSN connections [10].Advances in semiconductor technology have enabled additional ECG signal storage with even lower power consumption; these ECG signals provide information that is subsequently used by clinicians to determine the mechanisms underlying CVD, and this development is expected to ultimately lead to effective treatment.
The emerging trend is to use wearable devices to record patients' ECG data [11].However, the Holter device typically has six to 10 sensors that must be arrayed on the body, which makes it inconvenient for everyday use.Recent technological advances have thus produced single-use, wearable, monitoring devices that are capable of continuously recording ECG signals for a period of three days or more.A wearable patch ECG monitor (PEM) records ECG signals using an embedded electronic circuit that is attached to a patient's chest with invisible electrodes and lead wires.The device can be considered a wearable health care system that is based on the use of knitted integrated sensors connected to electrodes using a conductive and piezoresistive yarn [12].PEMs are typically highly energy-efficient and provide an analog readout application-specific integrated circuit (ASIC) for signal acquisition, amplification, and analog-to-digital conversion.They also have the advantage of using wireless network interfaces instead of power-hungry wireless links while simultaneously maintaining an extremely small footprint.
ECG monitoring systems produce large volumes of data that must be compressed for efficient processing, storage, and transmission.Many wavelet transform-based methods have been proposed for use with the lossy data compression technique [13][14][15][16][17][18][19][20][21][22][23], and these have fine visual qualities that minimize reconstruction errors.Such methods achieve high compression ratios (CRs) and have no diagnostic-affecting features relating to reconstructed signals.Lossless compression schemes [24,25] employ original signals that are not reconstructed, and because no signal distortion can occur with their use, they are preferable for diagnostic applications.In this respect, Koski [26] used LZ77, complex extraction, and Huffman coding to achieve lossless ECG compression; Giurcâneanu et al. [27] proposed a lossless compression scheme using contexts and R-R interval estimation; and Miaou and Chao [28] proposed a lossless compression method using vector quantization and wavelet transforms.
The encoding scheme proposed in this study addresses real-time application under resource-limited conditions for field-programmable gate array (FPGA), ASIC, or chip implementation, and the primary objective of this design was to achieve easy circuit integration (Figure 1).The ECG signal-acquiring module uses an Analogy-to-Digital converter (ADC) chip to convert an analogy signal to digital raw data for processing.This implementation requires less modification when inserting the proposed chip between the ADC chip and the processor, because it uses the existing sample clock from the ADC data-ready signal as the only operation clock.This chip encodes raw data from the ADC output, and sends it for processing using the same connection interface.The encoding scheme comprises an arithmetic logic unit, such as subtraction or rotation, and a counter unit for minimal power consumption.A PEM uses this encoding scheme by employing the existing ASIC at no additional cost.This approach offers two operation modes: fixed-block mode and dynamic-block mode.Fixed-block mode has one prefix parameter, a "split resolution", which affects the CR and was experimentally applied to the MIT/BIH Arrhythmia Database [29] to identify parameters for optimal compression.Dynamic-block mode uses the selected "split resolution" from the fixed-block mode to compress ECG data while simultaneously producing a quantity of continue flat data, which could be as heartbeat detection.The final CR exceeds 2.1; however, and the heartbeat detection accuracy reaches 98% with a normal beat.
mode.Fixed-block mode has one prefix parameter, a "split resolution", which affects the CR and was experimentally applied to the MIT/BIH Arrhythmia Database [29] to identify parameters for optimal compression.Dynamic-block mode uses the selected "split resolution" from the fixed-block mode to compress ECG data while simultaneously producing a quantity of continue flat data, which could be as heartbeat detection.The final CR exceeds 2.1; however, and the heartbeat detection accuracy reaches 98% with a normal beat.

Design, Materials, and Methods
ECG signals comprise low-frequency (P and T waves and ST segments) and medium-frequency (QRS complexes) components [30].This study aimed to reduce the storage space required for lowfrequency segmentation using the fixed and dynamic-block modes.In this study, "block" refers to a quantity of ECG records, and it is the basic unit of data to be compressed.Both modes are used for real-time and lossless ECG data compression for wearable devices, particularly for PEMs.Herein, fixed-block mode is discussed in three main sections: Section 2.1 discusses delta coding [31], Section 2.2 discusses zero separation, and Section 2.3 discusses zero run length encoding (ZRLE).In Section 2.4, the format output provides a detailed description of the compressed result.Since the dynamicblock mode is similar to fixed-block mode, Section 2.5 explains only the major differences between the two modes.
Figure 2 shows a block diagram of the process used in the proposed encoding scheme.This encoding scheme processes only the voltage values.First, delta coding is used to generate delta values by reducing the dynamic range of the ECG volume.Next, the delta value is rotated one bit to the left in zero separation.This rotation can displace the sign flag of the highest bit, which produces the lowest bit so that the remaining bits shift to the left.The rotated delta value is then split into low bits and high bits with the prefix parameter "split resolution".Finally, one of the listed coding methods, ZRLE, which is based on run length encoding (RLE), is used to encode the zero value of high-bit data only.This scheme bypasses low-bit data and can be subsequently enhanced.

Design, Materials, and Methods
ECG signals comprise low-frequency (P and T waves and ST segments) and medium-frequency (QRS complexes) components [30].This study aimed to reduce the storage space required for low-frequency segmentation using the fixed and dynamic-block modes.In this study, "block" refers to a quantity of ECG records, and it is the basic unit of data to be compressed.Both modes are used for real-time and lossless ECG data compression for wearable devices, particularly for PEMs.Herein, fixed-block mode is discussed in three main sections: Section 2.1 discusses delta coding [31], Section 2.2 discusses zero separation, and Section 2.3 discusses zero run length encoding (ZRLE).In Section 2.4, the format output provides a detailed description of the compressed result.Since the dynamic-block mode is similar to fixed-block mode, Section 2.5 explains only the major differences between the two modes.
Figure 2 shows a block diagram of the process used in the proposed encoding scheme.This encoding scheme processes only the voltage values.First, delta coding is used to generate delta values by reducing the dynamic range of the ECG volume.Next, the delta value is rotated one bit to the left in zero separation.This rotation can displace the sign flag of the highest bit, which produces the lowest bit so that the remaining bits shift to the left.The rotated delta value is then split into low bits and high bits with the prefix parameter "split resolution".Finally, one of the listed coding methods, ZRLE, which is based on run length encoding (RLE), is used to encode the zero value of high-bit data only.This scheme bypasses low-bit data and can be subsequently enhanced.

Delta Coding
Delta coding is applied to reduce the dynamic range of original ECG signals.Subsequent encoded samples are generated from the difference between the current sample and the previous sample of the original ECG signal.An ECG signal contains the shape and size of the P-QRS-T and U waves, and time intervals between various peaks.Each interval contains different frequencies and variations, and the dynamic range of the delta coding volume therefore depends on the input waves.The minimal dynamic range is the P-Q or T-U wave, and the maximal dynamic range is the QRS complex.
A 30-minute ECG recording of MIT/BIH 100 was taken from the MIT/BIH database, which uses an 11-bit resolution over a 10-mv range, and has a dynamic signal range from 485 (2.3 mv) to 1308 (6.3 mv).In addition to the first recorded value of 995 that has a previous sample of 0, delta coding generates a new dynamic range with a delta volume from −217 (−1.05 mv) to 141 (0.688 mv).Since MIT/BIH has a resolution of 11 bits, the first delta value of the first sampled ECG volume can be calculated using the initial previous value of 1024 (middle value) to reduce the dynamic range of the delta volume.Figure 3 compares the MIT/BIH 100 probability of occurrence of each distinct symbol between the ECG (original) volume and delta volume variance; the distinct delta volume variance is more centralized than the original volume.The dynamic range of the delta volume is limited to between −217 and 141, which can be represented by nine bits (in addition to the first record of 995). Figure 3 shows the MIT/BIH 100 ECG volume and delta volume.

Delta Coding
Delta coding is applied to reduce the dynamic range of original ECG signals.Subsequent encoded samples are generated from the difference between the current sample and the previous sample of the original ECG signal.An ECG signal contains the shape and size of the P-QRS-T and U waves, and time intervals between various peaks.Each interval contains different frequencies and variations, and the dynamic range of the delta coding volume therefore depends on the input waves.The minimal dynamic range is the P-Q or T-U wave, and the maximal dynamic range is the QRS complex.
A 30-minute ECG recording of MIT/BIH 100 was taken from the MIT/BIH database, which uses an 11-bit resolution over a 10-mv range, and has a dynamic signal range from 485 (2.3 mv) to 1308 (6.3 mv).In addition to the first recorded value of 995 that has a previous sample of 0, delta coding generates a new dynamic range with a delta volume from −217 (−1.05 mv) to 141 (0.688 mv).Since MIT/BIH has a resolution of 11 bits, the first delta value of the first sampled ECG volume can be calculated using the initial previous value of 1024 (middle value) to reduce the dynamic range of the delta volume.Figure 3 compares the MIT/BIH 100 probability of occurrence of each distinct symbol between the ECG (original) volume and delta volume variance; the distinct delta volume variance is more centralized than the original volume.The dynamic range of the delta volume is limited to between −217 and 141, which can be represented by nine bits (in addition to the first record of 995). Figure 3 shows the MIT/BIH 100 ECG volume and delta volume.

Zero Separation
Since an ECG is composed of low-frequency (P and T waves and ST segments) and mediumfrequency (QRS complexes) components, each ECG interval can be stored in different resolutions.Figure 4 shows that a nine-bit resolution can be used to present delta sequence data in MIT/BIH case 100.This step splits the delta value into two parts: high bits and low bits.Ideally, high bits contain only zero values with specific bit quantities (resolutions) in each interval.With a low-frequency component, a flat signal means a smaller dynamic range of delta volume and produces a zero value with a higher resolution in high bits, and a sign flag problem arises in this step when the delta value is negative.One additional bit, the Most Significant Bit (MBS), increases the data size to indicate either a positive or a negative delta value, and results in many non-zero values in high bits.Since neither maximal (2048) nor minimal (0) ECG signal values appear nearby, the additional bit can be ignored.The delta value must be rotated one bit to the left to encode the bit with the most negative value as zero.Figure 5 shows the MIT/BIH recording of 100 original volumes and rotated delta volumes.

Zero Separation
Since an ECG is composed of low-frequency (P and T waves and ST segments) and medium-frequency (QRS complexes) components, each ECG interval can be stored in different resolutions.Figure 4 shows that a nine-bit resolution can be used to present delta sequence data in MIT/BIH case 100.This step splits the delta value into two parts: high bits and low bits.Ideally, high bits contain only zero values with specific bit quantities (resolutions) in each interval.With a low-frequency component, a flat signal means a smaller dynamic range of delta volume and produces a zero value with a higher resolution in high bits, and a sign flag problem arises in this step when the delta value is negative.One additional bit, the Most Significant Bit (MBS), increases the data size to indicate either a positive or a negative delta value, and results in many non-zero values in high bits.Since neither maximal (2048) nor minimal (0) ECG signal values appear nearby, the additional bit can be ignored.The delta value must be rotated one bit to the left to encode the bit with the most negative value as zero.Figure 5 shows the MIT/BIH recording of 100 original volumes and rotated delta volumes.

ZRLE
Preprocessing with delta coding for optimal selective Huffman coding is used to achieve lossless ECG compression [32].Huffman coding creates variable-length codes with shorter code words for higher probabilities, and each is represented by an integer bit number.Huffman coding is relatively simple, and it is the best coding scheme possible when coded words are restricted to integer lengths [32,33].Section 2.2 describes how zero separation increases the zero-value probability of high bits, and this can then be compressed using Huffman.For real-time encoding and minimal implementation complexity, a new method based on RLE [34] was designed with a high probability of zero bases.RLE is a simple technique that is used for digital data compression and represents successive runs of the same value in the data when the value is followed by a counter, rather than the original run of values.ZRLE is modified from RLE to encode zero values only.This method replaces continual zero values as one zero and a number of consecutive zeros, and it requires a quantity of consecutive zeros greater than two.In addition, it fails to compress a single zero with a pair of 0 and 1.The resolution of high bits defines the maximum number of consecutive zeros.For example, fourbit high-bit resolution presents a maximum number of consecutive zeros of 16, or two to the fourth power.However, a lower resolution corresponds with more consecutive zeros in high bits, but an increasing low-bits resolution reduces the total CR.Although a QRS complex is of medium-frequency and has a higher dynamic data range, it provides fewer periods in a single heartbeat.Since it is not possible to know the encoded size of high bits, two consecutive zeros represent the end tag that identifies the end of one block.When a block of data is encoded, the end tag is appended to the last

ZRLE
Preprocessing with delta coding for optimal selective Huffman coding is used to achieve lossless ECG compression [32].Huffman coding creates variable-length codes with shorter code words for higher probabilities, and each is represented by an integer bit number.Huffman coding is relatively simple, and it is the best coding scheme possible when coded words are restricted to integer lengths [32,33].Section 2.2 describes how zero separation increases the zero-value probability of high bits, and this can then be compressed using Huffman.For real-time encoding and minimal implementation complexity, a new method based on RLE [34] was designed with a high probability of zero bases.RLE is a simple technique that is used for digital data compression and represents successive runs of the same value in the data when the value is followed by a counter, rather than the original run of values.ZRLE is modified from RLE to encode zero values only.This method replaces continual zero values as one zero and a number of consecutive zeros, and it requires a quantity of consecutive zeros greater than two.In addition, it fails to compress a single zero with a pair of 0 and 1.The resolution of high bits defines the maximum number of consecutive zeros.For example, fourbit high-bit resolution presents a maximum number of consecutive zeros of 16, or two to the fourth power.However, a lower resolution corresponds with more consecutive zeros in high bits, but an increasing low-bits resolution reduces the total CR.Although a QRS complex is of medium-frequency and has a higher dynamic data range, it provides fewer periods in a single heartbeat.Since it is not possible to know the encoded size of high bits, two consecutive zeros represent the end tag that identifies the end of one block.When a block of data is encoded, the end tag is appended to the last

ZRLE
Preprocessing with delta coding for optimal selective Huffman coding is used to achieve lossless ECG compression [32].Huffman coding creates variable-length codes with shorter code words for higher probabilities, and each is represented by an integer bit number.Huffman coding is relatively simple, and it is the best coding scheme possible when coded words are restricted to integer lengths [32,33].Section 2.2 describes how zero separation increases the zero-value probability of high bits, and this can then be compressed using Huffman.For real-time encoding and minimal implementation complexity, a new method based on RLE [33] was designed with a high probability of zero bases.RLE is a simple technique that is used for digital data compression and represents successive runs of the same value in the data when the value is followed by a counter, rather than the original run of values.ZRLE is modified from RLE to encode zero values only.This method replaces continual zero values as one zero and a number of consecutive zeros, and it requires a quantity of consecutive zeros greater than two.In addition, it fails to compress a single zero with a pair of 0 and 1.The resolution of high bits defines the maximum number of consecutive zeros.For example, four-bit high-bit resolution presents a maximum number of consecutive zeros of 16, or two to the fourth power.However, a lower resolution corresponds with more consecutive zeros in high bits, but an increasing low-bits resolution reduces the total CR.Although a QRS complex is of medium-frequency and has a higher dynamic data range, it provides fewer periods in a single heartbeat.Since it is not possible to know the encoded size of high bits, two consecutive zeros represent the end tag that identifies the end of one block.When a block of data is encoded, the end tag is appended to the last record (that is not a pair of zeros) and the counter.Thus, the decoding process restores the high-bit volume with the same predefined block size, or the zero value is used to make up for the shortage of records in a high-bit volume.The end tag affects the CR terminating the data string with 0, 0, and a suitable segmentation has an end tag to eliminate longer continual zeros in the tail.This experiment aimed to provide a high-bit resolution encoding scheme to achieve the optimal CR for use in dynamic-block mode.

Format Output
ZRLE compresses high-bit data produced by delta coding and zero separation.Zero separation splits delta data with a selected resolution that must be experimentally identified.Figure 2 shows a flow chart where the low-bit and high-bit streams are the compressed results of continuous, real-time ECG data.Zero separation directly transfers the low-bit portion of the rotated delta data into the low-bit stream without compression.The maximal CR is then determined by the high-bit resolution and limited (low-bit resolution + high-bit resolution)/(low-bit resolution).Figure 6 shows the encoded data format of a fixed-block size, where the M value is determined by ZRLE, and should be smaller than N, the block size.
Appl.Sci.2018, 8, x 7 of 17 record (that is not a pair of zeros) and the counter.Thus, the decoding process restores the high-bit volume with the same predefined block size, or the zero value is used to make up for the shortage of records in a high-bit volume.The end tag affects the CR terminating the data string with 0, 0, and a suitable segmentation has an end tag to eliminate longer continual zeros in the tail.This experiment aimed to provide a high-bit resolution encoding scheme to achieve the optimal CR for use in dynamic-block mode.

Format Output
ZRLE compresses high-bit data produced by delta coding and zero separation.Zero separation splits delta data with a selected resolution that must be experimentally identified.Figure 2 shows a flow chart where the low-bit and high-bit streams are the compressed results of continuous, real-time ECG data.Zero separation directly transfers the low-bit portion of the rotated delta data into the lowbit stream without compression.The maximal CR is then determined by the high-bit resolution and limited (low-bit resolution + high-bit resolution)/(low-bit resolution).Figure 6 shows the encoded data format of a fixed-block size, where the M value is determined by ZRLE, and should be smaller than N, the block size.

Dynamic-Block Mode and Heartbeat
The heartbeat ratio and sampling rate influence the quantity of samples for each interval, such as P, PR segments, QRS complexes, ST segments, T, U, and V in fixed-block mode, and an increment counter counts the quantity of the encoded data and appends an end tag to the high-bit output stream.The optimal CR has a valid end tag when using ECG data block segmentation with QRS complexes, and the sequence value following the QRS complexes in one heartbeat can be replaced by an end tag.Although many real-time QRS detection algorithms have been proposed, dynamic-block mode can simply modify the counter for QRS complex detection.In addition, counting continual zeros in high-bits can be used roughly to segment the ECG stream by QRS complexes.When the quantity of consecutive zeros exceeds the threshold, one-third of the sampling rate is calculated in the normal heartbeat range from 0.8-3 HZ [35].The next non-zero has a high probability of being a QRS complex, which will thus determine the block size of the dynamic-block mode.The compression procedure is identical to that of the fixed-block mode; the only major difference is the block size K, which is generated through non-QRS-complex segmentation, and is inserted in the initial output (Figure 4). Figure 7 shows the output format for dynamic-block mode.

Dynamic-Block Mode and Heartbeat
The heartbeat ratio and sampling rate influence the quantity of samples for each interval, such as P, PR segments, QRS complexes, ST segments, T, U, and V in fixed-block mode, and an increment counter counts the quantity of the encoded data and appends an end tag to the high-bit output stream.The optimal CR has a valid end tag when using ECG data block segmentation with QRS complexes, and the sequence value following the QRS complexes in one heartbeat can be replaced by an end tag.Although many real-time QRS detection algorithms have been proposed, dynamic-block mode can simply modify the counter for QRS complex detection.In addition, counting continual zeros in high-bits can be used roughly to segment the ECG stream by QRS complexes.When the quantity of consecutive zeros exceeds the threshold, one-third of the sampling rate is calculated in the normal heartbeat range from 0.8-3 HZ [34].The next non-zero has a high probability of being a QRS complex, which will thus determine the block size of the dynamic-block mode.The compression procedure is identical to that of the fixed-block mode; the only major difference is the block size K, which is generated through non-QRS-complex segmentation, and is inserted in the initial output (Figure 4). Figure 7 shows the output format for dynamic-block mode.

Results
This encoding scheme was implemented in C using GCC 4.01 on FreeBSD 10.1 and tested using the MIT/BIH Arrhythmia Database records 100 to 109.Each record had a sampling rate of 360 Hz and 11-bit resolution.The CR calculation is defined as follows, and the results are provided in the following sections.

High-Bit Resolution
With respect to the fixed-block mode, this research reserved 512 records as the block size and 512 units of output buffer space to identify three to eight suitable high-bit resolutions.The CRs are presented in Table 1 and Figure 8.The preferred CR was found at a resolution of seven bits on recording 100. Figure 9 shows the best case for high-bit and low-bit results for recording 100.Recording 107 provided the lowest performance of all 10 records because it contained an ECG signal with an abnormal "paused" heartbeat.The best CR of recording 107 was at a resolution of five bits for high bits, and it was the only recording that provided a high performance at five bits.Figure 10 presents the original ECG signal, which has a longer QRS complex than a standard ECG signal does.Since the QRS complex has a high-variation signal, high bits are used to represent the value and have short continual zeros.In contrast, zero separation exhibited a less favorable performance.

Results
This encoding scheme was implemented in C using GCC 4.01 on FreeBSD 10.1 and tested using the MIT/BIH Arrhythmia Database records 100 to 109.Each record had a sampling rate of 360 Hz and 11-bit resolution.The CR calculation is defined as follows, and the results are provided in the following sections.CR = Number of bits in/Number of bits out

High-Bit Resolution
With respect to the fixed-block mode, this research reserved 512 records as the block size and 512 units of output buffer space to identify three to eight suitable high-bit resolutions.The CRs are presented in Table 1 and Figure 8.The preferred CR was found at a resolution of seven bits on recording 100. Figure 9 shows the best case for high-bit and low-bit results for recording 100.Recording 107 provided the lowest performance of all 10 records because it contained an ECG signal with an abnormal "paused" heartbeat.The best CR of recording 107 was at a resolution of five bits for high bits, and it was the only recording that provided a high performance at five bits.Figure 10 presents the original ECG signal, which has a longer QRS complex than a standard ECG signal does.Since the QRS complex has a high-variation signal, high bits are used to represent the value and have short continual zeros.In contrast, zero separation exhibited a less favorable performance.

Block Size of Fixed-Block Mode
Whole high-bit data that are zero have the highest compression rate in this scheme; however, QRS segmentation causes the data to fail.To attain the optimum performance, the input data need an ECG data length of one heartbeat over time with QRS segmentation at the start of the data; this best-encoded high-bit data content employs QRS segmentation and an end tag only.This data length can be predicted because of changes in the heartbeat rate.Since using the QRS detection algorithm to segment the ECG signal makes this scheme complicated, this section addresses finding a prefixedblock size that has the most end tags to attain a higher encoded performance for each high-bit resolution with a 360 sampling rate in the MIT/BIH database.
High-bit data requires an efficient storage space to be encoded.Table 2 presents the results of different block sizes.Since the CR can be improved by increasing the block size, the block size

Block Size of Fixed-Block Mode
Whole high-bit data that are zero have the highest compression rate in this scheme; however, QRS segmentation causes the data to fail.To attain the optimum performance, the input data need an ECG data length of one heartbeat over time with QRS segmentation at the start of the data; this best-encoded high-bit data content employs QRS segmentation and an end tag only.This data length can be predicted because of changes in the heartbeat rate.Since using the QRS detection algorithm to segment the ECG signal makes this scheme complicated, this section addresses finding a prefixed-block size that has the most end tags to attain a higher encoded performance for each high-bit resolution with a 360 sampling rate in the MIT/BIH database.
High-bit data requires an efficient storage space to be encoded.Table 2 presents the results of different block sizes.Since the CR can be improved by increasing the block size, the block size properties for different CRs in Figure 11 suggest that diminishing marginal returns occur when the block size reaches 256 records.More storage space enhances the CR, but the effect diminishes.properties for different CRs in Figure 11 suggest that diminishing marginal returns occur when the block size reaches 256 records.More storage space enhances the CR, but the effect diminishes.

Dynamic-Block Mode
Our experiments used high-bit resolution and block size, with the aim of eliminating as many records as possible using the end tag.MIT/BIH database recording 107 has the best CR with a block size of 128, whereas the other recordings have block sizes of 256.In dynamic-block mode, the block size is calculated by detecting the number of consecutive zeros produced by applying QRS to the high bits.Segmenting the high-bit streaming data with QRS complexes also provides useful information

Dynamic-Block Mode
Our experiments used high-bit resolution and block size, with the aim of eliminating as many records as possible using the end tag.MIT/BIH database recording 107 has the best CR with a block size of 128, whereas the other recordings have block sizes of 256.In dynamic-block mode, the block size is calculated by detecting the number of consecutive zeros produced by applying QRS to the high bits.Segmenting the high-bit streaming data with QRS complexes also provides useful information about the heart rate.The correct rate and CR for dynamic-block mode are shown in Table 3, which shows a positive correlation between the CR and heartbeat detection ability based on the numbers provided by the MIT database.However, while this feature works well for normal heartbeats, it performs poorly with MIT/BIH database recording 107, which features insignificant QRS complexes.

Discussion
Lossy compression methods produce a much higher CR than lossless methods [26], with some methods achieving 10-20 times the compression with total errors under 10%.Table 4 shows the reported lossless compression results obtained from many different sources.Although the proposed method does not outperform other methods in terms of total compression, it can be easily implemented through ASIC or FPGA.In addition, although the heartbeat detection feature may not be entirely accurate, it may be suitable for some applications.The result could be used to trigger ECG data transmission, which could be followed by analysis at a medical center.
Existing PEM systems provide a feasible ECG recording solution that replaces wireless transmission with local storage.To determine its capabilities, fixed-block mode was implemented and verified on an Xilinx ML505 FPGA evaluation board (Figure 12).Arithmetic and logic units were used to implement the proposed scheme, which is shown as a block diagram in Figure 13.This implementation is triggered by data input from ADC conversion to reduce power consumption.An rs232 module was used as a communication interface between the desktop computer and evaluation board that transfers MIT/BIH arrhythmia data and verifies data compression.
Table 4 presents the results from various lossless ECG compression sources.Typical "entropy coding" is Huffman coding, which requires the Huffman tree to be written as part of the data.Differential pulse-code modulation (DPCM) uses a baseline of pulse-code modulation and a prediction function to encode data.DPCM linear prediction uses a discrete-time signal to estimate a linear function from previous samples.The entropy coding of second differences and orthogonal transforms-Compute Tomography (CT), Korhunen-Loeve transform (KLT), and Hibert transform (HT)-have the same time complexity, but orthogonal transforms is a frequency domain method; therefore, more computational power is used.In Figure 13, the encoding scheme's delta coding module comprises CURRENT, PREVIOUS, and DELTA.The ROTATION and SEPARATION operation implement the zero separation module to generate the high and low-bit streams, which indicate to the other module that the input signal is ready.The low-bit stream is connected to the four-pin LowData_out interface, and can be stored on an external flash drive with four-bit writing.ZRLE uses MAX, HALF, ZERO, and ZERO-COUNTER to compress the high-bit stream from the previous module.ZERO-COUNTER is an increment that is used to count the number of consecutive zeros to trigger one MAX, HALF, or ZERO operation.The high-bit output stream can also be stored on an external flash drive using the storage module.Furthermore, Output_status_0 and Output_status_1 are used to identify three different output formats that appear in the high-bit stream pipeline system architecture: non-zero value status, maximal zero value status, and continual zero values with a non-zero value status.Two studies have developed lossless ECG data compression chips [26,35] and determined that a high operation clock is not needed (Table 5).Existing chips have low power consumption, and although this cannot currently be ascertained for the proposed chip, it is expected to be even lower.
In Figure 13, the encoding scheme's delta coding module comprises CURRENT, PREVIOUS, and DELTA.The ROTATION and SEPARATION operation implement the zero separation module to generate the high and low-bit streams, which indicate to the other module that the input signal is ready.The low-bit stream is connected to the four-pin LowData_out interface, and can be stored on an external flash drive with four-bit writing.ZRLE uses MAX, HALF, ZERO, and ZERO-COUNTER to compress the high-bit stream from the previous module.ZERO-COUNTER is an increment that is used to count the number of consecutive zeros to trigger one MAX, HALF, or ZERO operation.The high-bit output stream can also be stored on an external flash drive using the storage module.Furthermore, Output_status_0 and Output_status_1 are used to identify three different output formats that appear in the high-bit stream pipeline system architecture: non-zero value status, maximal zero value status, and continual zero values with a non-zero value status.Two studies have developed lossless ECG data compression chips [37,38] and determined that a high operation clock is not needed (Table 5).Existing chips have low power consumption, and although this cannot currently be ascertained for the proposed chip, it is expected to be even lower.

Conclusions
Wearable ECG monitors do not provide sufficient computing power to detect critical P, QRS, and T events to allow a reliable cardiovascular assessment [39][40][41][42][43][44].The proposed encoding uses a In Figure 13, the encoding scheme's delta coding module comprises CURRENT, PREVIOUS, and DELTA.The ROTATION and SEPARATION operation implement the zero separation module to generate the high and low-bit streams, which indicate to the other module that the input signal is ready.The low-bit stream is connected to the four-pin LowData_out interface, and can be stored on an external flash drive with four-bit writing.ZRLE uses MAX, HALF, ZERO, and ZERO-COUNTER to compress the high-bit stream from the previous module.ZERO-COUNTER is an increment that is used to count the number of consecutive zeros to trigger one MAX, HALF, or ZERO operation.The high-bit output stream can also be stored on an external flash drive using the storage module.Furthermore, Output_status_0 and Output_status_1 are used to identify three different output formats that appear in the high-bit stream pipeline system architecture: non-zero value status, maximal zero value status, and continual zero values with a non-zero value status.Two studies have developed lossless ECG data compression chips [37,38] and determined that a high operation clock is not needed (Table 5).Existing chips have low power consumption, and although this cannot currently be ascertained for the proposed chip, it is expected to be even lower.

Conclusions
Wearable ECG monitors do not provide sufficient computing power to detect critical P, QRS, and T events to allow a reliable cardiovascular assessment [39][40][41][42][43][44].The proposed encoding uses a

Conclusions
Wearable ECG monitors do not provide sufficient computing power to detect critical P, QRS, and T events to allow a reliable cardiovascular assessment [37][38][39][40][41][42].The proposed encoding uses a basic logic component, arithmetic and logic unit subtraction, rotation, comparator, and counter, and stores original real-time and lossless data for processing in clinical contexts.It is used to minimize the physical size and power consumption of a unit, and the encoding scheme offers superior efficiency to comparable software solutions.Since this scheme rotates only one bit, a simple circuit switch can be used to replace the rotating arithmetic logic unit (ALU).In addition, because each module is triggered by the previous one, the pipeline architecture achieves real-time ECG data encoding, and the scheme can be integrated into a wearable ECG monitor or PEM system.Replacing wireless modules with local storage in wearable ECG monitors (e.g., Holter device or PEM) reduces the overall footprint, power consumption, and battery weight.Existing PEM ASICs are suitable for implementing this design to minimize equipment size and power consumption while enhancing user convenience.
The designed scheme detects significant QRS complexes in a normal ECG signal.MIT records 100 and 103 have the best CR of approximately 2.1, whereas MIT 107 has the worst (i.e., 1.5), because it contains abnormal signals such as premature ventricular contractions and pauses.However, when high-bit resolution was split into five bits for MIT recording 107, both the CR and heartbeat detection correction increased.Despite its poor performance with abnormal ECG signals, the proposed approach can be used for Holter or PEM-based health care devices for occasional CVD assessment without data loss.FPGA was used to compress real ECG data from an ECG generator with a high sampling rate, and has reached a high CR (2.7 when a five-KHz sampling rate is used), as shown in Figure 14.This result confirms that an ADC-ready signal can be used as an operation clock when this scheme is implemented on a chip.
Appl.Sci.2018, 8, x 14 of 17 basic logic component, arithmetic and logic unit subtraction, rotation, comparator, and counter, and stores original real-time and lossless data for processing in clinical contexts.It is used to minimize the physical size and power consumption of a unit, and the encoding scheme offers superior efficiency to comparable software solutions.Since this scheme rotates only one bit, a simple circuit switch can be used to replace the rotating arithmetic logic unit (ALU).In addition, because each module is triggered by the previous one, the pipeline architecture achieves real-time ECG data encoding, and the scheme can be integrated into a wearable ECG monitor or PEM system.Replacing wireless modules with local storage in wearable ECG monitors (e.g., Holter device or PEM) reduces the overall footprint, power consumption, and battery weight.Existing PEM ASICs are suitable for implementing this design to minimize equipment size and power consumption while enhancing user convenience.
The designed scheme detects significant QRS complexes in a normal ECG signal.MIT records 100 and 103 have the best CR of approximately 2.1, whereas MIT 107 has the worst (i.e., 1.5), because it contains abnormal signals such as premature ventricular contractions and pauses.However, when high-bit resolution was split into five bits for MIT recording 107, both the CR and heartbeat detection correction increased.Despite its poor performance with abnormal ECG signals, the proposed approach can be used for Holter or PEM-based health care devices for occasional CVD assessment without data loss.FPGA was used to compress real ECG data from an ECG generator with a high sampling rate, and has reached a high CR (2.7 when a five-KHz sampling rate is used), as shown in Figure 14.This result confirms that an ADC-ready signal can be used as an operation clock when this scheme is implemented on a chip.However, the actual performance did not meet expectations in dynamic-block mode.With an eight-bit high-bit resolution and a sampling rate of 360 Hz, the longest plate period of one heartbeat has 320 values for non-QRS segmentation, and it has the same storage requirements for the end tag (zero, zero) and zero encoding (zero and number).Dynamic-block mode could provide excellent performance with a higher data sampling rate or more high-bit resolution with a long continual zero values.MIT/BIH arrhythmia provides Physikalisch-Technische Bundesanstalt (PTB) databases with a one-kHz sampling rate and 16 bits of raw data resolution.However, this encoding scheme doesn't archive expected performance; the CR is only 1.98 because of eight high-bit resolutions and 8 eight high-bit resolutions.Figure 15 shows the MIT s0010_re probability of occurrence of each distinct symbol between the ECG (original) volume and delta volume variance.However, this record has high resolution, but the plate period needs eight bits in order to be present.Then, the maximal CR of s0010_re is restricted to the ratio of high bits and low bits.In fact, although MIT s0010_re has a 16-bit resolution, it still only uses nine bits to record data.However, the actual performance did not meet expectations in dynamic-block mode.With an eight-bit high-bit resolution and a sampling rate of 360 Hz, the longest plate period of one heartbeat has 320 values for non-QRS segmentation, and it has the same storage requirements for the end tag (zero, zero) and zero encoding (zero and number).Dynamic-block mode could provide excellent performance with a higher data sampling rate or more high-bit resolution with a long continual zero values.MIT/BIH arrhythmia provides Physikalisch-Technische Bundesanstalt (PTB) databases with a one-kHz sampling rate and 16 bits of raw data resolution.However, this encoding scheme doesn't archive expected performance; the CR is only 1.98 because of eight high-bit resolutions and 8 eight high-bit resolutions.Figure 15 shows the MIT s0010_re probability of occurrence of each distinct symbol between the ECG (original) volume and delta volume variance.However, this record has high resolution, but the plate period needs eight bits in order to be present.Then, the maximal CR of The rough heartbeat rate detection feature of dynamic-block mode, which has a lower CR than that of fixed-block mode, could be used in medic alert applications.Furthermore, in order to enhance the CR, uncompressed low-bit data can be processed through a method such as Huffman coding.The optimal integration is to implement this scheme on an existing ADC chip or main processor, because it changes no input and output interfaces.Fixed-block mode can use a chip that is taped out from TSMC (Taiwan Semiconductor Manufacturing Company, Limited) to evaluate power consumption.The rough heartbeat rate detection feature of dynamic-block mode, which has a lower CR than that of fixed-block mode, could be used in medic alert applications.Furthermore, in order to enhance the CR, uncompressed low-bit data can be processed through a method such as Huffman coding.The optimal integration is to implement this scheme on an existing ADC chip or main processor, because it changes no input and output interfaces.Fixed-block mode can use a chip that is taped out from TSMC (Taiwan Semiconductor Manufacturing Company, Limited) to evaluate power consumption.

Figure 3 .
Figure 3.Comparison of probability of occurrence of each distinct symbol for an electrocardiogram (ECG) (original) volume and delta volume variance with MIT/BIH Arrhythmia Database 100.

Figure 3 .
Figure 3.Comparison of probability of occurrence of each distinct symbol for an electrocardiogram (ECG) (original) volume and delta volume variance with MIT/BIH Arrhythmia Database 100.

Figure 15 .
Figure 15.Comparison of probability of occurrence of each distinct symbol for ECG (original) volume and delta volume variance with MIT s0010_re.

Figure 15 .
Figure 15.Comparison of probability of occurrence of each distinct symbol for ECG (original) volume and delta volume variance with MIT s0010_re.

Table 1 .
Compression rate for high-bit resolution.

Table 1 .
Compression rate for high-bit resolution.

Table 2 .
Block size and compression rate.

Table 2 .
Block size and compression rate.

Table 3 .
Dynamic-block mode compression ratio (CR) and heartbeat detection rate.