An electrocardio data compression method, system, decompression method and system

By employing differential processing and adaptive variable-length coding, ECG data is compressed in frames, resolving the imbalance between computational complexity and compression efficiency in existing technologies. This achieves lossless compression with high compression ratio and low computational complexity, making it suitable for embedded devices.

CN122457066APending Publication Date: 2026-07-24HANGZHOU PROTON HEART PET TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HANGZHOU PROTON HEART PET TECHNOLOGY CO LTD
Filing Date
2026-04-14
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing ECG data compression algorithms struggle to achieve a good balance between computational complexity and compression efficiency on embedded devices, making real-time operation impossible.

Method used

Differential processing and adaptive variable-length coding are used to perform frame processing on ECG data. By taking advantage of the strong correlation of ECG signals, the difference is converted into a small value close to zero and compressed through various coding rules to adapt to coding strategies with different numerical ranges.

Benefits of technology

It achieves high compression ratio, low computational complexity, and lossless or near-lossless compression, making it suitable for real-time operation on embedded devices and flexibly adapting to the needs of different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122457066A_ABST
    Figure CN122457066A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of electrocardio data processing, in particular to an electrocardio data compression method and system and a decompression method and system, which comprises the following steps: converting collected original data to obtain an electrocardio sequence with a preset bit width; framing the electrocardio sequence to obtain a plurality of frames; performing difference calculation on all sampling points in each frame except the first sampling point of the frame to obtain a difference value, and selecting a corresponding encoding rule for compression encoding according to the difference value; wherein the plurality of encoding rules comprise a first encoding rule corresponding to a first value range and L second encoding rules corresponding to a plurality of value ranges exceeding the first value range, the length of the encoding result corresponding to the first encoding rule comprises a compression bit width, and the length of the encoding result corresponding to the second encoding rule comprises the compression bit width and a feature value bit width. The application has the effect of achieving a good balance among compression efficiency, calculation complexity and implementation difficulty on an embedded device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of electrocardiogram (ECG) data processing, and in particular to an ECG data compression method, system, and decompression method and system. Background Technology

[0002] With the increasing prevalence of telemedicine and wearable health monitoring devices, the demand for long-term, continuous electrocardiogram (ECG) monitoring is growing. The large amounts of raw data collected by ECG devices via analog-to-digital converters (ADCs) pose a significant challenge to the devices' storage space and wireless transmission bandwidth. Therefore, efficient, lossless, or near-lossless ECG data compression technology is crucial.

[0003] Existing compression algorithms, such as Huffman coding and LZW, while offering high compression ratios, also have high computational complexity, making them unsuitable for real-time operation on embedded devices with limited computing power and power consumption. Therefore, a compression and decompression method that achieves a good balance between compression efficiency, computational complexity, and implementation difficulty is needed on embedded devices. Summary of the Invention

[0004] In order to achieve a good balance between compression efficiency, computational complexity and implementation difficulty on embedded devices, this application provides an electrocardiogram data compression method, system, and decompression method, system.

[0005] In a first aspect, this application provides a method for compressing electrocardiogram (ECG) data, employing the following technical solution:

[0006] A method for compressing electrocardiogram (ECG) data includes the following steps:

[0007] The collected raw data is converted to obtain an electrocardiogram sequence with a preset bit width;

[0008] The electrocardiogram sequence is divided into frames as described above to obtain several consecutive frames;

[0009] Differential calculation is performed on all sampling points in each frame except the first sampling point to obtain the difference value. Based on the numerical range of the difference value, the corresponding encoding rule is selected from a variety of predefined encoding rules for compression encoding to obtain encoded data. Several encoded data are combined to form compressed data.

[0010] The various encoding rules include: a first encoding rule corresponding to a first numerical range, and L second encoding rules corresponding to several numerical ranges exceeding the first numerical range. The encoding result length corresponding to the first encoding rule includes the compressed bit width, and the encoding result length corresponding to the second encoding rule includes the compressed bit width and the feature value bit width used to identify the selected encoding rule.

[0011] In some embodiments, each frame contains N consecutive sampling points, and the first sampling point of each frame is stored as the frame start sampling point with its original value.

[0012] In some embodiments, N is a dynamic value, and the method for determining the number of sampling points contained in each frame includes the following steps:

