Bitmap storage method, device, equipment and storage medium

CN115618029BActive Publication Date: 2026-09-22VIVO MOBILE COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211285163.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-20
Publication Date
2026-09-22
Estimated Expiration
2042-10-20

AI Technical Summary

Technical Problem

[0004]本申请实施例的目的是提供一种位图存储方法、装置、设备和存储介质,能够解决相关技术中在定期存储位图数据的场景下,数据量大,占用存储空间大的问题

Benefits of technology

[0011]在本申请实施例中,第一位图集合中可以包括多个已有的第二位图,在获取到新位图,即第一位图的情况下,可以从已存储的第一位图集合中,获取与第一位图的匹配度满足预设匹配条件的第二位图,作为第一目标位图。基于此,可以对第一位图和第一目标位图进行异或处理,从而确定第一位图与第一目标位图的第一差异位图,第一目标位图是已有位图,因此第一位图的部分位可以通过已有的第一目标位图表示。如此,在确定出新位图与已有位图的不匹配部分,即第一差异位图之后,仅存储第一差异位图即可,实现对已有位图的灵活复用,相比于直接存储第一位图,能够减少数据存储量,节省存储空间。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115618029B_ABST
    Figure CN115618029B_ABST
Patent Text Reader

Abstract

The application discloses a bitmap storage method, device and equipment and a storage medium, and belongs to the technical field of data processing. The method comprises the following steps: in the case that a first bitmap is acquired, a second bitmap that meets a preset matching condition in a matching degree with the first bitmap in a first bitmap set is acquired, and a first target bitmap is obtained, wherein the first bitmap set comprises a plurality of second bitmaps; the first bitmap and the first target bitmap are subjected to exclusive or processing, and a first difference bitmap of the first bitmap and the first target bitmap is determined; and the first difference bitmap is stored.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, and specifically relates to a bitmap storage method, apparatus, device and storage medium. Background Technology

[0002] As storage application demands increase, users need to protect data online. Snapshots are one of the effective methods for preventing data loss using online storage devices. When the original data is being processed in online applications, users can access the snapshot data and also use snapshots for testing and other tasks.

[0003] In related technologies, snapshot data is usually stored in the form of bitmaps. However, since snapshot data is generated periodically, there are problems with large data volume and large storage space consumption in the scenario of periodically storing bitmap data. Summary of the Invention

[0004] The purpose of this application is to provide a bitmap storage method, apparatus, device, and storage medium that can solve the problem of large data volume and large storage space occupation in the scenario of periodically storing bitmap data in related technologies.

[0005] In a first aspect, embodiments of this application provide a bitmap storage method, the method comprising: when a first bitmap is obtained, obtaining a second bitmap from a stored set of first bitmaps whose matching degree with the first bitmap satisfies a preset matching condition to obtain a first target bitmap, wherein the set of first bitmaps includes a plurality of second bitmaps; performing an XOR operation on the first bitmap and the first target bitmap to determine a first difference bitmap between the first bitmap and the first target bitmap; and storing the first difference bitmap.

[0006] Secondly, embodiments of this application provide a bitmap storage device, the device comprising: an acquisition module, configured to, upon acquiring a first bitmap, acquire a second bitmap from a stored set of first bitmaps whose matching degree with the first bitmap satisfies a preset matching condition, thereby obtaining a first target bitmap, wherein the set of first bitmaps includes a plurality of second bitmaps; a determination module, configured to perform an XOR operation on the first bitmap and the first target bitmap to determine a first difference bitmap between the first bitmap and the first target bitmap; and a storage module, configured to store the first difference bitmap.

[0007] Thirdly, embodiments of this application provide an electronic device, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor. When the program or instructions are executed by the processor, they implement the steps of the bitmap storage method as described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the bitmap storage method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the steps of the bitmap storage method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the steps of the bitmap storage method as described in the first aspect.

[0011] In this embodiment, the first bitmap set may include multiple existing second bitmaps. When a new bitmap, i.e., the first bitmap, is obtained, a second bitmap whose matching degree with the first bitmap meets a preset matching condition can be obtained from the stored first bitmap set and used as the first target bitmap. Based on this, the first bitmap and the first target bitmap can be XORed to determine the first difference bitmap between the first bitmap and the first target bitmap. The first target bitmap is an existing bitmap, so some bits of the first bitmap can be represented by the existing first target bitmap. Thus, after determining the mismatched part between the new bitmap and the existing bitmap, i.e., the first difference bitmap, only the first difference bitmap needs to be stored, realizing flexible reuse of existing bitmaps. Compared with directly storing the first bitmap, this reduces the amount of data stored and saves storage space. Attached Figure Description

[0012] Figure 1 This is a schematic flowchart of a bitmap storage method provided in an embodiment of this application;

[0013] Figure 2 This is a flowchart illustrating a bitmap storage method provided in another embodiment of this application;

[0014] Figure 3 This is a schematic diagram illustrating an example of a bitmap storage method provided in another embodiment of this application;

[0015] Figure 4 This is a schematic diagram illustrating an example of a bitmap storage method provided in another embodiment of this application;

[0016] Figure 5 This is a schematic diagram illustrating an example of a bitmap storage method provided in another embodiment of this application;

[0017] Figure 6 This is a schematic diagram illustrating an example of a bitmap storage method provided in another embodiment of this application;

[0018] Figure 7 This is a schematic diagram of the structure of a bitmap storage device provided in an embodiment of this application;

[0019] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;

[0020] Figure 9 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0022] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0023] First, the technical terms involved in the technical solutions provided in the embodiments of this application will be introduced:

[0024] Bitmap: A set of bits, each of which represents a state, either 0 or 1.

[0025] Bitmap operations: Operations between bitmaps, such as XOR operation, crossover and complement operation, etc.

[0026] As the background technology suggests, with the increasing demands of storage applications, users need to protect data online. Snapshots are one of the effective methods for preventing data loss using online storage devices. When the original data is being processed in online applications, users can access the snapshot data and also use snapshots for testing and other tasks. Related technologies typically use bitmaps to store snapshot data. However, since snapshot data is generated periodically, scenarios involving periodically storing bitmap data suffer from large data volumes and significant storage space requirements.

