Data compression method, decompression method, device and storage medium

By combining the distribution feature of binary coded segments and multiple compressions on the binary coded file, the problem of bit-level redundancy in existing lossless compression is solved, and better compression effect and efficiency are achieved.

CN113868206BActive Publication Date: 2024-11-1981 ZAN TECH DEV (CHONGQING) CO LTD
View PDF 17 Cites 0 Cited by

Patent Information

Application Number
CN202111168996.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-08
Publication Date
2024-11-19
Estimated Expiration
2041-10-08

AI Technical Summary

Technical Problem

The existing lossless compression algorithm is encoded in bytes, resulting in bit-level data redundancy, wasted storage space, and poor compression effect.

Method used

By obtaining the binary coded file of the data to be compressed, dividing it into binary coded segments, extracting and combining the identification bit distribution characteristics of each segment to form a compressed file, and it can be compressed multiple times until the preset condition is reached, and the number of compressions is recorded to represent document.

Benefits of technology

It realizes finer granular compression of data, removes bit-level redundancy, improves the compression effect to 7%-10%, and obtains a better compression ratio through multiple compressions, improving storage and transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113868206B_ABST
    Figure CN113868206B_ABST
Patent Text Reader

Abstract

The present invention discloses a data compression method, a decompression method, a device and a storage medium. The compression method includes: obtaining a binary coded file of data to be compressed; dividing the binary coded file into a plurality of binary coded segments arranged in sequence, and performing coding processing on each binary coded segment; the coding processing includes: extracting the distribution characteristics of the identification bit in the binary coded segment, the identification bit is 0 or 1; combining the distribution characteristics of all binary coded segments according to the arrangement order of the binary coded segments in the binary coded file to obtain a compressed file of the binary coded file. The unit of data processing is reduced to a single bit, and compression coding is performed in bits. The granularity of processing is finer, the data redundancy based on bits is removed, and the compression effect is better. The single compression effect reaches 7%-10%. In order to improve the compression efficiency, multiple binary coded segments can be compressed in parallel, and a better compression ratio can be achieved through multiple compressions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data compression, and in particular to a data compression method, a decompression method, a device and a storage medium. Background Art

[0002] With the continuous development of multimedia and information technology, individuals and organizations in the Internet environment generate a large amount of data every day, and large-scale data puts tremendous pressure on storage devices and communication exchange systems. For this reason, the generated data is generally compressed appropriately to reduce the demand for storage space and save the bandwidth required for data transmission. Data compression is divided into lossy compression and lossless compression. Compared with lossy compression, lossless compression can completely restore the original data without causing any distortion.

[0003] In modern lossless compression coding algorithms, compression coding algorithms based on statistical principles are often used in bytes. Typical lossless compression algorithms include: Huffman compression method, compression method based on arithmetic coding, compression method based on run-length coding, LZW compression method based on dictionary coding technology, etc. Run-length coding and LZW coding are compression algorithms based on dictionary models, while Huffman coding and arithmetic coding are compression algorithms based on statistical models. The former is related to the arrangement order of the original data but not to its frequency of occurrence, while the latter is just the opposite. These algorithms all encode and compress information in bytes. This is bound to bring bit-level data redundancy. Some information can be represented by one bit, but is encoded as one byte, wasting storage space. Summary of the invention

[0004] The present invention aims to at least solve the technical problems existing in the prior art, and in particular innovatively proposes a data compression method, a decompression method, a device and a storage medium.

[0005] In order to achieve the above-mentioned purpose of the present invention, according to the first aspect of the present invention, the present invention provides a data compression method, including: obtaining a binary coded file of data to be compressed; dividing the binary coded file into a plurality of binary coded segments arranged in sequence, and performing encoding processing on each binary coded segment; the encoding processing includes: extracting the distribution characteristics of an identification bit in the binary coded segment, the identification bit is 0 or 1; combining the distribution characteristics of all binary coded segments according to the arrangement order of the binary coded segments in the binary coded file to obtain a compressed file of the binary coded file.

[0006] In order to achieve the above-mentioned purpose of the present invention, according to the second aspect of the present invention, the present invention provides a data compression method, comprising: obtaining a binary encoded file of data to be compressed; compressing the binary encoded file multiple times according to a data compression method of the first aspect of the present invention until a preset condition is reached, obtaining a compressed file, and recording the number of compressions, adding a suffix to the compressed file, wherein the suffix includes the number of compressions.

[0007] In order to achieve the above-mentioned purpose of the present invention, according to the third aspect of the present invention, the present invention provides a data decompression method, including: obtaining a compressed file obtained according to a data compression method described in the first aspect of the present invention; identifying all prefixes and distribution features corresponding to the prefixes in turn from the compressed file; restoring the binary code segments corresponding to each distribution feature; splicing the restored binary code segments in turn according to the arrangement order of the distribution features in the compressed file to complete the data decompression process.

[0008] In order to achieve the above-mentioned purpose of the present invention, according to the fourth aspect of the present invention, the present invention provides a data decompression method, comprising: obtaining a compressed file obtained by a data compression method described in the second aspect of the present invention, and obtaining the number of compressions from the suffix of the compressed file; decompressing the compressed file multiple times according to a data decompression method described in the third aspect of the present invention, and recording the number of decompressions until the decompression number is equal to the compression number and stopping the decompression.

[0009] In order to achieve the above-mentioned purpose of the present invention, according to the fifth aspect of the present invention, the present invention provides a data compression device, including: a data acquisition module, used to obtain a binary code file of the data to be compressed; a binary code segment extraction module, dividing the binary code file into a plurality of binary code segments arranged in sequence; a coding processing module, extracting the distribution characteristics of the identification bits in the binary code segments, and combining the distribution characteristics of all the binary code segments according to the arrangement order of the binary code segments in the binary code file to obtain a compressed file of the binary code file.

[0010] In order to achieve the above-mentioned purpose of the present invention, according to the sixth aspect of the present invention, the present invention provides a decompression device, including: a compressed file acquisition module, which acquires a compressed file obtained according to a data compression method described in the first aspect of the present invention; an identification module, which sequentially identifies all prefixes and distribution features associated with the prefixes from the compressed file; a binary code segment restoration module, which restores the binary code segment corresponding to the distribution feature based on each distribution feature; and a splicing module, which splices the restored binary code segments in sequence according to the arrangement order of the corresponding distribution features in the compressed file to complete the data decompression process.

[0011] In order to achieve the above-mentioned purpose of the present invention, according to the seventh aspect of the present invention, the present invention provides a storage medium, which is used to store instructions, and the instructions are used to execute a data compression method as described in the first aspect or the second aspect of the present invention or a data decompression method as described in the third aspect or the fourth aspect of the present invention.

[0012] In summary, due to the adoption of the above technical scheme, the beneficial effects of the present invention are as follows: the data compression method provided by the present invention is to compress the binary bit stream of the compressed data, reduce the unit of data processing to a single bit, and perform compression encoding in units of bit, so that the processing granularity is finer, the data redundancy based on bit is removed, and the compression effect is better. In the compression process, the binary code segment is expressed by distribution features, and the distribution features include the number of identification bits and their position features, so that the length of most binary code segments can be shortened, and a good compression effect is achieved. Experiments have shown that the single compression effect reaches 7%-10%. At the same time, in order to improve the compression efficiency, multiple binary code segments can also be compressed in parallel to obtain corresponding distribution features. The compression method provided by the present invention can also achieve a better compression ratio through multiple compressions. In the compressed file provided by the data compression method of the present invention, in addition to the distribution features representing the binary code segment, no other special marks are required. During decompression, the prefix of the distribution feature can be automatically identified as the separation mark between the binary code segments, and then multiple position features are obtained. In order to improve the decompression efficiency, multiple distribution features can be restored in parallel. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 is a flow chart of a data compression method in a first preferred embodiment of the present invention;

[0014] Figure 2 is a flow chart of a data compression method in a second preferred embodiment of the present invention;

[0015] Figure 3 is a flow chart of a data decompression method in a third preferred embodiment of the present invention;

[0016] Figure 4 is a flow chart of a data decompression method in a fourth preferred embodiment of the present invention;

[0017] Figure 5 It is a schematic diagram of the first compressed file structure of the present invention;

[0018] Figure 6 It is a schematic diagram of the second compressed file structure of the present invention;

[0019] Figure 7 It is a schematic diagram of the third compressed file structure of the present invention;

[0020] Figure 8 It is a schematic diagram of the fourth compressed file structure of the present invention. DETAILED DESCRIPTION

[0021] Embodiments of the present invention are described in detail below, examples of which 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.

[0022] In the description of the present invention, it is necessary to understand that the terms "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying 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 operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0023] In the description of the present invention, unless otherwise specified and limited, it should be noted that the terms "installed", "connected" and "connected" should be understood in a broad sense. For example, it can be a mechanical connection or an electrical connection, or it can be the internal connection between two components. It can be a direct connection or an indirect connection through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to the specific circumstances.

[0024] The present invention discloses a first data compression method. In a preferred embodiment, Figure 1 As shown, including:

[0025] Step 101, obtaining a binary encoding file of the data to be compressed; the binary encoding file is a binary 01-style code stream of the data to be compressed.

[0026] Step 102, dividing the binary code file into a plurality of binary code segments arranged in sequence;

[0027] Step 103, encoding processing is performed on each binary code segment; the encoding processing includes: extracting the distribution characteristics of the identification bit in the binary code segment, the identification bit is 0 or 1, and the distribution characteristics are mainly the number and distribution position of the identification bit (0 or 1) in the binary code segment; 0 can be used as the identification bit, and 1 can also be used as the identification bit. When 0 is used as the identification bit, 1 is used as a non-identification bit, and when 1 is used as the identification bit, 0 is used as a non-identification bit.

[0028] Step 104: Combining the distribution features of all binary code segments according to the arrangement order of the binary code segments in the binary code file to obtain a compressed file of the binary code file.

[0029] In this embodiment, the data to be compressed is preferably but not limited to document data, picture data or image data.

[0030] In this embodiment, in step 102 and step 103, encoding processing can be performed in parallel or serially for multiple binary coding segments. When processing in parallel, step 102 can be performed first, the binary coding file is first divided into multiple binary coding segments arranged in sequence, and the arrangement order of each binary coding segment is recorded, and then step 103 is performed in parallel for multiple binary coding segments, and finally step 104 is performed. Parallel processing can improve efficiency. When processing in serial, steps 102 and 103 can be performed crosswise, first a binary coding segment is taken out from the binary coding file, and then the binary coding segment is encoded based on step 103 to obtain distribution features, and then step 102 is returned to take out the next binary coding segment, and then step 103 is performed on the next binary coding segment to obtain distribution features, and the distribution features are spliced ​​behind the previous distribution features, and the process is repeated until the extraction, encoding and distribution feature splicing of all binary coding segments in the binary coding file are completed, and a compressed file is obtained. Serial processing does not need to record the arrangement order of binary coding segments, is not prone to errors, and has high reliability.

[0031] In this embodiment, in step 102, the lengths of multiple binary coding segments may be the same or different. When the lengths of multiple binary coding segments are the same, calculations can be simplified and space can be saved. It should be noted that when the compressor and the decompressor reach a consensus on the length of the binary coding segment and the identification bit, it is not necessary to set the length label and identification bit of the binary coding segment in the compressed file. When the compressor and the decompressor do not reach a consensus on the length or identification bit of the binary coding segment, it is also necessary to set the length label and identification bit of the binary coding segment in the compressed file to facilitate the decompression process by the decompressor. The length of the binary coding segment can be customized, such as 40 bits, 20 bits, etc.

[0032] In this embodiment, preferably, the distribution feature includes a position feature and a prefix associated with the position feature; the prefix is ​​the number K of identification bits in the binary coding segment, where K is an integer; the position feature includes a fusion value of the position information of the K identification bits in the binary coding segment. In addition to distinguishing the position features of different binary coding segments, the prefix also has the function of indicating the number of identification bits. It is not a simple separator and can reduce the overall storage space. Preferably, the prefix is ​​a fixed-length bit string, and the numerical value of the bit string is equal to the number K of identification bits. In order to increase the compression ratio, preferably, the identification bit can be determined based on the total number of 0s and 1s in the binary coding file, and the smaller number is selected as the identification bit, which can reduce the cumulative length value of all prefixes.

[0033] In this embodiment, when the total number of bits of the binary coded file is an integer multiple of the length of the binary coded segment, the compressed file is Figure 5 As shown in FIG. 1 , prefix 1 and position feature 1 represent the distribution features of the first binary coding segment. In step 102, when the total number of bits in the binary coding file is not an integer multiple of the length of the binary coding segment, that is, after taking out the last binary coding segment from the binary coding file, the number of bits remaining in the binary coding file is less than the length of the binary coding segment, the remaining bits can be placed at the end of the compressed file, as shown in FIG. Figure 6 As shown; the remaining bits can also be padded with 0 or 1 to meet the length of the binary code segment, the new binary code segment is encoded, and a padded tag is set in the compressed file, such as Figure 7 As shown, the complement tag includes a complement type and a complement length, and the complement type is 0 or 1.

[0034] In a preferred embodiment, the process of obtaining the position feature of the binary code segment includes:

[0035] Assume that the binary code segment includes N binary bits, N is a positive integer, N ≥ K;

[0036] Let the position number of the nth bit in the binary code segment be n, n∈[0,N-1];

[0037] Get the position numbers of K identification bits in the binary code segment, and set the position number of the kth identification bit to n k , k∈[1,K], if k=1, the position information of the kth identification bit is 0, if k>1, the position information of the kth identification bit is the number of bits that match n k The number of binary code combinations with k bits;

[0038] Get the fused value of the position information of K identification bits in the binary code segment, and combine the fused value with the position number n1 of the first identification bit to obtain the position feature of the binary code segment. Preferably, the fused value is the cumulative sum of the position information of K identification bits for easy calculation.

[0039] In this embodiment, preferably, the number of matching digits is n k The number of binary code combinations with k bits is obtained through the combin function, which can be expressed as combin(n k ,k), indicating that in n k The number of binary code combinations with k bits in the bit. The combin function is used to calculate the number of combinations of several objects extracted from a given set of objects. The combin function can be used to determine the number of all possible combinations of a set of objects.

[0040] The present invention also discloses a second data compression method, such as Figure 2 As shown, in a preferred embodiment, the data compression method includes:

[0041] Step 201, obtaining a binary encoding file of data to be compressed;

[0042] Step 202, according to the first data compression method provided by the present invention, the binary coded file is compressed multiple times until the preset condition is met, a compressed file is obtained, and the number of compressions is recorded, and a suffix is ​​added to the compressed file, the suffix including the number of compressions. The structure of the final compressed file is as follows: Figure 8 shown.

[0043] In this embodiment, the preset condition may be a preset maximum number of compressions or a compression ratio threshold. When the number of compressions reaches the preset maximum number of compressions or the compression ratio reaches the compression ratio threshold, compression is stopped.

[0044] The present invention also discloses a first data decompression method, such as Figure 3 As shown, in a preferred embodiment, the data decompression method includes:

[0045] Step 301, obtaining a compressed file obtained according to the first data compression method of the present invention;

[0046] Step 302, identifying all prefixes and distribution features corresponding to the prefixes in sequence from the compressed file;

[0047] Step 303, restoring the binary code segment corresponding to each distribution feature according to the distribution feature, specifically includes: obtaining the number K of identification bits from the prefix of the distribution feature; restoring the binary code segment based on the position feature in the distribution feature, the number K of identification bits and the length N of the binary code segment;

[0048] Step 304: The restored binary code segments are sequentially spliced ​​according to the arrangement order of the corresponding distribution features in the compressed file to complete the data decompression process.

[0049] In this embodiment, preferably, the process of restoring the binary code segment based on the position feature in the distribution feature, the number of identification bits K and the length N of the binary code segment includes: taking out the cumulative sum of the position information of the K-bit identification bits from the position feature, and recording it as a first value; obtaining all binary codes that meet the bit number N and contain K identification bits, and obtaining the cumulative sum of the position information of the K-bit identification bits of each binary code, and recording it as a second value; if the second value is equal to the first value, then the binary code is considered to be the restored binary code segment; if the second value is not equal to the first value, then the binary code is considered not to be the restored binary code segment, and the next binary code verification is performed.

[0050] In a preferred embodiment, restoring the binary code segment corresponding to each distribution feature specifically includes:

[0051] Extract the prefix and position features from the distribution features, and separate the position information fusion value M of the K-bit identification bit and the position number n1 of the first identification bit from the position features;

[0052] Get the position number of the K-bit identification bit in the binary encoding segment, including:

[0053] Step S1, setting a sliding position sequence number variable i, an identification bit number variable j and a difference variable △M, wherein the initial value of i is N-1, the initial value of j is K, and the initial value of △M is M;

[0054] Step S2, obtain the number q of binary codes that match the number of bits i and the number of identification bits j. If q < △M, then it is considered that n i is the position number of an identification bit, let j=j-1, △M=△Mq, i=i-1, and go to step S3. If q>△M, let i=i-1 and go to step S3. If q=△M, then the bits with position numbers less than or equal to i are all identification bits, and the step of obtaining the position number of the K-bit identification bit in the binary code segment ends.

[0055] Step S3, if j=1, the position number of the K-bit identification bit in the binary coding segment has been obtained; if j is greater than 1, return to step S2;

[0056] The binary code segment is restored according to the position sequence number of the obtained K-bit identification bit in the binary code segment.

[0057] In an application scenario of this embodiment, assume that N is 16 and the identification bit is 1. The number of identification bits K obtained from the prefix is ​​8, and n1 obtained from the position information fusion value is 3, then the cumulative sum of the position information of the 8-bit identification bit M is calculated to be 6759. The initial value of △M is 6759. The restoration process is:

[0058] Calculate the number of combinations when the highest bit is 1, combin(15,8)=6435. Because 6435<△M, the position numbered 15 is the identification bit, which is 1, and △M is updated to (6759-6435)=324.

[0059] Test whether the position numbered 14 is a marker bit, and calculate combin(14,7)=3432. Since 3432 is greater than 324, the position numbered 14 is a non-marker bit, which is 0.

[0060] And so on, until the position number is 11, calculate combin(11,7)=330. Since 330 is greater than 324, the position number 11 is a non-identification bit, which is 0.

[0061] Test whether the position numbered 10 is the identification bit, calculate combin(10,7)=120. Since 120 is less than 324, the position numbered 10 is the identification bit, which is 1. △M is updated to (324-120)=204.

[0062] And so on, until it is determined that the test position numbered 4 is the identification bit, which is 1. Since n1 is 3, the final original binary code segment is 1000011111011000.

[0063] The present invention also discloses a second data decompression method, such as Figure 4 As shown, in a preferred embodiment, the data decompression method includes:

[0064] Step 401, obtaining a compressed file obtained according to the second data compression method of the present invention, and obtaining the number of compressions from the suffix of the compressed file;

[0065] Step 402: decompress the compressed file multiple times according to the first data decompression method of the present invention, and record the number of decompressions until the number of decompressions is equal to the number of compressions, and then stop decompressing.

[0066] The present invention also discloses a data compression device. In a preferred embodiment, the data compression device includes: a data acquisition module, used to obtain a binary code file of the data to be compressed; a binary code segment extraction module, which divides the binary code file into a plurality of binary code segments arranged in sequence; and a coding processing module, which extracts the distribution characteristics of the identification bits in the binary code segments, and combines the distribution characteristics of all the binary code segments according to the arrangement order of the binary code segments in the binary code file to obtain a compressed file of the binary code file.

[0067] The present invention also discloses a decompression device. In a preferred embodiment, the decompression device includes: a compressed file acquisition module, which acquires a compressed file obtained by the first data compression method provided by the present invention; an identification module, which sequentially identifies all prefixes and distribution features associated with the prefixes from the compressed file; a binary code segment restoration module, which restores the binary code segment corresponding to the distribution feature based on each distribution feature, specifically including: acquiring the number K of identification bits from the prefix of the distribution feature; restoring the binary code segment based on the position feature in the distribution feature, the number K of identification bits and the length N of the binary code segment; and a splicing module, which sequentially splices the restored binary code segments according to the arrangement order of the corresponding distribution features in the compressed file to complete the data decompression process.

[0068] The present invention also discloses a device, which includes the above-mentioned decompression device and the above-mentioned data compression device. The device can be a personal computer, a mobile phone, etc.

[0069] The present invention also discloses a storage medium. In a preferred embodiment, the storage medium is used to store instructions, and the instructions are used to execute the data compression method provided by the present invention or the data decompression method provided by the present invention.

[0070] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" 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 invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0071] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

Claims

1. A data compression method, It is characterized in that include: Get the binary encoding file of the data to be compressed; Dividing the binary coded file into a plurality of binary coded segments arranged in sequence, and performing encoding processing on each binary coded segment; The encoding process includes: extracting distribution characteristics of identification bits in a binary encoding segment, wherein the identification bits are 0 or 1; Combining the distribution features of all binary coded segments according to the arrangement order of the binary coded segments in the binary coded file to obtain a compressed file of the binary coded file; The distribution feature includes a location feature and a prefix associated with the location feature; The prefix is ​​the number K of identification bits in the binary code segment, where K is an integer; The position feature includes a fusion value of position information of K identification bits in the binary code segment; The process of obtaining the position features of the binary coded segment includes: Assume that the binary code segment includes N binary bits, N is a positive integer, N ≥ K; Let the position number of the nth bit in the binary code segment be n, n∈[0,N-1]; Get the position numbers of K identification bits in the binary code segment, and set the position number of the kth identification bit to n k , k∈[1,K], if k=1, the position information of the kth identification bit is 0, if k>1, the position information of the kth identification bit is the number of bits that match n k The number of binary code combinations with k bits; Get the fused value of the position information of the K identification bits in the binary code segment, and add the fused value to the position number n of the first identification bit. 1 The position features of the binary code segment are obtained by combining.

2. A data compression method, It is characterized in that include: Get the binary encoding file of the data to be compressed; According to the data compression method described in claim 1, the binary coded file is compressed multiple times until a preset condition is met, a compressed file is obtained, the number of compressions is recorded, and a suffix is ​​added to the compressed file, wherein the suffix includes the number of compressions.

3. A data decompression method, It is characterized in that include: Obtaining a compressed file obtained by a data compression method according to claim 1; Identify all prefixes and distribution features corresponding to the prefixes in sequence from the compressed file; Restore the binary code segment corresponding to each distribution feature according to the distribution feature; The restored binary code segments are sequentially spliced ​​according to the arrangement order of the corresponding distribution features in the compressed file to complete the data decompression process.

