[go: up one dir, main page]

CN118737207B - Recording data compression method and recording data decompression method capable of calculating amplitude - Google Patents

Recording data compression method and recording data decompression method capable of calculating amplitude Download PDF

Info

Publication number
CN118737207B
CN118737207B CN202411231446.5A CN202411231446A CN118737207B CN 118737207 B CN118737207 B CN 118737207B CN 202411231446 A CN202411231446 A CN 202411231446A CN 118737207 B CN118737207 B CN 118737207B
Authority
CN
China
Prior art keywords
data
offset
buffer area
recording
compression
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411231446.5A
Other languages
Chinese (zh)
Other versions
CN118737207A (en
Inventor
熊文波
王伟
武中林
张哲浩
徐凯
史鑫源
杜有权
王敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Aihua Intelligent Technology Co ltd
Original Assignee
Hangzhou Aihua Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Aihua Intelligent Technology Co ltd filed Critical Hangzhou Aihua Intelligent Technology Co ltd
Priority to CN202411231446.5A priority Critical patent/CN118737207B/en
Publication of CN118737207A publication Critical patent/CN118737207A/en
Application granted granted Critical
Publication of CN118737207B publication Critical patent/CN118737207B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/00007Time or data compression or expansion
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/00007Time or data compression or expansion
    • G11B2020/00014Time or data compression or expansion the compressed signal being an audio signal

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Signal Processing (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a recording data compression method and a recording data decompression method capable of calculating amplitude, which relate to the technical field of recording data processing, wherein the compression method comprises the following steps: acquiring target data to be compressed, and carrying out serialization processing on the target data; writing the processed serialized data into a preset buffer area, compressing the data in the preset buffer area after the preset buffer area is fully written or the writing of the serialized data is completed, and then entering the next writing compression period; compressing the data in the preset buffer area, including: calculating the offset of the absolute peak value of the serialized data in the preset buffer area, and carrying out offset processing on each data in the preset buffer area according to the offset to obtain an offset sequence; intercepting the offset sequence according to a preset compression bit number to obtain a compression sequence, and writing the compression sequence into a record file. The invention realizes low power consumption, high compression rate, high fidelity and real-time recording of the compression of the recording file, and can calculate the voltage value corresponding to the data.

Description

Recording data compression method and recording data decompression method capable of calculating amplitude
Technical Field
The invention relates to the technical field of recording data processing, in particular to a recording data compression method and a recording data decompression method capable of calculating amplitude.
Background
The current recording compression method is to perform A/D conversion on analog signals such as sound vibration, and then directly write the converted result into WAV file or compress the result according to MP3 format and then store the result in the file. The above prior art has mainly the following drawbacks: if the precision is high, the AD number is high, the size of the WAV file is larger, if the size is small, the WAV file can be compressed by adopting MP3 format and the like, but the compression algorithm is complex, and the single chip microcomputer with lower main frequency can not be used for collecting, compressing and storing the WAV file. The corresponding relation between the value written into the WAV file and the input voltage is unknown, and the voltage value of the acquired analog signal cannot be directly calculated by the WAV file.
Therefore, a recording compression method capable of collecting, compressing and storing analog signals in a file by adopting a singlechip with a relatively low main frequency is needed at present.
The above information disclosed in the above background section is only for enhancement of understanding of the background of the application and therefore it may contain information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
The invention provides a method for compressing recording data and decompressing the recording data, which solves the technical problems of high compression cost and complex compression algorithm in the current stage and solves the problem that the voltage value of an analog signal cannot be directly calculated in the current stage.
The technical scheme provided by the embodiment of the invention is that the recording data compression method comprises the following steps:
Acquiring target data to be compressed, and carrying out serialization processing on the target data;
Writing the processed serialized data into a preset buffer area, compressing the data in the preset buffer area after the preset buffer area is fully written or the writing of the serialized data is completed, and then entering the next writing compression period;
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 according to the offset to obtain an offset sequence;
And obtaining partial data of the offset data in the offset sequence according to a preset compression bit number to obtain a compression sequence, and writing the compression sequence into a record file.
The technical scheme provided by the embodiment of the invention is that the method for decompressing the recording data, which can accurately calculate the amplitude, decompresses the recording file obtained by the recording data compression method, and comprises the following steps:
Acquiring a data decompression request;
opening a record file which is arbitrarily recorded with recording data in the storage equipment according to the data decompression request, and reading a file header of the record file;
And reading the record data corresponding to the file header in the record file, wherein the record data comprises an offset and compressed data corresponding to the offset, and restoring the corresponding compressed data according to the offset to obtain decompressed data.
In one embodiment of the present invention, a computer readable storage medium stores a computer program, where the program is executed by a processor to implement a method for compressing recorded data as described above, or a method for decompressing recorded data as described above.
The invention has the beneficial effects that:
The absolute peak value in the preset buffer area is directly obtained, the offset corresponding to the absolute peak value is calculated, then all data in the buffer area are offset according to the offset to obtain offset data, because the other data in the buffer area are smaller than the absolute peak value, the buffer area data overflow cannot be caused after the other data are shifted, and therefore the precision of the other data in the buffer area can be ensured as long as the precision of the absolute peak value is ensured. Therefore, the method and the device can offset other data in the buffer area only by calculating the offset of the absolute peak value, and the offset of each data is not required to be calculated, so that the calculated amount is reduced.
The partial data with preset compression bit numbers is intercepted from the offset data, and the data is compressed because the bit numbers of the compressed data are much smaller than the bit numbers of the data in the serialized data, namely, the bit numbers of the data are reduced.
Therefore, the same processing is performed on different data in the buffer area, namely, after each buffer area data is collected or the writing of the serialization data is completed, the buffer area data is compressed, the average calculation amount of each compression is about one comparison (absolute peak value calculation) and one shift (the data is directly shifted through the offset of the absolute peak value), so that the analog signal can be collected, compressed and stored in the file while the singlechip with relatively low main frequency is adopted, and further, the low power consumption, the high compression rate, the high fidelity and the real-time recording of the record file compression are realized.
The method for decompressing the recording data comprises the following steps: the corresponding voltage value of the file recording analog signal can be calculated by using the maximum input voltage.
The foregoing summary is merely an overview of the present invention, and is intended to be implemented in accordance with the teachings of the present invention in order that the present invention may be better understood, and in order that the following detailed description of the invention may be put forth with other objects, features and advantages thereof.
Drawings
Other features, objects and advantages of the present invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to designate like parts throughout the figures.
FIG. 1 is a flow chart of a method for compressing recorded data provided by the invention;
Fig. 2 is a flowchart of compressing data in the preset buffer area in the recording data compression method provided by the present invention;
Fig. 3 is a flowchart of a method for decompressing audio recording data capable of accurately calculating amplitude.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and examples, it being understood that the detailed description herein is merely a preferred embodiment of the present invention, which is intended to illustrate the present invention, and not to limit the scope of the invention, as all other embodiments obtained by those skilled in the art without making any inventive effort fall within the scope of the present invention.
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention.
In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present invention, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
A recording data compression method and a recording data decompression method according to embodiments of the present invention are described below with reference to the accompanying drawings.
Fig. 1 is a flowchart of a recording data compression method according to an embodiment of the present invention. As shown in fig. 1, the method comprises the steps of:
Acquiring target data to be compressed, carrying out serialization processing on the target data, writing the processed serialized data into a preset buffer area, compressing the data in the preset buffer area after the preset buffer area is fully written or the writing of the serialized data is completed, and then entering the next writing compression period;
the compressing the data in the preset buffer area, as shown in fig. 2, 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 according to the offset to obtain an offset sequence;
And obtaining partial data of the offset data in the offset sequence according to a preset compression bit number to obtain a compression sequence, and writing the compression sequence into a record file.
In the application, the absolute peak value in the preset buffer zone is directly obtained, the offset corresponding to the absolute peak value is calculated, and then all data in the buffer zone are offset according to the offset to obtain offset data. Therefore, the method and the device can offset other data in the buffer area only by calculating the offset of the absolute peak value, and the offset of each data is not required to be calculated, so that the calculated amount is reduced.
The partial data with preset compression bit numbers is intercepted from the offset data, and the data is compressed because the bit numbers of the compressed data are much smaller than the bit numbers of the data in the serialized data, namely, the bit numbers of the data are reduced.
Therefore, the same processing is performed on different data in the buffer area, namely, after each buffer area data is collected or the writing of the serialization data is completed, the buffer area data is compressed, the average calculation amount of each compression is about one comparison (absolute peak value calculation) and one shift (the data is directly shifted through the offset of the absolute peak value), so that the analog signal can be collected, compressed and stored in the file while the singlechip with relatively low main frequency is adopted, and further, the low power consumption, the high compression rate, the high fidelity and the real-time recording of the record file compression are realized.
In an embodiment of the present application, the serializing processing is performed on the target data, and the writing of the processed serialized data into a preset buffer area includes:
And carrying out serialization processing on target data by adopting an A/D converter to obtain a binary sequence, and writing the obtained binary sequence into the preset buffer area.
In a preferred embodiment, after recording starts, the collected target data is serialized by the a/D converter, the processed serialized data is stored in a preset buffer area with a preset buffer length, an absolute peak value in the preset buffer area is calculated, an offset of the absolute peak value is calculated, that is, it is judged that the absolute peak value needs to be shifted left by several bits to ensure that the highest bit is 1, and since the bits in front of the previous offset are all 0, the bit corresponding to the shifted left does not affect the accuracy of the absolute peak value, and the effective bit number of the data is the largest. Since the other data in the buffer is smaller than the absolute peak value, the bit number corresponding to the shift left offset will not cause data overflow in the buffer. The effective value of the buffer data is greatly influenced by the absolute peak value, so that the accuracy of the effective value of the buffer can be ensured as long as the accuracy of the absolute peak value is ensured.
After shifting all data of the buffer area to the left by the bit number corresponding to the offset, writing the offset into the record file, reserving the offset data of the buffer area by the preset compression bit number, and re-writing the compressed data into the record file, wherein the offset is in front of the corresponding compressed data, so that the offset corresponding to each compressed data can be read in the subsequent decompression, and the 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.
In the compression process, each time one buffer data is collected, the buffer data is compressed, so that the purposes of collecting, compressing and storing the buffer data in a file are achieved, the average calculated amount of each compression is about one time of comparison (absolute peak value calculation) and one time of shift (data are directly shifted through the offset of the absolute peak value), and the compression algorithm is quite higher than MP3 compression algorithm in efficiency.
In an embodiment of the present application, the calculating the absolute peak value of the preset buffer area includes:
Reading the serialized data in the preset buffer area, obtaining the maximum value or the minimum value in the serialized data, taking the maximum value or the minimum value as a peak value, and carrying out absolute treatment to obtain the absolute peak value.
In the above embodiment, the offset of the absolute peak value is obtained by obtaining the absolute peak value in the buffer area and then calculating the offset of the absolute peak value, so that the offset of one data in the buffer area is only calculated, and the offset processing of other data in the buffer area can be realized. The effective value of the buffer data is greatly influenced by the absolute peak value, so that the accuracy of the effective value of the buffer can be ensured as long as the accuracy of the absolute peak value is ensured.
In an embodiment of the present application, the calculating the offset of the absolute peak value includes:
identifying a first significant bit of binary data corresponding to the absolute peak;
Taking the bit number before the first valid bit as the offset;
wherein the first significant bit is 1.
In the above embodiment, bits in binary data corresponding to the absolute peak value are sequentially identified, and whether the bits are valid bits is determined;
if the bit in the binary data corresponding to the absolute peak value is a valid bit, recording the bit number of the valid bit, and taking the bit number of the previous bit of the first valid bit as the offset;
If the bit in the binary data corresponding to the absolute peak value is a non-valid bit, the next bit is identified until the valid bit is identified.
For example, the absolute peak is 0x001FF, and the corresponding binary data is expressed as: 0000 0000 0001 1111 1111B;
Sequentially identifying bits in binary data corresponding to the absolute peak value, wherein, it is noted that the first 0 is a sign bit and no identification judgment is made;
The first significant bit 1 is found to be at bit 11, and therefore, the number of bits of the bit preceding the first significant bit is taken as the offset, i.e., the offset is 10.
In an embodiment of the present application, obtaining partial data of offset data in the offset sequence according to a preset compression bit number to obtain a compression sequence, and writing the compression sequence into a record file, where the method includes:
intercepting partial data with preset compression bits from the first byte of the offset data in the offset sequence, and writing the partial data into the record file as compression data;
wherein the offset is recorded before the compressed data.
In the above embodiment, by intercepting part of the data of the preset compression bit number from the first byte of the offset data in the offset sequence, the bit number of the offset data is reduced to the preset compression bit number, and thus the offset data is compressed.
In the above embodiment, during the compression, the offset is written into the record file, and then the corresponding compressed data is written after the offset.
In the embodiment of the present application, the preset compression bit number is 8.
For example, assuming that the preset compression bit number is 8 and the offset data is 0111 1111 1111 1111 1111, at this time, part of the data with the preset compression bit number is intercepted from the first bit, that is, the obtained offset data is 01111110. Thus, the initial 24-bit data acquired from the A/D is compressed to 8 bits, and the compression rate is about 8/24.
In the above embodiment, the average calculation amount of compressing one data is about one comparison (calculating the absolute peak value), one shift (shifting the data directly by the offset amount of the absolute peak value), and one compression, which improves the fidelity of the data.
In the present embodiment, the compression error is calculated by the following formula:
error = 1-decompressed data/offset data corresponding to compressed data.
Error analysis was performed using the data of 0x001FF as an example, as follows:
The absolute peak value is 0x001FF, and the binary expression corresponding to 0x001FF is: 0000 0000 0001 1111 1111B, the first significant bit is preceded by 100 s, so the calculated offset is 10;
Shifting data 0x001FF to the left by 10 bits, resulting in 0x7ffff, the binary representation corresponding to 0x7ffff being: 0111 1111 1111 1111 1111;
8 bits are intercepted, and binary expressions corresponding to 0x7F and 0x7F are obtained as follows: 01111110;
Wherein 0x7F is converted to initial 24-bit data of 0x7F000;
The error at this time is: 1-0x7F0000/0x7 FFFF=1-8323072/8388607 =0.78%, less than 1%, so that the distortion caused by decompression after compression is small, and the error can be controlled within 1%.
Therefore, the compression mode of the application can reduce errors and improve the fidelity.
In the embodiment of the application, before acquiring the target data to be compressed, the method further comprises the following steps: defining a file header, wherein the information stored in the file header comprises sampling frequency, bit number, channel number, maximum input voltage and buffer length, and writing the file header into a record file.
Before recording, information such as sampling frequency, bit number, channel number, maximum input voltage, buffer length and the like is written into the file header.
As a specific implementation mode, data acquisition with the sampling frequency of 48kHz is needed for one path of analog signal, the maximum input voltage of analog quantity is +/-1V, the hardware adopts the number of A/D bits as 24 bits, the numerical format is the highest bit as a sign bit, the next 23 bits as a numerical value, the data adopts complementary codes, the number of data bits stored into a file is 8 bits, the numerical format is the highest bit as a sign bit, the next 7 bits as a numerical value, the data adopts complementary codes, and the sampling buffer length is 1024.
The 24-bit A/D result data format is shown in Table 1 below:
TABLE 1
The compressed data format (8 bits) is shown in table 2 below:
TABLE 2
When recording starts, a file is created, a file header is generated, 48000 is written into a sampling frequency place, an 8-writing bit number place, a 1-writing channel number place, a 1.0V writing maximum input voltage place and a 1024-writing buffer area length place are written into the following table 3:
TABLE 3 Table 3
The acquired target data is subjected to serialization processing through an A/D converter so as to obtain 24-bit binary data, and the data is stored in a preset buffer zone with a preset buffer length; wherein, the preset buffer length can be 100;
Judging whether a preset buffer area is fully written;
if yes, compressing the data in the preset buffer area;
if not, continuing to judge whether the writing of the serialization data is completed;
if yes, compressing the data in the preset buffer area;
If not, returning to the step of writing the processed serialized data into a preset buffer area;
The compressing the data in the preset buffer area includes: and calculating an absolute peak value in a preset buffer zone, and calculating the offset of the absolute peak value, namely judging that the absolute peak value needs to be shifted left by a few bits to ensure that the highest bit is 1 (the symbol bit without the first bit). For example, the absolute peak value is 0x001FF, and the corresponding binary data is expressed as: 0000 0000 0001 1111 1111B, identifying bits in binary data corresponding to the absolute peak value in sequence, wherein, it is noted that the first 0 is a sign bit, and no identification judgment is made, and the first valid bit 1 is found to be at the 11 th bit, so that the bit number of the previous bit of the first valid bit is taken as the offset, namely, the offset is 10.
Writing the offset into the record file, shifting all data of the buffer area to the left by 10 bits, reserving the offset data of the buffer area by 8 high bits, and re-writing the compressed data after reserving the 8 high bits into the record file, wherein the compressed data is behind the corresponding offset. This step is then looped until the recording is completed, i.e., the compression of the target data to be compressed is completed. The original data acquired from the A/D is 24 bits, and after the compression algorithm is adopted, the data only keeps 8 bits, and the compression rate is about 8/24.
Fig. 3 is a flowchart of a method for decompressing recorded data in which an amplitude can be precisely calculated according to an embodiment of the present invention. As shown in fig. 3, the method for decompressing recording data decompresses the recording file obtained by the method for compressing recording data, and the method includes the following steps:
Acquiring a data decompression request;
opening a record file which is arbitrarily recorded with recording data in the storage equipment according to the data decompression request, and reading a file header of the record file;
And reading the record data corresponding to the file header in the record file, wherein the record data comprises an offset and compressed data corresponding to the offset, and restoring the corresponding compressed data according to the offset to obtain decompressed data.
In the above embodiment, when the recording file needs to be analyzed, the information of the file header is read first. The method comprises the steps of searching the record data corresponding to the file head, then reading in a byte from the head of the record data, wherein the byte is an offset, the offset is followed by a to-be-shifted value of buffer length data, then reading in the compressed data (the compressed data is a sequence of 8-bit integer) after the offset, and shifting the compressed data rightwards according to the offset to obtain decompressed data (the decompressed data is a sequence of 24-bit integer), and cycling the steps until the record file is completely read.
In an embodiment of the present application, after obtaining the decompressed data, the method further includes: the voltage value decompressed into 24-bit data is calculated according to the following formula:
Vi=Vmax×Bi/223;
Wherein Vi is used for representing a voltage value corresponding to one of the decompressed data, bi is used for representing one of the decompressed data, and Vmax is a positive maximum input voltage.
In the above embodiment, the most significant bit of the 24-bit integer data is the sign bit, the remaining 23 bits are the data complement, and the maximum positive integer expressible by the 23 bits is 2 23,, which corresponds to the positive maximum input voltage.
In the above embodiment, the maximum input voltage of the recorded file is stored at the file header, and the corresponding voltage value of the recorded analog signal of the file can be calculated by using the maximum input voltage.
A computer-readable storage medium having stored thereon a computer program for execution by a processor for implementing the recorded data compression method as described above or the recorded data decompression method as described above.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or N embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, "N" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more N executable instructions for implementing specific logical functions or steps of the process, and further implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present application.
It is to be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the N steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable gate arrays, field programmable gate arrays, and the like.
Those of ordinary skill in the art will appreciate that all or part of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, and the program may be stored in a computer readable storage medium, where the program when executed includes one or a combination of the steps of the method embodiments.
While embodiments of the present application have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the application, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the application.

Claims (10)

1.一种录音数据压缩方法,其特征在于,包括:1. A recording data compression method, comprising: 获取待压缩的目标数据,并对所述目标数据进行序列化处理;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.如权利要求1所述的录音数据压缩方法,其特征在于,所述对所述目标数据进行序列化处理,将处理后的序列化数据写入预设缓存区,包括:2. The recording data compression method according to claim 1, wherein the step of serializing the target data and writing the processed serialized data into a preset buffer area comprises: 采用A/D转换器对目标数据进行序列化处理,以得到二进制序列,并将得到的二进制序列写入所述预设缓存区。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.如权利要求1所述的录音数据压缩方法,其特征在于,所述计算所述预设缓存区的绝对峰值,包括:3. The recording data compression method according to claim 1, wherein the step of calculating the absolute peak value of the preset buffer area comprises: 读取所述预设缓存区中的所述序列化数据,获取所述预设缓存区中的所述序列化数据中的最大值或最小值,将所述最大值或最小值作为峰值,并进行绝对化处理,以得到所述绝对峰值。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.如权利要求1所述的录音数据压缩方法,其特征在于,所述计算所述绝对峰值的偏移量,包括:4. The recording data compression method according to claim 1, wherein 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; 其中,所述第一个有效位为1。Wherein, the first valid bit is 1. 5.如权利要求1所述的录音数据压缩方法,其特征在于,根据预设压缩位数获取所述偏移序列中的偏移数据的部分数据,以得到压缩序列,并将所述压缩序列写入记录文件中,包括:5. The recording data compression method according to claim 1, characterized in that the step of obtaining partial data of the offset data in the offset sequence according to a preset compression bit number to obtain a compressed sequence, and writing the compressed sequence into a recording file comprises: 从所述偏移序列中的所述偏移数据的首位字节开始截取预设压缩位数的部分数据,将部分数据作为压缩数据写入所述记录文件中;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.如权利要求1或5所述的录音数据压缩方法,其特征在于,所述预设压缩位数为8。6. The recording data compression method according to claim 1 or 5, characterized in that the preset compression bit number is 8. 7.如权利要求1所述的录音数据压缩方法,其特征在于,所述记录文件的文件头还包括:采样频率、位数、通道数、最大输入电压和缓冲长度。7. The recording data compression method as claimed in claim 1 is characterized in that the file header of the recording file also includes: sampling frequency, bit number, number of channels, maximum input voltage and buffer length. 8.一种可精确计算幅度的录音数据解压方法,其特征在于,对权利要求1-7任一项所述的录音数据压缩方法获取的记录文件进行解压,包括:8. A method for decompressing recorded data capable of accurately calculating amplitude, characterized in that the recorded file obtained by the recorded data compression method according to any one of claims 1 to 7 is decompressed, comprising: 获取数据解压请求;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.如权利要求8所述的可精确计算幅度的录音数据解压方法,其特征在于,于得到所述解压数据后还包括:根据下述公式计算所述解压为24位数据的电压值: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 comprises: calculating the voltage value of the decompressed 24-bit data according to the following formula: Vi=Vmax×Bi/223; Vi=V max ×Bi/2 23; 其中,Vi用于表示所述解压数据中的一个数据对应的电压值,Bi用于表示解压数据中的一个数据,Vmax为正的最大输入电压。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 V max is the maximum positive input voltage. 10.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该程序被处理器执行,以用于实现如权利要求1-7任一项所述的录音数据压缩方法,或者,如权利要求8-9任一项所述的录音数据解压方法。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 to 7, or the recording data decompression method as described in any one of claims 8 to 9.
CN202411231446.5A 2024-09-04 2024-09-04 Recording data compression method and recording data decompression method capable of calculating amplitude Active CN118737207B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411231446.5A CN118737207B (en) 2024-09-04 2024-09-04 Recording data compression method and recording data decompression method capable of calculating amplitude

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411231446.5A CN118737207B (en) 2024-09-04 2024-09-04 Recording data compression method and recording data decompression method capable of calculating amplitude

Publications (2)

Publication Number Publication Date
CN118737207A CN118737207A (en) 2024-10-01
CN118737207B true CN118737207B (en) 2024-11-15

Family

ID=92869280

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411231446.5A Active CN118737207B (en) 2024-09-04 2024-09-04 Recording data compression method and recording data decompression method capable of calculating amplitude

Country Status (1)

Country Link
CN (1) CN118737207B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175185A (en) * 2019-04-17 2019-08-27 南京天数智芯科技有限公司 A kind of self-adaptive non-loss compression based on time series data distribution characteristics
CN113728601A (en) * 2019-04-29 2021-11-30 日立数据管理有限公司 Optimizing storage and retrieval of compressed data

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4922537A (en) * 1987-06-02 1990-05-01 Frederiksen & Shu Laboratories, Inc. Method and apparatus employing audio frequency offset extraction and floating-point conversion for digitally encoding and decoding high-fidelity audio signals
FR2787962B1 (en) * 1998-12-28 2001-02-09 Thomson Multimedia Sa METHOD FOR SIMULTANEOUS RECORDING AND PLAYING OF A DIGITAL AUDIO AND VIDEO DATA STREAM, AND RECEIVER FOR IMPLEMENTING THE METHOD
JP3131647B1 (en) * 2000-08-02 2001-02-05 株式会社ケイシーイージャパン Audio data compression method, audio data expansion method, audio data compression device, audio data expansion device, and recording medium
US7487169B2 (en) * 2004-11-24 2009-02-03 International Business Machines Corporation Method for finding the longest common subsequences between files with applications to differential compression
US8694703B2 (en) * 2010-06-09 2014-04-08 Brocade Communications Systems, Inc. Hardware-accelerated lossless data compression
US9047669B1 (en) * 2012-09-20 2015-06-02 Matrox Graphics Inc. Bit rate control for data compression
US9350384B2 (en) * 2014-09-30 2016-05-24 International Business Machines Corporation Hierarchical data compression and computation
US11032546B1 (en) * 2020-07-20 2021-06-08 Tencent America LLC Quantizer for lossless and near-lossless compression
CN114124102A (en) * 2020-08-29 2022-03-01 华为云计算技术有限公司 Data compression method, device and equipment and computer storage medium
CN114817160A (en) * 2022-04-08 2022-07-29 深圳Tcl新技术有限公司 File decompression method and device, electronic equipment and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175185A (en) * 2019-04-17 2019-08-27 南京天数智芯科技有限公司 A kind of self-adaptive non-loss compression based on time series data distribution characteristics
CN113728601A (en) * 2019-04-29 2021-11-30 日立数据管理有限公司 Optimizing storage and retrieval of compressed data

Also Published As

Publication number Publication date
CN118737207A (en) 2024-10-01

Similar Documents

Publication Publication Date Title
US4910780A (en) Audio signal recording and reproducing apparatus utilizing digital data compression and extension
US6941267B2 (en) Speech data compression/expansion apparatus and method
JP2001035086A (en) Signal processing device and signal processing method thereof
CN118737207B (en) Recording data compression method and recording data decompression method capable of calculating amplitude
CN116470919A (en) Data compression method, device, electronic equipment and storage medium
CN114330820A (en) Patient disease prognosis prediction method, system, storage medium and electronic device
JPH11514165A (en) Apparatus and method for waveform data compression without loss
JPH0795694B2 (en) Data compression circuit
USRE38719E1 (en) Adjust bit determining circuit
US7196642B2 (en) Circuitry and method for sampling audio data
CN114822591A (en) Sound box data information processing method
CN101952890B (en) Data conversion device, program and method
JPH0652497B2 (en) Signal storage method
JP4645866B2 (en) DIGITAL SIGNAL PROCESSING METHOD, LEARNING METHOD, DEVICE THEREOF, AND PROGRAM STORAGE MEDIUM
JP3256399B2 (en) Apparatus and method for detecting linearity error of digital audio signal, and apparatus and method for reducing linearity error
CN115964342A (en) Rapid decompression analysis method of Steim1 compression technology and application thereof
JP3064048B2 (en) Method and circuit for storing deleted bits in CD-ROM
CN107967296B (en) Improved LZO compression method with rapid low resource overhead
JP2002271207A (en) Data conversion device, data compression device and data extension device
JPH05265500A (en) Information signal recording device
JP4374817B2 (en) Method for compressing resolution of waveform data in waveform display device
US5648953A (en) Sub-que code data read circuit for compact disc reproduction apparartus
JPWO2005053163A1 (en) Signal processing device
CN115712041A (en) Method and system for compressing and decompressing map data for partial discharge detection
JP2573746B2 (en) Data compression device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant