Lossless compression and decompression of data
By processing the first 8 bytes of the data, combining rule operations and combinations, and using the formula A + B + C + D, the problem of lossless compression of irregular data in existing technologies is solved, thus improving the compression rate and efficiency.
Patent Information
- Application Number
- CN202310887083.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-18
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-07-18
AI Technical Summary
Existing data compression algorithms cannot perform multiple lossless compressions on irregular data with low repetition rates, resulting in low compression ratios and low efficiency.
By reading the first 8 bytes of the data, determining and adding half bytes, obtaining the data length, performing rule-based operations and combinations, and using the formula of data A + data B + data C + data D for multiple lossless compressions.
It achieves multiple lossless compressions of irregular data, improving compression ratio and efficiency.
Smart Images

Figure CN116894017B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more specifically, to a method for lossless compression and decompression of data. Background Technology
[0002] Most current data compression algorithms are based on the LZ77 and Huffman algorithms, with some being fused or modified. Some compression algorithms are fast but have low compression ratios, while others are the opposite. They are also divided into lossy compression (data is lost after compression, used for video, image, audio files, etc.) and lossless compression (data is not lost after compression, used for system files, executable programs, etc.). All existing algorithms require data statistics before compression can be performed. For irregular data with low repetition, the compression ratio is very low, so all algorithms can only compress once. Summary of the Invention
[0003] The purpose of this invention is to provide a lossless compression and decompression method for data, which can solve the problem that current compression software cannot perform repeated lossless compression and can perform multiple compressions.
[0004] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is as follows:
[0005] In a first aspect, this application provides a lossless data compression method, comprising the following steps:
[0006] S101. Read the file to be compressed, obtain the original hexadecimal data of the file, and read the first 8 bytes of the original data to obtain the first data to be processed; S102. Determine whether the first data to be processed satisfies that each number from 0 to F is at least one. If not, select half-bytes from the 9th byte of the original data and add them to the end of the first data to be processed until the condition is met to obtain the second data to be processed; if the condition is met, use the first data to be processed as the second data to be processed; S103. Obtain the data length according to the second data to be processed, convert it to hexadecimal, and save it as data A; obtain the remaining data in the second data to be processed excluding the last 4 bytes and save it as data B; S104. Select the second S105. Perform rule-based operations on the last 4 bytes of the data to be processed to obtain the third calculation result; convert the third calculation result to hexadecimal and save it as data C; S106. Obtain the base number of the last 4 bytes of the second data to be processed, and arrange and combine them in an orderly manner according to the set rules, and save all combinations whose calculation result is the third calculation result; search for combinations of the last 4 bytes of the second data to be processed from the saved combinations, and obtain their arrangement position; convert the arrangement position to hexadecimal and save it as data D; S107. Obtain compressed data through the formula data A + data B + data C + data D; S108. Repeat steps S102-S106 for the unread raw data, selecting the next 8 bytes in sequence, until all bytes are selected and the operation ends.
[0007] Based on the first aspect, the step of sequentially selecting the next 8 bytes of the unread raw data and repeating steps S102-S106 until all bytes have been selected and the operation ends includes:
[0008] When the last selected data is padded to 8 bytes, add a number that is not present in 0-F to the end of the data.
[0009] Based on the first aspect, the step of converting the permutation order to hexadecimal and saving it as data D includes:
[0010] If the data D is less than 2 bytes, pad it with 0s.
[0011] Based on the first aspect, the step of selecting the last 4 bytes of the second data to be processed for rule-based operation to obtain the third calculation result includes:
[0012] Select the first and second half-byte data of the last 4 bytes of the second data to be processed, compare the first and second half-byte data, and perform the larger-to-smaller rule operation to obtain the first calculation result; compare the first calculation result with the third half-byte data, and perform the larger-to-smaller operation to obtain the second calculation result; repeat this process until all data is calculated to obtain the third calculation result.
[0013] Secondly, this application provides a lossless decompression method for data, comprising the following steps:
[0014] S201. Read the file to be decompressed in hexadecimal and obtain the third data to be processed; S202. Convert the first byte of the third data to decimal to obtain the first data; obtain the calculation length based on the first data, and read data starting from the second byte of the third data to obtain the fourth data to be processed, and save the fourth data to be processed as data E; S203. Search the fourth data to be processed, determine the missing number in OF, and combine it according to the set rules to obtain the second data; S204. Read the third data that has not been read. Take the first position data of the first byte and convert it to decimal to obtain the third data; continue to read the next two bytes and convert them to decimal to obtain the fourth data; S205, using the second data as the base number, enumerate all combinations and perform rule operations, and save all combinations whose calculation result is the third data, read the combination whose position is the fourth data and save it as data F; S206, obtain the decompressed data through the formula E + F; S207, repeat steps S202-S206 for the unread data of the third data to be processed until it can no longer be read.
[0015] Based on the second aspect, the step of obtaining the calculation length based on the first data, and reading data from the second byte of the third data to be processed according to the calculation length to obtain the fourth data to be processed includes:
[0016] Subtract 8 from the first data to obtain the calculation result M; divide the calculation result M by 2 to obtain the calculation result N; read the length of the calculation result N starting from the second byte of the third data to be processed.
[0017] Thirdly, this application provides an electronic device including at least one processor, at least one memory, and a data bus; wherein: the processor and the memory communicate with each other through the data bus; the memory stores program instructions that are executed by the processor, and the processor calls the program instructions to perform the method as described in any of the first aspects above.
[0018] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the methods described in any of the first aspects above.
[0019] Compared with the prior art, the present invention has at least the following advantages or beneficial effects:
[0020] This invention proposes a lossless data compression method. It involves acquiring the original data, reading the first 8 bytes to obtain first data to be processed, and then obtaining second data to be processed through data addition conditions. Data A is obtained based on the length of the second data. The remaining data (excluding the last four bytes) is then acquired and saved as data B. Further, rule-based operations are performed on the last four bytes of the second data to obtain data C. Based on the base number of the last four bytes, permutation and combination calculations are performed to obtain data D. Finally, compressed data is obtained using the formula: data A + data B + data C + data D. This method solves the problem that current compression software cannot perform repeated lossless compression, allowing for multiple compression operations. Attached Figure Description
[0021] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of an embodiment of a lossless data compression method according to the present invention;
[0023] Figure 2 This is a flowchart of an embodiment of a lossless decompression method for data according to the present invention;
[0024] Figure 3 This is a logic flowchart of an embodiment of a lossless data compression method according to the present invention;
[0025] Figure 4 This is a logic flowchart of an embodiment of a lossless data decompression method according to the present invention;
[0026] Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of the present invention.
[0027] Icons: 1. Processor; 2. Memory; 3. Data bus. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0029] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the various embodiments and features described below can be combined with each other.
[0030] Example 1
[0031] Please see Figure 1 This application provides a lossless data compression method that solves the problem that current compression software cannot perform repeated lossless compression, allowing for unlimited compression. The lossless data compression method includes the following steps:
[0032] Step S101: Read in the file to be compressed, obtain the original hexadecimal data of the file, and read the first 8 bytes of the original data to obtain the first data to be processed.
[0033] In the above steps, the file is first read in hexadecimal. For example, if the first 12 bytes of the file are read as: 23 66AB CDE2 33 19 74 58F0 A1 E2, then the first 8 bytes of data read would be: 23 66AB CD E2 33 19 74. Please refer to [link / reference]. Figure 3 .
[0034] Step S102: Determine whether the first data to be processed satisfies that each number from 0 to F is at least one. If not, select half-bytes from the ninth byte of the original data and add them to the end of the first data to be processed until the condition is met, and obtain the second data to be processed. If the condition is met, use the first data to be processed as the second data to be processed.
[0035] In the above steps, it is determined whether the byte data of 23 66AB CD E2 33 19 74 satisfies that each number from 0 to F is present at least once. It is clear that the selected data does not satisfy this condition. Therefore, the next half-byte of the original data is added to the end of 23 66AB CD E2 33 19 74, resulting in 23 66AB CD E2 33 19 74 5 bytes of data. However, 23 66AB CD E2 33 19 74 5 bytes still does not satisfy the condition. The above steps are continued, successively obtaining 23 66AB CD E2 3319 74 58 bytes, 23 66AB CD E2 33 19 74 58F bytes, and 23 66AB CD E2 33 19 74 58F0 bytes of data. At this point, 23 66AB CD E2 33 19 74 58F0 satisfies the condition, therefore 23 66AB CD E2 3319 74 58F0 is the second data to be processed; please refer to [link / reference]. Figure 3 .
[0036] Step S103: Obtain the data length based on the second data to be processed, convert it to hexadecimal, and save it as data A; obtain the remaining data after subtracting the last four bytes from the second data to be processed, and save it as data B.
[0037] In the above steps, we know that the length of the byte data 23 66AB CD E2 33 19 74 58F0 is 20, which is 14 in hexadecimal. This 14 is then saved as data A. Subtracting the last four bytes from 23 66AB CD E2 3319 74 58F0 gives 2366AB CD E2 33, therefore data B is 23 66AB CD E2 33. Please refer to [link / reference]. Figure 3 .
[0038] Step S104: Select the last four bytes of the second data to be processed and perform rule operations to obtain the third calculation result; convert the third calculation result into hexadecimal and save it as data C.
[0039] The step of selecting the last four bytes of the second data to be processed for rule-based operation to obtain the third calculation result includes:
[0040] Select the first and second half-byte data of the last four bytes of the second data to be processed, compare the first and second half-byte data, and perform the larger-to-smaller rule operation to obtain the first calculation result; compare the first calculation result with the third half-byte data, and perform the larger-to-smaller operation to obtain the second calculation result; repeat this process until all data is calculated to obtain the third calculation result.
[0041] In the above steps, the last 4 bytes of data are selected as 19 74 58F0. The calculation method is to compare the first half-byte data 1 and the second half-byte data 9, and then perform the larger-to-smaller rule. 9-1 gives the first calculation result 8. Then, this result 8 is compared with the third half-byte data 7, and the larger-to-smaller rule is still applied. 8-7 gives the second calculation result 1. Then, this result 1 is compared with the fourth half-byte data 4, and the larger-to-smaller rule is still applied. This gives 3. This process is repeated until all data is calculated. Then 5-3=2, 8-2=6, F-6=9, and the final third calculation result is 9. Finally, 9 is saved as data C. Please refer to [link to relevant documentation]. Figure 3 .
[0042] Step S105: Obtain the base number of the last four bytes of the second data to be processed, and arrange and combine them in an orderly manner according to the set rules, and save all combinations that result in the third calculation result; search for combinations of the last four bytes of the second data to be processed from the saved combinations, and obtain their arrangement position; convert the arrangement position to hexadecimal and save it as data D.
[0043] In the above steps, the base number of the last four bytes of the second data to be processed is 0145789F. All combinations are enumerated and the results are calculated, and all combinations with a result of 9 are saved. Further, the correct combination 197458F0 is searched for within the combinations with a result of 9, resulting in the 15th position in the enumerated combination results. Then, 15 is converted to hexadecimal as F, and if less than two bytes, it is padded with zeros, resulting in 00 0F. Finally, the 000F bytes of data are saved as data D. Please refer to [link to relevant documentation]. Figure 3 .
[0044] Step S106: Obtain compressed data using the formula A + B + C + D.
[0045] In the above steps, the compressed data of the first 10 bytes of the final file is data A + data B + data C + data D = 1423 66AB CD E2 33 90 00F. Please refer to [link / reference]. Figure 3 .
[0046] Step S107: Select the next 8 bytes of the unread raw data in sequence and repeat steps S102-S105 until all bytes have been selected and the process ends.
[0047] The step of selecting the next 8 bytes of the unread raw data and repeating steps S102-S106 until all bytes have been selected and the process ends includes:
[0048] When the last selected data is padded to 8 bytes, the missing numbers from 0-F are added to the end of the data.
[0049] In the above steps, considering that only the first 10 bytes of the example file are compressed, it is necessary to continue selecting the next 8 bytes from A1 and repeat steps S102-S106 until all bytes are selected, thus completing file compression. If the last selected data is less than 8 bytes, a number not present in 0-F is added to the end of the data. Since there are 16 numbers in 0-F, the added data satisfies the 8-byte calculation method. The order in which the numbers are added is preferably the same as the enumeration order described above. Using enumeration can reduce compression and decompression time. The second-to-last byte and the last byte of the entire compressed data record the length after the addition and the number of compressions, respectively, providing data support for subsequent decompression.
[0050] Example 2
[0051] Please see Figure 2 This application provides a lossless decompression method for data, including the following steps:
[0052] Step S201: Read the file to be decompressed in hexadecimal and obtain the third data to be processed.
[0053] In the above steps, for example, if the file to be decompressed is read in hexadecimal as 14 23 66AB CD E233 90 00F, please refer to [link / reference needed]. Figure 4 .
[0054] Step S202: Convert the first byte of the third data to be processed into decimal to obtain the first data; obtain the calculation length based on the first data; read data starting from the second byte of the third data to be processed based on the calculation length to obtain the fourth data to be processed, and save the fourth data to be processed as data E.
[0055] The step of obtaining the calculation length based on the first data, and reading data from the second byte of the third data to be processed based on the calculation length to obtain the fourth data to be processed includes:
[0056] Subtract 8 from the first data to obtain the calculation result M; divide the calculation result M by 2 to obtain the calculation result N; start reading the byte length of the calculation result N from the second byte of the third data to be processed.
[0057] In the above steps, the first byte of the third data to be processed, 14, is converted to decimal 20. The data length is 20-8=12. Starting from the second byte, 12 / 2=6 bytes of data are read, which is 23 66AB CD E2 33. This 23 66AB CD E2 33 is then saved as data E. Please refer to [link to relevant documentation]. Figure 4 .
[0058] Step S203: Search the fourth data to be processed, determine the missing number in OF of the fourth data to be processed, and combine it according to the set rules to obtain the second data.
[0059] In the above steps, a data retrieval of 23 66AB CD E2 33 revealed that the missing digit in OF is 0145789F. This is saved as the second set of data. Please refer to [link / reference]. Figure 3 The rule is to arrange them in ascending order.
[0060] Step S204: Read the first position data of the first byte of the third data to be processed that has not been read, and convert it to decimal to obtain the third data; continue to read the last two bytes and convert them to decimal to obtain the fourth data.
[0061] In the above steps, the first position data of the first byte of the third data to be processed that has not been read is 9, where the first position is the first half-byte data of that byte. Then, 9 is converted to decimal 9 and saved as the third data. Next, the next two bytes of data, 000F, are read, converted to decimal 15, and saved as the fourth data. Please refer to [link to relevant documentation]. Figure 4 .
[0062] Step S205: Using the second data as the base number, enumerate all combinations and perform rule operations, and save all combinations whose calculation result is the third data. Read the combination whose position is the fourth data and save it as data F.
[0063] In the above steps, using 0145789F as the base number, all combinations are enumerated and the results are calculated. All combinations with a result of 9 are saved. Then, the combination in the 15th row of the enumeration results is read, which is 197458F0, and 197458F0 is saved as data F. Please refer to [link / reference]. Figure 4 .
[0064] Step S206: Obtain the decompressed data using the formula E + F.
[0065] In the above steps, the first 10 bytes of decompressed data are data E + data F = 23 66AB CD E233 19 74 58F0. Please refer to [link / reference]. Figure 4 .
[0066] Step S207: Repeat steps S2-S5 sequentially for the unread data of the third pending data until it can no longer be read.
[0067] In the above steps, considering that only the first 10 bytes of the example file are decompressed, steps S202-S206 need to be repeated until all bytes of data are read and the file decompression is complete. If the decompressed data records the length to be added, it can be deleted accordingly. If the decompression data also records the number of decompression attempts, then decompression can be performed the corresponding number of times.
[0068] Example 3
[0069] Please see Figure 5 This application provides an electronic device including at least one processor 1, at least one memory 2, and a data bus 3; wherein: the processor 1 and the memory 2 communicate with each other via the data bus 3; the memory 2 stores program instructions executable by the processor 1, and the processor 1 calls the program instructions to execute a lossless data compression and decompression method. For example, implementing:
[0070] S101. Read the file to be compressed, obtain the original hexadecimal data of the file, and read the first 8 bytes of the original data to obtain the first data to be processed; S102. Determine whether the first data to be processed satisfies that each number from 0 to F is at least one. If not, select half-bytes from the ninth byte of the original data and add them to the end of the first data to be processed until the condition is met to obtain the second data to be processed; if the condition is met, use the first data to be processed as the second data to be processed; S103. Obtain the data length according to the second data to be processed, convert it to hexadecimal, and save it as data A; obtain the remaining data in the second data to be processed excluding the last four bytes and save it as data B; S104. Select the second The last four bytes of the data to be processed are subjected to rule-based operations to obtain the third calculation result; the third calculation result is converted to hexadecimal and saved as data C; S105, the base number of the last four bytes of the second data to be processed is obtained, and the data is arranged and combined in an orderly manner according to the set rules, and all combinations whose calculation result is the third calculation result are saved; the combination of the last four bytes of the second data to be processed is searched from the saved combinations, and its arrangement position is obtained; the arrangement position is converted to hexadecimal and saved as data D; S106, the compressed data is obtained through the formula data A + data B + data C + data D; S107, the next 8 bytes of the unread raw data are selected in sequence and steps S102-S106 are repeated until all bytes are selected and the operation ends.
[0071] The memory 2 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.
[0072] Processor 1 can be an integrated circuit chip with signal processing capabilities. Processor 1 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0073] Understandable. Figure 5 The structure shown is for illustrative purposes only; the electronic device may also include components that are more advanced than those shown. Figure 5 The more or fewer components shown, or having the same Figure 5 The different configurations shown. Figure 5 The components shown can be implemented using hardware, software, or a combination thereof.
[0074] Example 4
[0075] This invention provides a computer-readable storage medium storing a computer program that, when executed by a processor 1, implements a lossless data compression and decompression method. For example, it implements:
[0076] S101. Read the file to be compressed, obtain the original hexadecimal data of the file, and read the first 8 bytes of the original data to obtain the first data to be processed; S102. Determine whether the first data to be processed satisfies that each number from 0 to F is at least one. If not, select half-bytes from the ninth byte of the original data and add them to the end of the first data to be processed until the condition is met to obtain the second data to be processed; if the condition is met, use the first data to be processed as the second data to be processed; S103. Obtain the data length according to the second data to be processed, convert it to hexadecimal, and save it as data A; obtain the remaining data in the second data to be processed excluding the last four bytes and save it as data B; S104. Select the second The last four bytes of the data to be processed are subjected to rule-based operations to obtain the third calculation result; the third calculation result is converted to hexadecimal and saved as data C; S105, the base number of the last four bytes of the second data to be processed is obtained, and the data is arranged and combined in an orderly manner according to the set rules, and all combinations whose calculation result is the third calculation result are saved; the combination of the last four bytes of the second data to be processed is searched from the saved combinations, and its arrangement position is obtained; the arrangement position is converted to hexadecimal and saved as data D; S106, the compressed data is obtained through the formula data A + data B + data C + data D; S107, the next 8 bytes of the unread raw data are selected in sequence and steps S102-S106 are repeated until all bytes are selected and the operation ends.
[0077] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0078] It will be apparent to those skilled in the art that this application is not limited to the details of the exemplary embodiments described above, and that this application can be implemented in other specific forms without departing from the spirit or essential characteristics of this application. Therefore, the embodiments should be considered illustrative and non-limiting in all respects, and the scope of this application is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within this application. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method of lossless compression of data, characterized by, The method comprises the following steps: S101, reading a file to be compressed, obtaining original data of 16 hexadecimal data of the file, and reading the first 8 bytes of the original data to obtain first to-be-processed data; S102, judging whether each digit of 0-F in the first to-be-processed data satisfies at least one, when the condition is not satisfied, selecting half bytes from the 9th byte of the original data in sequence and adding them to the tail of the first to-be-processed data until the condition is satisfied to obtain second to-be-processed data; when the condition is satisfied, taking the first to-be-processed data as the second to-be-processed data; S103, obtaining the data length according to the second to-be-processed data and converting it into 16 hexadecimal to save it as data A; obtaining the remaining data of the second to-be-processed data except the last 4 bytes and saving it as data B; S104, selecting the last 4 bytes of the second to-be-processed data to perform a rule operation to obtain a third calculation result; converting the third calculation result into 16 hexadecimal to save it as data C; S105, obtaining the reference number of the last 4 bytes of the second to-be-processed data and performing ordered arrangement combination according to a set rule to save the calculation result as all combinations of the third calculation result; searching the combination of the last 4 bytes of the second to-be-processed data from the saved combinations and obtaining the arrangement position; converting the arrangement position into 16 hexadecimal to save it as data D; S106, obtaining compressed data through the formula of data A+data B+data C+data D; S107, selecting the next 8 bytes from the original data that has not been read to repeat the steps of S102-S106 until all the bytes are selected to end the operation.
2. The method for lossless compression of data as claimed in claim 1 wherein, The step of selecting the next 8 bytes from the original data that has not been read to repeat the steps of S102-S106 until all the bytes are selected to end the operation comprises: When the last selected data is supplemented to 8 bytes, adding the missing number in 0-F to the tail of the data.
3. The method for lossless compression of data as claimed in claim 1 wherein, The step of converting the arrangement position into 16 hexadecimal to save it as data D comprises: When data D is less than 2 bytes, supplementing 0.
4. The method for lossless compression of data as claimed in claim 1 wherein, The step of selecting the last 4 bytes of the second to-be-processed data to perform a rule operation to obtain a third calculation result comprises: selecting the 1st half byte data and the 2nd half byte data of the last 4 bytes of the second to-be-processed data, comparing the 1st half byte data and the 2nd half byte data, and performing a rule operation of large subtraction to obtain a first calculation result; comparing the first calculation result with the 3rd half byte data and performing a large subtraction operation to obtain a second calculation result; repeating in sequence until all the data are calculated to obtain a third calculation result.
5. A lossless decompression method of data, characterized by, The method comprises the following steps: S201, reading a file to be decompressed in 16 hexadecimal and obtaining third to-be-processed data; S202, converting the 1st byte data of the third to-be-processed data into 10 decimal to obtain first data; obtaining a calculation length according to the first data, reading data from the 2nd byte of the third to-be-processed data according to the calculation length to obtain fourth to-be-processed data, and saving the fourth to-be-processed data as data E; S203, searching the fourth to-be-processed data, judging that the fourth to-be-processed data lacks a number in O-F, and combining the number according to a set rule to obtain second data; S204, reading first position data of a first byte of the third to-be-processed data which is not read, converting the first position data into decimal to obtain third data, and continuing to read second byte data and converting the second byte data into decimal to obtain fourth data; S205, taking the second data as a reference number, enumerating all combinations and performing rule operation, saving the calculation results as all combinations of the third data, reading bit positions of the saved combinations as combinations of the fourth data, and saving the combinations as data F; S206, obtaining decompressed data through a formula of data E+data F; S207, repeating the steps of S202-S206 for the data of the third to-be-processed data which is not read in sequence until the data cannot be read any more.
6. The lossless decompression method of data according to claim 5, wherein, The step of obtaining the fourth to-be-processed data according to the first data, the calculation length, and the second byte of the third to-be-processed data includes: Subtracting 8 from the first data to obtain a calculation result M; Dividing the calculation result M by 2 to obtain a calculation result N; Reading byte length data of the calculation result N from the second byte of the third to-be-processed data.
7. An electronic device, comprising: The computer program is executed by the processor to implement the method of any one of claims 1-6.
8. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1-6.
Citation Information
Patent Citations
Lossless compression and decompression method for general information
CN101977061A
Method and device for processing compressed file
CN104579357A