Data compression method and apparatus, computer device, and storage medium

By classifying data streams and analyzing contextual information, combined with the use of predictors and hash tables, the problem that existing technologies can only handle redundant adjacent data is solved, achieving effective compression of non-adjacent data and improving Improve the efficiency of data storage and transmission.

WO2024222386A1PCT designated stage expired Publication Date: 2024-10-31HUAWEI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/084949
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-26
Filing Date
2024-03-29
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

Existing data compression technology can only eliminate redundancy between adjacent data, has low compression flexibility, and cannot effectively handle redundancy between non-adjacent data.

Method used

By classifying the data stream, using the context information of each type of data for compression, combining predictors and hash tables to mine the same data, classifying and compressing based on similarities, and using different compression methods to improve the compression rate.

Benefits of technology

It eliminates the redundancy between adjacent and non-adjacent data, improves the flexibility and efficiency of data compression, and improves the performance of data storage and transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024084949_31102024_PF_FP_ABST
    Figure CN2024084949_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application belong to the technical field of data storage, and disclose a data compression method and apparatus, a computer device, and a storage medium. The method comprises: acquiring a data stream to be compressed, the data stream comprising a plurality of pieces of data; determining a plurality of classes of data from the plurality of pieces of data on the basis of context information of each piece of data among the plurality of pieces of data, wherein each class of data among the plurality of classes of data comprises at least one piece of data among the plurality of pieces of data, and the context information of each piece of data indicates data before and / or after the corresponding data in the data stream; and compressing at least one class of data among the plurality of classes of data. According to the embodiments of the present application, data in a data stream can be classified so as to facilitate subsequent compression of each class of classified data, so that both the redundancy between adjacent data and the redundancy between non-adjacent data can be eliminated, and the compression flexibility is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Data compression method, device, computer equipment and storage medium

[0001] This application claims priority to Chinese patent application No. 202310475629.0, filed on April 26, 2023, entitled “Data compression method, device, computer equipment and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] The embodiments of the present application relate to the field of data storage technology, and in particular to a data compression method, apparatus, computer equipment, and storage medium. Background Art

[0003] With the development of internet technology, computers often need to store large amounts of numerical data. For example, an environmental monitoring system needs to store the temperature of a city at various points in time each day. To improve data storage efficiency, this data can be compressed and stored to save storage space.

[0004] In related technologies, for a data stream to be stored, the current data can be compressed based on the relationship between each data item and the adjacent previous data item to eliminate redundancy between adjacent data items. For example, the current data item can be subtracted from the adjacent previous data item, and the current data item can be compressed based on the subtraction result. This can eliminate redundancy between adjacent data items in the data stream.

[0005] However, the related technology can only eliminate redundancy between adjacent data, and the compression flexibility is low.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a data compression method, apparatus, computer device, and storage medium that can classify data and then compress each classified data. This eliminates redundancy not only between adjacent data but also between non-adjacent data, thereby improving compression flexibility. The technical solution is as follows:

[0008] In a first aspect, a data compression method is provided, in which a data stream to be compressed is obtained, the data stream including multiple data; based on context information of each data in the multiple data, multiple categories of data are determined from the multiple data, each category of data in the multiple categories of data includes at least one data from the multiple data, and the context information of each data indicates the data in the data stream that is located before and / or after the corresponding data; and at least one category of data in the multiple categories of data is compressed.

[0009] In an embodiment of the present application, the data in the data stream can be classified to facilitate subsequent compression of each type of classified data. This not only eliminates redundancy between adjacent data, but also eliminates redundancy between non-adjacent data, thereby improving compression flexibility.

[0010] Based on the method provided in the first aspect, in a possible implementation manner, based on the context information of each data in the multiple data, the implementation process of determining multiple categories of data from multiple data can be: determining at least one first data among the multiple data, the first data is data that does not appear for the first time in the data stream, and treating each first data as a category of identical data; classifying at least one second data among the multiple data except at least one first data according to similarity to obtain at least one category of similar data.

[0011] Considering that identical and similar data in a data stream may use different compression methods, in embodiments of the present application, data in the data stream can be classified and mined based on both identical and similar data. Furthermore, compressing identical data has a higher compression rate than compressing similar data. Therefore, by mining identical and similar data, the data compression rate can be further improved.

[0012] Based on the method provided in the first aspect, in a possible implementation manner, the implementation process of compressing at least one type of data in multiple types of data can be: for each first data, the recurrence rule of each first data is determined as the compressed data of the corresponding first data, and the recurrence rule indicates the association between the corresponding first data and the third data, and the third data is the data in the data stream that is located before the first data and is the same as the first data; for any type of similar data in at least one type of similar data, if any type of similar data includes multiple second data, then determine the compression algorithm corresponding to any type of similar data, compress any type of similar data according to the compression algorithm corresponding to any type of similar data, and obtain the compressed data corresponding to each second data in any type of similar data.

[0013] After performing identical data mining and similar data mining on the data stream, different compression methods can be used for identical data and similar data to improve the data compression rate.

[0014] Based on the method provided in the first aspect, in a possible implementation manner, the implementation process of determining at least one first data among multiple data can be: multiple data are sequentially input into each predictor of at least one predictor, and each predictor is used to predict the predicted value of the currently input data based on the data input before the current time; for the i-th data among the multiple data, if there is a difference between the predicted value output by the first predictor in at least one predictor and the i-th data is 0, then the i-th data is determined as a first data.

[0015] In the embodiment of the present application, the same data in the data stream can be mined through a predictor.

[0016] Based on the method provided in the first aspect, in a possible implementation manner, the implementation process of compressing at least one type of data among the multiple types of data may be: determining the identifier of the first predictor as the compressed data of the i-th data.

[0017] The identifier of the first predictor can be used to identify the prediction algorithm of the first predictor, and the i-th data can be subsequently recovered based on this prediction algorithm. Therefore, when the first data is mined using the first predictor, the recurrence pattern of the first data can be the identifier of the first predictor. In other words, the identifier of the first predictor is determined as the compressed data of the i-th data.

