Recording data compression method and recording data decompression method capable of calculating amplitude
By using absolute peaks and offsets in recording data processing for serialization and offset processing, the problem of large file size and complex compression algorithm of recording data compression is solved, and real-time recording data compression on the main frequency microcontroller is realized and High compression rate and accurate calculation of the voltage value of the analog signal.
Patent Information
- Application Number
- CN202411231446.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-09-04
AI Technical Summary
The existing recording compression method has large file sizes when the accuracy is high, and the compression algorithm is complex when using the MP3 format. It is impossible to collect, compress and save while collecting, and the voltage value of the analog signal cannot be directly calculated.
By obtaining the absolute peak and offset of the recorded data, serialization and offset processing are performed to realize data compression, and the compressed data is written into a file. The recording data is processed using low power consumption and high compression ratio methods.
Real-time acquisition, compression and storage of recorded data on microcontrollers with low main frequency is realized, which reduces calculation amount and power consumption, improves compression rate and fidelity, and can accurately calculate the voltage value of the analog signal through decompression method.
Smart Images

Figure CN118737207B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of recording data processing, and in particular to a recording data compression method and a recording data decompression method capable of calculating amplitude. Background Art
[0002] The current recording compression method is to perform A / D conversion on analog signals such as sound vibration, and then directly write the converted results into a WAV file or compress them in MP3 format and save them in the file. The above-mentioned prior art mainly has the following defects: if high precision and high AD bit number are required, the size of the WAV file will be relatively large. If a small size is desired, MP3 and other formats can be used for compression, but the compression algorithm is relatively complex, and it is impossible to use a single-chip microcomputer with a relatively low main frequency to collect, compress and save them in a file at the same time. The corresponding relationship between the value written into the WAV file and the input voltage is unknown, and the voltage value of the collected analog signal cannot be directly calculated from the WAV file.
[0003] Therefore, there is a need for a recording compression method that can use a single-chip microcomputer with a relatively low main frequency to collect, compress and save analog signals to files.
[0004] The above information disclosed in the above Background section is only for enhancement of understanding of the background of the present application and therefore it may contain information that does not constitute the prior art that is already known to a person of ordinary skill in the art. Summary of the invention
[0005] The present invention provides a recording data compression method which solves the technical problems of high compression cost and complex compression algorithm at present, and a decompression method which solves the problem that the voltage value of an analog signal cannot be directly calculated at present.
[0006] A technical solution provided in an embodiment of the present invention is a recording data compression method, comprising:
[0007] Acquire target data to be compressed, and perform serialization processing on the target data;
[0008] Writing the processed serialized data into a preset buffer area, and after the preset buffer area is full or the writing of the serialized data is completed, compressing the data in the preset buffer area, and then entering the next write compression cycle;
[0009] The compressing the data in the preset buffer area specifically includes:
[0010] Calculating an absolute peak value of the serialized data in the preset buffer area, calculating an offset of the absolute peak value, and writing the offset into a record file of a storage device;
[0011] Performing offset processing on each data in the preset buffer area according to the offset to obtain an offset sequence;
[0012] Part of the offset data in the offset sequence is acquired according to a preset number of compression bits to obtain a compressed sequence, and the compressed sequence is written into a record file.
[0013] A technical solution provided in an embodiment of the present invention is a recording data decompression method capable of accurately calculating amplitude, which decompresses a recording file obtained by the recording data compression method described above, comprising:
[0014] Get data decompression request;
[0015] Open any recording file containing recording data in the storage device according to the data decompression request, and read the file header of the recording file;
[0016] Read the record data corresponding to the file header in the record file, the record data including an offset and compressed data corresponding to the offset, and restore the corresponding compressed data according to the offset to obtain decompressed data.
[0017] A technical solution provided in an embodiment of the present invention is a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the recording data compression method as described above, or the recording data decompression method as described above.
[0018] Beneficial effects of the present invention:
[0019] By directly obtaining the absolute peak value in the preset buffer area and calculating the offset corresponding to the absolute peak value, all data in the buffer area are then offset according to the offset to obtain offset data. Since other data in the buffer area are smaller than the absolute peak value, offsetting other data will not cause buffer data overflow. Therefore, as long as the accuracy of the absolute peak value is guaranteed, the accuracy of other data in the buffer area can be guaranteed. In this way, it is possible to offset other data in the buffer area by only calculating the offset of the absolute peak value, without calculating the offset of each data, thereby reducing the amount of calculation.
[0020] By intercepting part of the offset data with a preset number of compression bits, the data is compressed because the number of bits of the compressed data is much smaller than the number of bits in the serialized data, that is, the number of bits of the data is reduced.
[0021] Therefore, the same processing is performed on different data in the buffer, that is, each time a buffer data is collected or the writing of the serialized data is completed, the buffer data is compressed, and the average calculation amount for each compression is approximately one comparison (calculation of the absolute peak) and one shift (directly shifting the data by the offset of the absolute peak). This allows a single-chip microcomputer with a relatively low main frequency to collect, compress and save the analog signal to a file, thereby achieving low power consumption, high compression rate, high fidelity and real-time recording of the compressed recording file.
[0022] Recording data decompression method: The corresponding voltage value of the analog signal recorded in this file can be calculated using the maximum input voltage.
[0023] The above invention content is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Other features, objects and advantages of the present invention will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present invention. Also, the same reference symbols are used throughout the drawings to represent the same parts.
[0025] Figure 1 A flowchart of a recording data compression method provided by the present invention;
[0026] Figure 2 A flowchart of compressing data in the preset buffer area in a recording data compression method provided by the present invention;
[0027] Figure 3 The present invention provides a flowchart of a recording data decompression method capable of accurately calculating amplitude. DETAILED DESCRIPTION
[0028] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific implementation method described herein is only an optimal embodiment of the present invention, which is only used to explain the present invention and does not limit the scope of protection of the present invention. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0029] Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0030] In the description of the present invention, it is necessary to understand that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance.
[0031] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0032] The following describes a recording data compression method and a recording data decompression method according to an embodiment of the present invention in conjunction with the accompanying drawings.
[0033] Figure 1 FIG. 1 is a flow chart of a method for compressing recorded data according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0034] Obtaining target data to be compressed, performing serialization processing on the target data, writing the processed serialized data into a preset cache area, and after the preset cache area is full or the writing of the serialized data is completed, compressing the data in the preset cache area, and then entering the next write compression cycle;
[0035] The data in the preset buffer area is compressed, such as Figure 2 As shown, specifically including:
[0036] Calculating an absolute peak value of the serialized data in the preset buffer area, calculating an offset of the absolute peak value, and writing the offset into a record file of a storage device;
[0037] Performing offset processing on each data in the preset buffer area according to the offset to obtain an offset sequence;
[0038] Part of the offset data in the offset sequence is acquired according to a preset number of compression bits to obtain a compressed sequence, and the compressed sequence is written into a record file.
[0039] In this application, by directly obtaining the absolute peak value in the preset buffer area and calculating the offset corresponding to the absolute peak value, all the data in the buffer area are then offset according to the offset to obtain the offset data. Since the other data in the buffer area are smaller than the absolute peak value, the offset of other data will not cause buffer data overflow. Therefore, as long as the accuracy of the absolute peak value is guaranteed, the accuracy of other data in the buffer area can be guaranteed. Thus, it is realized that only the offset of the absolute peak value is calculated to offset other data in the buffer area, without calculating the offset of each data, thereby reducing the amount of calculation.
[0040] By intercepting part of the offset data with a preset number of compression bits, the data is compressed because the number of bits of the compressed data is much smaller than the number of bits in the serialized data, that is, the number of bits of the data is reduced.
[0041] Therefore, the same processing is performed on different data in the buffer, that is, each time a buffer data is collected or the writing of the serialized data is completed, the buffer data is compressed, and the average calculation amount for each compression is approximately one comparison (calculation of the absolute peak) and one shift (directly shifting the data by the offset of the absolute peak). This allows a single-chip microcomputer with a relatively low main frequency to collect, compress and save the analog signal to a file, thereby achieving low power consumption, high compression rate, high fidelity and real-time recording of the compressed recording file.
[0042] In the embodiment of the present application, the serialization processing of the target data and writing the processed serialization data into a preset buffer area includes:
[0043] The target data is serialized by using an A / D converter to obtain a binary sequence, and the obtained binary sequence is written into the preset buffer area.
[0044] As a preferred embodiment, after recording begins, the collected target data is serialized by an A / D converter, the processed serialized data is saved in a preset buffer with a preset buffer length, the absolute peak value in the preset buffer is calculated, and the offset of the absolute peak value is calculated, that is, the absolute peak value needs to be shifted left by a few bits to ensure that the highest bit is 1. Since the bits in front of the offset are all 0, the number of bits corresponding to the left shift offset will not affect the accuracy of the absolute peak value, and the number of effective bits of the data is the largest. Since the other data in the buffer are smaller than the absolute peak value, the number of bits corresponding to the left shift offset will not cause data overflow in the buffer. The effective value of the buffer data is greatly affected by the absolute peak value, so as long as the accuracy of the absolute peak value is guaranteed, the accuracy of the effective value of the buffer can be guaranteed.
[0045] After all the data in the buffer are shifted left by the number of bits corresponding to the offset, the offset is first written to the record file, and then the offset data in the buffer is retained with the preset number of compressed bits, and the compressed data is written to the record file again. At this time, the offset is before the corresponding compressed data, so that the offset corresponding to each compressed data can be read during subsequent decompression, and decompression is performed according to the offset. Since the number of bits of the compressed data is much smaller than the A / D conversion result, the data is compressed.
[0046] In the above compression process, each time a buffer data is collected, the buffer data is compressed, thereby realizing collection, compression and saving to file at the same time, and the average calculation amount for each compression is approximately one comparison (calculation of absolute peak value) and one shift (directly shifting the data by the offset of the absolute peak value), which is much more efficient than compression algorithms such as MP3.
[0047] In the embodiment of the present application, calculating the absolute peak value of the preset buffer area includes:
[0048] The serialized data in the preset buffer area is read, a maximum value or a minimum value in the serialized data is obtained, the maximum value or the minimum value is used as a peak value, and an absolute processing is performed to obtain the absolute peak value.
[0049] In the above embodiment, by obtaining the absolute peak value in the buffer area and then calculating the offset of the absolute peak value, it is possible to implement the offset processing of other data in the buffer area by only calculating the offset of one data in the buffer area, and since other data in the buffer area are smaller than the absolute peak value, the number of bits corresponding to the left shift offset will not cause data overflow in the buffer area. The effective value of the buffer data is greatly affected by the absolute peak value, so as long as the accuracy of the absolute peak value is guaranteed, the accuracy of the effective value of the buffer area can be guaranteed.
[0050] In the embodiment of the present application, the calculating the offset of the absolute peak value includes:
[0051] Identifying a first valid bit of the binary data corresponding to the absolute peak value;
[0052] The number of bits before the first valid bit is taken as the offset;
[0053] The first valid bit is 1.
[0054] In the above embodiment, the bits in the binary data corresponding to the absolute peak value are identified in sequence, and it is determined whether they are valid bits;
[0055] If the bit in the binary data corresponding to the absolute peak value is a valid bit, the number of bits of the valid bit is recorded, and the number of bits before the first valid bit is used as the offset;
[0056] If the bit in the binary data corresponding to the absolute peak value is a non-valid bit, the next bit is identified until a valid bit is identified.
[0057] For example, the absolute peak value is 0x001FF, and the corresponding binary data expression is: 0000 0000 0001 11111111B;
[0058] Identify the bits in the binary data corresponding to the absolute peak value in sequence, wherein it should be noted that the first 0 is a sign bit and is not identified;
[0059] It is found that the first valid bit 1 is at the 11th bit, so the number of bits before the first valid bit is used as the offset, that is, the offset is 10.
[0060] In an embodiment of the present application, obtaining part of the offset data in the offset sequence according to a preset number of compression bits to obtain a compressed sequence, and writing the compressed sequence into a record file includes:
[0061] intercepting part of the data with a preset number of compression bits from the first byte of the offset data in the offset sequence, and writing the part of the data as compressed data into the record file;
[0062] The offset is recorded before the compressed data.
[0063] In the above embodiment, by intercepting partial data of a preset compression bit number starting from the first byte of the offset data in the offset sequence, the number of bits of the offset data is reduced to the preset compression bit number, thereby compressing the offset data.
[0064] In the above embodiment, during the compression process, the offset is first written into the record file, and then the corresponding compressed data is written after the offset.
[0065] In the embodiment of the present application, the preset number of compression bits is 8.
[0066] For example, assuming that the preset number of compression bits is 8 and the offset data is 0111 1111 1111 1111 1111, the partial data of the preset number of compression bits is intercepted from the first bit, that is, the obtained offset data is 01111110. Thus, the initial 24-bit data collected from the A / D is compressed to 8 bits, and the compression rate is about 8 / 24.
[0067] In the above embodiment, the average amount of calculation for compressing one data is approximately one comparison (calculating the absolute peak), one shift (directly shifting the data by the offset of the absolute peak) and one compression, which improves the fidelity of the data.
[0068] In this embodiment, the compression error is calculated by the following formula:
[0069] Error = 1-decompressed data corresponding to compressed data / offset data.
[0070] The error analysis is performed by taking the data 0x001FF as an example, as shown below:
[0071] The absolute peak value is 0x001FF. The binary expression of 0x001FF is: 0000 0000 0001 11111111B. There are 10 zeros before the first valid bit, so the calculated offset is 10.
[0072] Shift the data 0x001FF 10 bits to the left to get 0x7FFFF. The binary expression of 0x7FFFF is: 01111111 1111 1111 1111;
[0073] Intercept 8 bits and get 0x7F. The binary expression of 0x7F is: 01111110;
[0074] Among them, 0x7F is converted to the initial 24-bit data 0x7F000;
[0075] The error at this time is: 1-0x7F0000 / 0x7FFFF=1-8323072 / 8388607=0.78%, which is less than 1%. Therefore, the distortion caused by compression and decompression is small, and the error can be controlled within 1%.
[0076] Therefore, the compression method of the present application can reduce errors and improve fidelity.
[0077] In an embodiment of the present application, before obtaining the target data to be compressed, it also includes: defining a file header, the information stored in the file header includes sampling frequency, bit number, number of channels, maximum input voltage and buffer length, and writing the file header into a record file.
[0078] Before recording begins, information such as sampling frequency, number of bits, number of channels, maximum input voltage, and buffer length are written into the file header.
[0079] As a specific implementation method, it is necessary to collect data at a 48kHz sampling frequency for an analog signal. The maximum input voltage of the analog quantity is ±1V. The hardware uses an A / D bit number of 24 bits. The numerical format is that the highest bit is the sign bit, and the following 23 bits are the numerical value. The data uses the complement code. The number of data bits saved to the file is 8 bits. The numerical format is that the highest bit is the sign bit, and the following 7 bits are the numerical value. The data uses the complement code, and the sampling buffer length is 1024.
[0080] Among them, the 24-bit A / D result data format table is shown in Table 1 below:
[0081] Table 1
[0082]
[0083] The compressed data format (8 bits) is shown in Table 2 below:
[0084] Table 2
[0085]
[0086] When recording starts, create a file, generate a file header, write 48000 to the sampling frequency, 8 to the bit number, 1 to the number of channels, 1.0V to the maximum input voltage, and 1024 to the buffer length, as shown in Table 3 below:
[0087] Table 3
[0088]
[0089] The collected target data is serialized by an A / D converter to obtain 24-bit binary data, and the data is saved in a preset buffer with a preset buffer length; wherein the preset buffer length may be 100;
[0090] Determine whether the preset buffer is full;
[0091] If so, compressing the data in the preset buffer area;
[0092] If not, continue to determine whether the writing of serialized data is completed;
[0093] If so, compressing the data in the preset buffer area;
[0094] If not, return to the step of writing the processed serialized data into the preset buffer area;
[0095] Among them, compressing the data in the preset buffer area includes: calculating the absolute peak value in the preset buffer area, calculating the offset of the absolute peak value, that is, judging how many bits the absolute peak value needs to be shifted left to ensure that the highest bit is 1 (excluding the sign bit of the first bit). For example, the absolute peak value is 0x001FF, and the corresponding binary data is expressed as: 0000 0000 00011111 1111B, and the bits in the binary data corresponding to the absolute peak value are identified in turn. It should be noted that the first 0 is the sign bit, and no identification judgment is made. It is found that the first valid bit 1 is at the 11th bit. Therefore, the number of bits before the first valid bit is used as the offset, that is, the offset is 10.
[0096] First write the offset to the record file, shift all the data in the buffer to the left by 10 bits, then keep the high 8 bits of the offset data in the buffer, and write the compressed data after keeping the high 8 bits into the record file. At this time, the compressed data is after the corresponding offset. Then repeat this step until the recording is finished, and the compression of the target data to be compressed is completed. The data collected from the A / D is 24 bits. After the above compression algorithm, only 8 bits of data are retained, and the compression rate is about 8 / 24.
[0097] Figure 3 FIG. 1 is a flow chart of a method for decompressing recorded data that can accurately calculate amplitude according to an embodiment of the present invention. Figure 3 As shown, the recording data decompression method decompresses the recording file obtained by the recording data compression method described above, and the method includes the following steps:
[0098] Get data decompression request;
[0099] Open any recording file containing recording data in the storage device according to the data decompression request, and read the file header of the recording file;
[0100] Read the record data corresponding to the file header in the record file, the record data including an offset and compressed data corresponding to the offset, and restore the corresponding compressed data according to the offset to obtain decompressed data.
[0101] In the above embodiment, when the recording file needs to be analyzed, the file header information is read in first. The recording data corresponding to the file header is found, and then a byte is read in from the head of the recording data. This byte is the offset, and the offset is followed by a buffer length data to be shifted. Then the compressed data after the offset is read in (the compressed data is a sequence of 8-bit integers), and the compressed data is shifted right according to the offset to obtain the decompressed data (the decompressed data is a sequence of 24-bit integers), and this step is repeated until the recording file is read out.
[0102] In the embodiment of the present application, after obtaining the decompressed data, the method further includes: calculating the voltage value of the decompressed 24-bit data according to the following formula:
[0103] Vi=V max ×Bi / 2 23;
[0104] Among them, Vi is used to represent a voltage value corresponding to a data in the decompressed data, Bi is used to represent a data in the decompressed data, and Vmax is the maximum positive input voltage.
[0105] In the above embodiment, the highest bit of the 24-bit integer data is the sign bit, and the remaining 23 bits are the data complement. The maximum positive integer that can be expressed by 23 bits is 2 23, This value corresponds to the maximum positive input voltage.
[0106] In the above embodiment, the maximum input voltage of the recorded file is saved at the file header, and the corresponding voltage value of the analog signal recorded in the file can be calculated using the maximum input voltage.
[0107] A computer-readable storage medium stores a computer program, which is executed by a processor to implement the recording data compression method as described above, or the recording data decompression method as described above.
[0108] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms are not necessarily directed to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or N embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0109] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0110] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0111] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiment, the N steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array, a field programmable gate array, etc.
[0112] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0113] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A recording data compression method, characterized in that: include: Acquire target data to be compressed, and perform serialization processing on the target data; Writing the processed serialized data into a preset buffer area, and after the preset buffer area is full or the writing of the serialized data is completed, compressing the data in the preset buffer area, and then entering the next write compression cycle; The compressing the data in the preset buffer area specifically includes: Calculating an absolute peak value of the serialized data in the preset buffer area, calculating an offset of the absolute peak value, and writing the offset into a record file of a storage device; Performing offset processing on each data in the preset buffer area according to the offset to obtain an offset sequence; Part of the offset data in the offset sequence is acquired according to a preset number of compression bits to obtain a compressed sequence, and the compressed sequence is written into a record file.
2. The recording data compression method according to claim 1, characterized in that: The serializing the target data and writing the processed serialized data into a preset buffer area includes: The target data is serialized by using an A / D converter to obtain a binary sequence, and the obtained binary sequence is written into the preset buffer area.
3. The recording data compression method according to claim 1, characterized in that: The calculating the absolute peak value of the preset buffer area includes: The serialized data in the preset buffer area is read, a maximum value or a minimum value in the serialized data in the preset buffer area is obtained, the maximum value or the minimum value is used as a peak value, and an absolute processing is performed to obtain the absolute peak value.
4. The recording data compression method according to claim 1, characterized in that: The calculating the offset of the absolute peak value comprises: Identifying a first valid bit of the binary data corresponding to the absolute peak value; The number of bits before the first valid bit is taken as the offset; The first valid bit is 1.
5. The recording data compression method according to claim 1, characterized in that: Acquiring part of the offset data in the offset sequence according to a preset number of compression bits to obtain a compressed sequence, and writing the compressed sequence into a record file, including: intercepting part of the data with a preset number of compression bits from the first byte of the offset data in the offset sequence, and writing the part of the data as compressed data into the record file; The offset is recorded before the compressed data.
6. The recording data compression method according to claim 1 or 5, characterized in that: The preset compression bit number is 8.
7. The recording data compression method according to claim 1, characterized in that: The file header of the record file also includes: sampling frequency, number of bits, number of channels, maximum input voltage and buffer length.
8. A method for decompressing recorded data capable of accurately calculating amplitude, characterized in that: Decompressing the recording file obtained by the recording data compression method according to any one of claims 1 to 7 comprises: Get data decompression request; Open any recording file containing recording data in the storage device according to the data decompression request, and read the file header of the recording file; Read the record data corresponding to the file header in the record file, the record data including an offset and compressed data corresponding to the offset, and restore the corresponding compressed data according to the offset to obtain decompressed data.
9. The recording data decompression method capable of accurately calculating amplitude as claimed in claim 8, characterized in that: After obtaining the decompressed data, the method further includes: calculating the voltage value of the decompressed 24-bit data according to the following formula: Vi=V max ×Bi / 2 23; Wherein, Vi is used to represent the voltage value corresponding to one of the decompressed data, Bi is used to represent one of the decompressed data, V max is the maximum positive input voltage.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the recording data compression method as described in any one of claims 1-7, or the recording data decompression method as described in any one of claims 8-9.