[0013] The peak position of the QRS complex is obtained by extracting an electrocardiogram signal of a preset duration from the electrocardiogram sequence.

[0014] The adjacent valley positions are obtained on both sides of the i-th peak position to select the frame range, wherein at least one end of the frame range corresponds to a valley value;

[0015] The number of sampling points within each frame range is defined as N.

[0016] In some embodiments, the first numerical range corresponds to (-V, V). Under the first encoding rule, the compression bit width is calculated by rounding up log2(2V+2*(L-2)) to compress and store the difference. V and L are dynamically selected based on the distribution of the difference within the frame, corresponding to the value with the highest compression ratio.

[0017] In some embodiments, when the numerical range of the second encoding rule does not exceed the range of the first L-1 types of the second encoding rule, the numerical range corresponding to the second encoding rule is (-K-(2^ ),-K] and [K,K+(2^ ), where -K and K represent the boundary values ​​corresponding to the previous adjacent numerical range, 2^ This is represented by the extent of boundary expansion between the i-th numerical range and the previous adjacent numerical range. Characterized as the offset storage bit length parameter;

[0018] Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. This refers to the compressed bit width.

[0019] In some embodiments, under the second encoding rule, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the offset, wherein...

[0020] The feature value is represented as any value within the range of signed integers excluding the first numerical range, and the feature values ​​under the second encoding rule are all different;

[0021] The offset represents the absolute value of the difference between the difference corresponding to the sampling point and the inner boundary value within the numerical range. The inner boundary value is characterized as the boundary value in the positive direction within the numerical range of the corresponding negative number, and as the boundary value in the negative direction within the numerical range of the corresponding positive number.

[0022] In some embodiments, when the value exceeds the numerical range of the first L-1 second encoding rules, the numerical range corresponding to the second encoding rule is (-∞, -K] and [K, +∞). Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. The original bit width of the sampling point is used as the compressed bit width, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the original value corresponding to the sampling point.

[0023] Secondly, this application provides an electrocardiogram (ECG) data compression system, which adopts the following technical solution:

[0024] An electrocardiogram (ECG) data compression system is provided to implement the ECG data compression method described above.

[0025] Thirdly, this application provides a method for decompressing electrocardiogram (ECG) data, employing the following technical solution:

[0026] A method for decompressing electrocardiogram (ECG) data includes the following steps:

[0027] Acquire compressed data and identify frame header features, and divide the compressed data into several frames based on the frame header features;

[0028] Read the original value of the first sampling point of the frame, parse the frame header features corresponding to the remaining sampling points, and read the corresponding encoded data sequentially;

[0029] The encoding rule corresponding to the encoded data is determined based on the feature value corresponding to the feature value bit width in the encoded data, and the sampling point is reverse decoded based on the encoding rule to recover the original sampling value;

[0030] After all frames are decoded, the original electrocardiogram sequence is formed.

[0031] Fourthly, this application provides an electrocardiogram (ECG) data decompression system, which adopts the following technical solution:

[0032] An electrocardiogram (ECG) data decompression system is provided to implement the aforementioned ECG data decompression method.

[0033] The technical solutions provided by the embodiments of this application have the following technical effects:

[0034] 1. High compression ratio: By utilizing the strong correlation between ECG signal sampling points, most of the data is converted into small values ​​close to zero through differential processing, and then adaptive variable length coding is used to represent the difference with the highest probability of occurrence with the fewest number of bits, thus achieving a high compression ratio.

[0035] 2. Low computational complexity: The algorithm mainly consists of subtraction, comparison and bit operations. It is simple to calculate and does not involve complex multiplication, division or table lookup operations, making it very suitable for real-time implementation in MCU or dedicated digital circuits.

[0036] 3. High flexibility: By adjusting parameters (such as M, N, V, n), a flexible trade-off can be made between compression ratio and signal fidelity to adapt to the needs of different application scenarios.

[0037] 4. Lossless / Near-lossless compression: By setting the "large difference original storage" strategy, it ensures that the information of the abrupt part of the signal (such as QRS wave) is not lost, and visual lossless reconstruction can be achieved under reasonable quantization conditions. Attached Figure Description

[0038] Figure 1 This is a schematic diagram of the steps of an electrocardiogram data compression method provided in this embodiment.

[0039] Figure 2 This is a schematic diagram illustrating the numerical range in the embodiments of this application.

[0040] Figure 3 This is a schematic diagram illustrating compression based on different encoding rules in the embodiments of this application.

[0041] Figure 4 This is a schematic diagram of the steps of an electrocardiogram data decompression method in an embodiment of this application.

[0042] Figure 5 This is a schematic diagram illustrating decompression based on different encoding rules in the embodiments of this application. Detailed Implementation

[0043] To better understand the purpose, technical solutions, and advantages of this application, it has been described and illustrated below with reference to the accompanying drawings and embodiments. However, those skilled in the art should understand that this application can be implemented without these details. In some cases, to avoid obscuring various aspects of this application due to unnecessary description, well-known methods, processes, systems, components, and / or circuits already described at a higher level will not be elaborated upon. It will be apparent to those skilled in the art that various modifications can be made to the embodiments disclosed in this application, and the general principles defined in this application can be applied to other embodiments and application scenarios without departing from the principles and scope of this application. Therefore, this application is not limited to the illustrated embodiments, but conforms to the broadest scope consistent with the scope of protection claimed in this application.

[0044] It should be noted that the descriptions of these embodiments are for the purpose of aiding understanding the present invention, but do not constitute a limitation thereof. Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0045] In the description of this application, "several" means one or more, "more than" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0046] In the description of this application, the terms "one embodiment," "some embodiments," "illustrative embodiment," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples.