[0018] Based on the method provided in the first aspect, in a possible implementation, in this method, if the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, then data identical to the i-th data is searched from each hash table in at least one hash table; if there is a first hash table in at least one hash table that stores data identical to the i-th data, then the i-th data is determined as a first data.

[0019] In the implementation of this application, the same data can be mined by using a predictor and a hash table at the same time to fully mine the same data in the data stream.

[0020] Based on the method provided in the first aspect, in one possible implementation, the implementation process of compressing at least one type of data among multiple types of data can be: determining the identifier of the first hash table and the hash value of the i-th data in the first hash table as the compressed data of the i-th data.

[0021] The identifier of the first hash table can be used to identify the specific hash table. Based on the hash value of the i-th data in the first hash table, the i-th data can be subsequently recovered. Therefore, when the first data is mined through the first hash table, the recurrence rule of the first data can be the identifier of the first hash table and the hash value corresponding to the first data in the first hash table. In other words, the identifier of the first hash table and the hash value of the i-th data in the first hash table are determined as the compressed data of the i-th data.

[0022] Based on the method provided in the first aspect, in a possible implementation, in this method, if the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, then at least one predictor is updated, and the difference between the predicted value output by the second predictor and the i-th data in the at least one updated predictor is 0.

[0023] When the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, at least one predictor can also be updated so that when data identical to the i-th data appears subsequently, the repeated data can be mined based on the updated at least one predictor.

[0024] Based on the method provided in the first aspect, in a possible implementation, in this method, if there is no data identical to the i-th data in at least one hash table, at least one hash table is updated, and the at least one updated hash table contains data identical to the i-th data stored in the second hash table.

[0025] If no data identical to the i-th data is stored in at least one hash table, it indicates that the current predictor and hash table have not mined out the data identical to the i-th data. At this time, at least one hash table can also be updated so that when data identical to the i-th data appears subsequently, the repeated data can be mined based on the at least one updated hash table.

[0026] Based on the method provided in the first aspect, in a possible implementation, in this method, if there is no data identical to the i-th data in at least one hash table, marking information of the i-th data is generated, and the marking information indicates that the i-th data is a second data.

[0027] If at least one hash table does not store data identical to the i-th data, it indicates that neither the current predictor nor the hash table has mined data identical to the i-th data. In this case, tag information for the i-th data can be generated, indicating that the i-th data is a second data. This facilitates subsequent classification of the remaining second data based on similarity.

[0028] Based on the method provided in the first aspect, in a possible implementation manner, for any one type of similar data in at least one type of similar data, a distance between any two data in any one type of similar data is less than a reference distance.

[0029] For the plurality of second data, the plurality of second data may be classified according to the distances between different second data.

[0030] In a second aspect, a data compression device is provided, wherein the data compression device has the function of implementing the data compression method of the first aspect. The data compression device includes at least one module, and the at least one module is used to implement the data compression method provided by the first aspect.

[0031] In a third aspect, a computer device is provided, comprising a processor and a memory, wherein the memory is configured to store a program that supports the computer device in executing the data compression method provided in the first aspect, and to store data used to implement the data compression method provided in the first aspect. The processor is configured to execute the program stored in the memory. The operating device of the storage device may further include a communication bus configured to establish a connection between the processor and the memory.

[0032] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes the data compression method described in the first aspect.

[0033] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the data compression method described in the first aspect.

[0034] The technical effects obtained in the above-mentioned second, third, fourth and fifth aspects are similar to those obtained by the corresponding technical means in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] FIG1 is a flowchart of a compression algorithm for numerical data provided by an embodiment of the present application;

[0036] FIG2 is a flowchart of another compression algorithm for numerical data provided by an embodiment of the present application;

[0037] FIG3 is a schematic diagram of the architecture of a data storage system provided in an embodiment of the present application;

[0038] FIG4 is a schematic diagram of a scenario of data storage provided by an embodiment of the present application;

[0039] FIG5 is a schematic diagram of a computing node communication scenario provided by an embodiment of the present application;

[0040] FIG6 is a flow chart of a data compression method provided in an embodiment of the present application;

[0041] FIG7 is a schematic diagram of a process for mining identical data provided by an embodiment of the present application;

[0042] FIG8 is a schematic diagram of updating data in a hash table according to an aging value provided by an embodiment of the present application;

[0043] FIG9 is a schematic diagram of updating an aging value provided in an embodiment of the present application;

[0044] FIG10 is a schematic diagram showing a floating-point value 0.152625 in binary format provided by an embodiment of the present application;

[0045] FIG11 is a schematic diagram of obtaining similar data provided in an embodiment of the present application;

[0046] FIG12 is a flowchart of a method for compressing data provided by an embodiment of the present application;

[0047] FIG13 is a flowchart of another method for compressing data provided by an embodiment of the present application;

[0048] FIG14 is a schematic structural diagram of a data compression device provided in an embodiment of the present application;

[0049] FIG15 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0051] It should be understood that the "plurality" mentioned herein refers to two or more. In the description of this application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. 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, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.

[0052] Before explaining the embodiments of the present application in detail, the application scenarios of the embodiments of the present application are first introduced.

[0053] Numerical data exists in large quantities in scenarios such as scientific computing and artificial intelligence, which puts enormous pressure on data storage and data transmission. Therefore, how to compress numerical data is a hot topic in current research.

[0054] Because numerical data often has many digits and is often noisy, compression algorithms based on contextual matching often struggle with this type of high-entropy data. Furthermore, while lossy compression techniques can remove low-order noise in numerical data, data owners often cannot afford to invest heavily in lossy data. Data owners often need to control the lossy steps themselves. Therefore, in the storage field, lossless compression techniques are a popular area of ​​research.

[0055] Numerical data, due to its generation process, often exhibits temporal continuity or localized spatial continuity, manifesting as minimal fluctuations between adjacent data points. Based on this characteristic, compression algorithms can be designed to eliminate redundancy between adjacent data points.

[0056] Figure 1 is a flow chart of a compression algorithm for numerical data provided by an embodiment of the present application. As shown in Figure 1, the compression algorithm includes the following steps.

[0057] 1. Prediction: Use the previous value adjacent to the current value as the predicted value of the current value.

