A data processing method and device

By dividing data blocks into sub-blocks and establishing mapping relationships, the problem of long delay in locating data in filtering scenarios with traditional data compression schemes is solved, fast access and efficient storage are achieved, and the processing performance of the chip is improved.

CN114296643BActive Publication Date: 2024-09-06HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111545103.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-16
Publication Date
2024-09-06
Estimated Expiration
2041-12-16

AI Technical Summary

Technical Problem

In filtering scenarios, traditional data compression schemes are difficult to quickly locate the location of each data in a data block, resulting in large data access delays and affecting chip performance.

Method used

Divide the target data block to be compressed into multiple sub-data blocks, compress and store them, and establish the mapping relationship between the sub-data blocks and the storage space through preset rules to quickly locate and read data.

Benefits of technology

It improves the data access rate and the chip's flexibility in processing data, reduces access delays, and improves storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114296643B
    Figure CN114296643B
Patent Text Reader

Abstract

The present application discloses a data processing method and device, which relates to the field of chip design technology and is used to improve data processing efficiency. The method includes: dividing a target data block to be compressed into multiple first sub-data blocks; wherein the target data block to be compressed includes multiple data, and the data block to be compressed and the first sub-data block are both N-dimensional data blocks, and N is an integer greater than or equal to 2; compressing the multiple first sub-data blocks respectively to obtain multiple second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one; storing the multiple second sub-data blocks according to preset rules; wherein the preset rules are used to characterize the mapping relationship between the identifiers of the multiple first sub-data blocks and the identifiers of the storage spaces of the multiple second sub-data blocks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Currently, in order to reduce the storage space occupied by data blocks, data compression is usually performed. When a user needs to obtain data, the traditional compression scheme maps the entire data block to the storage location of the compressed data block to facilitate user indexing. When a user needs to obtain data in different forms, for example, in a filtering scenario, a 3×3 data block or a 5×5 data block needs to be obtained. At this time, the above mapping rules have a high computational complexity, and the position of each data in the data block cannot be quickly located. The data access delay is large, which affects the working performance of the chip. Summary of the invention

[0003] The embodiments of the present application provide a data processing method and device for improving the data access rate and enhancing the flexibility of chip in processing data.

[0004] To achieve the above objectives, the present application provides the following technical solutions:

[0005] In a first aspect, a data processing method is provided, comprising: dividing a target data block to be compressed into a plurality of first sub-data blocks; wherein the target data block to be compressed includes a plurality of data, and the target data block to be compressed and the first sub-data blocks are both N-dimensional data blocks, and N is an integer greater than or equal to 2; compressing the plurality of first sub-data blocks respectively to obtain a plurality of second sub-data blocks; wherein the first sub-data blocks correspond one-to-one to the second sub-data blocks; storing the plurality of second sub-data blocks according to a preset rule; wherein the preset rule is used to characterize a mapping relationship between identifiers of the plurality of first sub-data blocks and identifiers of storage spaces of the plurality of second sub-data blocks.

[0006] Dividing the target data blocks to be compressed and then compressing them helps to improve data storage efficiency; the divided data blocks are compressed and stored separately. When reading data, the data to be read can be quickly located in the compressed data blocks based on the compression rules and the one-to-one correspondence between the data blocks before and after compression, which helps to improve the data reading rate and the flexibility of the chip in processing data.

[0007] In a possible implementation, the method also includes: storing first information; wherein the first information includes the size of the target data block to be compressed and the size of the first sub-data block; the first information is used to determine the mapping relationship between the identifiers of multiple first sub-data blocks and the identifiers of storage spaces of multiple second sub-data blocks.

[0008] This possible implementation method stores parameter information used to calculate the mapping relationship, which is used by other devices to calculate storage and reading rules.

[0009] In a possible implementation, the method also includes: receiving a read request sent by a second device, the read request including an identification of the data to be read in the target data block to be compressed; determining an identification of the storage space of the target second sub-data block based on the identification of the data to be read; wherein the target second sub-data block is at least one of multiple second sub-data blocks; based on the identification of the storage space of the target second sub-data block, reading the target second sub-data block; decompressing the target second sub-data block, the decompressed target second sub-data block including the data to be read; and sending the data to be read to the second device.

[0010] This possible implementation method provides a specific implementation method for reading data, which determines the identification of the storage space of the target second sub-data block to which the data to be read belongs through the identification of the data to be read, obtains the target second sub-data block according to the identification of the storage space of the target second sub-data block, and obtains the data to be read through decompression.

[0011] In one possible implementation, the identification of the data to be read includes the starting position of the data to be read and the size of the data to be read; determining the identification of the storage space of the target second sub-data block based on the identification of the data to be read includes: determining the identification of the target first sub-data block based on the starting position and size of the data to be read and the first information, the target first sub-data block being at least one of multiple first sub-data blocks; determining the identification of the storage space of the target second sub-data block based on the identification and mapping relationship of the target first sub-data block.

[0012] This possible implementation provides a specific implementation method for obtaining the identifier of the target second sub-data block to which the to-be-read data belongs. According to the first information, at least one first sub-data block into which the to-be-read data is divided before compression is determined, and according to the mapping rule between the first sub-data block compression and the second sub-data block, the compressed data block is quickly located, thereby improving the efficiency of data reading.