[0027] To address the problems in related technologies, this application provides a bitmap storage method. The first bitmap set can include multiple existing second bitmaps. When a new bitmap, i.e., the first bitmap, is obtained, a second bitmap whose matching degree with the first bitmap meets a preset matching condition can be obtained from the stored first bitmap set and used as the first target bitmap. Based on this, an XOR operation can be performed on the first bitmap and the first target bitmap to determine the first difference bitmap between the first bitmap and the first target bitmap. The first target bitmap is an existing bitmap, so some bits of the first bitmap can be represented by the existing first target bitmap. Thus, after determining the mismatched portion between the new bitmap and the existing bitmaps, i.e., the first difference bitmap, only the first difference bitmap needs to be stored, achieving flexible reuse of existing bitmaps. Compared to directly storing the first bitmap, this reduces data storage volume and saves storage space, solving the problem of large data volume and large storage space occupation in scenarios where bitmap data is stored periodically in related technologies.

[0028] The bitmap storage method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0029] Figure 1 This is a schematic flowchart of a bitmap storage method provided in an embodiment of this application. The execution subject of this bitmap storage method can be an electronic device. It should be noted that the above-mentioned execution subject does not constitute a limitation on this application.

[0030] like Figure 1 As shown, the bitmap storage method provided in this application embodiment may include steps 110-130.

[0031] Step 110: If the first bit image is obtained, obtain the second bit image from the stored set of first bit images that matches the first bit image with a preset matching condition, and obtain the first target bit image.

[0032] The first bitmap set includes multiple second bitmaps, which are existing bitmaps previously stored in the electronic device. The first bitmap set is a bitmap pool used to store existing bitmaps.

[0033] In one embodiment, the preset matching conditions may include: the second bitmap with the highest or lowest matching degree with the first bitmap is the first target bitmap.

[0034] Step 120: Perform an XOR operation on the first bitmap and the first target bitmap to determine the first difference bitmap between the first bitmap and the first target bitmap.

[0035] Specifically, by performing an XOR operation on the first bitmap and the first target bitmap, a fourth bitmap can be obtained. The electronic device can determine that the fourth bitmap is the first difference bitmap, or it can determine the first difference bitmap based on the fourth bitmap.

[0036] In one example, the first bitmap is X (0001111011) and the first target bitmap is A (1101111011). XORing the first bitmap and the first target bitmap yields the fourth bitmap. Based on this, electronic devices can directly determine For the first difference bitmap, or continue based on Determine the first difference bitmap.

[0037] Step 130: Store the first difference bitmap.

[0038] Specifically, the first difference bitmap can be stored in memory.

[0039] Referring to the example above, the electronic device directly determines... In the case of a first-difference bitmap, it can be stored directly in memory. (1100000000), since the number of 1s in a bitmap represents its density, a denser bitmap occupies more storage space. Therefore, compared to storing the first bitmap X (0001111011), storing... (1100000000) occupies less storage space, and through Using the existing first target bitmap A (1101111011) and (1100000000) can also easily restore the first image X (0001111011).

[0040] The bitmap storage method provided in this application embodiment includes a first bitmap set that may include multiple existing second bitmaps. When a new bitmap, i.e., a first bitmap, is obtained, a second bitmap whose matching degree with the first bitmap meets a preset matching condition can be obtained from the stored first bitmap set and used as the first target bitmap. Based on this, the first bitmap and the first target bitmap can be XORed to determine the first difference bitmap between the first bitmap and the first target bitmap. The first target bitmap is an existing bitmap, so some bits of the first bitmap can be represented by the existing first target bitmap. Thus, after determining the mismatched part between the new bitmap and the existing bitmap, i.e., the first difference bitmap, only the first difference bitmap needs to be stored, realizing flexible reuse of existing bitmaps. Compared with directly storing the first bitmap, this reduces the amount of data stored and saves storage space.

[0041] The following detailed description of steps 110-130, with reference to specific embodiments, is provided below.

[0042] In step 110, if the first bit image is obtained, a second bit image in the stored set of first bit images that matches the first bit image with a preset matching condition is obtained, and the first target bit image is obtained.

[0043] In some embodiments of this application, step 110 may specifically include: calculating the matching degree between the first bitmap and each second bitmap; and determining the second bitmap with the highest or lowest matching degree with the first bitmap as the first target bitmap.

[0044] The matching degree is positively correlated with the number of identical bit values ​​(identical number of bits) in the first and second bit maps.

[0045] For example, the matching degree between the first and second bitmaps can be the ratio of the number of identical bits in the first and second bitmaps to the number of bits in the first bitmap. If the number of identical bits between the first bitmap X (0001111011) and the second bitmap A (1101111011) is 8, and the number of identical bits between the first bitmap X (0001111011) and the second bitmap C (1101110011) is 7, then the matching degree between X and A is 80%, and the matching degree between X and A is 70%.

[0046] In some embodiments of this application, since the first bit image set contains multiple second bit images, and each second bit image has a large number of bits, comparing the first bit image with all the second bit images bit by bit is time-consuming. In order to save comparison time and improve the efficiency of matching degree calculation, the preset matching conditions include the highest or lowest matching degree with the first bit image. Figure 2 This is a flowchart illustrating a bitmap storage method according to another embodiment of this application. Step 110 may include... Figure 2 Steps 210-240 are shown.

[0047] Step 210: Obtain the M first-position values ​​corresponding to the M target indices in the first-position image, and the M second-position values ​​corresponding to the M target indices in each second-position image.

[0048] The target index can be obtained by random sampling, and the number M of the target index can be set according to specific needs. This application does not make specific limitations here.

[0049] Step 220: Based on the similarity between the M first-order values ​​and the M second-order values, determine N third-order bitmaps among the multiple second-order bitmaps.

[0050] The similarity can be the ratio of the number of identical bit values ​​corresponding to the first and second bit values ​​to M; multiple second bit images can be sorted in descending order of similarity; the third bit image can be either the first N / 2 or the last N / 2 second bit images, and N can be set according to specific needs, which is not specifically limited in this application.

[0051] For example, M is 2, the first image is J (000111), and the second image is K (111011). The target index ranges from 0 to 5. If two target indices are randomly sampled and index = {3, 4}, then the two first-position values ​​corresponding to {3, 4} in the first image J (000111) are 1 and 1, and the two second-position values ​​corresponding to {3, 4} in the second image K (111011) are 0 and 1. Therefore, the similarity between the first image J and the second image K is 1 / 2 = 50%.

[0052] Step 230: Calculate the matching degree between the first bitmap and each third bitmap.

[0053] The matching degree is positively correlated with the number of identical digits in the first and third bitmaps. For example, the matching degree can be the ratio of the number of identical digits in the first and third bitmaps to the number of digits in the first bitmap.

[0054] Step 240: Determine the third bitmap, which has the highest or lowest matching degree with the first bitmap, as the first target bitmap.

[0055] In this embodiment, by randomly selecting M target indices and comparing the bit values ​​at the M target indices of the first bitmap and the second bitmap, third bitmaps with high or low approximate similarity to the first bitmap can be initially screened. Based on this, the electronic device only needs to perform a bit-by-bit comparison between the first bitmap and N third bitmaps. Compared to performing a bit-by-bit comparison between the first bitmap and all second bitmaps, this reduces the number of bitmap comparisons, saves comparison time, and improves the efficiency of matching degree calculation.

[0056] In some embodiments of this application, after step 230, the method may further include: if the matching degree between the N third bitmaps and the first bitmap is within a preset matching degree range, directly storing the first bitmap.

[0057] In step 120, the first bitmap and the first target bitmap are XORed to determine the first difference bitmap between the first bitmap and the first target bitmap.

[0058] In some embodiments of this application, the preset matching criteria may include the highest matching degree with the first image. Figure 3 This is a flowchart illustrating a bitmap storage method provided in another embodiment of this application. Step 120 may include... Figure 3 Steps 310-340 are shown.

[0059] Step 310: If the first target bitmap and the first bitmap have the highest matching degree, perform XOR processing on the first bitmap and the first target bitmap to obtain the fourth bitmap.

[0060] Specifically, based on the fourth bitmap obtained, the electronic device determines a first difference bitmap, which may include a first sub-bitmap and a second sub-bitmap.

[0061] For example, the first bitmap is X (0001111011), the first target bitmap is A (1101111011), and after X and A are XORed, the fourth bitmap is obtained. (1100000000).

[0062] Step 320: Obtain the first intersection of the first bitmap and the first target bitmap.

[0063] Referring to the example above, the first image is X (0001111011), and the fourth image is... If (1100000000), then take the union of the two to obtain the first intersection X∩A(0001111011).

[0064] Step 330: Calculate the first sub-bitmap based on the intersection of the fourth bitmap and the first bitmap.

[0065] The first sub-bitmap is used to represent the redundant part of the first bitmap relative to the first target bitmap.

[0066] Specifically, the first sub-bitmap can be calculated based on formula (1).

[0067]

[0068] in, This is the first sub-map. This is the fourth bitmap, and A∩X is the first intersection.

[0069] Step 340: Calculate the second sub-bitmap based on the first target bitmap and the first intersection.

[0070] The second sub-bitmap is used to represent the missing part of the first bitmap relative to the first target bitmap.

[0071] Specifically, the second sub-bitmap can be calculated based on formula (2).

[0072]

[0073] in, Let A be the second sub-bitmap, A be the first target bitmap, and A∩X be the first intersection.

[0074] In this embodiment, when the matching degree between the first target bitmap and the first bitmap is high, the mismatch is only a small part of the first bitmap. Therefore, it is only necessary to determine and store this mismatch. Specifically, since the mismatch can be divided into the redundant part and the missing part of the first bitmap relative to the first target bitmap, the electronic device can obtain the first intersection based on the first bitmap and the first target bitmap based on the fourth bitmap. Based on the fourth bitmap and the first intersection, the redundant part (first sub-bitmap) of the first bitmap relative to the first target bitmap is determined, and the missing part (second sub-bitmap) of the first bitmap relative to the first target bitmap is determined based on the first target bitmap and the first intersection. In this way, the electronic device only needs to store the first sub-bitmap and the second sub-bitmap. The first bitmap can be restored using the first sub-bitmap, the second sub-bitmap, and the existing first target bitmap. This achieves new bitmap data storage based on the reuse of existing bitmap data, which can effectively save storage space compared to directly storing the first bitmap.

[0075] In other embodiments of this application, the preset matching conditions may include the lowest matching degree with the first image. Figure 4 This is a flowchart illustrating a bitmap storage method provided in another embodiment of this application. Step 120 may include... Figure 4 Steps 410-450 are shown.

[0076] Step 410: If the matching degree between the first target bitmap and the first bitmap is the lowest, perform bit-by-bit inversion on the first target bitmap to obtain the fifth bitmap.

[0077] In some embodiments, this application may be based on a first target bitmap B, and the mismatch between the first target bitmap B and the first bitmap X. Restore the first image X, where... Can be broken down into Two parts, Used to characterize the redundant portion of the first bitmap X relative to the first target bitmap B. The restoration expression for the first bitmap X, used to characterize the missing portion of the first bitmap X relative to the first target bitmap B, is shown in formula (3):

[0078]

[0079] For example, the first bitmap X is (0001110101), the first target bitmap B is (1110111010), and the matching portion of B and X. (0000110000) has only 2 bits that are 1, but the mismatched part (1111001111) has 8 bits that are 1, so the storage cost of the mismatched part is obviously high. The storage cost of the matching part is relatively high. It is very small, therefore, when the matching degree between the first bitmap and the first target bitmap is low, if... As the first difference bitmap, its storage cost is relatively high. Therefore, this application can perform bitwise inversion on B to obtain the fifth bitmap B. ′ =~B=(0001000101), using the fifth bitmap B ′ Implement bitmap reuse based on worst-case matching.

[0080] Step 420: Perform an XOR operation on the first bitmap and the fifth bitmap to obtain the sixth bitmap.

[0081] For example, the first bit image X is (0001110101), the fifth bit image B′ is (0001000101), and after XORing X and A, the sixth bit image n is obtained. B X′ (0000110000).

[0082] Step 430: Obtain the second intersection of the first bitmap and the fifth bitmap.

[0083] Referring to the example above, the first image X is (0001110101), and the fifth image B′ is (0001000101). Taking the union of the two, we get the second intersection B′∩X(0001000101).