4. The data decompression method according to claim 3, It is characterized in that The step of restoring the binary code segment corresponding to each distribution feature specifically includes: Extract the prefix and position features from the distribution features, and separate the K-bit position information fusion value M and the position number n of the first bit from the position features. 1 ; Get the position number of the K-bit identification bit in the binary encoding segment, including: Step S1, setting a sliding position sequence number variable i, an identification bit number variable j and a difference variable ΔM, wherein the initial value of i is N-1, the initial value of j is K, and the initial value of ΔM is M; Step S2, obtain the binary code combination number q with the number of bits i and the number of identification bits j. If q<ΔM, then it is considered that n i is the position number of an identification bit, let j=j-1, ΔM=ΔM-q, i=i-1, and go to step S3; if q>ΔM, let i=i-1, and go to step S3; if q=ΔM, then the bits with position numbers less than or equal to i are all identification bits, and the step of obtaining the position number of the K-bit identification bit in the binary code segment ends; Step S3, if j=1, the position number of the K-bit identification bit in the binary coding segment has been obtained; if j is greater than 1, return to step S2; The binary code segment is restored according to the position sequence number of the obtained K-bit identification bit in the binary code segment.

5. A data decompression method, It is characterized in that include: Obtain a compressed file obtained by a data compression method according to claim 2, and obtain the number of compressions from the suffix of the compressed file; According to the data decompression method described in claim 3 or 4, the compressed file is decompressed multiple times, and the number of decompressions is recorded until the decompression number is equal to the compression number, and the decompression is stopped.

6. A data compression device, used to implement a data compression method according to claim 1, It is characterized in that include: A data acquisition module, used to acquire a binary encoding file of data to be compressed; A binary code segment extraction module is used to divide the binary code file into a plurality of binary code segments arranged in sequence; The encoding processing module extracts the distribution characteristics of the identification bits in the binary encoding segments, and combines the distribution characteristics of all the binary encoding segments according to the arrangement order of the binary encoding segments in the binary encoding file to obtain a compressed file of the binary encoding file; The distribution feature includes a location feature and a prefix associated with the location feature; The prefix is ​​the number K of identification bits in the binary code segment, where K is an integer; The position feature includes a fusion value of position information of K identification bits in the binary code segment; The process of the encoding processing module obtaining the position feature of the binary encoding segment includes: Assume that the binary code segment includes N binary bits, N is a positive integer, N ≥ K; Let the position number of the nth bit in the binary code segment be n, n∈[0,N-1]; Get the position numbers of K identification bits in the binary code segment, and set the position number of the kth identification bit to n k , k∈[1,K], if k=1, the position information of the kth identification bit is 0, if k>1, the position information of the kth identification bit is the number of bits that match n k The number of binary code combinations with k bits; Get the fused value of the position information of the K identification bits in the binary code segment, and add the fused value to the position number n of the first identification bit. 1 The position features of the binary code segment are obtained by combining.

7. A decompression device, used to implement the data decompression method according to claim 3, It is characterized in that include: A compressed file acquisition module, which acquires a compressed file obtained according to a data compression method according to claim 1; An identification module, which sequentially identifies all prefixes and distribution features associated with the prefixes from the compressed file; A binary code segment restoration module restores the binary code segment corresponding to each distribution feature according to the distribution feature; The splicing module splices the restored binary code segments in sequence according to the arrangement order of the corresponding distribution features in the compressed file to complete the data decompression process.

8. A storage medium, wherein the storage medium is used to store instructions, wherein the instructions are used to execute a data compression method according to claim 1 or 2 or a data decompression method according to any one of claims 3 to 5.

Citation Information

Patent Citations

  • Nondestructive compressing method, uncompressing method, compressing device and uncompressing device for integer data

    CN103067022A

  • Lossless compression method based on binary processing

    CN103546161A

  • Data compression method and device

    CN104868922A

  • File compression and decompression method and device

    CN110504973A

  • Data encryption storage method, device and equipment and readable storage medium

    CN110795747A