[0013] In a possible implementation, the size of the first sub-data block is a target size, and the method further includes: determining the data amount of a sub-data block; determining multiple sizes of the sub-data block based on the data amount of the sub-data block; dividing multiple data blocks to be compressed based on multiple sizes, respectively, and compressing the divided sub-data blocks respectively, and storing the compressed sub-data blocks based on preset rules; wherein one size corresponds to at least one data block to be compressed; the sizes of multiple data blocks to be compressed are the same; counting the processing efficiency of multiple data blocks to be compressed, and determining the corresponding size when the processing efficiency meets the preset conditions as the target size.

[0014] This possible implementation method provides a method for updating the size of the sub-data blocks, by calculating the storage efficiency, determining the adaptability of the size of the sub-data blocks, and appropriately adjusting the size of the divided sub-data blocks to improve the storage efficiency.

[0015] In the second aspect, a computer device is provided, comprising: a functional unit for executing any one of the methods provided in the first aspect, and the actions performed by each functional unit are implemented by hardware or by executing corresponding software through hardware. For example, the computer device may include: a division unit, a compression unit and a storage unit; the division unit is used to divide the target data block to be compressed into multiple first sub-data blocks; wherein the target data block to be compressed includes multiple data, and the target data block to be compressed and the first sub-data block are both N-dimensional data blocks, and N is an integer greater than or equal to 2; the compression unit is used to compress the multiple first sub-data blocks respectively to obtain multiple second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one; the storage unit is used to store the multiple second sub-data blocks according to preset rules; wherein the preset rules are used to characterize the mapping relationship between the identifiers of the multiple first sub-data blocks and the identifiers of the storage space of the multiple second sub-data blocks.

[0016] In a third aspect, a computer device is provided, comprising: a processor and a memory. The processor is connected to the memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, thereby implementing any one of the methods provided in the first aspect.

[0017] In a fourth aspect, a chip is provided, comprising: a processor and an interface circuit; the interface circuit is used to receive code instructions and transmit them to the processor; the processor is used to run the code instructions to execute any one of the methods provided in the first aspect.

[0018] In a fifth aspect, a computer-readable storage medium is provided, comprising computer execution instructions, which, when executed on a computer, enable the computer to execute any one of the methods provided in the first aspect.

[0019] In a sixth aspect, a computer program product is provided, comprising computer execution instructions, which, when executed on a computer, cause the computer to execute any one of the methods provided in the first aspect.

[0020] The technical effects brought about by any implementation method in the second to sixth aspects can refer to the technical effects brought about by the corresponding implementation method in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 A schematic diagram of the structure of a computer device provided in an embodiment of the present application;

[0022] Figure 2 A schematic diagram of a data storage method provided in an embodiment of the present application;

[0023] Figure 3 A schematic diagram of data block division provided in an embodiment of the present application;

[0024] Figure 4 A schematic diagram of data block division provided in an embodiment of the present application;

[0025] Figure 5 A schematic diagram of a data storage address before compression provided in an embodiment of the present application;

[0026] Figure 6 A schematic diagram of a compressed data storage address provided in an embodiment of the present application;

[0027] Figure 7 A flowchart of a data reading method provided in an embodiment of the present application;

[0028] Figure 8 A schematic diagram of obtaining the storage address of data to be read before compression provided by an embodiment of the present application;

[0029] Fig. 9 A schematic diagram of the composition of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0030] 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 three relationships may exist. 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, "at least one" means one or more, and "plurality" means two or more. 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 different.

[0031] It should be noted that, in this 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 this 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 specific way.

[0032] The embodiment of the present application provides a data processing method, which can be applied to a computer device. The embodiment of the present application does not impose any restrictions on the specific form of the computer device. For example, the computer device can be a terminal device or a network device. Among them, the terminal device can be referred to as: terminal, user equipment (UE), terminal equipment, access terminal, user unit, user station, mobile station, remote station, remote terminal, mobile device, user terminal, wireless communication device, user agent or user device, etc. The terminal device can be a mobile phone, augmented reality (AR) device, virtual reality (VR) device, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. The network device can be a server, etc. Among them, the server can be a physical or logical server, or it can be two or more physical or logical servers that share different responsibilities and cooperate with each other to realize the functions of the server.

[0033] In terms of hardware implementation, the above-mentioned computer device can be implemented as follows: Figure 1 The computer device shown is implemented as shown. Figure 1 FIG. 1 is a schematic diagram of the hardware structure of a computer device 10 provided in an embodiment of the present application. The computer device 10 can be used to implement the functions of the above-mentioned computer devices.

[0034] Figure 1 The computer device 10 shown may include: a processor 101 , a memory 102 , a communication interface 103 , and a bus 104 . The processor 101 , the memory 102 , and the communication interface 103 may be connected via the bus 104 .

[0035] The processor 101 is the control center of the computer device 10, and may be a general-purpose central processing unit (CPU) or other general-purpose processors, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0036] As an example, the processor 101 may include one or more CPUs, such as Figure 1 CPU 0 and CPU 1 are shown in .

[0037] The memory 102 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, an electrically erasable programmable read-only memory (EEPROM), a disk storage medium 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.