[0084] Step 440: Calculate the first sub-bitmap based on the intersection of the sixth bitmap and the second bitmap.

[0085] The first sub-bitmap is used to represent the redundant part of the first bitmap relative to the fifth bitmap.

[0086] Specifically, the first sub-bitmap can be calculated based on formula (4).

[0087]

[0088] in, This is the first sub-map. This is the sixth bitmap, and B′∩X is the second intersection.

[0089] Step 450: Calculate the second sub-bitmap based on the intersection of the fifth bitmap and the second bitmap.

[0090] The second sub-bitmap is used to represent the missing part of the first bitmap relative to the fifth bitmap.

[0091] Specifically, the second sub-bitmap can be calculated based on formula (5).

[0092]

[0093] in, B is the second sub-bitmap, B′ is the fifth bitmap, and B′∩X is the second intersection.

[0094] In some embodiments of this application, a fifth bitmap B is obtained by bit-inverting the first target bitmap B. ′ Then, the matching and non-matching parts are swapped, resulting in the fifth bitmap B. ′ Matching part with X Fifth Figure B ′ The part that does not match X This application can now be based on the fifth bitmap, and the fifth bitmap B. ′ The part that does not match X Restore the first image X. Can be broken down into The two parts are restored as shown in formula (6):

[0095]

[0096] In this embodiment, when the matching degree between the first target bitmap and the first bitmap is low, the matching part is only a small part of the first bitmap. Therefore, by performing bitwise inversion on the first target bitmap, the original matching part becomes the mismatched part, and the original mismatched part becomes the matching part. Thus, the matching degree between the fifth bitmap obtained by bitwise inversion and the first bitmap is high. Based on this, bitmap operations can be performed on the fifth bitmap to determine the mismatched part between the fifth bitmap and the first bitmap (i.e., the sixth bitmap), and this mismatched part can be split into the redundant part and the missing part of the first bitmap relative to the fifth bitmap. Specifically, the electronic device can obtain a second intersection based on the fifth bitmap, the first bitmap, and the fifth bitmap, and determine the redundant part of the first bitmap relative to the fifth bitmap (the first sub-bitmap) based on the sixth bitmap and the second intersection, and determine the missing part of the first bitmap relative to the fifth bitmap (the second sub-bitmap) based on the fifth bitmap and the second intersection. In this way, the electronic device only needs to store the first sub-bitmap and the second sub-bitmap. Even if the existing first target bitmap has a low matching degree with the first bitmap, the fifth bitmap can be obtained by bit-inverting the first target bitmap. Then, based on the fifth bitmap, the first bitmap can be restored by combining the first and second sub-bitmaps. This realizes the storage of new bitmap data based on the reuse of existing bitmap data. Compared with directly storing the first bitmap, it can effectively save storage space and improve the diversity of reuse methods, realizing the reuse based on the bitmap with the lowest matching degree.

[0097] In some other embodiments of this application, the preset matching condition may include the lowest matching degree with the first bitmap. Step 120 may specifically include the following steps: when the matching degree between the first target bitmap and the first bitmap is the lowest, the first target bitmap and the first bitmap are respectively subjected to bit-by-bit inversion to obtain the fifth bitmap and the seventh bitmap; the third intersection of the fifth bitmap and the seventh bitmap is obtained to obtain the first sub-bitmap; the fourth intersection of the first target bitmap and the first bitmap is obtained to obtain the second sub-bitmap.

[0098] Specifically, the seventh bitmap is obtained by inverting the first bitmap bitwise. If the first target bitmap is B, the first bitmap is X, the fifth bitmap is ~B, and the seventh bitmap is ~X, then the first sub-bitmap... Second child diagram

[0099] Thus, this application can be based on the fifth bitmap and the matching portion of the first target bitmap B and X. Restore the first image X. Can be broken down into Two parts, The restoration expression is shown in formula (7):

[0100]

[0101] Step 130 involves storing the first difference bitmap.

[0102] In some embodiments of this application, the first bitmap set may also include a second bitmap set corresponding to each second bitmap, and step 130 may specifically include: storing the first sub-bitmap and the second sub-bitmap in the third bitmap set and the fourth bitmap set, respectively.

[0103] Specifically, each second bitmap in the first bitmap set has a corresponding second bitmap set, which is used to store the mismatch between the new bitmap (including the first bitmap) and the first target bitmap. This second bitmap set can be divided into two parts: a third bitmap set and a fourth bitmap set. The third bitmap set can store the redundant parts of the new bitmap (including the first bitmap) relative to the first target bitmap, and the fourth bitmap set can store the missing parts of the new bitmap (including the first bitmap) relative to the first target bitmap.

[0104] In this embodiment, since the fourth bitmap is obtained by XORing the first target bitmap and the first bitmap, restoring the first bitmap based on the fourth bitmap and the first target bitmap requires bitmap calculations using the XOR operation principle, which is cumbersome. Therefore, the electronic device can split the first difference bitmap into the redundant and missing parts of the first bitmap relative to the first target bitmap, obtaining a first sub-bitmap and a second sub-bitmap. Thus, when restoring the first bitmap, it is only necessary to subtract the redundant parts and add the missing parts from the first target bitmap. In other words, the electronic device can restore the first bitmap by performing subtraction and union operations on the first sub-bitmap and the second bitmap, eliminating the need for bitmap calculations using the XOR operation principle and simplifying the calculation process.

[0105] In related technologies, reading snapshot data requires loading data from disk into memory, which is inefficient. Furthermore, the overhead of this operation includes not only the necessary CPU overhead but also a large amount of input / output I / O transfer overhead.

[0106] In some embodiments of this application, in order to improve the reading efficiency of bitmap data, after step 130, the method may further include the following steps: determining the first operation path corresponding to the first bitmap based on the first target bitmap and the first difference bitmap; reading the first bitmap based on the first operation path to obtain bitmap data.

[0107] In one embodiment, the first difference bitmap can be a fourth bitmap, in which case the first operation path can be determined based on the fourth bitmap and the first target bitmap.

[0108] Specifically, the first operation path can be as shown in formula (8).

[0109]

[0110] in, A is the fourth bitmap, A is the first target bitmap, and X is the first bitmap.