[0058] 2. Make the difference: current value - predicted value, and the difference is used as the residual of the current value.

[0059] 3. Residual coding: Encode the residual of the current value to obtain the residual coding of the current value. Examples of encoding methods include positive-negative number conversion or multi-plane conversion.

[0060] 4. Compression: Record the highest bit of each residual code and remove the leading 0s to achieve compression.

[0061] The compression algorithm shown in FIG1 is described below using FIG2 as an example.

[0062] As shown in Figure 2, assume that the data stream to be compressed includes the following four rows of data: (5, 2, 104), (10, 2, 103), (15, 2, 102), and (20, 2, 101). Each row of data includes three values ​​in the X, Y, and Z dimensions. In addition, as shown in Figure 2, the previous row of data adjacent to (5, 2, 104) is (-3, 2, 104).

[0063] As shown in Figure 2, we first predict and subtract each value in each row of data to obtain the corresponding residual. For example, for the value 5 in the first row of data, we subtract the value 5 from the value -3 in the previous row of data to obtain a residual of 8. Similarly, we obtain the residual for each value in the four rows of data.

[0064] The residual of each value is then encoded by multiplying positive numbers by 2 and negative numbers by 2+1, and then taking the absolute value. For example, if the residual of the value 5 is 8, the value 16 after 8*2 is encoded as the residual of the value 5.

[0065] After obtaining the residual code of each value, the residual code of each value is expressed in binary form. Compress the three dimensions X, Y and Z respectively. Take the compression of the X dimension as an example. As shown in Figure 2, the residual codes of the four values ​​of the X dimension are expressed as 00010000, 00001010, 00001010 and 00001010 respectively. The highest bit of the four binary residual codes is 5, so the highest bit 5 is recorded (recorded as 101 in binary mode). The first three bits of the four binary residual codes are removed, and the compressed data is: 101 (for recording the highest bit), 10000 / 01010 / 01010 / 01010. Other dimensions can refer to this process.

[0066] The above compression algorithm eliminates redundancy between adjacent data by prediction and subtraction, and cannot handle redundancy between periodic or similar distance values, so the compression flexibility is very low.

[0067] Based on this, an embodiment of the present application provides a method for compressing data, which can classify data and then compress each type of classified data. This not only eliminates redundancy between adjacent data, but also eliminates redundancy between non-adjacent data, thereby improving compression flexibility.

[0068] The data storage system, data compression method and related devices provided in the embodiments of the present application are explained in detail below.

[0069] Figure 3 is a schematic diagram of the architecture of a data storage system provided in an embodiment of the present application. As shown in Figure 3, the data storage system includes a computer device 100, which is configured to receive a data stream to be compressed, compress each data element in the data stream based on the data compression method provided in an embodiment of the present application, obtain compressed data for each data element in the data stream, and store the compressed data for each data element. Specifically, the data stream is classified and each category of data is compressed.

[0070] The data compression method provided in the embodiments of the present application can be applied to scenarios where data is stored on disk, to scenarios where computing nodes communicate, and optionally, to other scenarios where batch data needs to be stored. The following uses these two scenarios as examples for illustration.

[0071] Figure 4 is a schematic diagram of a data storage scenario provided by an embodiment of the present application. As shown in Figure 4, the data storage system includes a computing cluster, a cache cluster, and a storage cluster. The computing cluster includes multiple computing nodes, the cache cluster includes multiple cache nodes, and the storage cluster includes multiple storage nodes. Each computing node can communicate with one or more cache nodes, and each cache node can communicate with one or more storage nodes.

[0072] After receiving data, an application (APP) on any computing node in the computing cluster sends the data to one or more cache nodes in the cache cluster. The cache cluster is used to cache the received data, that is, to store the received data in the write cache. On the other hand, it is used to compress the data in the write cache using the data compression method provided in the embodiments of the present application and write the compressed data to one or more storage nodes in the storage cluster, thereby completing the data storage operation.

[0073] The storage node may be, for example, a storage device such as a traditional hard disk drive (HDD) or a solid state drive (SDD).

[0074] In the scenario shown in FIG4 , the computer device shown in FIG3 may be a cache node in a cache cluster.

[0075] Figure 5 is a schematic diagram of a computing node communication scenario provided by an embodiment of the present application. As shown in Figure 5, the data storage system includes a computing cluster and a cache cluster. The computing cluster includes multiple computing nodes, such as computing node 1 and computing node 2 in Figure 5, and the cache cluster includes multiple cache nodes. Each computing node can communicate with one or more cache nodes.

[0076] As shown in Figure 5, after obtaining data, compute node 1 caches the data in the write cache of a cache node in the cache cluster. The cache node compresses the data in the write cache using the method provided in the embodiment of the present application. Compute node 2 can decompress the compressed data stored in the write cache of the cache node to obtain the data of compute node 1, thereby completing the communication between compute node 1 and compute node 2.

[0077] In the scenario shown in FIG5 , the computer device shown in FIG3 may be a cache node in a cache cluster.

[0078] Figure 6 is a flow chart of a data compression method provided by an embodiment of the present application. As shown in Figure 6, the method includes the following steps.

[0079] Step 601: Obtain a data stream to be compressed, where the data stream includes multiple data.

[0080] The data stream to be compressed can be understood as a plurality of data arranged in sequence. The embodiment of the present application does not limit the ordering method of each data in the data stream.

[0081] In addition, the data in the data stream may be numerical data or other types of data, such as character data. That is, the compression method provided in the embodiment of the present application can be adapted to any type of data.

[0082] In addition, the length of the data in the data stream is a reference length to facilitate subsequent compression. That is, the method provided in the embodiment of the present application can be applied to scenarios where the length of the data in the data stream is fixed.

[0083] Step 602: Based on the context information of each data in the multiple data, determine multiple categories of data from the multiple data, each category of data in the multiple categories of data includes at least one data in the multiple data, and the context information of each data indicates the data before and / or after the corresponding data in the data stream.

[0084] In an embodiment of the present application, the data in the data stream can be classified so that each type of classified data can be compressed based on step 603. This not only eliminates redundancy between adjacent data, but also eliminates redundancy between non-adjacent data, thereby improving compression flexibility.