[0038] In a possible implementation, the memory 102 may exist independently of the processor 101. The memory 102 may be connected to the processor 101 via a bus 104 and used to store data, instructions, or program codes. When the processor 101 calls and executes the instructions or program codes stored in the memory 102, the data processing method provided in the embodiment of the present application can be implemented.

[0039] In another possible implementation, the memory 102 may also be integrated with the processor 101 .

[0040] The communication interface 103 is used for connecting the computer device 10 to other devices through a communication network, which may be Ethernet, a radio access network (RAN), a wireless local area network (WLAN), etc. The communication interface 103 may include a receiving unit for receiving data and a sending unit for sending data.

[0041] The bus 104 may be an industry standard architecture (ISA) bus, a peripheral component interconnect (PCI) bus, or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 1 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0042] It should be pointed out that Figure 1 The structure shown in the figure does not constitute a limitation on the computer device 10, except Figure 1In addition to the components shown, computer device 10 may include more or fewer components than shown, or combine certain components, or arrange components differently.

[0043] like Figure 2 As shown, it is a flow chart of a data processing method provided by the present application. The computer device in the present application may also be referred to as the first device. The method includes:

[0044] Step S201: The first device divides a target data block to be compressed into a plurality of first sub-data blocks; wherein the target data block to be compressed includes a plurality of data.

[0045] It is understandable that when data is stored in binary format, it can be further represented as multi-dimensional data. The data can be any type of data such as text, picture, video, or data obtained after processing these data. For example, when the picture is a face, feature data representing the features of the face is obtained through further processing, and the feature data can be stored in binary format, thereby representing multi-dimensional data.

[0046] The target data block to be compressed is a data block composed of N-dimensional data to be compressed, where N is an integer greater than or equal to 2. When the target data block to be compressed is a two-dimensional data block, the size of the data block can be expressed as W×H; when the target data block to be compressed is a three-dimensional data block, the size of the data block can be expressed as W×H×C. Exemplarily, when the target data block to be compressed is a picture, the target data block to be compressed includes multiple data, which are multiple pixel values ​​of the picture. The pixel value can be represented by brightness and chrominance.

[0047] Before executing step S201, the first device needs to know the size of the first sub-data block and divide the target to-be-compressed data block according to the size.

[0048] Optionally, the first device determines the size of the first sub-data block according to a preset amount of data in the first sub-data block. Figure 3 As shown, it is assumed that the first device compresses a two-dimensional data block of size W×H, and the data volume of the target data block to be compressed is W×H. Then the first device needs to determine the appropriate data volume of the first sub-data block as a×b, and obtain at least one set of a and b representing the size of the first sub-data block, where a≤W, b≤H. For example, if the preset data volume of the first sub-data block is 4KB, that is, the data volume of a×b is 4KB, then a can be 1 and b can be 4. When the values ​​of a and b are determined, W and H are divided according to a and b respectively. The result of the division is M=W / a, N=H / b, where M represents the number of divisions of W in units of a, and N represents the number of divisions of H in units of b.

[0049] It can be understood that a and b of the first sub-data block are obtained by dividing according to W and H respectively. The first sub-data block is the same as the target data block to be compressed, and both are N-dimensional data blocks, where N is an integer greater than or equal to 2.

[0050] Optionally, when the first device determines that the data volume of the first sub-data block corresponds to multiple groups a and b, the first device may randomly select from the multiple groups a and b. For example, in the above example, the data volume of the first sub-data block is 4 KB, and the values ​​of a and b may also be 2 respectively.

[0051] Optionally, the first device sets a selection range for the data volume of the first sub-data block. Exemplarily, the selection range of a×b is 1KB-4KB. For the selection range of the data volume, there are more options for the selection methods of a and b.

[0052] Optionally, if the first device has further restrictions on the values ​​of a and b, a and b are further selected on the premise that the data volume requirement is met. Exemplarily, the first device sets upper and lower limits of a and / or b, and then, among multiple combinations of a and b that meet the data volume of the first sub-data block, a and b are further selected based on the upper and lower limits of a and / or b.

[0053] It should be noted that if Figure 3 In the example shown, if W and H are divided by a and b respectively, there are two cases: complete division and incomplete division. Complete division means that W and a, H and b are integer multiples, that is, M and N are integers greater than 0; and when W and a, H and b do not satisfy the integer multiple relationship, it is incomplete division, that is, M and N are non-integers. In the case of incomplete division, the first device can supplement the part that is less than an integer multiple, that is, round M and N to obtain M' and N'. Figure 4 As shown, the slashed part is supplementary data.

[0054] M' = Ceil(M) = Ceil(W / a);

[0055] N' = Ceil(N) = Ceil(H / b);

[0056] According to M' and N', we get

[0057] W' = a × Ceil (M);

[0058] H' = b × Ceil (N);

[0059] By rounding M and N as described above, the calculation process is simplified, making it easier to locate the relationship between the first sub-data block and the target to-be-compressed data block.

[0060] Step S202: The first device compresses the multiple first sub-data blocks respectively to obtain multiple second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one.