[0111] In another embodiment, the first difference bitmap includes a first sub-bitmap and a second sub-bitmap, and the first operation path can be determined based on the first sub-bitmap, the second sub-bitmap and the first target bitmap.

[0112] Specifically, the first operation path can be shown in formula (9).

[0113]

[0114] in, This is the first sub-map. A is the second sub-bitmap, A is the first target bitmap, and X is the first bitmap.

[0115] In this embodiment, since a bitmap can be represented by multiple bitmaps, this application can reuse existing bitmaps, storing only the first difference bitmap in memory. A new bitmap can be reconstructed using the original first target bitmap and the stored first difference bitmap, reducing the storage overhead of the new bitmap. Furthermore, when reading bitmap data, the electronic device can read the first bitmap from memory based on the first processing path, which speeds up bitmap data access compared to loading data from disk into memory.

[0116] In some embodiments of this application, to further reduce the storage amount of bitmap data, the first bitmap set also includes a second bitmap set corresponding to each second bitmap, the second bitmap set including multiple sub-bitmaps, and a fifth bitmap set corresponding to each sub-bitmap. Figure 5 This is a flowchart illustrating a bitmap storage method provided in another embodiment of this application. Step 130 may include... Figure 5 Steps 510-540 are shown.

[0117] Step 510: Calculate the matching degree of each sub-bitmap in the second bitmap set corresponding to the first difference bitmap and the first target bitmap.

[0118] The matching degree is positively correlated with the number of identical bits corresponding to the first difference bitmap and the sub-bitmap. For example, the matching degree can be the ratio of the number of identical bits corresponding to the first difference bitmap and the sub-bitmap to the number of bits in the first difference bitmap.

[0119] For example, the first target bitmap is A, and the first difference bitmap is A. Then the electronic device can calculate The degree of matching with all sub-bitmaps in A's bitmap pool (second bitmap set).

[0120] Step 520: Determine the sub-bitmap with the highest or lowest matching degree to the first difference bitmap as the second target bitmap.

[0121] Step 530: Perform an XOR operation on the first difference bitmap and the second target bitmap to determine the second difference bitmap between the first difference bitmap and the second target bitmap.

[0122] The second difference bitmap is the part that does not match between the first difference bitmap and the second target bitmap.

[0123] Specifically, if the second target bitmap is the sub-bitmap with the highest matching degree to the first difference bitmap, the electronic device can directly perform XOR processing on the first difference bitmap and the second target bitmap to determine the second difference bitmap between the first difference bitmap and the second target bitmap; or, if the second target bitmap is the sub-bitmap with the lowest matching degree to the first difference bitmap, the electronic device can first perform bit-inverting processing on the second target bitmap, and then perform XOR processing on the first difference bitmap and the bit-inverted second target bitmap to determine the second difference bitmap between the first difference bitmap and the second target bitmap.

[0124] In one example, If the matching degree with sub-bitmap E1 in the bitmap pool of A is the highest, then it can be calculated by XOR operation. The mismatch with sub-bitmap E1 yields a second difference bitmap; or, in If the matching degree with sub-bitmap E1 in the bitmap pool of A is the highest, then sub-bitmap E1 can be bitwise inverted to obtain ~E1, and then calculated using XOR. The mismatch with ~E1 is used to obtain the second difference bitmap.

[0125] It should be noted that the method for determining the second difference bitmap in step 530 is similar to that in step 120; that is, this application can adopt... Figure 3 or Figure 4 The method shown determines the second difference bitmap between the first difference bitmap and the second target bitmap.

[0126] Step 540: Store the second difference bitmap in the fifth bitmap set corresponding to the second target bitmap.

[0127] The fifth bitmap set is used to store the mismatched parts between the first difference bitmap and the second target bitmap.

[0128] In this embodiment, the second bitmap set corresponding to the first target bitmap includes multiple existing sub-bitmaps. Based on this, the electronic device can obtain the second target bitmap with the highest or lowest matching degree with the first difference bitmap from all the sub-bitmaps. The second target bitmap can be used to represent the matching part between the first difference bitmap and the first target bitmap. Specifically, the electronic device can determine the mismatch part (second difference bitmap) between the second target bitmap and the first difference bitmap. Since the first difference bitmap can be restored using the second target bitmap and the second difference bitmap, the second difference bitmap can be directly stored. Compared with storing the first difference bitmap, this improves the utilization rate of existing bitmap data, further reduces the amount of bitmap data stored, and saves storage space.

[0129] In some other embodiments of this application, step 130 may specifically include: when the second bitmap set corresponding to the first target bitmap is an empty set, storing a first difference bitmap in the second bitmap set corresponding to the first target bitmap.

[0130] In some embodiments of this application, to optimize the access path of bitmap data, the first bitmap set further includes a second bitmap set corresponding to each second bitmap, and the second bitmap set includes multiple sub-bitmaps. Figure 6 This is a flowchart illustrating a bitmap storage method provided in another embodiment of this application, as shown below. Figure 6 As shown, after determining the first difference bitmap between the first bitmap and the first target bitmap in step 120, the method may further include steps 610-660.

[0131] Step 610: Obtain the sub-bitmaps in the second bitmap set whose matching degree with the first difference bitmap satisfies the preset matching conditions, and obtain the second target bitmap.

[0132] Step 620: Based on the first target bitmap, the second target bitmap, and the second difference bitmap, determine the second operation path corresponding to the first bitmap.

[0133] The second difference bitmap is the mismatched part between the first difference bitmap and the second target bitmap.

[0134] Step 630: Create a third target bitmap based on the portion of the computation path in the second computation path that is associated with the first target bitmap and the second target bitmap.

[0135] The third target bitmap is the result of the operation of a part of the operation path associated with the first target bitmap and the second target bitmap.

[0136] For example, the second operation path is {A∪B∪C}, where the first target bitmap is A and the second target bitmap is B. Then, the part of the operation path associated with the first target bitmap and the second target bitmap is A∪B, and a third target bitmap E2 = A∪B can be created.

[0137] Step 640: Add the third target bitmap to the first bitmap set.

[0138] Step 650: Based on the third target bitmap and the second difference bitmap, determine the third operation path corresponding to the first bitmap.

[0139] Step 660: Read the first bitmap based on the third operation path to obtain bitmap data.

