Data compression method, device, and storage medium

Through binary compression method and index number replacement technology, combined with training data list and compression engine, the problems of insufficient image file compression ratio and high computing resource consumption in the existing technology are solved, and efficient 20% compression rate and visual quality fidelity are achieved. data compression effect.

CN113987229BActive Publication Date: 2024-12-24SHENZHEN ZHI HUI LIN NETWORK TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111190013.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2024-12-24
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

When the existing data compression method compresses image files, the compression ratio is insufficient and the computing resources consumes a lot, resulting in insufficient disk space utilization and difficult to guarantee the visual quality after decompression.

Method used

Using binary compression method, the hexadecimal data of the original image file is compressed through index number replacement and probability allocation technology, and saved as index number set and replaced index number set. Combined with training data list and compression engine technology, it can achieve efficient data compression.

Benefits of technology

It realizes the compression of the original image file to about 20% of the original file size, while ensuring the integrity of visual quality after decompression, significantly saving disk space and reducing computing resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113987229B_ABST
    Figure CN113987229B_ABST
Patent Text Reader

Abstract

The present application discloses a data compression method, device and storage medium. The method comprises: saving one byte of hexadecimal data of a first original image file as a first index number set and a second index number set; replacing the second index number with a value corresponding to the difference between any second index number in the second index number set and the minimum index number in the second index number set; saving the first index number set and the replaced second index number set. The corresponding device and storage medium are also disclosed. The scheme disclosed in the present application is adopted, and a binary compression method is used to provide a high-end compression ratio, which can not only ensure the accurate quality of the compressed original image file, but also provide a very low compression ratio, and the original image file can be compressed to about 20% of the original file size without losing any visual quality after decompression.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Raw image files (RAW) (file formats such as .raf, .NEF, CR3, ...) are constructed as bitmap files and are usually compressed using a mathematical (totally) lossless compression method (TLC). Most TLC methods provide maximum performance results of no more than about 90% compression ratio. For example, ZIP and RAR provide an average compression ratio of 90% to 99%.

[0003] Although these techniques, as well as completely lossless compression techniques, can produce an exact bit-for-bit equivalent image file of the original image file after decompression, the compression ratio is far from satisfactory.

[0004] Current methods such as Adobe's compression of RAW image files result in a huge sacrifice in compression ratio to obtain the compressed bit-for-bit data, therefore preventing the compression software from saving more (or in many cases, even implementing a completely lossless compression method) beneficial disk space compression results.

[0005] In addition, since current compression methods require a lot of computation to compress binary data, a lot of computing resources, such as central processing unit (CPU) and random access memory (RAM), are consumed during the compression process. Summary of the invention

[0006] The present application provides a data compression method and device, and a storage medium, which provide a lower compression ratio without losing any visual quality.

[0007] In a first aspect, a data compression method is provided, the method comprising:

[0008] Saving one byte of hexadecimal data of the first original image file as a first index number set and a second index number set;

[0009] Replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set;

[0010] The first index number set and the replaced second index number set are saved.

[0011] Optionally, the first index number in the first index number set is an index number of at least two digits, and the second index number in the second index number set is an index number of one digit.

[0012] Optionally, the method further comprises:

[0013] Saving one byte of binary data of the second original image file into two hexadecimal files;

[0014] Get the type of the hexadecimal value in each of the two hexadecimal files;

[0015] Get the probability of each type of hexadecimal value appearing in the two hexadecimal files;

[0016] According to the probability, assigning a corresponding index number to each hexadecimal value in the two hexadecimal files;

[0017] The second original image file is saved as a third index number set and a fourth index number set.

[0018] Optionally, the method further comprises:

[0019] Acquire binary data of the second original image file;

[0020] extracting a header of the second original image file;

[0021] The step of saving one byte of binary data of the second original image file into two hexadecimal files includes:

[0022] The binary data of the message body of the second original image file except the header is saved as the two hexadecimal files.

[0023] Optionally, the method further comprises:

[0024] Training is performed on a plurality of the second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

[0025] In a second aspect, a data compression device is provided, the device comprising:

[0026] A first saving unit, used for saving one byte of hexadecimal data of the first original image file as a first index number set and a second index number set;

[0027] a replacement unit, configured to replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set;

[0028] The second storage unit is used to store the first index number set and the replaced second index number set.