[0047] like Figure 1 As shown in the figure, this application discloses a method for compressing electrocardiogram (ECG) data, which specifically includes the following steps:

[0048] S100 converts the acquired raw data to obtain an electrocardiogram sequence with a preset bit width.

[0049] First, the integer ECG data output by the analog-to-digital converter is converted into floating-point voltage values, and then the floating-point voltage values ​​are converted into an integer ECG sequence with a preset bit width.

[0050] The above conversion process consists of two parts: the first part converts the integer ECG data (which has no physical meaning) output by the ADC into floating-point voltage values ​​(which have actual physiological signal meaning, such as the mV level); the second part quantizes the floating-point voltage values ​​into integer data with a preset bit width, unifying the data scale and avoiding coding redundancy caused by the excessive dynamic range of the original data.

[0051] The preset width of the integer ECG sequence is an M-bit integer, where M can be 8, 12, 16, etc.

[0052] S200, the electrocardiogram sequence is divided into frames as described above to obtain a series of consecutive frames.

[0053] The quantized continuous ECG data stream is divided into multiple frames, each containing N consecutive sampling points. N is a dynamically configurable parameter whose value range can be adjusted according to the actual application. Frame division helps to transform global data correlation into local intra-frame correlation, simplifying the processing logic.

[0054] The method for determining N includes the following steps:

[0055] In the electrocardiogram sequence, an electrocardiogram signal of a preset duration is extracted, the peak position of the QRS complex is obtained, and the adjacent valley positions are obtained on both sides of the i-th peak position to select a frame range. At least one end of the frame range corresponds to a valley value, and the number of sampling points in each frame range is taken as N.

[0056] Specifically, N is determined dynamically based on the characteristics of the ECG signal. The value of N is dynamically selected by taking advantage of the fact that the amplitude of the QRS complex in the ECG signal changes more significantly while the amplitude of other bands changes less significantly.

[0057] First, acquire ECG signals for 2 seconds (this duration can be adjusted according to requirements), obtain the peak positions (r1, r2, ...) of the QRS complex of the ECG signal during this time, and then take all points before the first valley value to the left of the i-th peak position as the data of the first frame, with a data volume of N1.

[0058] The valley value is used as the first storage point of the second frame, the first valley value to the right of the i-th peak position is used as the last storage point, and the value between the two valley values ​​is used as the data stored in this frame, with a data volume of N2.

[0059] This process is repeated to frame all the data from the electrocardiogram sequence.

[0060] The goal is to group points with similar difference distances into one frame, allowing for data storage with fewer bits. Since the QRS complex duration is typically less than 120ms, only a small amount of data per heartbeat requires more bits for storage.