[0140] Referring to the example above, after creating the third target bitmap E2, the first bitmap can be directly reconstructed based on the third target bitmap E2 and the second difference bitmap C, resulting in the third operation path {E2∪C} corresponding to the first bitmap. In this way, the electronic device can directly read the first bitmap based on {E2∪C} to obtain the bitmap data.

[0141] In this embodiment, if the second operation path used to restore the first bitmap contains multiple existing bitmaps, the computational cost between these multiple existing bitmaps is high. Therefore, a portion of the second operation path containing existing bitmaps can be extracted, and a third target bitmap can be created based on this portion. This third target bitmap is then used to replace the computational process between the multiple existing bitmaps, simplifying the second operation path and resulting in the third operation path. Thus, when reading the first bitmap using the third operation path, only the third target bitmap and the second difference bitmap need to be accessed and bitmap operations performed, effectively improving the access efficiency of the first bitmap and compressing and optimizing the access path for bitmap data.

[0142] In some embodiments of this application, step 620 may specifically include: determining a portion of the computation path in the second computation path that is associated with the first target bitmap and the second target bitmap as the first target computation path; if a second target computation path that overlaps with the first target computation path is found in the database, creating a third target bitmap based on the first target computation path; the method may further include: replacing the portion of the second target computation path that overlaps with the first target computation path with the first target computation path.

[0143] The database can store multiple bitmaps corresponding to computation paths. Each computation path can access or read a bitmap that is not stored in an electronic device. Part of the second target computation path overlaps with the first target computation path.

[0144] It should be noted that the bitmap storage method provided in this application embodiment can be executed by a bitmap storage device or a control module within that bitmap storage device for executing the bitmap storage method. This application embodiment uses the execution of the bitmap storage method by a bitmap storage device as an example to illustrate the bitmap storage device provided in this application embodiment. The bitmap storage device will be described in detail below.

[0145] Figure 7 This is a schematic diagram of the structure of a bitmap storage device provided in this application.

[0146] like Figure 7 As shown in the figure, this application provides a bitmap storage device 700, which includes an acquisition module 710, a determination module 720 and a storage module 730.

[0147] The acquisition module 710 is used to acquire, when the first bit image is acquired, a second bit image from the stored set of first bit images that matches the first bit image with a preset matching condition, to obtain a first target bit image, wherein the set of first bit images includes multiple second bit images; the determination module 720 is used to perform XOR processing on the first bit image and the first target bit image to determine a first difference bit image between the first bit image and the first target bit image; the storage module 730 is used to store the first difference bit image.

[0148] In some embodiments of this application, the preset matching conditions include the highest or lowest matching degree with the first bit image. The acquisition module 710 includes: an acquisition unit, used to acquire M first-position values ​​corresponding to M target subscripts in the first bit image, and M second-position values ​​corresponding to M target subscripts in each second bit image; a determination unit, used to determine N third bit images among the multiple second bit images based on the similarity between the M first-position values ​​and the M second-position values; a calculation unit, used to calculate the matching degree between the first bit image and each third bit image; and the determination unit is further used to determine the third bit image with the highest or lowest matching degree with the first bit image as the first target bit image.

[0149] In some embodiments of this application, the first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The determining module 720 includes: a calculation unit, configured to perform an XOR operation on the first bitmap and the first target bitmap to obtain a fourth bitmap when the matching degree between the first target bitmap and the first bitmap is the highest; an acquisition unit, configured to acquire a first intersection of the first bitmap and the first target bitmap; a calculation unit, configured to calculate the first sub-bitmap based on the fourth bitmap and the first intersection; and the calculation unit is further configured to calculate the second sub-bitmap based on the first target bitmap and the first intersection.

[0150] In some embodiments of this application, the first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The determining module 720 includes: a calculation unit, configured to perform bitwise inversion on the first target bitmap to obtain a fifth bitmap when the matching degree between the first target bitmap and the first bitmap is the lowest; a calculation unit, further configured to perform XOR operation on the first bitmap and the fifth bitmap to obtain a sixth bitmap; an acquisition unit, configured to acquire a second intersection of the first bitmap and the fifth bitmap; a calculation unit, configured to calculate the first sub-bitmap based on the sixth bitmap and the second intersection; and a calculation unit, further configured to calculate the second sub-bitmap based on the fifth bitmap and the second intersection.

[0151] In some embodiments of this application, the apparatus further includes: a determining module 720, configured to determine a first operation path corresponding to the first bitmap based on the first target bitmap and the first difference bitmap after storing the first difference bitmap; and a reading module, configured to read the first bitmap based on the first operation path to obtain bitmap data.

[0152] In some embodiments of this application, the first bitmap set further includes a second bitmap set corresponding to each second bitmap, and the second bitmap set includes multiple sub-bitmaps. The device further includes: an acquisition module 710, which is further configured to, after determining a first difference bitmap between the first bitmap and the first target bitmap, acquire a sub-bitmap in the second bitmap set whose matching degree with the first difference bitmap satisfies a preset matching condition, to obtain a second target bitmap; a determination module 720, which is further configured to determine a second operation path corresponding to the first bitmap based on the first target bitmap, the second target bitmap, and the second difference bitmap, wherein the second difference bitmap is the mismatched part between the first difference bitmap and the second target bitmap; a creation module, which is configured to create a third target bitmap based on a portion of the operation path in the second operation path that is associated with the first target bitmap and the second target bitmap; an addition module, which is configured to add the third target bitmap to the first bitmap set; a determination module 720, which is configured to determine a third operation path corresponding to the first bitmap based on the third target bitmap and the second difference bitmap; and a reading module, which is configured to read the first bitmap based on the third operation path to obtain bitmap data.

[0153] The bitmap storage device provided in this application embodiment can include a set of first bitmaps that may contain multiple existing second bitmaps. When a new bitmap, i.e., a first bitmap, is obtained, a second bitmap whose matching degree with the first bitmap meets a preset matching condition can be obtained from the stored set of first bitmaps and used as the first target bitmap. Based on this, the first bitmap and the first target bitmap can be XORed to determine the first difference bitmap between the first bitmap and the first target bitmap. The first target bitmap is an existing bitmap, so some bits of the first bitmap can be represented by the existing first target bitmap. Thus, after determining the mismatched part between the new bitmap and the existing bitmap, i.e., the first difference bitmap, only the first difference bitmap needs to be stored, realizing flexible reuse of existing bitmaps. Compared with directly storing the first bitmap, this reduces the amount of data stored and saves storage space.