[0085] Considering that the compression methods used for the same data and similar data in the data stream may be different, in the embodiment of the present application, the data in the data stream can be classified and mined from two dimensions: the same and the similar.

[0086] Moreover, the compression rate of compressing the same data is higher than that of compressing similar data. Therefore, the compression rate of data can be further improved by mining the same data and similar data.

[0087] Based on this, in some embodiments, step 602 can be implemented through the following two steps.

[0088] Step 1: Mining of the same data.

[0089] In this scenario, based on the context information of each data in the multiple data, the implementation method of determining multiple categories of data from multiple data can be: determining at least one first data among the multiple data, the first data is data that does not appear for the first time in the data stream, and treating each first data as a category of the same data.

[0090] Step 2: Mining similar data.

[0091] In this scenario, based on the context information of each data in the multiple data, the implementation method of determining multiple categories of data from the multiple data can be: classifying at least one second data in the multiple data except at least one first data according to similarity to obtain at least one category of similar data.

[0092] That is, in the embodiment of the present application, repeated data is first searched from the data stream to mine the same data in the data stream, and then the remaining data in the data stream is classified according to similarity to mine similar data in the data stream.

[0093] The following first describes how to implement step 1.

[0094] Among them, the implementation method of determining at least one first data among multiple data can be: inputting multiple data into each predictor in at least one predictor in sequence, and each predictor is used to predict the predicted value of the currently input data based on the data input before the current time; for the i-th data among the multiple data, if there is a difference between the predicted value output by the first predictor in at least one predictor and the i-th data is 0, then the i-th data is determined as a first data.

[0095] That is, in the embodiment of the present application, the same data in the data stream can be mined through the predictor.

[0096] The predictor is configured to predict a predicted value of currently input data based on data input before the current time. For example, the predictor may have a corresponding prediction algorithm. For any data input at the current time (referred to as the current data), the predictor may determine, based on the prediction algorithm, a data from the data input before the current time as the predicted value of the current data.

[0097] For example, the prediction algorithm may use the last data from the data input before the current time as the predicted value of the current data. Alternatively, the prediction algorithm may use the tenth last data from the data input before the current time as the predicted value of the current data.

[0098] Thus, for the current data input to the predictor at the current time, if the difference between the predicted value output by the predictor and the current data is 0, it indicates that the current data is the same as a previously input data, that is, the current data is not the first appearing data.

[0099] In addition, different predictors in at least one predictor correspond to different prediction algorithms, thereby enabling mining of the same data from multiple dimensions rather than just mining adjacent identical data.

[0100] In addition, after the i-th data is input into each predictor in at least one predictor, if the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, it indicates that no data identical to the i-th data is mined through the predictor. At this time, in order to avoid possible errors in the predictor, data identical to the i-th data can be further searched from each hash table in at least one hash table; if there is data identical to the i-th data stored in the first hash table in at least one hash table, the i-th data is determined as a first data.

[0101] That is, in the implementation of this application, the same data can be mined using both the predictor and the hash table simultaneously to fully mine the same data in the data stream. Alternatively, in the embodiments of this application, the same data can be mined using only the predictor or the hash table. The subsequent embodiments will be explained using the example of using both the predictor and the hash table to mine the same data.

[0102] Among them, for any hash table in at least one hash table, the hash table corresponds to a hash algorithm, and the hash value calculated by the hash algorithm corresponding to the hash table indicates a storage location in the hash table. For example, it can indicate the row of the hash table, and the storage location is used to store data corresponding to the hash value.

[0103] Based on this, searching for data identical to the i-th data in each of the at least one hash table can be implemented by calculating a hash value of the i-th data in each of the at least one hash table based on the hash algorithm corresponding to the hash table, and then searching the hash table for the data corresponding to the hash value. If the data found is identical to the i-th data, it is determined that the hash table stores data identical to the i-th data. This indicates that the i-th data is identical to the data input before the current time, thereby achieving mining of identical data.

[0104] In addition, different hash tables in at least one hash table correspond to different hash algorithms, thereby enabling mining of the same data in various dimensions to avoid insufficient mining of the same data.

[0105] In addition, when the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, at least one predictor can also be updated so that when data identical to the i-th data appears subsequently, the repeated data can be mined based on the updated at least one predictor.

[0106] That is, when the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, at least one predictor is updated, and the difference between the predicted value output by the second predictor and the i-th data in the at least one updated predictor is 0.

[0107] For example, updating at least one predictor may be implemented by updating the prediction algorithm of a predictor in at least one predictor, so that if the j-th data is subsequently received and the j-th data is the same as the i-th data, the predictor can be used to determine that the j-th data is repeated data.

[0108] In addition, if no data identical to the i-th data is stored in at least one hash table, it indicates that the current predictor and hash table have not mined out the data identical to the i-th data. At this time, at least one hash table can also be updated so that when data identical to the i-th data appears subsequently, the repeated data can be mined based on the at least one updated hash table.

[0109] That is, when the at least one hash table does not store data identical to the i-th data, the at least one hash table is updated, and the at least one updated hash table stores data identical to the i-th data in the second hash table.

[0110] For example, updating the at least one hash table may be implemented as follows: for any hash table in the at least one hash table, if no data is stored at a storage location indicated by a hash value corresponding to the i-th data in the hash table, then the i-th data is stored at the storage location indicated by the hash value in the hash table. In this way, if the j-th data is subsequently received and the j-th data is the same as the i-th data, the hash table can be used to determine that the j-th data is a repeated data.

[0111] In addition, if at least one hash table does not store data identical to the i-th data, it indicates that neither the current predictor nor the hash table has mined data identical to the i-th data. In this case, tag information for the i-th data can also be generated, indicating that the i-th data is a second data, so as to facilitate subsequent classification of the remaining second data according to similarity.

[0112] FIG7 is a schematic diagram of a process of mining identical data provided by an embodiment of the present application.

[0113] As shown in Figure 7, assuming the data in the data stream is binary data, for the currently processed data x, multiple predictors are first used to determine whether the data x is identical to the previously input data. As shown in Figure 7, predictor 1, predictor 2, and predictor 3 can each determine whether the data x is identical to the previously input data.