[0061] Among them, the first device uses any existing compression algorithm to compress the first sub-data block. For example, such as the run-length encoding algorithm. Run-length encoding is a common compression algorithm, also known as run-length encoding, variable length encoding, etc. The main technology is to detect repeated bits or character sequences, and replace them with their number of occurrences. For example, a character sequence is aaaabbccccc, which can be compressed to 4a2b5c through run-length encoding. The first device uses the compressed data block as the second sub-data block. If the character sequence aaaabbccccc is the first sub-data block, then 4a2b5c is the second sub-data block.

[0062] It should be noted that the first device may obtain a compression algorithm before performing compression. Exemplarily, the target data block to be compressed and the compression algorithm are sent to the first device, and the first device performs compression according to the compression algorithm. Alternatively, the compression algorithm is preset in the first device, and the data processed by the first device all adopt the preset compression algorithm. This application does not limit this.

[0063] Step S203: The first device stores the plurality of second sub-data blocks according to a preset rule; wherein the preset rule is used to characterize a mapping relationship between identifiers of the plurality of first sub-data blocks and identifiers of storage spaces of the plurality of second sub-data blocks.

[0064] The preset rule is used to characterize the mapping relationship between the identifier of the first sub-data block and the identifier of the storage space of the second sub-data block corresponding thereto. The preset rule may be a formula or a table used to identify the mapping relationship.

[0065] The identifier of the first sub-data block includes the position information of the first sub-data block in the target data block to be compressed. Optionally, when the target data block to be compressed is a two-dimensional data block, the first sub-data block after being divided can be identified by rows and columns to indicate the position of the first sub-data block in the target data block to be compressed. Figure 3 As shown, M is the number of columns divided by W based on a, N is the number of rows divided by H based on b, and (n, m) represents the first sub-data block of the nth row and the mth column, where 1≤m≤M, 1≤n≤N.

[0066] Understandably, Figure 3 The address of the element in the first sub-data block obtained by division is as follows Figure 5As shown, the starting position is 1. When n is 1, the address of the first row element in the first sub-data block of the row is 1, ..., a, ..., W; the address of the second row element is W+1, ..., 2×W. When n is 2, the address of the first row element in the first sub-data block of the row is b×W+1, ..., b×W+1+a, ..., (b+1)×W. Until n is N, the address of the last row element in the first sub-data block of the row is (H-1)×W+1, ..., H×W.

[0067] The identifier of the storage space of the second sub-data block includes the first address of the storage space of the second sub-data block. Figure 6 As shown, it is used for storage Figure 5 The storage space of the second sub-data block after compression in each row is used to store a second sub-data block. Specifically, the storage space of the first row is used to store Figure 5 In the figure, n is 1, m is 1, and the corresponding shadow data block is compressed into the second sub-data block. The first address of the row storage space is 1. Since the amount of data in the data block is a×b, the address of the last element in the row is a×b.

[0068] Understandably, Figure 5 The first sub-data block in is compressed and stored line by line. Figure 6 The second row of storage space is used to store Figure 5 In the example, the data block represented by the slash is compressed into the second sub-data block, and the first address of the storage space is 1×a×b+1. Similarly, Figure 5 The data blocks represented by the grid correspond to Figure 6 The storage space of the last row in the table has a starting address of (M-1)×N×a×b+1.

[0069] A mapping relationship is established between the identifier of the first sub-data block and the identifier of the storage space of the second sub-data block, and the address of the compressed data block is obtained according to the mapping relationship, so as to establish a corresponding relationship between the data before and after compression.

[0070] It should be noted that the first device can perform the above steps S201-S203 in units of one or more target data blocks to be compressed. Exemplarily, when the first device uses one target data block to be compressed as a unit, the size of the first sub-data block is determined for each target data block to be compressed according to the above step S201. When the first device uses multiple target data blocks to be compressed as a unit, for example, ten target data blocks to be compressed are one unit, and each unit is processed with the same size of the first sub-data block, which can be the size of the first sub-data block determined in the above step S201 for any target data block to be compressed in each unit, or the total data amount of each unit is determined, and the size of the first sub-data block is determined according to the total data amount of the unit using the above step S201. This application does not impose any restrictions on this.

[0071] Optionally, based on the same target data block to be compressed, different sizes of first sub-data blocks are used for compression and storage with different processing efficiencies. Specifically, the first device calculates and compares the processing efficiencies corresponding to different sizes of first sub-data blocks, and selects the size of the first sub-data block with higher processing efficiency for division.

[0072] Specifically, the following steps S11-S14 are included.

[0073] S11. The first device determines the data size of a sub-data block for the data block to be compressed.

[0074] The data block to be compressed is any target data block to be compressed, and the data volume of the sub-data block is smaller than the data volume of the data block to be compressed. It can be understood that the data volume of the sub-data block is any one of multiple selection methods of the data volume of the first sub-data block.

[0075] S12. The first device determines multiple sizes of sub-data blocks based on the data amount of the sub-data blocks, and divides and compresses multiple data blocks to be compressed based on the sub-data blocks of the multiple sizes.

[0076] For example, the size of the sub-data block includes a first size and a second size, the data block to be compressed includes a first data block to be compressed and a second data block to be compressed, and the data amount of the first data block to be compressed is the same as the data amount of the second data block to be compressed. The first device divides and compresses the first data block to be compressed based on the first size, and divides and compresses the data block to be compressed based on the second size.