[0029] Optionally, the first index number in the first index number set is an index number of at least two digits, and the second index number in the second index number set is an index number of one digit.

[0030] Optionally, the device further comprises:

[0031] A third saving unit, used for saving one byte of binary data of the second original image file into two hexadecimal files;

[0032] A first acquiring unit, configured to acquire a type of a hexadecimal value in each of the two hexadecimal files;

[0033] A second obtaining unit, used for obtaining the probability of each type of hexadecimal value appearing in the two hexadecimal files;

[0034] an allocating unit, configured to allocate a corresponding index number to each hexadecimal value in the two hexadecimal files according to the probability;

[0035] The fourth saving unit is used to save the second original image file as a third index number set and a fourth index number set.

[0036] Optionally, the device further comprises:

[0037] A third acquiring unit, configured to acquire binary data of the second original image file;

[0038] an extraction unit, configured to extract a header of the second original image file;

[0039] The third saving unit is used to save the binary data of the message body of the second original image file except the header as the two hexadecimal files.

[0040] Optionally, the device further comprises:

[0041] The training unit is used to train the plurality of second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

[0042] In a third aspect, a data compression device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method described in the first aspect or any one of the implementations of the first aspect is implemented.

[0043] According to a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect or any one of the implementations of the first aspect is implemented.

[0044] The data compression scheme of the present application has the following beneficial effects:

[0045] Uses a binary compression method to provide high-end compression ratios that guarantee the exact quality of the original image file after compression, and very low compression ratios that can compress the original image file to about 20% of the original file size without any loss of visual quality after decompression. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0047] Figure 1 A flowchart of a data compression method provided in an embodiment of the present application;

[0048] Figure 2 A schematic diagram of data compression according to an example of an embodiment of the present application;

[0049] Figure 3 A flowchart of another data compression method provided in an embodiment of the present application;

[0050] Figure 4 A schematic diagram of a data compression training example of an embodiment of the present application;

[0051] Figure 5 A schematic diagram of the structure of a data compression device provided in an embodiment of the present application;

[0052] Figure 6 A schematic diagram of the structure of another data compression device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0054] The present application provides a different method to compress the original image file, that is, using a binary compression method to provide a high-end compression ratio, which can provide the accurate quality of the original image file and a very low compression ratio, close to 20%.

[0055] The method described in this application compresses the original image file to about 20% of the original file size without losing any visual quality so that photographers can enjoy all the photo editing functions they will have in the original original image file in the generated digital news gathering (DNG) file.

[0056] Compressing and storing DNG image files from raw image files created from any of hundreds of cameras will display the exact pixel-to-pixel visual image as their raw image files before compression. DNG images can be visualized and analyzed using a variety of image analysis methods such as structural similarity (SSIM) comparisons, proving that DNG image files have exactly the same visual quality as their corresponding raw image files.

[0057] method:

[0058] This application describes a solution to compress RAW image files into DNG file format with a compression margin of 20% of the original file size, thus producing exactly the same visual quality and editing freedom as the original file.

[0059] This method uses binary compression technology and does not analyze the pixel and grayscale data (regarded as visual units) of the RAW file. Instead, the pixel data and grayscale data are exported as binary values ​​and analyzed using the most efficient calculations to save a lot of computing power.

[0060] This method, referred to here as RAW image replication (RIR), is mainly based on a data model trained by an artificial intelligence (AI) algorithm.

[0061] like Figure 1 FIG. 1 is a flow chart of a data compression method provided in an embodiment of the present application, the method comprising the following steps:

[0062] S101. Save one byte of hexadecimal data of a first original image file as a first index number set and a second index number set.

[0063] S102. Replace the second index number with a value corresponding to the difference between any second index number in the second index number set and the minimum index number in the second index number set.

[0064] S103. Save the first index number set and the replaced second index number set.

[0065] Store the HEX value of a byte one by one into a new file, which is actually a compressed file (the output result of the compression process):

[0066] Step S101: Given Figure 2 The HEX value in the data compression diagram saves the HEX value of a byte as an index, or a one- and two-bit index number:

[0067] DD=>index 85 00=>index 5

[0068] E4=>index 80 00=>index 5

[0069] EF=>index 85 00=>index 5

[0070] E7=>index 81 00=>index 5