[0061] In each segment of an ECG signal, the first and last frame ranges may have only one end corresponding to a valley value, while the remaining frame ranges will have valley values ​​at both ends. This division results in a frame where the first frame is a flat segment with small differences between all points. Although subsequent frames may contain data with larger differences, such as peak values, these data are concentrated in the same frame. This allows for targeted selection of encoding rules during subsequent encoding, avoiding encoding redundancy caused by large and small differences being mixed in one frame.

[0062] Meanwhile, the first sampling point in each frame is used as the frame start sampling point. It does not participate in differential calculation during subsequent compression and is directly stored with its original quantization value. The frame start sampling point of each frame is used as the reference point for decoding that frame.

[0063] S300, perform differential calculation on all sampling points in each frame except the first sampling point to obtain the difference value, select the corresponding encoding rule from a variety of predefined encoding rules according to the numerical range of the difference value, compress and encode to obtain encoded data, and several encoded data constitute compressed data.

[0064] Differential calculations are performed on the sampling points other than the frame header to obtain several difference values. Specifically:

[0065] The difference D[i] between the current sampling point X[i] and the previous sampling point X[i-1] is calculated using the following formula:

[0066] D[i]=X[i]-X[i-1].

[0067] Meanwhile, based on the numerical range corresponding to the value of the difference D[i], the most economical encoding strategy is dynamically selected. Among them, multiple encoding rules include: a first encoding rule corresponding to the first numerical range, and L second encoding rules corresponding to several numerical ranges exceeding the first numerical range. The encoding result length corresponding to the first encoding rule includes the compressed bit width, and the encoding result length corresponding to the second encoding rule includes the compressed bit width and the feature value bit width used to identify the selected encoding rule.

[0068] like Figure 2 and Figure 3 As shown in the embodiment of this application, taking L=3 as an example, based on the different numerical ranges of the difference, each difference in each frame will correspond to the first encoding rule and three second encoding rules respectively. The bit width setting logic and the composition method of the compressed encoded data are different between the first encoding rule and the second encoding rule. The second encoding rules will also have different bit width setting logic and different composition methods of the compressed encoded data based on the different numerical ranges.

[0069] The specific implementation methods of the different encoding rules are as follows:

[0070] The first numerical range corresponds to (-V, V). Here, the values ​​of V and L are dynamically determined, varying based on the different difference distributions within the current frame. When determining the values ​​of V and L, the expected compression for different V and L values ​​is calculated, and the V and L with the highest compression ratio are selected. In this application, V is set to 7.

[0071] Under the first encoding rule, the compressed bit width is calculated by rounding up log2(2V+2*(L-2)) to compress and store the difference.

[0072] The calculated compressed bit width is used to store the difference corresponding to the sampling point, which is usually represented by two's complement.

[0073] Based on the compressed bit width calculation method in this application

[0074] If L=3 and V=7, then log2(2V+2*(L-2))=log2(2*7+2*(3-2))=4, which is within the range of (-7,7). When M=12, the difference of the original signal stored in 12 bits only needs to be encoded with 4 bits, achieving a high compression rate.

[0075] If L=4 and V=7, then log2(2V+2*(L-2))=log2(2*7+2*(4-2))≈5. In this case, the range (-7,7) only requires 5 bits for encoding.