[0114] If it is determined by any predictor among predictor 1, predictor 2, and predictor 3 that the data x is the same as previously input data, the identifier of the predictor may be recorded for subsequent storage and use.

[0115] If the three predictors do not determine that the data x is the same as the data x, multiple hash tables can be used to determine whether the data x is the same as the previously input data. As shown in Figure 7, hash tables 1, 2, and 3 can be used to determine whether the data x is the same as the previously input data.

[0116] If the data x is determined to be the same as the previously input data through one of the hash tables 1, 2, and 3, the identifier of the hash table and the hash value corresponding to the data x in the hash table can be recorded for subsequent storage and use. In addition, in this case, multiple predictors can also be updated.

[0117] If no data identical to the data x is determined through these three hash tables, multiple predictors and multiple hash tables are updated, and marking information of the data x is generated to indicate that the data x is the first data to appear in the data stream, so as to facilitate the subsequent classification of the first-appearing data according to similarity.

[0118] By executing the process shown in FIG7 for each data in the data stream, it is possible to mine the same data for all the data in the data stream.

[0119] In addition, for any of the above hash tables, a corresponding aging value may also be stored at the storage location indicated by each hash value in the hash table. The aging value is used to indicate the validity of the data corresponding to the corresponding hash value. For example, if the data corresponding to the hash value has not appeared for a long time, the aging value corresponding to the hash value is smaller.

[0120] In this case, for the i-th data, if a hash table stores data corresponding to the hash value of the i-th data, and the data corresponding to the hash value stored in the hash table is different from the i-th data, it can also be determined whether to update the data corresponding to the hash value in the hash table based on the aging value corresponding to the hash value.

[0121] For example, if the aging value is less than the aging value threshold, indicating that the validity of the data corresponding to the hash value is very low, the i-th data can be updated to the storage location indicated by the hash value in the hash table, that is, the data corresponding to the hash value in the hash table is updated to the i-th data. Correspondingly, if the aging value is not less than the aging value threshold, indicating that the validity of the data corresponding to the hash value is still relatively high, there is no need to update the data corresponding to the hash value in the hash table.

[0122] The purpose of setting the aging value is: taking into account the situation that different data may correspond to the same hash value in the hash algorithm, if under the hash algorithm of a certain hash table, the hash value corresponding to the i-th data has already stored data in the hash table, then the i-th data may be different from the data corresponding to the hash value in the hash table. Therefore, the aging value can be set to determine whether the data corresponding to the hash value needs to be updated.

[0123] Figure 8 is a schematic diagram of an embodiment of the present application for updating data in a hash table according to an aging value. As shown in Figure 8, assuming that the i-th data is the current value shown in Figure 8, the hash value k=0x41 of the current value is calculated by a hash algorithm corresponding to a certain hash table, where 0x indicates that the following value is a hexadecimal value. Looking up the hash table shows that the data stored at the storage location indicated by the hash value k=0x41 in the hash table is 0x41520100, which is different from the i-th data 0x41523c7a. This situation can be called a hash collision. At this time, it can be judged whether the data corresponding to the hash value k=0x41 in the hash table needs to be updated based on the aging value corresponding to the hash value k=0x41 in the hash table.

[0124] Furthermore, the aging value of hash values ​​in a hash table can be updated in two ways. One is to update at a fixed interval, for example, by decreasing the aging value every once in a while. The other is to update based on a fixed number of hits, for example, by increasing the aging value each time the data corresponding to the hash value matches the i-th data currently being processed. The aging value adjustment rules in these two scenarios can differ, and within the same scenario, the aging value can be adjusted by different amounts each time.

[0125] FIG9 is a schematic diagram of an aging value update method provided by an embodiment of the present application. As shown in FIG9 , a hash table stores data corresponding to each hash value and an aging value corresponding to the hash value, with each hash value indicating a storage location in the hash table. As shown in FIG9 , for any aging value corresponding to a hash value, the aging value corresponding to the hash value can be reduced by a certain coefficient at fixed intervals until the aging value is less than a preset value. At this time, if the hash value of the i-th data is the same as the hash value, the data corresponding to the hash value can be updated to the i-th data.

[0126] After mining the same data in the data stream in step 1, similar data mining can be continued for the remaining data (ie, the second data) in step 2. The implementation of step 2 is described below.

[0127] In some embodiments, the plurality of second data may be classified according to the distances between different second data, so that for any of the at least one category of similar data after classification, the distance between any two data in any category of similar data is less than the reference distance.

[0128] The distance between any two data can be Euclidean distance, Hamming distance, Manhattan distance, Chebyshev distance, etc.

[0129] For example, the plurality of second data may be classified by means of weak hashing.

[0130] For example, corresponding to multiple second data, second data with the same low-order bits can be regarded as a type of similar data, or second data with the same high-order bits can be regarded as a type of similar data, or second data with the same middle-order bits can be regarded as a type of similar data.

[0131] For numerical data, the low-order bits are often chaotic, while the high-order bits follow a certain pattern, and generally the sign and exponent bits do not fluctuate significantly. Therefore, for numerical data, second data with the same low-order bits can be defined as a class of similar data, which can reduce residual entropy in subsequent predictions.

[0132] Figure 10 is a schematic diagram of a floating-point value 0.152625 in binary format provided by an embodiment of the present application. As shown in Figure 10, the first bit from high to low represents a sign, the second to ninth bits represent an exponent, and the tenth bit value, the 32nd bit, represents a fraction. As can be seen from Figure 10, the sign and exponent part occupy the high bits, and the bits they occupy are relatively few, so the range of variation is small, but the fraction part occupies the low bits, and the bits they occupy are relatively many, so the range of variation is large. Based on this, it can be considered to classify the data according to whether the low bits are the same.

[0133] Figure 11 is a schematic diagram of obtaining similar data provided by an embodiment of the present application. Each data shown in Figure 11 is a hexadecimal representation of a floating point value, and some data in Figure 11 only shows the low-order portion of the data, and the high-order portion of the data is not shown in Figure 11.