[0071] D3=>index 55 00=>index 5

[0072] C1=>index 50 00=>index 5

[0073] BF=>index 55 00=>index 5

[0074] C8=>index 56 00=>index 5

[0075] Step S102: Replace the maximum index number with the value corresponding to the difference between the maximum index number and the minimum index number. For example, if there are 85 index numbers (DD, E4, EF, E7, D3, C1, BF, C8, ...) in file 1 and the minimum index number is 50, then 85-50=35.

[0076] Thus, the largest index number (85) is replaced by 35, and the index numbers are sorted in such a way that the smallest index number is 0.

[0077] This enables more disk space to be saved by storing smaller index numbers.

[0078] Step S103: Each 1-byte HEX value is replaced by its modified index number, and the storage is as follows:

[0079] DD=>35

[0080] 00=>5

[0081] E4=>30

[0082] 00=>5

[0083] EF=>35

[0084] 00=>5

[0085] E7=>31

[0086] 00=>5

[0087] D3=>20

[0088] 00=>5

[0089] C1=>15

[0090] 00=>5

[0091] BF=>20

[0092] 00=>5

[0093] C8=>21

[0094] 00=>5

[0095] The largest Index value in the first byte (DD, E4, EF, ...) is 35, which is a 6-digit number. The largest Index value in the second byte (00, 00, 00, 00, ...) is 5, which is a 3-digit number.

[0096] In this way, the first 1-byte HEX value can be saved in only 6 bits, and the second 1-byte HEX value can be saved in only 3 bits, which means that 16-bit data is saved in a data block of only 9 bits. This will automatically save about 45% of disk space, which means the compression ratio will be about 55%.

[0097] Now that the original data has been compressed, but its redundancy has not been significantly reduced, another compression algorithm (patents have been obtained / submitted) will be used to compress the file that still has a lot of redundancy. This method includes:

[0098] Ⅰ) Redundancy Generator

[0099] II) Probabilistic Predictor

[0100] III) Batch of data analyzers of the same type

[0101] Since the input file has been halved, it is possible to start the compression process using the three methods described above and achieve approximately 40% of the input data. This enables the creation of a compression ratio of approximately 20% over the original RAW image file.

[0102] Extra digits that are not considered to be an integer. For example, in step 8 of TDI, we have:

[0103] FE=>1.125% (index: 2)

[0104] Replace the probability number 1.125% with 1.1%. The remaining numbers (2 and 5) are lost.

[0105] This will allow no quality issues in the final image, since the probabilities of RIFs are always assigned to numbers, the corresponding values ​​of the binary data in the RIF will not be affected by the simplified number having only one digit to the right.

[0106] According to a data compression method provided in an embodiment of the present application, a binary compression method is used to provide a high-end compression ratio, which can not only ensure the accurate quality of the compressed original image file, but also provide a very low compression ratio. The original image file can be compressed to about 20% of the original file size without losing any visual quality after decompression.

[0107] like Figure 3 FIG. 1 is a flow chart of a data compression method provided in an embodiment of the present application, the method comprising the following steps:

[0108] S301. Obtain binary data of a second original image file.

[0109] S302. Extract the header of the second original image file.

[0110] S303. Save the binary data of the message body of the second original image file except the header as the two hexadecimal files.

[0111] S304. Save one byte of binary data of the second original image file as two hexadecimal files.

[0112] S305. Obtain the type of the hexadecimal value in each of the two hexadecimal files.

[0113] S306. Obtain the probability of each type of hexadecimal value appearing in the two hexadecimal files.

[0114] S307. According to the probability, assign a corresponding index number to each hexadecimal value in the two hexadecimal files.

[0115] S308. Save the second original image file as a third index number set and a fourth index number set.

[0116] S309. Train the plurality of second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

[0117] S310. According to the training data list, save one byte of hexadecimal data of the first original image file as a first index number set and a second index number set.

[0118] S311. Replace the second index number with a value corresponding to the difference between any second index number in the second index number set and the minimum index number in the second index number set.

[0119] S312. Save the first index number set and the replaced second index number set.

[0120] The existing trained data inventories (TDIs) that underlie this approach minimize the computational power of any new RAW image file.

[0121] The method includes the following algorithms:

[0122] I) Training data inventory (TDI)