[0076] For values ​​exceeding the range (-V, V), in some other embodiments, when the value does not exceed the range of the first L-1 types of the second encoding rule, the value range corresponding to the second encoding rule is (-K-(2^ ),-K] and [K,K+(2^ ), where -K and K represent the boundary values ​​corresponding to the previous adjacent numerical range, 2^ This is represented by the extent of boundary expansion between the i-th numerical range and the previous adjacent numerical range. It is represented as an offset storage bit length parameter.

[0077] Taking the numerical range corresponding to the first second encoding rule as an example, -K=-V, K=V, i=1, so the specific numerical range is (-V-(2^ ),-V] and [V,V+(2^ )).

[0078] With V=7, For example, the numerical range corresponding to the first second encoding rule is (-22, -7] and [7, 22].

[0079] For the numerical range corresponding to the second encoding rule, -K = -V - (2^ ), K=V+(2^ Since i=2, the specific numerical range is (-V-2^). 1-(2^ ), -V-(2^ )] and [V+(2^ ),V+2^ +(2^ )).

[0080] With V=7, =4, =4 For example, the corresponding numerical range under the second encoding rule is (-37,-22] and [22,37].

[0081] in, Characterized as the offset storage bit length parameter, its core function is to store the "offset distance" between the difference and the corresponding range boundary with the minimum number of bits. In essence, it is a key configuration item for balancing the encoding coverage and compression efficiency.

[0082] The value of needs to be dynamically changed as V, L, and M are adjusted to avoid insufficient coverage or redundancy.

[0083] Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. This refers to the compressed bit width.

[0084] First, the feature value bit width is calculated by rounding up from log2(2V+2*(L-2)). This feature value bit width is used to store the feature value corresponding to the difference as a feature identifier. Second, under the second encoding rule, the offset also needs to be stored using a compressed bit width of a certain number of bits. Specifically:

[0085] In other embodiments, under the second encoding rule, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the offset, wherein...

[0086] The feature value is represented as any value within the range of signed integers excluding the first numerical range, and the feature values ​​under the second encoding rule are all different.

[0087] The encoded feature value is a flag bit used to identify the "range of values ​​to which the difference belongs". It is stored in the first segment of the encoded data. Each encoding rule for "non-first range of values" corresponds to a unique feature value. During decoding, the current difference can be quickly determined by recognizing the feature value, and then the corresponding reverse calculation logic can be used (for example, if you see the feature value 7, you know that the following n bits are the offset and need to be decoded according to a certain range rule).

[0088] The calculation of the feature value is to remove any value from the first numerical range within the range of the signed integer. For example, by removing any value from the range (-7, 7) in a 4-bit signed integer, the value range of the 4-bit signed integer is [-8, 7] (binary two's complement rule: the highest bit is the sign bit, and the value range is -2^(4-1)~2^(4-1)-1 = -8~7). After removing (-7, 7), there are three values ​​left: 8, 7, and -7. Then, a value can be randomly selected as the feature value and stored in the feature value bit width under a certain second encoding rule.

[0089] When compressing the next frame, the feature value must be any one of the remaining values ​​after removing the values ​​in (-7,7) and any feature values ​​that have already been used.

[0090] In this way, the second encoding rule under each numerical range can be distinguished by feature, which can be used for subsequent decompression to quickly determine which range the current difference is in by identifying feature values, and then use the corresponding reverse calculation logic to decompress (for example, if you see feature value 7, you know that the following n bits are offset values ​​and need to be decoded according to the Lth encoding rule).

[0091] The reason for removing any value within the range (-7, 7) from the 4-bit signed integer is that differences between different numerical ranges are stored using 4 bits. For example, the difference within the range (-7, 7) includes -6 to 6. If the feature value is also selected from -6 to 6, during decoding, there might be cases where both the difference and the feature value are 6, making it impossible to distinguish whether these 4 bits represent the difference within the first numerical range or the feature value. Therefore, selecting the feature value from the remaining value of the 4-bit signed integer ensures the uniqueness of the feature value and allows the decoder to quickly distinguish between the difference within the first range and feature values ​​from other ranges by whether they fall within a certain interval, simplifying the decoding logic.

[0092] Furthermore, when the number of L is large, the remaining eigenvalues ​​after removing any value in the range (-V, V) from a 4-bit signed integer may not be enough. For example, when L=5 and the first range is (-7, 7), the three eigenvalues ​​cannot uniquely distinguish each numerical range. In this case, the number of bits can be expanded, such as changing it to a 5-bit signed integer, at which point its range becomes [-16, 15], thus significantly increasing the number of eigenvalues.

[0093] The offset represents the absolute value of the difference between the difference corresponding to the sampling point and the inner boundary value within the numerical range. The inner boundary value is characterized as the boundary value in the positive direction within the numerical range of the corresponding negative number, and as the boundary value in the negative direction within the numerical range of the corresponding positive number.

[0094] The offset is used to precisely locate the current difference within the defined second range. It is the "actual data stored during encoding" that allows the decoder to reconstruct the unique original difference.

[0095] The variable value is calculated from "current difference D[i] - interval boundary" (e.g., when D[i]=10, the boundary is V=7, and the offset is 10-7=3; when D[i]=20, the offset is 20-7=13), and each difference corresponds to a unique value.

[0096] In other embodiments, when the numerical range of the second encoding rule exceeds the range of the first L-1 types, the numerical range corresponding to the second encoding rule is (-∞, -K] and [K, +∞). Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. The original bit width of the sampling point is used as the compressed bit width, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the original value corresponding to the sampling point.

[0097] When the difference exceeds the numerical range of the first L-1 second encoding rules, the corresponding encoding rule is to abandon the difference encoding and directly store the original M-bit integer value of the sampling point, which is divided into two segments. The first segment is the feature value, and the selection of the feature value is the same as the selection method under the aforementioned second encoding rule. The only difference is that the second segment is the original value with a predetermined bit width.

[0098] When L=2, the ranges corresponding to the first type of second encoding rule are [7,22) and (-22,-7], and the ranges corresponding to the second type of second encoding rule are [22,+∞) and (-∞,-22). In other words, the ranges beyond the ranges corresponding to the first L-1 types of second encoding rules are the numerical ranges at the very edge of the frame.

[0099] Implementation principle:

[0100] Data format conversion: Convert the integer data output by the ADC into a floating-point voltage value with physical meaning, and then quantize it into integer data with a preset bit width to unify the data scale and reduce the dynamic range of subsequent processing.

[0101] Data framing: Divide continuous sampled data into multiple frames, each containing a fixed number of sampled points, which facilitates segmented processing and management.

[0102] Intra-frame differential and adaptive coding: For each frame, calculate the difference between all points except the first one and the previous point. Based on the dynamic range of the difference, various coding strategies are employed for compression. The smaller the difference, the fewer bits are used for coding, thus achieving compression.

[0103] This application also discloses a method for decompressing electrocardiogram (ECG) data, which is used to implement the ECG data compression method described above.

[0104] like Figure 4 and Figure 5 As shown, this application also discloses a method for decompressing electrocardiogram (ECG) data, including the following steps:

[0105] S400: Acquire compressed data and identify frame header features, and divide the compressed data into several frames based on the frame header features.

[0106] S500: Read the original value of the first sampling point of the frame, parse the frame header features corresponding to the remaining sampling points, and read the corresponding encoded data sequentially.

[0107] S600, based on the feature value corresponding to the feature value bit width in the encoded data, determine the encoding rule corresponding to the encoded data, and perform reverse decoding on the sampling point based on the encoding rule to recover the original sampling value.

[0108] S700, after all frames are decoded, forms the original ECG sequence.

[0109] The decompression end starts from the compressed data stream, identifies the frame header features (usually the original M-bit data of the first sample point of each frame and the specific flag before it), and re-segments the data stream into independent frames, which correspond one-to-one with the frames during compression.

[0110] Read the original value 'X[0]' of the first sample point of the frame.

[0111] Read subsequent encoded data sequentially:

[0112] The encoding strategy for the current sampling point is determined based on the first few bits (feature values) of the encoded data.

[0113] If the feature value indicates "first numerical range", then the difference 'D[i]' is directly parsed from the feature value, and then 'X[i]=X[i-1]+D[i]' is calculated to complete the decompression of the frame.

[0114] If the feature value indicates that it belongs to the "second numerical range" corresponding to the first L-1 second encoding rules: read the following 'n' bits to get the offset, combine it with the feature value information, reconstruct the difference 'D[i]' (for example, the difference in the positive medium is 'V + offset'), and then calculate 'X[i] = X[i-1]+D[i]'.

[0115] If the feature value indicates a "raw value" exceeding the first L-1 second encoding rules: directly read the subsequent M bits of data as the value of the current sampling point 'X[i]'.

[0116] Repeat the above steps until all N sampling points in a frame have been decoded. Then continue processing the next frame until all compressed data has been processed. Concatenate the decoded sampling points from all frames in sequence to obtain the complete raw ECG data series, and restore it to M-bit integer format.

[0117] This application also discloses an electrocardiogram (ECG) data decompression system for implementing the above-described ECG data decompression method.

[0118] The implementation principle is as follows:

[0119] By reversing the compression process described above, and by identifying the frame structure and encoding flags, the original ECG sampling data is accurately reconstructed point by point through decoding.

[0120] It should be understood that although the steps in the flowcharts in the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they may be performed in other orders.

[0121] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A method for compressing electrocardiogram (ECG) data, characterized in that, Includes the following steps: The collected raw data is converted to obtain an electrocardiogram sequence with a preset bit width; The electrocardiogram sequence is divided into frames as described above to obtain several consecutive frames; Differential calculation is performed on all sampling points in each frame except the first sampling point to obtain the difference value. Based on the numerical range of the difference value, the corresponding encoding rule is selected from a variety of predefined encoding rules for compression encoding to obtain encoded data. Several encoded data are combined to form compressed data. The various encoding rules include: a first encoding rule corresponding to a first numerical range, and L second encoding rules corresponding to several numerical ranges exceeding the first numerical range. The encoding result length corresponding to the first encoding rule includes the compressed bit width, and the encoding result length corresponding to the second encoding rule includes the compressed bit width and the feature value bit width used to identify the selected encoding rule.

2. The ECG data compression method according to claim 1, characterized in that, Each frame contains N consecutive sampling points, and the first sampling point of each frame is stored as the frame start sampling point with its original value.

3. The ECG data compression method according to claim 2, characterized in that, N is a dynamic value. The method for determining the number of sampling points contained in each frame includes the following steps: The peak position of the QRS complex is obtained by extracting an electrocardiogram signal of a preset duration from the electrocardiogram sequence. The adjacent valley positions are obtained on both sides of the i-th peak position to select the frame range, wherein at least one end of the frame range corresponds to a valley value; The number of sampling points within each frame range is defined as N.

4. The ECG data compression method according to claim 1, characterized in that, The first numerical range corresponds to (-V, V). Under the first encoding rule, the compression bit width is calculated by rounding up log2(2V+2*(L-2)) to compress and store the difference. V and L are dynamically selected based on the distribution of the difference within the frame, corresponding to the value with the highest compression ratio.

5. The ECG data compression method according to claim 4, characterized in that, When the numerical range of the second encoding rule does not exceed the range of the first L-1 types, the numerical range corresponding to the second encoding rule is (-K-(2^ ),-K] and [K,K+(2^ ), where -K and K represent the boundary values ​​corresponding to the previous adjacent numerical range, 2^ This is represented by the extent of boundary expansion between the i-th numerical range and the previous adjacent numerical range. Characterized as the offset storage bit length parameter; Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. This refers to the compressed bit width.

6. The ECG data compression method according to claim 5, characterized in that, Under the second encoding rule, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the offset, wherein... The feature value is represented as any value within the range of signed integers excluding the first numerical range, and the feature values ​​under the second encoding rule are all different; The offset represents the absolute value of the difference between the difference corresponding to the sampling point and the inner boundary value within the numerical range. The inner boundary value is characterized as the boundary value in the positive direction within the numerical range of the corresponding negative number, and as the boundary value in the negative direction within the numerical range of the corresponding positive number.

7. The ECG data compression method according to claim 6, characterized in that, When the value exceeds the range of the first L-1 second encoding rules, the value range corresponding to the second encoding rule is (-∞, -K] and [K, +∞). Under the second encoding rule, log2(2V+2*(L-2)) is rounded up to calculate the feature value bit width. The original bit width of the sampling point is used as the compressed bit width, the feature value bit width is used to store the feature value, and the compressed bit width is used to store the original value corresponding to the sampling point.

8. An electrocardiogram (ECG) data compression system, characterized in that, Used to implement the electrocardiogram data compression method as described in any one of claims 1-7.

9. A method for decompressing electrocardiogram (ECG) data, characterized in that, Includes the following steps: Acquire compressed data and identify frame header features, and divide the compressed data into several frames based on the frame header features; Read the original value of the first sampling point of the frame, parse the frame header features corresponding to the remaining sampling points, and read the corresponding encoded data sequentially; The encoding rule corresponding to the encoded data is determined based on the feature value corresponding to the feature value bit width in the encoded data, and the sampling point is reverse decoded based on the encoding rule to recover the original sampling value; After all frames are decoded, the original electrocardiogram sequence is formed.

10. An electrocardiogram (ECG) data decompression system, characterized in that, Used to implement the ECG data decompression method as described in claim 9.