[0134] As shown in Figure 11, the data with the same low-order bits (the last and the second-to-last bits) are considered as one type of similar data, resulting in four types of data. One type includes two data with the low-order bit being 14, one type includes two data with the low-order bit being 16, one type includes two data with the low-order bit being 17, and one type includes two data with the low-order bit being 18.

[0135] In addition, in the embodiment of the present application, there can be multiple ways of weak hashing, and the embodiment of the present application will not be illustrated one by one here.

[0136] Optionally, the plurality of second data may be classified by clustering, which may be K-means clustering or other clustering methods.

[0137] The above description uses the example of first mining identical data in a data stream and then mining similar data. Alternatively, in embodiments of the present application, the data stream can also be directly classified. In this scenario, each identical data item can also be classified into the same category. However, this approach is not as efficient as mining identical data using a predictor and hash table.

[0138] Step 603: compress at least one type of data among the multiple types of data.

[0139] The following explains step 603 by taking step 602 as an example in which identical data mining is first performed on the data stream and then similar data mining is performed.

[0140] In step 1 of step 602, after obtaining each first data, for each first data, the recurrence rule of each first data is determined as the compressed data of the corresponding first data, and the recurrence rule indicates the association between the corresponding first data and the third data, and the third data is the data in the data stream that is located before the first data and is the same as the first data.

[0141] For example, when the first data is obtained by predictor mining, the recurrence rule of the first data may be the identifier of the predictor. That is, in step 1 of step 602, the identifier of the first predictor is determined as the compressed data of the i-th data.

[0142] The prediction algorithm of the first predictor can be made clear through the identifier of the first predictor, and the i-th data can be subsequently restored based on the prediction algorithm.

[0143] For another example, when the first data is obtained through hash table mining, the recurrence rule of the first data may be the hash table identifier and the hash value corresponding to the first data in the hash table. That is, in step 1 of step 602, the identifier of the first hash table and the hash value of the i-th data in the first hash table are determined as the compressed data of the i-th data.

[0144] The identifier of the first hash table can be used to identify the specific hash table, and the i-th data can be subsequently restored based on the hash value of the i-th data in the first hash table.

[0145] In step 2 of step 602, after obtaining at least one type of similar data, for any type of similar data in the at least one type of similar data, if the type of similar data includes multiple second data, the compression algorithm corresponding to the type of similar data is determined, and the type of similar data is compressed according to the compression algorithm corresponding to the type of similar data to obtain compressed data corresponding to each second data in the type of similar data.

[0146] In addition, after obtaining the compressed data corresponding to each second data in this type of similar data, it is necessary to store the identifier of the similar data class to which the second data belongs while storing the compressed data, so that during subsequent decompression, the corresponding compression algorithm can be obtained according to the identifier of the similar data class, and then the second data can be restored based on the compression algorithm and the compressed data.

[0147] Correspondingly, if the similar data includes a second data, the second data may be directly stored.

[0148] The compression algorithm corresponding to the similar data can be any conventional compression algorithm, for example, the compression algorithm shown in FIG1 . The compression algorithms corresponding to different types of similar data can be different or the same.

[0149] For example, for a class of similar data including multiple second data, the type of the similar data can be determined using a floating degree or entropy information, such as an integer or a decimal type, and then a compression algorithm that matches the type of the similar data can be selected from multiple compression algorithms. The specific implementation will not be described in detail here.

[0150] To sum up, in an embodiment of the present application, the data in the data stream can be classified so that each type of classified data can be compressed based on step 603. This not only eliminates the redundancy between adjacent data, but also eliminates the redundancy between non-adjacent data, thereby improving compression flexibility.

[0151] Furthermore, you can first search for repeated data in the data stream to mine identical data in the data stream. Then, you can classify the remaining data in the data stream based on similarity to mine similar data in the data stream. This completes the classification of the data in the data stream.

[0152] Figure 12 is a flowchart of a data compression method provided by an embodiment of the present application. As shown in Figure 12, for a data stream including numerical data, identical data can be mined using context information, and similar data can then be mined using context information. For any similar data being mined, compression can be achieved using the classic compression process.

[0153] The process shown in FIG. 12 is explained by taking FIG. 13 as an example.

[0154] As shown in Figure 13, assume that the data stream includes the data 1.123, 1.124, 10.398, 1.123, 1.134, 1.144, and 10.409. After identical data mining, the fourth data 1.123 is found to be repeated. Therefore, the identifier of the predictor that mined the fourth data as identical data, or the identifier of the hash table and the hash value, can be directly stored. For ease of explanation, the identifier of the predictor that mined the fourth data as identical data, or the identifier of the hash table and the hash value, are referred to as entry identification (ID).

[0155] Similarity mining is then performed on the remaining six data points. As shown in Figure 13, two categories of similar data are obtained. One category includes 1.123 in the first row, 1.24 in the second row, 1.134 in the fifth row, and 1.144 in the sixth row. This category is referred to as category ID1. The other category includes 10.398 in the third row and 10.409 in the second row. This category is referred to as category ID2. For each category of data, the category ID is recorded and compressed using a traditional compression algorithm. Traditional compression algorithms can include operations such as prediction, residual, change, and encoding.

[0156] Figure 14 is a schematic diagram of the structure of a data compression device provided in an embodiment of the present application. As shown in Figure 14, the device includes the following modules.

[0157] The acquisition module 1401 is used to acquire a data stream to be compressed, where the data stream includes multiple data. For specific implementation, please refer to step 601 in the embodiment of FIG6 .

[0158] Determination module 1402 is configured to determine multiple categories of data from the multiple data based on context information of each data item in the multiple data items, where each category of data in the multiple categories of data includes at least one data item from the multiple data items, and the context information of each data item indicates data that precedes and / or follows the corresponding data item in the data stream. For specific implementation, see step 602 in the embodiment of FIG. 6 .

[0159] The compression module 1403 is used to compress at least one type of data among the multiple types of data. For specific implementation, please refer to step 603 in the embodiment of FIG6 .

[0160] Optionally, the determining module 1402 includes:

[0161] a determination submodule, configured to determine at least one first data among the plurality of data, where the first data is data that does not appear for the first time in the data stream, and each first data is regarded as a type of identical data;