[0123] II) Compression Engine

[0124] Method Description:

[0125] I) TDI

[0126] Introduction:

[0127] TDI is responsible for collecting analysis data obtained from thousands of RAW files, referred to here as RAW image files (RIFs).

[0128] The working of TDI is as follows:

[0129] Receive a single RIF.

[0130] Step S301: Read binary data of RIF. The binary data can be read as hexadecimal (HEX) equivalent data of the binary data.

[0131] Step S302: Extract the RIF header. The RIF header contains the metadata of the RIF, including camera and lens configuration information and various user-selected or camera-selected information. The file header is usually in the range of several kilobytes, which varies from file to file.

[0132] Save the extracted RIF header as a separate binary file.

[0133] Step S303: Divide the remaining binary data into two parts, each part represents one byte. Finally, two independent binary files are obtained, one consisting of single-byte data with odd indexes, and the other consisting of single-byte data with even indexes.

[0134] Step S304: This is achieved by storing the first, third, fifth, seventh, ... one byte of data in one binary file, and saving the second, fourth, sixth, eighth, tenth, ... one byte of data in another binary file.

[0135] Continue this step for all remaining bytes.

[0136] Example: Keep the HEX values ​​in a rectangular box in one file. The rest of the HEX values ​​in another file.

[0137] Step S305: Perform the following analysis on the two files respectively:

[0138] Determine how many types of values ​​there are for each file. For example, considering the hexadecimal values ​​of the file are displayed in rectangular boxes as shown, there are 5 types of hexadecimal values:

[0139] (00,01,02,03,04)

[0140] Selected data: 00,00 00 00,00,00,00,00,00,00 00,01,01,……,02,03,03, 04,...

[0141] Step S306: Generate probability lists of the following two files:

[0142] File 1: [ie 1.bin]

[0143] 00=>20%

[0144] 01=>12.5%

[0145] 02=>8%

[0146] 03=>5%

[0147] 04=>2%

[0148] …=>…%

[0149] A1=>3.5%

[0150] A2=>4.5%

[0151] A3=>5.5%

[0152] A4=>19%

[0153] A5=>0.5%

[0154] …=>…%

[0155] B1=>2%

[0156] B2=>3%

[0157] B3=>3.5%

[0158] B3=>4.5%

[0159] B4=>5.5%

[0160] B5=>11.5%

[0161] …=>…%

[0162] File 2: [ie.bin]

[0163] 00=>25%

[0164] 01=>5%

[0165] 02=>12.5%

[0166] 03=>20%

[0167] 04=>30%

[0168] 05=>1%

[0169] …=>…%

[0170] Considering that file 2 is the representation of the second 1-byte hexadecimal value (with Figure 4 The rectangle shown in the screenshot is highlighted), and strangely, the probability distribution between the HEX values ​​corresponding to this file does not show such a big difference, but only a collection of a few HEX values, unlike file 1, which has a large number of HEX values, each with a corresponding probability value.

[0171] Steps S307 and S308: Create a separate index file (.bin file) for each of the two files.

[0172] The index file contains each hexadecimal value and its corresponding index number.

[0173] Index numbers are assigned in the HEX values, from the highest number belonging to the HEX value with the highest probability to the HEX value with the lowest probability.

[0174] For example, if we consider that file 2 consists only of the HEX values ​​highlighted by the rectangle in the screenshot, the index file corresponding to file 2 is as follows:

[0175] File 2:

[0176] 00=>53.125% (index: 5)

[0177] 01=>40.625% (index: 4)

[0178] 02=>1.5625% (index: 2)

[0179] 03=>3.125% (index: 3)

[0180] 04=>1.5625% (index: 1)

[0181] Note: If two HEX values ​​(02 and 04 in this example) have equal probability, the software will randomly assign two consecutive index numbers between them.

[0182] Repeat steps S301 to S307 for the next RIF. By training TDI with more RAW image files, the accuracy of TDI will become higher and higher.

[0183] Step S309: Generate an overall analysis data (as a .bin file), which contains the sorting probabilities of all 1-byte HEX values.

[0184] The bin file should contain results similar to those generated in step 8, except that the index numbers are generated from a set of rifs, rather than a single RAW image file.

[0185] For example, analyzing 100,000 RAW files might return the following values:

[0186] (Index2.bin)