[0077] S13. The first device stores the divided sub-data blocks based on the above preset rules.

[0078] S14. The first device counts processing efficiencies of multiple data blocks to be compressed, and determines a size corresponding to when the processing efficiency meets a preset condition as a target size.

[0079] The processing efficiency can be determined by comparing the time taken for a plurality of data blocks to be compressed with the same amount of data to be compressed and stored in different sizes. A longer time means that the processing efficiency of compressing and storing in this size is low, and vice versa. Specifically, the preset condition can be the preset time length, and if the processing time length is less than the preset time length, it means that the processing efficiency meets the preset condition. The size of the sub-data block corresponding to the processing efficiency that meets the preset condition is used as the target size and applied to the first sub-data block.

[0080] It can be understood that the above-mentioned first device measures the processing efficiency by the time taken to process a certain amount of data in different ways. Similarly, the processing efficiency can also be measured by calculating the rate at which different amounts of data are processed in different ways. The present application does not impose any restrictions on this.

[0081] Through the above steps S11-S14, the first device calculates the processing time under a certain amount of data according to the sizes of different sub-data blocks, and determines the processing efficiency corresponding to the size of the first sub-data block by comparing the length of the processing time. The first device selects the size of the first sub-data block with higher processing efficiency to divide the target data block to be compressed by comparing the processing efficiency.

[0082] It should be noted that the sizes of different first sub-data blocks may correspond to the same or different data amounts of the first sub-data blocks. Figure 3 In the example shown, when a×b is the same, the values ​​of a and b are different, and the processing efficiency of the first device may also be different.

[0083] Optionally, the first device updates the size of the first sub-data block. Specifically, the first device updates the size of the first sub-data block of the second unit according to the processing efficiency of the first unit. The size of the first sub-data block of the second unit is a target size, and the first unit and the second unit respectively include one or more target data blocks to be compressed. The data in the first unit is processed according to the above steps S201-S203, and the processing efficiency of the first unit is calculated.

[0084] In a possible implementation, the processing efficiency of the first unit is compared with a first condition, and the first condition is composed of an upper and lower limit of the processing efficiency that the first device needs to meet. Exemplarily, the processing efficiency of computer device A requires processing at least A data volume per second, and / or processing at most B data volume per second. The above-mentioned A data volume and B data volume constitute a first threshold range of processing efficiency. If the processing efficiency of the first unit is within the range, it means that the size of the first sub-data block divided by the first unit is appropriate, and the target size is the same as the size. If the first unit is not within the first threshold range, it means that the size of the first sub-data block divided by the first unit is not appropriate, and the second unit is adjusted based on the size of the first sub-data block. For example, the first device increases the original size by 5% based on the size, and uses the increased size as the target size. Or, the first device reduces the original size by 5% based on the size, and uses the reduced size as the target size. Or, for the second unit, the first device re-executes step S201 and re-determines the target size.

[0085] It should be noted that the amount of increase and the amount of decrease can be adjusted according to the difference between the processing efficiency of the first unit and the first threshold range, and this application does not limit this.

[0086] It should be noted that the above-mentioned first condition is related to the attribute of the first device, and the attribute refers to the device performance of the first device. Exemplarily, when the first device processes data within a certain amount of data, the more data is processed, the higher the processing efficiency is. When a certain peak value is reached, the processing efficiency no longer increases; similarly, when the processing efficiency is lower than a certain valley value, the processing efficiency drops significantly or becomes zero. The first device can determine the first condition according to the peak-valley value, and the first condition can be preset in the first device, or the user can adjust it later. In the above possible implementation, when the processing efficiency of the first unit is within the first threshold range, the second unit can continue to adjust based on the size of the first sub-data block. Exemplarily, in order to reach the peak faster, the target size can be adjusted significantly, or in order to ensure that the efficiency change range is not too large, the target size can be adjusted slightly. It can be understood that the adjustment is made by the first device in order to reach the peak value or the highest efficiency point in the first condition, and the specific implementation method is not limited.

[0087] Optionally, the method further includes step S204, in which the first device stores first information; wherein the first information includes the size of the target data block to be compressed and the size of the first sub-data block; and the first information is used to determine the mapping relationship between the identifiers of multiple first sub-data blocks and the identifiers of the storage space of multiple second sub-data blocks.

[0088] Specifically, the first device stores first information. When other devices need to read or write data compressed and stored by the first device, they can obtain the first information from the first device and determine the mapping relationship between the identifiers of multiple first sub-data blocks and the identifiers of storage spaces of multiple second sub-data blocks based on the first information, thereby determining the rules for data storage and reading.

[0089] Through the above method, data blocks are divided before compression and storage, and a mapping relationship between the divided data blocks and the compressed storage space is established. The mapping relationship is easy to calculate and is compatible with existing compression algorithms. It also achieves independence of data storage before and after compression, which is convenient for user storage.

[0090] When the user needs to read data, the first device can execute the following Figure 7 The method shown comprises:

[0091] Step S701: A first device receives a read request sent by a second device, where the read request includes an identifier of the data to be read in a target data block to be compressed.

[0092] Specifically, the identifier of the data to be read includes the starting position and size of the data to be read.

[0093] It should be noted that the data to be read in the present application has various data forms, and the starting position and size of the data to be read are helpful to quickly locate the data to be read. Exemplarily, the size of the data to be read may be a 3×3 data block.