[0162] The classification submodule is used to classify at least one second data except the at least one first data among the multiple data according to similarity to obtain at least one category of similar data.

[0163] Optionally, the compression module 1403 is configured to:

[0164] For each first data, determining a recurrence rule of each first data as compressed data of the corresponding first data, the recurrence rule indicating an association between the corresponding first data and third data, where the third data is data that precedes the first data in the data stream and is identical to the first data;

[0165] For any class of similar data in at least one class of similar data, if any class of similar data includes multiple second data, determine the compression algorithm corresponding to any class of similar data, compress any class of similar data according to the compression algorithm corresponding to any class of similar data, and obtain compressed data corresponding to each second data in any class of similar data.

[0166] Optionally, determine the submodule for:

[0167] sequentially inputting a plurality of data into each predictor of at least one predictor, each predictor being configured to predict a predicted value of currently input data based on data input before the current time;

[0168] For an i-th data among the plurality of data, if a difference between a predicted value output by a first predictor in at least one predictor and the i-th data is 0, the i-th data is determined as a first data.

[0169] Optionally, the compression module is used to:

[0170] The identification of the first predictor is determined as the compressed data of the i-th data.

[0171] Optionally, the determination submodule is further configured to:

[0172] If the difference between the predicted value output by each predictor in the at least one predictor and the i-th data is not 0, searching for data identical to the i-th data in each hash table of the at least one hash table;

[0173] If there is data in the first hash table in at least one hash table that is identical to the i-th data, the i-th data is determined as the first data.

[0174] Optionally, the compression module is used to:

[0175] The identifier of the first hash table and the hash value of the i-th data in the first hash table are determined as compressed data of the i-th data.

[0176] Optionally, the device further comprises:

[0177] The first updating module is used to update at least one predictor if the difference between the predicted value output by each predictor in at least one predictor and the i-th data is not 0, so that the difference between the predicted value output by the second predictor and the i-th data in the at least one updated predictor is 0.

[0178] Optionally, the device further comprises:

[0179] The second updating module is configured to update at least one hash table if data identical to the i-th data does not exist in at least one hash table, and the at least one updated hash table stores data identical to the i-th data in the second hash table.

[0180] Optionally, the device further comprises:

[0181] The generating module is configured to generate marking information of the i-th data if no data identical to the i-th data exists in at least one hash table, wherein the marking information indicates that the i-th data is a second data.

[0182] Optionally, for any one type of similar data in the at least one type of similar data, a distance between any two data in any one type of similar data is less than a reference distance.

[0183] In an embodiment of the present application, the data in the data stream can be classified to facilitate subsequent compression of each type of classified data. This not only eliminates redundancy between adjacent data, but also eliminates redundancy between non-adjacent data, thereby improving compression flexibility.

[0184] It should be noted that the data compression device provided in the above embodiment is merely an example of the division of the functional modules described above when compressing data. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data compression device provided in the above embodiment and the data compression method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0185] FIG15 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Any of the devices for compressing data in the aforementioned embodiments can be implemented using the computer device shown in FIG15 . Referring to FIG15 , the computer device includes a processor 1501 , a communication bus 1502 , a memory 1503 , and at least one communication interface 1504 .

[0186] The processor 1501 may be a general-purpose central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0187] The communication bus 1502 is used to transmit information between the above components.

[0188] The memory 1503 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 1503 may exist independently and be connected to the processor 1501 via the communication bus 1502. The memory 1503 may also be integrated with the processor 1501.

[0189] Memory 1503 is used to store program code for executing the solution of the present application, and is controlled by processor 1501 for execution. Processor 1501 is used to execute the program code stored in memory 1503. The program code may include one or more software modules. The device for compressing data in the aforementioned embodiment can determine the data used to develop the application through processor 1501 and one or more software modules in the program code in memory 1503.

[0190] The communication interface 1504 uses any transceiver or other device for communicating with other devices or communication networks. The communication network can be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc.

[0191] In a specific implementation, as an embodiment, a computer device may include multiple processors, such as processor 1501 and processor 1505 shown in FIG15 . Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0192] In a specific implementation, as an embodiment, the computer device may further include an output device 1506 and an input device 1507. The output device 1506 communicates with the processor 1501 and can display information in a variety of ways. For example, the output device 1506 can be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 1507 communicates with the processor 1501 and can receive user input in a variety of ways. For example, the input device 1507 can be a mouse, a keyboard, a touch screen device, or a sensor device.

[0193] The aforementioned computer device may be a general-purpose computer device or a dedicated computer device. In a specific implementation, the computer device may be a desktop computer, a portable computer, a network server, a personal digital assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, a communication device, or an embedded device. The embodiments of the present application do not limit the type of computer device.

[0194] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can 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 instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).

[0195] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk, or an optical disk, etc.

[0196] The above description is an embodiment provided for this application and is not intended to limit the embodiments of this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the embodiments of this application should be included in the scope of protection of the embodiments of this application.

Claims

1. A data compression method, It is characterized in that The method comprises: Acquire a data stream to be compressed, wherein the data stream includes a plurality of data; Based on the context information of each data in the plurality of data, determine multiple categories of data from the plurality of data, each category of data in the plurality of categories of data includes at least one data in the plurality of data, and the context information of each data indicates data located before and / or after the corresponding data in the data stream; At least one type of data among the multiple types of data is compressed.

2. The method according to claim 1, It is characterized in that The determining of multiple types of data from the multiple data based on the context information of each data in the multiple data includes: Determine at least one first data among the plurality of data, where the first data is data that does not appear for the first time in the data stream, and treat each first data as a type of identical data; At least one second data among the plurality of data except the at least one first data is classified according to similarity to obtain at least one category of similar data.

3. The method according to claim 2, It is characterized in that The compressing at least one type of data among the multiple types of data comprises: For each first data, determining a recurrence rule of each first data as compressed data of the corresponding first data, wherein the recurrence rule indicates an association between the corresponding first data and third data, wherein the third data is data in the data stream that is located before the first data and is the same as the first data; For any one type of similar data among the at least one type of similar data, if the any one type of similar data includes multiple second data, determine the compression algorithm corresponding to the any one type of similar data, compress the any one type of similar data according to the compression algorithm corresponding to the any one type of similar data, and obtain compressed data corresponding to each second data in the any one type of similar data.