[0187] 00=>53.125% (index: 85)

[0188] ...=>...%(index:...)

[0189] FD=>1.5625% (index: 3)

[0190] FE=>1.125% (index: 2)

[0191] FF=>1.0625% (index: 1)

[0192] (II) Compression Engine

[0193] From the data collected from TDI, it is known how many of each 1-byte HEX value are typically available on average for the RIF.

[0194] This enables replacing a 1-byte hex value that would normally consume 8 bits of disk space with only the single digit number of the second 1-byte hex value and the double digit number of the first 1-byte hex value (this is a result of analyzing data collected by training the algorithm using thousands of raw image files).

[0195] Store the HEX value of a byte one by one into a new file, which is actually a compressed file (the output result of the compression process):

[0196] Step S310: Given Figure 4 The HEX value in the screenshot shown saves the HEX value of a byte as an index, or a one- and two-digit index number:

[0197] DD=>index 85 00=>index 5

[0198] E4=>index 80 00=>index 5

[0199] EF=>index 85 00=>index 5

[0200] E7=>index 81 00=>index 5

[0201] D3=>index 55 00=>index 5

[0202] C1=>index 50 00=>index 5

[0203] BF=>index 55 00=>index 5

[0204] C8=>index 56 00=>index 5

[0205] Step S311: Replace the maximum index number with the value corresponding to the difference between the maximum index number and the minimum index number. For example, if there are 85 index numbers (DD, E4, EF, E7, D3, C1, BF, C8, ...) in file 1 and the minimum index number is 50, then 85-50=35.

[0206] Thus, the largest index number (85) is replaced by 35, and the index numbers are sorted in such a way that the smallest index number is 0.

[0207] This enables more disk space to be saved by storing smaller index numbers.

[0208] Step S312: Each 1-byte HEX value is replaced by its modified index number, and the storage is as follows:

[0209] DD=>35

[0210] 00=>5

[0211] E4=>30

[0212] 00=>5

[0213] EF=>35

[0214] 00=>5

[0215] E7=>31

[0216] 00=>5

[0217] D3=>20

[0218] 00=>5

[0219] C1=>15

[0220] 00=>5

[0221] BF=>20

[0222] 00=>5

[0223] C8=>21

[0224] 00=>5

[0225] The largest Index value in the first byte (DD, E4, EF, ...) is 35, which is a 6-digit number. The largest Index value in the second byte (00, 00, 00, 00, ...) is 5, which is a 3-digit number.

[0226] In this way, the first 1-byte HEX value can be saved in only 6 bits, and the second 1-byte HEX value can be saved in only 3 bits, which means that 16-bit data is saved in a data block of only 9 bits. This will automatically save about 45% of disk space, which means the compression ratio will be about 55%.

[0227] Now that the original data has been compressed, but its redundancy has not been significantly reduced, another compression algorithm (patents have been obtained / submitted) will be used to compress the file that still has a lot of redundancy. This method includes:

[0228] Ⅰ) Redundancy Generator

[0229] II) Probabilistic Predictor

[0230] III) Batch of data analyzers of the same type

[0231] Since the input file has been halved, it is possible to start the compression process using the three methods described above and achieve approximately 40% of the input data. This enables the creation of a compression ratio of approximately 20% over the original RAW image file.

[0232] Extra digits that are not considered to be an integer. For example, in step 8 of TDI, we have:

[0233] FE=>1.125% (index: 2)

[0234] Replace the probability number 1.125% with 1.1%. The remaining numbers (2 and 5) are lost.

[0235] This will allow no quality issues in the final image, since the probabilities of RIFs are always assigned numbers, and the corresponding values ​​of the binary data in the RIF will not be affected by the simplified number having only one digit to the right.

[0236] According to a data compression method provided in an embodiment of the present application, a binary compression method is used to provide a high-end compression ratio, which can not only ensure the accurate quality of the compressed original image file, but also provide a very low compression ratio. The original image file can be compressed to about 20% of the original file size without losing any visual quality after decompression.

[0237] like Figure 5 FIG. 5 is a schematic diagram of a data compression device provided by the present application. The device 500 may include:

[0238] A first saving unit 501 is used to save one byte of hexadecimal data of the first original image file as a first index number set and a second index number set;