[0154] The bitmap storage device provided in this application embodiment can achieve... Figures 1-6 The various processes implemented by the electronic device in the method embodiment will not be described again here to avoid repetition.

[0155] The bitmap storage device in this application embodiment can be an electronic device, or a component, integrated circuit, or chip within an electronic device. The electronic device can be a terminal, or any other device besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television set (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0156] The bitmap storage device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0157] Optionally, such as Figure 8 As shown, this application embodiment also provides an electronic device 800, including a processor 801, a memory 802, and a program or instructions stored in the memory 802 and executable on the processor 801. When the program or instructions are executed by the processor 801, they implement the various processes of the bitmap storage method embodiment described above and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0158] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0159] Figure 9 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application.

[0160] The electronic device 900 includes, but is not limited to, components such as: radio frequency unit 901, network module 902, audio output unit 903, input unit 904, sensor 905, display unit 906, user input unit 907, interface unit 908, memory 909, and processor 910.

[0161] Those skilled in the art will understand that the electronic device 900 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 910 through a power management system, thereby enabling the management of charging, discharging, and power consumption through the power management system. Figure 9 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0162] The processor 910 is configured to, upon obtaining a first bit image, acquire a second bit image from a stored set of first bit images whose matching degree with the first bit image satisfies a preset matching condition, thereby obtaining a first target bit image, wherein the set of first bit images includes multiple second bit images; the processor 910 is also configured to perform an XOR operation on the first bit image and the first target bit image to determine a first difference bit image between the first bit image and the first target bit image; the memory 909 is configured to store the first difference bit image.

[0163] In this embodiment, the first bitmap set may include multiple existing second bitmaps. When a new bitmap, i.e., the first bitmap, is obtained, a second bitmap whose matching degree with the first bitmap meets a preset matching condition can be obtained from the stored first bitmap set and used as the first target bitmap. Based on this, the first bitmap and the first target bitmap can be XORed to determine the first difference bitmap between the first bitmap and the first target bitmap. The first target bitmap is an existing bitmap, so some bits of the first bitmap can be represented by the existing first target bitmap. Thus, after determining the mismatched part between the new bitmap and the existing bitmap, i.e., the first difference bitmap, only the first difference bitmap needs to be stored, realizing flexible reuse of existing bitmaps. Compared with directly storing the first bitmap, this reduces the amount of data stored and saves storage space.

[0164] In some embodiments of this application, the preset matching conditions include the highest or lowest matching degree with the first bit image. The processor 910 is specifically used to: obtain M first-position values ​​corresponding to M target subscripts in the first bit image, and M second-position values ​​corresponding to M target subscripts in each second bit image; determine N third bit images among the multiple second bit images based on the similarity between the M first-position values ​​and the M second-position values; calculate the matching degree between the first bit image and each third bit image; and determine the third bit image with the highest or lowest matching degree with the first bit image as the first target bit image.

[0165] In some embodiments of this application, the first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The processor 910 is specifically configured to: when the first target bitmap and the first bitmap have the highest matching degree, perform XOR processing on the first bitmap and the first target bitmap to obtain a fourth bitmap; obtain the first intersection of the first bitmap and the first target bitmap; calculate the first sub-bitmap based on the fourth bitmap and the first intersection; and calculate the second sub-bitmap based on the first target bitmap and the first intersection.

[0166] In some embodiments of this application, the first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The processor 910 is specifically configured to: when the matching degree between the first target bitmap and the first bitmap is the lowest, perform bitwise inversion on the first target bitmap to obtain a fifth bitmap; perform XOR operation on the first bitmap and the fifth bitmap to obtain a sixth bitmap; obtain a second intersection of the first bitmap and the fifth bitmap; calculate the first sub-bitmap based on the sixth bitmap and the second intersection; and calculate the second sub-bitmap based on the fifth bitmap and the second intersection.

[0167] In some embodiments of this application, the processor 910 is further configured to, after storing the first difference bitmap, determine the first operation path corresponding to the first bitmap based on the first target bitmap and the first difference bitmap; and read the first bitmap based on the first operation path to obtain bitmap data.

[0168] In some embodiments of this application, the first bitmap set further includes a second bitmap set corresponding to each second bitmap. The second bitmap set includes multiple sub-bitmaps. The processor 910 is further configured to: after determining the first difference bitmap between the first bitmap and the first target bitmap, obtain the sub-bitmap in the second bitmap set whose matching degree with the first difference bitmap satisfies a preset matching condition, and obtain the second target bitmap; determine the second operation path corresponding to the first bitmap based on the first target bitmap, the second target bitmap, and the second difference bitmap, wherein the second difference bitmap is the mismatched part between the first difference bitmap and the second target bitmap; create a third target bitmap based on the part of the operation path associated with the first target bitmap and the second target bitmap in the second operation path; add the third target bitmap to the first bitmap set; determine the third operation path corresponding to the first bitmap based on the third target bitmap and the second difference bitmap; and read the first bitmap based on the third operation path to obtain bitmap data.

[0169] It should be understood that, in this embodiment, the input unit 904 may include a graphics processing unit (GPU) 9041 and a microphone 9042. The GPU 9041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 906 may include a display panel 9061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 907 includes at least one of a touch panel 9071 and other input devices 9072. The touch panel 9071 is also called a touch screen. The touch panel 9071 may include two parts: a touch detection device and a touch controller. Other input devices 9072 may include, but are not limited to, physical keyboards, keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0170] The memory 909 can be used to store software programs and various data. The memory 909 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, N required application programs or instructions (such as sound playback, image playback, etc.). Furthermore, the memory 909 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 909 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0171] Processor 910 may include one or more processing units; optionally, processor 910 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 910.

[0172] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the bitmap storage method embodiments described above and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0173] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes a computer-readable storage medium, examples of which include non-transitory computer-readable storage media such as computer read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0174] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described bitmap storage method embodiments and achieve the same technical effect. To avoid repetition, it will not be described again here.