[0094] Step S702: The first device determines an identifier of a storage space of a target second sub-data block according to an identifier of the data to be read; wherein the target second sub-data block is at least one of the plurality of second sub-data blocks.

[0095] Specifically, step S702 includes steps S702a-S702b.

[0096] S702a. The first device determines an identifier of a target first sub-data block based on a starting position of the data to be read, a size of the data to be read, and first information, wherein the target first sub-data block includes at least one of multiple first sub-data blocks, and the target first sub-data block includes the data to be read.

[0097] Specifically, the first device determines the first plurality of sub-data blocks divided into the target to-be-compressed data block to which the to-be-read data belongs according to the first information. Figure 5As shown in FIG. 1 , the target data block to be compressed to which the data to be read belongs is divided based on the size of a×b. According to the starting position of the data to be read and the size of the data to be read, the target first sub-data block is determined from multiple first sub-data blocks. For example, assuming a>3, b>3, the starting position of the data to be read is a, and the size of the data to be read is 3×3, then the target first sub-data block to which the position of the data to be read belongs is Figure 8 The data blocks shown are indicated by slashes.

[0098] S702b: The first device determines an identifier of a storage space of a target second sub-data block based on an identifier of the target first sub-data block and a mapping relationship.

[0099] The mapping relationship is a mapping relationship between the identifiers of the plurality of first sub-data blocks and the identifiers of the storage spaces of the plurality of second sub-data blocks. Still as in the above example, the storage space of the target second sub-data block corresponding to the target first sub-data block corresponds to Figure 6 The identifier of the target second sub-data block is the first address of the second row storage space.

[0100] Step S703: The first device reads the target second sub-data block based on the identifier of the storage space of the target second sub-data block.

[0101] Exemplarily, the target second sub-data block is read based on the first address of the storage space of the target second sub-data block.

[0102] Step S704: The first device decompresses the target second sub-data block, and the decompressed target second sub-data block includes the data to be read.

[0103] The decompression algorithm corresponds to the above compression algorithm, and the present application does not limit the specific method of obtaining it. After the first device decompresses the target second sub-data block, it obtains all data in the target second sub-data block, including the data to be read.

[0104] It should be noted that all data in the target second sub-data block may contain invalid data except the data to be read. Exemplarily, the division of the target first sub-data block and the required data to be read are not in an integer multiple relationship, and the relationship between the target second sub-data block and the target first sub-data block is a one-to-one correspondence between the first sub-data block and the second sub-data block. When the first device obtains the data to be read, it needs to first decompress the data block to be read to which it belongs, and obtain the target first sub-data block after decompression, and calculate the data to be read according to the size of the target first sub-data block in the first information. Figure 8 As shown, the target first sub-data block indicated by the oblique lines excludes the 3×3 data blocks, and the rest are invalid data. The first device can further select from the decompressed target second sub-data block according to the size of the data to be read.

[0105] Step S705: The first device sends the to-be-read data to the second device.

[0106] It can be understood that the above steps S701-S705 provide a specific implementation of the data reading method. In this implementation, the user determines the target first sub-data block by obtaining the size of the first sub-data block divided before compression and the target data block to be compressed, and then determines the target second sub-data block after the compression of the target first sub-data block according to the mapping relationship; and obtains the data to be read by decompressing the target second sub-data block. According to the above method, the first device provides an index method for compressing the target data block to be read, and improves the efficiency of accessing different data forms according to the mapping relationship between this type of data and the data block to which it belongs.

[0107] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that in order to realize the above functions, the computer device includes at least one of the hardware structure and software modules corresponding to the execution of each function. It should be easily appreciated by those skilled in the art that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0108] The embodiment of the present application can divide the computer device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0109] For example, Fig. 9 A possible structural diagram of a computer device (referred to as computer device 90) involved in the above embodiment is shown, and the computer device 90 includes a division unit 901, a compression unit 902, and a storage unit 903. The division unit 901 is used to divide the target data block to be compressed into multiple first sub-data blocks; wherein the target data block to be compressed includes multiple data. For example, Figure 2 Step S201 shown. The compression unit 902 is used to compress the multiple first sub-data blocks respectively to obtain multiple second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one. For example, Figure 2The storage unit 903 is used to store the plurality of second sub-data blocks according to a preset rule; wherein the preset rule is used to characterize the mapping relationship between the identifiers of the plurality of first sub-data blocks and the identifiers of the storage spaces of the plurality of second sub-data blocks. For example, Figure 2 Step S203 shown.

[0110] Optionally, the storage unit 903 is also used to store first information; wherein the first information includes the size of the target data block to be compressed and the size of the first sub-data block; the first information is used to determine the mapping relationship between the identifiers of multiple first sub-data blocks and the identifiers of the storage space of multiple second sub-data blocks.

[0111] Optionally, the computer device 90 further includes a receiving unit 904, which is used to receive a read request sent by the second device, wherein the read request includes an identification of the data to be read in the target data block to be compressed. A determining unit 905, which is used to determine an identification of the storage space of the target second sub-data block according to the identification of the data to be read; wherein the target second sub-data block is at least one of the multiple second sub-data blocks. A reading unit 906, which is used to read the target second sub-data block based on the identification of the storage space of the target second sub-data block. A decompression unit 907, which is used to decompress the target second sub-data block, wherein the decompressed target second sub-data block includes the data to be read. A sending unit 908, which is used to send the data to be read to the second device.