4. The method according to claim 2 or 3, It is characterized in that The determining of at least one first data among the plurality of data comprises: inputting the plurality of data into each predictor of at least one predictor in sequence, each predictor being used to predict a predicted value of currently input data based on data input before a current time; For an i-th data among the multiple data, if a difference between a predicted value output by a first predictor in the at least one predictor and the i-th data is 0, the i-th data is determined as a first data.

5. The method according to claim 4, It is characterized in that The compressing at least one type of data among the multiple types of data comprises: The identifier of the first predictor is determined as compressed data of the i-th data.

6. The method according to claim 4 or 5, It is characterized in that The method further comprises: If the difference between the predicted value output by each predictor in the at least one predictor and the i-th data is not 0, searching each hash table in the at least one hash table for data identical to the i-th data; If there is a first hash table in the at least one hash table storing data identical to the i-th data, the i-th data is determined as a first data.

7. The method according to claim 6, It is characterized in that The compressing at least one type of data among the multiple types of data comprises: The identifier of the first hash table and the hash value of the i-th data in the first hash table are determined as compressed data of the i-th data.

8. The method according to any one of claims 4 to 7, It is characterized in that The method further comprises: If the difference between the predicted value output by each predictor in the at least one predictor and the i-th data is not 0, then the at least one predictor is updated, and the difference between the predicted value output by the second predictor and the i-th data in the at least one updated predictor is 0。 9. The method according to any one of claims 6 to 8, It is characterized in that The method further comprises: If the data identical to the i-th data does not exist in the at least one hash table, the at least one hash table is updated, and the at least one updated hash table stores the data identical to the i-th data in the second hash table.

10. The method according to any one of claims 6 to 9, It is characterized in that The method further comprises: If data identical to the i-th data does not exist in the at least one hash table, mark information of the i-th data is generated, where the mark information indicates that the i-th data is a second data.

11. The method according to any one of claims 2 to 10, It is characterized in that For any one type of similar data in the at least one type of similar data, a distance between any two data in the any one type of similar data is less than a reference distance.

12. A data compression device, It is characterized in that The device comprises: An acquisition module, used for acquiring a data stream to be compressed, wherein the data stream includes a plurality of data; a determination module, configured to determine multiple categories of data from the multiple data based on context information of each data in the multiple data, each category of data in the multiple categories of data including at least one data in the multiple data, and the context information of each data indicating data located before and / or after the corresponding data in the data stream; The compression module is used to compress at least one type of data among the multiple types of data.

13. The device according to claim 12, It is characterized in that The determination module comprises: A determination submodule, configured to determine at least one first data among the plurality of data, wherein the first data is data that does not appear for the first time in the data stream, and each first data is regarded as a type of identical data; The classification submodule is used to classify at least one second data among the multiple data except the at least one first data according to similarity to obtain at least one category of similar data.

14. The device according to claim 13, It is characterized in that The compression module is used to: For each first data, determining a recurrence rule of each first data as compressed data of the corresponding first data, wherein the recurrence rule indicates an association between the corresponding first data and third data, wherein the third data is data in the data stream that is located before the first data and is the same as the first data; For any one type of similar data among the at least one type of similar data, if the any one type of similar data includes multiple second data, determine the compression algorithm corresponding to the any one type of similar data, compress the any one type of similar data according to the compression algorithm corresponding to the any one type of similar data, and obtain compressed data corresponding to each second data in the any one type of similar data.

15. The device according to claim 13 or 14, It is characterized in that The determining submodule is used for: inputting the plurality of data into each predictor of at least one predictor in sequence, each predictor being used to predict a predicted value of currently input data based on data input before a current time; For an i-th data among the multiple data, if a difference between a predicted value output by a first predictor in the at least one predictor and the i-th data is 0, the i-th data is determined as a first data.

16. The device according to claim 15, It is characterized in that The compression module is used to: The identifier of the first predictor is determined as compressed data of the i-th data.

17. The device according to claim 15 or 16, It is characterized in that The determining submodule is also used for: If the difference between the predicted value output by each predictor in the at least one predictor and the i-th data is not 0, searching each hash table in the at least one hash table for data identical to the i-th data; If there is a first hash table in the at least one hash table storing data identical to the i-th data, the i-th data is determined as a first data.

18. The device according to claim 17, It is characterized in that The compression module is used to: The identifier of the first hash table and the hash value of the i-th data in the first hash table are determined as compressed data of the i-th data.

19. The device according to any one of claims 15 to 18, It is characterized in that The device also includes: The first updating module is used to update the at least one predictor if the difference between the predicted value output by each predictor in the at least one predictor and the i-th data is not 0, and the difference between the predicted value output by the second predictor and the i-th data in the at least one updated predictor is 0.

20. The device according to any one of claims 17 to 19, It is characterized in that The device also includes: The second updating module is used to update the at least one hash table if the data identical to the i-th data does not exist in the at least one hash table, and the at least one updated hash table stores the data identical to the i-th data in the second hash table.

21. The device according to any one of claims 17 to 20, It is characterized in that The device also includes: A generating module is used to generate marking information of the i-th data if there is no data identical to the i-th data in the at least one hash table, wherein the marking information indicates that the i-th data is a second data.

22. The device according to any one of claims 13 to 21, It is characterized in that For any one type of similar data in the at least one type of similar data, a distance between any two data in the any one type of similar data is less than a reference distance.

23. A computer device, It is characterized in that The computer device includes a memory and a processor; The memory is used to store a program that supports the computer device to execute the method described in any one of claims 1 to 11, and to store data involved in implementing the method described in any one of claims 1 to 11; The processor is configured to execute the program stored in the memory.

24. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Data compression method and device, computer equipment and storage medium

    CN118868952A

  • Lossless compression-encoding device

    CN101715132A

  • Data processing method and device and computer readable storage medium

    CN112099725A

  • Image data encoding and decoding

    CN114009029A

  • Encrypted image reversible information hiding method based on adaptive predictive coding

    CN115766963A