[0239] A replacement unit 502 is used to replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set;

[0240] The second storage unit 503 is used to store the first index number set and the replaced second index number set.

[0241] Optionally, the first index number in the first index number set is an index number of at least two digits, and the second index number in the second index number set is an index number of one digit.

[0242] Optionally, the device further includes (indicated by dotted lines in the figure):

[0243] A third saving unit 504 is used to save one byte of binary data of the second original image file into two hexadecimal files;

[0244] A first acquiring unit 505 is used to acquire the type of the hexadecimal value in each of the two hexadecimal files;

[0245] A second obtaining unit 506 is used to obtain the probability of each type of hexadecimal value appearing in the two hexadecimal files;

[0246] An allocating unit 507, configured to allocate a corresponding index number to each hexadecimal value in the two hexadecimal files according to the probability;

[0247] The fourth saving unit 508 is configured to save the second original image file as a third index number set and a fourth index number set.

[0248] Optionally, the device further includes (indicated by dotted lines in the figure):

[0249] A third acquiring unit 509 is used to acquire binary data of the second original image file;

[0250] An extraction unit 510, configured to extract a header of the second original image file;

[0251] The third saving unit 504 is used to save the binary data of the message body of the second original image file except the header as the two hexadecimal files.

[0252] Optionally, the device further includes (indicated by dotted lines in the figure):

[0253] The training unit 511 is used to train the plurality of second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

[0254] It should be noted that the above units or one or more of the units can be implemented by software, hardware or a combination of the two. When any of the above units or units is implemented by software, the software exists in the form of computer program instructions and is stored in a memory, and the processor can be used to execute the program instructions and implement the above method flow. The processor can be built into a system on chip (SoC) or ASIC, or it can be an independent semiconductor chip. In addition to the core used to execute software instructions for calculation or processing in the processor, it can also further include necessary hardware accelerators, such as field programmable gate arrays (FPGA), programmable logic devices (PLD), or logic circuits that implement dedicated logic operations.

[0255] When the above units or units are implemented in hardware, the hardware can be any one or any combination of a CPU, a microprocessor, a digital signal processing (DSP) chip, a microcontroller unit (MCU), an artificial intelligence processor, an ASIC, a SoC, an FPGA, a PLD, a dedicated digital circuit, a hardware accelerator or a non-integrated discrete device, which can run the necessary software or not rely on the software to execute the above method flow.

[0256] According to a data compression device provided in an embodiment of the present application, a binary compression method is used to provide a high-end compression ratio, which can not only ensure the accurate quality of the compressed original image file, but also provide a very low compression ratio. The original image file can be compressed to about 20% of the original file size without losing any visual quality after decompression.

[0257] like Figure 6 FIG. 6 is a schematic diagram of another data compression device provided by the present application. The device 600 may include:

[0258] An input device 61, an output device 62, a memory 63 and a processor 64 (the number of processors 64 in the device can be one or more, Figure 6 In some embodiments of the present application, the input device 61, the output device 62, the memory 63 and the processor 64 may be connected via a bus or other means, wherein: Figure 6 The example of connecting through bus is taken in the following.

[0259] The processor 64 is used to perform the following steps:

[0260] Saving one byte of hexadecimal data of the first original image file as a first index number set and a second index number set;

[0261] Replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set;

[0262] The first index number set and the replaced second index number set are saved.

[0263] Optionally, the first index number in the first index number set is an index number of at least two digits, and the second index number in the second index number set is an index number of one digit.

[0264] Optionally, the processor 64 is further configured to perform the following steps:

[0265] Saving one byte of binary data of the second original image file into two hexadecimal files;

[0266] Get the type of the hexadecimal value in each of the two hexadecimal files;

[0267] Get the probability of each type of hexadecimal value appearing in the two hexadecimal files;

[0268] According to the probability, assigning a corresponding index number to each hexadecimal value in the two hexadecimal files;

[0269] The second original image file is saved as a third index number set and a fourth index number set.

[0270] Optionally, the processor 64 is configured to perform the following steps:

[0271] Acquire binary data of the second original image file;

[0272] extracting a header of the second original image file;

[0273] The step of saving one byte of binary data of the second original image file into two hexadecimal files includes:

[0274] The binary data of the message body of the second original image file except the header is saved as the two hexadecimal files.

[0275] Optionally, the processor 64 is further configured to perform the following steps:

[0276] Training is performed on a plurality of the second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

[0277] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0278] According to a data compression device provided in an embodiment of the present application, a binary compression method is used to provide a high-end compression ratio, which can not only ensure the accurate quality of the compressed original medical image, but also provide a very low compression ratio. The medical image file can be compressed to about 6% of the original file size without losing any visual quality after decompression.