[0112] Optionally, the identification of the data to be read includes the starting position and size of the data to be read; the determination unit 905 is specifically used to determine the identification of the target first sub-data block based on the starting position of the data to be read, the size of the data to be read and the first information, wherein the target first sub-data block includes at least one of multiple first sub-data blocks, and the target first sub-data block includes the data to be read; based on the identification of the target first sub-data block and the mapping relationship, determine the identification of the storage space of the target second sub-data block.

[0113] Optionally, the size of the first sub-data block is a target size, and the determination unit 905 is further used to determine the data volume of a sub-data block; the determination unit 905 is further used to determine multiple sizes of the sub-data block based on the data volume of the sub-data block; the division unit 901 is further used to divide multiple data blocks to be compressed based on the multiple sizes; the compression unit 902 is further used to compress the divided sub-data blocks respectively; the storage unit 903 is further used to store the compressed sub-data blocks based on preset rules; wherein one size corresponds to at least one data block to be compressed; the sizes of multiple data blocks to be compressed are the same; the computer device 90 also includes a statistical unit 909, which is used to count the processing efficiency of multiple data blocks to be compressed; the determination unit 905 is further used to determine the corresponding size when the processing efficiency meets the preset conditions as the target size.

[0114] Optionally, the storage unit 903 is also used to store computer-executable instructions, and other units in the computer device can perform corresponding actions according to the computer-executable instructions stored in the storage unit 903.

[0115] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any of the above computer devices 90 and the description of the beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.

[0116] As an example, combining Figure 1 , the functions of the division unit 901, the compression unit 902, the storage unit 903, the decompression unit 904 and the determination unit 905 in the computer device 90 can be partially or completely implemented by Figure 1 Processor 101 in the Figure 1 The receiving unit 905 can also be implemented by the program code in the memory 102 in the Figure 1 The sending unit 908 can also be implemented by the receiving unit in the communication interface 103 in FIG. Figure 1 It is implemented by the sending unit in the communication interface 103.

[0117] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed on a computer, the computer is enabled to execute any of the methods executed by the computer devices provided above.

[0118] For the explanation of the relevant contents and description of the beneficial effects of any of the above-mentioned computer-readable storage media, reference may be made to the above-mentioned corresponding embodiments, which will not be repeated here.

[0119] The embodiment of the present application also provides a chip. The chip integrates a control circuit and one or more ports for implementing the functions of the above-mentioned computer device 90. Optionally, the functions supported by the chip can be referred to above and will not be repeated here. A person of ordinary skill in the art can understand that all or part of the steps of implementing the above-mentioned embodiment can be completed by instructing the relevant hardware through a program. The program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a random access memory, etc. The above-mentioned processing unit or processor can be a central processing unit, a general-purpose processor, an application specific integrated circuit (ASIC), a microprocessor (digital signal processor, DSP), a field programmable gate array (field programmable gatearray, FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.

[0120] The embodiment of the present application also provides a computer program product including instructions, when the instructions are run on a computer, the computer executes any one of the methods in the above embodiments. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions 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 instructions may be transmitted from a website site, a computer, a server, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means to another website site, computer, server, or data center. 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 a data center that includes one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., an SSD), etc.

[0121] It should be noted that the above-mentioned devices for storing computer instructions or computer programs provided in the embodiments of the present application, such as but not limited to the above-mentioned memories, computer-readable storage media and communication chips, etc., are all non-transitory.

[0122] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, 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 instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. 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, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0123] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0124] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A data processing method, applied to a first device, characterized in that: include: Divide the target data block to be compressed into a plurality of first sub-data blocks; wherein the target data block to be compressed includes a plurality of data, the target data block to be compressed and the first sub-data blocks are both N-dimensional data blocks, N is an integer greater than or equal to 2; the plurality of first sub-data blocks have the same amount of data and the same size; Compressing the plurality of first sub-data blocks respectively to obtain a plurality of second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one; The spaces to be stored of the plurality of second sub-data blocks are continuous, the sizes of the spaces to be stored corresponding to each of the second sub-data blocks are the same and equal to the data volume of the first sub-data block, and a mapping relationship between the identifiers of the plurality of first sub-data blocks and the identifiers of the spaces to be stored of the plurality of second sub-data blocks is established; The plurality of second sub-data blocks are stored according to a preset rule, wherein the preset rule is used to characterize the mapping relationship between the identifiers of the plurality of first sub-data blocks and the identifiers of the spaces to be stored of the plurality of second sub-data blocks.

2. The method according to claim 1, characterized in that The method further comprises: Store first information; wherein the first information includes the size of the target data block to be compressed and the size of the first sub-data block; the first information is used to determine the mapping relationship between the identifiers of the multiple first sub-data blocks and the identifiers of the storage space of the multiple second sub-data blocks.