[0175] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0176] This application provides a computer program product that is stored in a storage medium and executed by at least one processor to implement the various processes of the bitmap storage method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0177] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to being performed in the order shown or discussed, but may also include performance in a substantially simultaneous manner or in the reverse order, for example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0178] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0179] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A bitmap storage method, characterized in that, include: If the first bitmap is obtained, a second bitmap that matches the first bitmap with a preset matching condition is obtained from the stored set of first bitmaps to obtain the first target bitmap, wherein the first bitmap set includes multiple second bitmaps; Perform an XOR operation on the first bitmap and the first target bitmap to determine the first difference bitmap between the first bitmap and the first target bitmap; Store the first difference bitmap; The first bitmap set further includes a second bitmap set corresponding to each second bitmap, the second bitmap set including multiple sub-bitmaps, and after determining the first difference bitmap between the first bitmap and the first target bitmap, the method further includes: Obtain the sub-bitmaps in the second bitmap set whose matching degree with the first difference bitmap satisfies the preset matching condition, and obtain the second target bitmap; Based on the first target bitmap, the second target bitmap, and the second difference bitmap, a second operation path corresponding to the first bitmap is determined, wherein the second difference bitmap is the mismatched part between the first difference bitmap and the second target bitmap; A third target bitmap is created based on the portion of the second operation path that is associated with the first target bitmap and the second target bitmap. Add the third target bitmap to the first bitmap set; Based on the third target bitmap and the second difference bitmap, determine the third operation path corresponding to the first bitmap; The first bitmap is read based on the third operation path to obtain bitmap data.

2. The method according to claim 1, characterized in that, The preset matching conditions include the highest or lowest matching degree with the first bitmap. The step of obtaining a second bitmap from the stored set of first bitmaps that matches the first bitmap with the preset matching conditions, to obtain the first target bitmap, includes: Obtain the M first-bit values ​​corresponding to the M target indices in the first bitmap, and the M second-bit values ​​corresponding to the M target indices in each second bitmap; Based on the similarity between the M first-position values ​​and the M second-position values, N third-position values ​​are determined from the plurality of second-position values; Calculate the matching degree between the first bitmap and each third bitmap; The third bitmap with the highest or lowest matching degree with the first bitmap is determined as the first target bitmap.

3. The method according to claim 1, characterized in that, The first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The step of XORing the first bitmap and the first target bitmap to determine the first difference bitmap between the first bitmap and the first target bitmap includes: If the first target bitmap and the first bitmap have the highest matching degree, perform an XOR operation on the first bitmap and the first target bitmap to obtain the fourth bitmap. Obtain the first intersection of the first bitmap and the first target bitmap; The first sub-bitmap is calculated based on the intersection of the fourth bitmap and the first intersection. The second sub-bitmap is calculated based on the first target bitmap and the first intersection.

4. The method according to claim 1, characterized in that, The first difference bitmap includes a first sub-bitmap and a second sub-bitmap. The step of XORing the first bitmap and the first target bitmap to determine the first difference bitmap between the first bitmap and the first target bitmap includes: If the matching degree between the first target bitmap and the first bitmap is the lowest, the first target bitmap is bitwise inverted to obtain the fifth bitmap. The first bitmap and the fifth bitmap are XORed to obtain the sixth bitmap; Obtain the second intersection of the first bitmap and the fifth bitmap; The first sub-bitmap is calculated based on the intersection of the sixth bitmap and the second bitmap; The second sub-bitmap is calculated based on the fifth bitmap and the second intersection.

5. The method according to claim 1, characterized in that, After storing the first difference bitmap, the method further includes: Based on the first target bitmap and the first difference bitmap, determine the first operation path corresponding to the first bitmap; The first bitmap is read based on the first operation path to obtain bitmap data.

6. A bitmap storage device, characterized in that, include: The acquisition module is used to acquire, when the first bit image is acquired, a second bit image from the stored set of first bit images whose matching degree with the first bit image meets a preset matching condition, to obtain a first target bit image, wherein the first bit image set includes multiple second bit images; The determination module is used to perform an XOR operation on the first bitmap and the first target bitmap to determine a first difference bitmap between the first bitmap and the first target bitmap. A storage module is used to store the first difference bitmap; The first bitmap set also includes a second bitmap set corresponding to each second bitmap, and the second bitmap set includes multiple sub-bitmaps; The acquisition module is further configured to, after determining the first difference bitmap between the first bitmap and the first target bitmap, acquire a sub-bitmap in the second bitmap set whose matching degree with the first difference bitmap satisfies the preset matching condition, and obtain the second target bitmap; The determining module is further configured to determine a second operation path corresponding to the first bitmap based on the first target bitmap, the second target bitmap, and the second difference bitmap, wherein the second difference bitmap is the mismatched part between the first difference bitmap and the second target bitmap; The device further includes: A creation module is used to create a third target bitmap based on a portion of the computation path in the second computation path that is associated with the first target bitmap and the second target bitmap; Add a module for adding the third target bitmap to the first bitmap set; The determining module is further configured to determine the third operation path corresponding to the first bitmap based on the third target bitmap and the second difference bitmap; The device further includes: The reading module is used to read the first bitmap based on the third operation path to obtain bitmap data.

7. The apparatus according to claim 6, characterized in that, The first difference bitmap includes a first sub-bitmap and a second sub-bitmap, and the determining module includes: The arithmetic unit is used to perform an XOR operation on the first bitmap and the first target bitmap when the matching degree between the first target bitmap and the first bitmap is the highest, so as to obtain a fourth bitmap. The acquisition unit is used to acquire the first intersection of the first bitmap and the first target bitmap; The calculation unit is configured to calculate the first sub-bitmap based on the fourth bitmap and the first intersection; The calculation unit is further configured to calculate the second sub-bitmap based on the first target bitmap and the first intersection.

8. An electronic device, characterized in that, The electronic device includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the bitmap storage method as described in any one of claims 1-5.

9. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium, which, when executed by a processor, implements the steps of the bitmap storage method as described in any one of claims 1-5.

Citation Information

Patent Citations

  • Snapshot rollback method of distributed storage system and related device

    CN110018996A

  • Bitmap-based snapshot merging method and system, equipment and storage medium

    CN113760823A