[0279] The method steps in the embodiments of the present application can be implemented by hardware, or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, and the software modules can be stored in a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, a register, a hard disk, a mobile hard disk, a CD-ROM, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a data compression device. Of course, the processor and the storage medium can also be present in the data compression device as discrete components.

[0280] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a base station, a user device or other programmable device. The computer program or instruction may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer program or instruction may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired or wireless means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium, for example, a floppy disk, a hard disk, a tape; it may also be an optical medium, for example, a digital video disc; it may also be a semiconductor medium, for example, a solid-state hard disk.

[0281] In the various embodiments of the present application, unless otherwise specified or provided for in any logical conflict, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.

[0282] It should be understood that in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; wherein A and B can be singular or plural. Also, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, wherein a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be necessarily different. Meanwhile, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0283] It is understood that the various numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.

Claims

1. A data compression method, characterized in that: The method comprises: The hexadecimal data of one byte of the first original image file is saved as a first index number set and a second index number set, specifically: binary data of the first original image file is read, a header of the binary data is extracted, and the remaining binary data is divided into two parts, each part represents one byte, one of the two parts is composed of single-byte data of odd indexes and the other is composed of single-byte data of even indexes, and the first index number set and the second index number set are determined according to the two parts; Replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set; The first index number set and the replaced second index number set are saved.

2. The method according to claim 1, characterized in that The first index number in the first index number set is at least a two-digit index number, and the second index number in the second index number set is a one-digit index number.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: Saving one byte of binary data of the second original image file into two hexadecimal files; Get the type of the hexadecimal value in each of the two hexadecimal files; Get the probability of each type of hexadecimal value appearing in the two hexadecimal files; According to the probability, assigning a corresponding index number to each hexadecimal value in the two hexadecimal files; The second original image file is saved as a third index number set and a fourth index number set.

4. The method according to claim 3, characterized in that The method further comprises: Acquire binary data of the second original image file; extracting a header of the second original image file; The step of saving one byte of binary data of the second original image file into two hexadecimal files includes: The binary data of the message body of the second original image file except the header is saved as the two hexadecimal files.

5. The method according to claim 3, characterized in that: The method further comprises: Training is performed on a plurality of the second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

6. A data compression device, characterized in that: The device comprises: A first saving unit is used to save one byte of hexadecimal data of the first original image file as a first index number set and a second index number set, specifically: reading binary data of the first original image file, extracting a header of the binary data, dividing the remaining binary data into two parts, each part representing one byte, one of the two parts is composed of single-byte data of odd indexes and the other is composed of single-byte data of even indexes, and determining the first index number set and the second index number set according to the two parts; a replacement unit, configured to replace the second index number with a value corresponding to a difference between any second index number in the second index number set and the minimum index number in the second index number set; The second storage unit is used to store the first index number set and the replaced second index number set.

7. The device according to claim 6, characterized in that The device also includes: A third saving unit, used for saving one byte of binary data of the second original image file into two hexadecimal files; A first acquiring unit, configured to acquire a type of a hexadecimal value in each of the two hexadecimal files; A second obtaining unit, used for obtaining the probability of each type of hexadecimal value appearing in the two hexadecimal files; an allocating unit, configured to allocate a corresponding index number to each hexadecimal value in the two hexadecimal files according to the probability; The fourth saving unit is used to save the second original image file as a third index number set and a fourth index number set.

8. The device according to claim 7, characterized in that The device also includes: The training unit is used to train the plurality of second original image files in the training data list to obtain the sorting probabilities of all 1-byte hexadecimal values.

9. A data compression device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Mass analysis data processing method and mass analysis data processing system

    CN102683149A

  • Multi-dimensional quantum data compressing and uncompressing method and apparatus

    CN104125475A

  • Data compression method and device, and storage medium

    CN114036323A

  • High-efficiency compression suitable for use in character generation

    US5644684A