3. The method according to claim 2, characterized in that The method further comprises: receiving a read request sent by a second device, wherein the read request includes an identifier of the data to be read in the target data block to be compressed; Determining an identifier of a storage space of a target second sub-data block according to the identifier of the data to be read; wherein the target second sub-data block is at least one of the plurality of second sub-data blocks; Based on the identifier of the storage space of the target second sub-data block, reading the target second sub-data block; decompressing the target second sub-data block, wherein the decompressed target second sub-data block includes the data to be read; The to-be-read data is sent to the second device.

4. The method according to claim 3, characterized in that The identifier of the data to be read includes the starting position of the data to be read and the size of the data to be read; and determining the identifier of the storage space of the target second sub-data block according to the identifier of the data to be read includes: Determine an identifier of a target first sub-data block based on a starting position of the data to be read, a size of the data to be read, and the first information; wherein the target first sub-data block includes at least one of the plurality of first sub-data blocks, and the target first sub-data block includes the data to be read; Based on the identifier of the target first sub-data block and the mapping relationship, an identifier of the storage space of the target second sub-data block is determined.

5. The method according to any one of claims 1 to 4, characterized in that: The size of the first sub-data block is a target size, and the method further comprises: Determine the data volume of a sub-data block; determining multiple sizes of the sub-data blocks based on the data amounts of the sub-data blocks; Dividing the plurality of data blocks to be compressed respectively based on the plurality of sizes, compressing the divided sub-data blocks respectively, and storing the compressed sub-data blocks based on the preset rule; wherein one size corresponds to at least one data block to be compressed; and the plurality of data blocks to be compressed have the same size; The processing efficiencies of the plurality of data blocks to be compressed are counted, and a size corresponding to when the processing efficiency meets a preset condition is determined as the target size.

6. A computer device, characterized in that: include: a dividing unit, configured to divide a target data block to be compressed into a plurality of first sub-data blocks; wherein the target data block to be compressed includes a plurality of data, the target data block to be compressed and the first sub-data blocks are both N-dimensional data blocks, N is an integer greater than or equal to 2; and the plurality of first sub-data blocks have the same amount of data and the same size; A compression unit, configured to compress the plurality of first sub-data blocks respectively to obtain a plurality of second sub-data blocks; wherein the first sub-data blocks correspond to the second sub-data blocks one by one; The storage spaces of the plurality of second sub-data blocks are continuous, and the sizes of the storage spaces corresponding to each of the second sub-data blocks are the same and equal to the data volume of the first sub-data block; An establishing unit, configured to establish a mapping relationship between the identifiers of the plurality of first sub-data blocks and the identifiers of the spaces to be stored of the plurality of second sub-data blocks; A storage unit is used to store the multiple second sub-data blocks according to a preset rule; wherein the preset rule is used to characterize the mapping relationship between the identifiers of the multiple first sub-data blocks and the identifiers of the storage spaces of the multiple second sub-data blocks.

7. The computer device according to claim 6, characterized in that The storage unit is also used to store first information; wherein the first information includes the size of the target data block to be compressed and the size of the first sub-data block; the first information is used to determine the mapping relationship between the identifiers of the multiple first sub-data blocks and the identifiers of the space to be stored of the multiple second sub-data blocks.

8. The computer device according to claim 7, characterized in that The computer device also includes: A receiving unit, configured to receive a read request sent by a second device, wherein the read request includes an identifier of the data to be read in the target data block to be compressed; a determining unit, configured to determine an identifier of a storage space of a target second sub-data block according to an identifier of the data to be read; wherein the target second sub-data block is at least one of the plurality of second sub-data blocks; A reading unit, configured to read the target second sub-data block based on an identifier of a storage space of the target second sub-data block; a decompression unit, configured to decompress the target second sub-data block, wherein the decompressed target second sub-data block includes the data to be read; A sending unit is used to send the to-be-read data to the second device.

9. The computer device according to claim 8, characterized in that The identification of the data to be read includes the starting position of the data to be read and the size of the data to be read; The determining unit is specifically configured to determine an identifier of a target first sub-data block based on a starting position of the data to be read, a size of the data to be read, and the first information, wherein the target first sub-data block includes at least one of the plurality of first sub-data blocks, and the target first sub-data block includes the data to be read; An identifier of a storage space of the target second sub-data block is determined based on the identifier of the target first sub-data block and the mapping relationship.

10. The computer device according to claim 8 or 9, characterized in that: The size of the first sub-data block is a target size; The determining unit is further used to determine the data amount of a sub-data block; The determining unit is further configured to determine multiple sizes of the sub-data blocks based on the data amount of the sub-data blocks; The division unit is further used to divide the multiple data blocks to be compressed based on the multiple sizes respectively; The compression unit is further used to compress the divided sub-data blocks respectively; The storage unit is further used to store the compressed sub-data blocks based on the preset rule; wherein one size corresponds to at least one data block to be compressed; and the sizes of the multiple data blocks to be compressed are the same; The computer device further comprises a statistical unit for counting the processing efficiency of the plurality of data blocks to be compressed; The determining unit is further configured to determine a size corresponding to when the processing efficiency meets a preset condition as the target size.

11. A computer device, characterized in that: include: processor; The processor is connected to a memory, the memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions stored in the memory, so that the computer device implements the method according to any one of claims 1 to 5.

12. A computer-readable storage medium, characterized in that: Used to store computer instructions, when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 5.