Bitmap offset determination method and device, electronic equipment and storage medium

Through the combination of bitmap and sliding window, the backtracking range and number are dynamically adjusted, and the target offset of the data array is quickly determined, solving the problem of inefficient data filling and improving the filling efficiency and scalability.

CN120144581APending Publication Date: 2025-06-13SHANGHAI WANHANG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510084119.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-20
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

When the data to be filled in large scale, the data filling efficiency of the data array is low, resulting in a significant increase in the number of backtracking times and a greater time complexity.

Method used

The data to be filled is represented by a bitmap, and combined with the sliding window and historical offset information, the backtracking range and number of times of the sliding window are dynamically adjusted to quickly determine the target offset.

Benefits of technology

It improves the data filling efficiency of the data array, reduces the number of backtracking times and time complexity of the sliding window, adapts to data to be filled at different scales, and enhances the scalability of the method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120144581A_ABST
    Figure CN120144581A_ABST
Patent Text Reader

Abstract

The invention provides a bitmap offset determination method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining to-be-filled data, and carrying out the data processing of the to-be-filled data, and obtaining a bitmap; obtaining a preset block size of the data array and a historical scanning position of the sliding window, and determining a current scanning position of the sliding window according to the preset block size and the historical scanning position; obtaining a sliding window, and moving the sliding window from the current scanning position for a preset number of times at a fixed step length to scan the data array to obtain a current offset and window information; historical offset information is obtained, and whether the current offset is available or not is determined according to the bitmap, the window information and the historical offset information; when the current offset is available, determining the current offset as a target offset; and when the current offset is unavailable, the current scanning position is updated, and the step of obtaining the sliding window is triggered and executed, so that the data filling efficiency of the data array is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data processing, and particularly relates to a method, an apparatus, an electronic device, and a storage medium for determining the offset of a bitmap. Background Art

[0002] Currently, when filling data to be filled into a data array, it is necessary to determine the filling position of the data to be filled in the data array. When the data to be filled is at the filling position, the number of array positions between the data to be filled and the first array position of the data array is the offset of the data to be filled. Each time a new data to be filled is filled into the data array, it is necessary to re-scan each position of the entire data array back and forth to determine the offset of the data to be filled.

[0003] However, in the above data filling method, when the data scale of the data to be filled is large, the number of backtracking times will increase significantly, and the time complexity is large, resulting in low data filling efficiency of the data array. How to improve the data filling efficiency of the data array is an urgent problem to be solved currently. Summary of the Invention

[0004] The present invention provides a method, an apparatus, an electronic device, and a storage medium for determining the offset of a bitmap, which can solve the problem of low data filling efficiency of a data array.

[0005] According to a first aspect of the present invention, there is provided a method for determining the offset of a bitmap, the method including:

[0006] Obtain data to be filled, and perform data processing on the data to be filled to obtain a bitmap;

[0007] Obtain the preset block size of a data array and the historical scanning position of a sliding window, and determine the current scanning position of the sliding window according to the preset block size and the historical scanning position;

[0008] Obtain a sliding window, and move the sliding window from the current scanning position by a fixed step size for a preset number of times to scan the data array, to obtain a current offset and window information;

[0009] Obtain historical offset information, and determine whether the current offset is available according to the bitmap, the window information, and the historical offset information;

[0010] When the current offset is available, determine the current offset as the target offset;

[0011] When the current offset is not available, update the current scanning position, and trigger the step of obtaining a sliding window to be executed.

[0012] According to a second aspect of the present invention, there is provided an apparatus for determining an offset of a bitmap, the apparatus comprising:

[0013] A data processing module, configured to obtain data to be filled and perform data processing on the data to be filled to obtain a bitmap;

[0014] A position determination module, configured to obtain a preset block size of a data array and a historical scanning position of the sliding window, and determine a current scanning position of the sliding window according to the preset block size and the historical scanning position;

[0015] An array scanning module, configured to obtain a sliding window, and move the sliding window from the current scanning position a preset number of times at a fixed step length to scan the data array, so as to obtain a current offset and window information;

[0016] A judgment module, configured to obtain historical offset information, and determine whether the current offset is available according to the bitmap, the window information, and the historical offset information;

[0017] An offset determination module, configured to determine the current offset as a target offset when the current offset is available;

[0018] A trigger module, configured to update the current scanning position and trigger the step of obtaining a sliding window when the current offset is not available.

[0019] According to a third aspect of the present invention, there is provided an electronic device, comprising a processor and a memory,

[0020] The memory is configured to store codes and related data;

[0021] The processor is configured to execute the codes in the memory to implement the method for determining an offset of a bitmap according to any one of the embodiments of the present invention.

[0022] According to a fourth aspect of the present invention, there is provided a storage medium, on which a computer program is stored, and when the program is executed by a processor, the method for determining an offset of a bitmap according to any one of the embodiments of the present invention is implemented.

[0023] In the embodiments of the present invention, the data to be filled is obtained, and the data to be filled is processed to obtain a bitmap, that is, the data to be filled is represented by the bitmap, which can improve the determination speed and efficiency of the availability of the current offset determined according to the bitmap, window information, and historical offset information subsequently; when a new bitmap is obtained according to the data to be filled each time, the current scanning position of the sliding window is determined according to the preset block size and the historical scanning position. The smaller the preset block size, the smaller the backtracking range of the sliding window, and the fewer the backtracking times of the sliding window. It is equivalent to being able to dynamically reduce the backtracking range of the sliding window according to the preset block size and the historical scanning position, and then dynamically reduce the backtracking times of the sliding window. Therefore, by reducing the preset block size, the backtracking range of the sliding window can be reduced, and the backtracking times of the sliding window can be reduced. The sliding window can scan a smaller range of the data array to determine the target offset of the unique and available bitmap, reducing the scanning time of the sliding window and increasing the scanning speed of the sliding window. By increasing the scanning speed of the sliding window, the determination speed of the unique and available target offset is increased, and then the determination efficiency of the unique and available target offset is increased, and the determination efficiency of the offset of the bitmap is increased, that is, the determination efficiency of the offset of the data to be filled is increased. After quickly determining the target offset, the data in the bitmap can be quickly filled into the data array, quickly achieving the purpose of filling the data to be filled into the data array and increasing the data filling efficiency of the data array; alternatively, the block size can be increased to increase the backtracking range of the sliding window. The sliding window can determine the target offset of the unique and available bitmap more accurately in a larger range of the data array, thereby increasing the space utilization rate of the data array. Therefore, the method for determining the offset of the bitmap provided by the present invention can increase the data filling efficiency of the data array by reducing the preset block size, or increase the space utilization rate of the data array by increasing the preset block size, that is, flexibly adjust the preset block size according to actual needs to achieve the balance between the data filling efficiency of the flexible data array and the space utilization rate of the data array; moreover, according to the bitmap, window information, and historical offset information, the availability of the current offset is determined, and when the current offset is available, the current offset is determined as the target offset, which can ensure the uniqueness and availability of the target offset and avoid conflicts in the occupation of data array resources; in addition, by combining the sliding window and the bitmap, the backtracking times of the sliding window are reduced, and then the time complexity of determining the offset of the bitmap is reduced, which can adapt to different scales of data to be filled, increasing the scalability of the method for determining the offset of the bitmap, and then increasing the scalability of the data filling of the data array; finally, since the combination method of the sliding window and the bitmap is based on bit operations, it is easy to be efficiently implemented in various programming languages and systems and is convenient for integration and application. Description of the Drawings

[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0025] Figure 1 is a schematic flowchart of a method for determining the offset of a bitmap provided by an embodiment of the present invention;

[0026] Figure 2 is a schematic diagram of a bitmap provided by an embodiment of the present invention;

[0027] Figure 3 is a schematic diagram of a sliding window scanning data array provided by an embodiment of the present invention;

[0028] Figure 4 is another schematic diagram of a sliding window scanning data array provided by an embodiment of the present invention;

[0029] Figure 5 is a schematic diagram of an AND operation provided by an embodiment of the present invention;

[0030] Figure 6 is another schematic flowchart of a method for determining the offset of a bitmap provided by an embodiment of the present invention;

[0031] Figure 7 is a schematic structural diagram of a device for determining the offset of a bitmap provided by an embodiment of the present invention;

[0032] Figure 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0033] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0034] The terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above accompanying drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0035] The technical solution of the present invention will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0036] Figure 1 FIG. is a schematic flowchart of a method for determining the offset of a bitmap provided by an embodiment of the present invention. This method can be executed by a device for determining the offset of a bitmap, and the device can be implemented in software and / or hardware. In a specific embodiment, the device can be integrated in an electronic device, such as a computer, a server, etc. The following embodiments will be described by taking the device integrated in an electronic device as an example. Refer to Figure 1 The method specifically may include the following steps:

[0037] Step 101: Obtain the data to be filled, and perform data processing on the data to be filled to obtain a bitmap.

[0038] Among them, the data to be filled can be composed of characters in any form. The characters can be numbers, letters, punctuation marks, special symbols, or other symbols. The data to be filled can be one or multiple. A bitmap can be understood as data composed of 0s or 1s obtained by encoding and converting the data to be filled. One data to be filled corresponds to one bitmap, and multiple data to be filled correspond to multiple bitmaps.

[0039] In an alternative embodiment, the data to be filled can be encoded and converted to obtain a bitmap, so that based on bit operations, the combination of a sliding window and a bitmap can be realized, which is easy to efficiently implement the data filling of a data array in various programming languages and systems, and is convenient for integration and application.

[0040] Exemplarily, if the data to be filled is X, the data to be filled X can be encoded and converted to obtain the bitmap Bitmap of X as shown in Figure 2 . It can be seen from Figure 2 that the bitmap of X includes multiple bitmap bits, each bitmap bit stores 0 or 1, and multiple bitmap bits form the bitmap of X.

[0041] Step 102: Obtain the preset block size of the data array and the historical scan position of the sliding window, and determine the current scan position of the sliding window according to the preset block size and the historical scan position.

[0042] Among them, the data array can be understood as data composed of different array bits, and each array bit stores an integer value. As shown in Figure 3As shown, the array position 3 stores 6, and the array position 5 stores 0. When 0 is stored in the array position, it means that the array position is an available position and can be filled with data to be filled. The preset block size can be understood as the number of array positions included in each block of the preset data array. The current scan position can be understood as the array position of the data array corresponding to the first window bit of the sliding window, which can be represented by a number. The historical scan position can be understood as the current scan position of the sliding window when the target offset was determined last time.

[0043] To avoid the sliding window of different bitmaps having to start scanning from the beginning position of the data array to determine the target offset, the data array can be divided into blocks. According to the start scan position of the sliding window last time and the block size of the data array, the backtracking range of the sliding window can be dynamically adjusted. Furthermore, by dynamically adjusting the backtracking range, the number of backtracking times when the sliding window scans the data array can be changed, and then the scanning time of the sliding window scanning the data array can be changed, thereby changing the scanning efficiency of the sliding window scanning the data array, and determining the target offset according to the window information and the current offset obtained by the sliding window scanning the data array. Therefore, in an optional implementation manner, the historical scan position can be divided by the preset block size and rounded down to obtain an integer value; the integer value is multiplied by the preset block size to obtain the current scan position of the sliding window. In this way, the backtracking range of the sliding window can be dynamically adjusted according to the preset block size and the historical scan position, and then the backtracking times of the sliding window can be dynamically adjusted, thereby improving the determination efficiency of the offset of the bitmap or improving the space utilization rate of the data array.

[0044] Exemplarily, the preset block size is 4. As Figure 3 shown, the data array data array includes 18 array positions, and the sliding window is window. The data array can be divided into 4 data arrays. When the preset block size is 4 and the historical scan position is 7, the historical scan position is divided by the preset block size and rounded down to obtain an integer value 1; the integer value is multiplied by the preset block size to obtain the current scan position 4 of the sliding window, indicating that the sliding window needs to backtrack from array position 7 to array position 4. When the preset block size is 2 and the historical scan position is 7, the historical scan position is divided by the preset block size and rounded down to obtain an integer value 3; the integer value is multiplied by the preset block size to obtain the current scan position 6 of the sliding window, indicating that the sliding window needs to backtrack from array position 7 to array position 6.

[0045] When the preset block size is 2, the backtracking range of the sliding window is smaller than that when the preset block size is 4. Narrowing the backtracking range of the sliding window and reducing the number of backtracking times of the sliding window, the sliding window can scan a smaller range of the data array to determine the target offset of the unique and available bitmap, reducing the scanning time of the sliding window and improving the scanning speed of the sliding window. By improving the scanning speed of the sliding window, the determination speed of the unique and available target offset is improved, thereby improving the determination efficiency of the unique and available target offset and the determination efficiency of the offset of the bitmap. After quickly determining the target offset, the data in the bitmap can be quickly filled into the data array, quickly achieving the purpose of filling the data to be filled into the data array and improving the data filling efficiency of the data array.

[0046] When the preset block size is 4, the backtracking range of the sliding window is larger than that when the preset block size is 2. Increasing the backtracking range of the sliding window and increasing the number of backtracking times of the sliding window, the sliding window can scan a larger range of the data array to determine the target offset of the unique and available bitmap, improving the space utilization rate of the data array.

[0047] Step 103, obtain a sliding window, and move the sliding window from the current scanning position by a fixed step size for a preset number of times to scan the data array, obtaining the current offset and window information.

[0048] Among them, the fixed step size can be understood as the array position that the set sliding window needs to move. The fixed step size can be set to 1. When the fixed step size is 1, the Figure 3 whole sliding window in is moved one array position to the right. The data array can include multiple array positions, and each array position has a corresponding array location. For example, Figure 3 the array position 1 in corresponds to the first array position of the data array; each array position stores data. For example, Figure 3 the first array position corresponding to the array position 1 in stores 0. The current offset can be understood as the total number of array positions before the array position where the first bitmap bit of the bitmap is located. In the embodiments of the present invention, first, the data array is scanned by the sliding window at the array positions of the data array, and then the bitmap is automatically aligned with the array positions of the data array. When it is determined that the array position can fill the data to be filled in the bitmap into the data array, the data to be filled in the bitmap is filled into the data array by using the sliding window. Therefore, the total number of array positions before the array position where the first bitmap bit of the bitmap is located is the same as the total number of array positions before the array position where the first window bit of the sliding window is located. Then, the total number of array positions before the array position where the first window bit of the moving window is located can also be determined as the current offset of the bitmap. For example, inFigure 4 When the array position where the first window bit of the sliding window is located is 5, the total number of array bits before the array position where the first window bit of the sliding window is located is 4. If the first window bit of the bitmap Bitmap is aligned with the window bit 1 of the sliding window whose array position is 5, the total number of array bits before the array position where the first bitmap bit of the bitmap is located is also 4, that is, the current offset of the bitmap is 4. The window information can be understood as the data stored in multiple window bits updated according to the corresponding partial data array after the sliding window moves a fixed step. Specifically, if the array position of the data array stores non-zero data, the corresponding window bit of the array position is updated to 1; if the array position of the data array stores 0, the corresponding window bit of the array position is updated to 0.

[0049] In an alternative embodiment, the total number of array bits before the array position where the first window bit of the sliding window is located is determined as the current offset of the bitmap; and the data stored in multiple window bits is updated according to the corresponding partial data array after the sliding window moves a fixed step.

[0050] Specifically, if the array bit corresponding to the array position of the data array stores non-zero data, the corresponding window bit of the array position is updated to 1; if the array bit corresponding to the array position of the data array stores 0, the corresponding window bit of the array position is updated to 0.

[0051] Exemplarily, Figure 4 the historical scan position of the sliding window in is the array position 4, and the window information of the sliding window is 1010010; the sliding window is moved 1 fixed step to the right from the array position 4 to the array position 5. After the first window bit of the sliding window is aligned with the array position 5, the data stored in the array bits corresponding to the array positions 5 - 11 in the data array can be used to update the data stored in each window bit in the sliding window, and the window information of the sliding window obtained is 0100100. The total number 4 of the array bits before the array position where the first window bit of the sliding window is located is determined as the current offset of the bitmap Bitmap.

[0052] Step 104, obtain the historical offset information, and determine whether the current offset is available according to the bitmap, the window information, and the historical offset information. If so, execute Step 105; if not, execute Step 106.

[0053] Among them, the bitmap includes multiple bitmap bits, each bitmap bit stores a bit value, the sliding window includes multiple window bits, each window bit stores a bit value, the bit value is 0 or 1, and the window information includes the bit values stored in multiple window bits.

[0054] In an alternative embodiment, perform an AND operation on the bit values stored in multiple bitmap bits and the bit values stored in multiple window bits to obtain multiple operation results; when all of the multiple operation results are 0, it indicates that the partial data array corresponding to the current scanning position of the sliding window can fill the data in the bitmap, ensuring the availability of the offset. Further, to ensure the uniqueness of the offset, it is possible to determine whether the current offset is unique based on the current offset and historical offset information; when the current offset is unique, determine that the current offset is available; when the current offset is not unique, determine that the current offset is unavailable to avoid duplication of the historical offset in the target offset and historical offset information; when any one of the multiple operation results is not 0, it indicates that the partial data array corresponding to the current scanning position of the sliding window cannot fill the data in the bitmap, and determine that the current offset is unavailable.

[0055] Exemplarily, as Figure 5 shown, perform an AND operation on the bit values stored in multiple bitmap bits and the bit values stored in multiple window bits to obtain multiple operation results; when all of the multiple operation results are 0, continue to determine whether the current offset is available based on the current offset and historical offset information.

[0056] Step 105, determine the current offset as the target offset.

[0057] Step 106, update the current scanning position.

[0058] After executing Step 106, return to execute Step 103.

[0059] In an alternative embodiment, the current scanning position can be updated according to the current scanning position, the current offset, and a preset increment of the current offset, so that the sliding window can scan the data array again at the updated current scanning position to obtain a new current offset and window information, achieving the purpose of repeatedly and iteratively determining the available target offset of the bitmap until the sliding window scans to the stop scanning position.

[0060] In the embodiments of the present invention, the data to be filled is obtained, and the data to be filled is processed to obtain a bitmap, that is, the data to be filled is represented by the bitmap, which can improve the determination speed and efficiency of the availability of the current offset determined according to the bitmap, window information, and historical offset information in the subsequent process; when a new bitmap is obtained according to the data to be filled each time, the current scanning position of the sliding window is determined according to the preset block size and the historical scanning position. The smaller the preset block size, the smaller the backtracking range of the sliding window, and the fewer the backtracking times of the sliding window. It is equivalent to being able to dynamically reduce the backtracking range of the sliding window according to the preset block size and the historical scanning position, and then dynamically reduce the backtracking times of the sliding window. Therefore, by reducing the preset block size, the backtracking range of the sliding window can be reduced, and the backtracking times of the sliding window can be reduced. The sliding window can scan a smaller range of the data array to determine the target offset of the unique and available bitmap, reducing the scanning time of the sliding window and improving the scanning speed of the sliding window. By improving the scanning speed of the sliding window, the determination speed of the unique and available target offset is improved, and then the determination efficiency of the unique and available target offset is improved, and the determination efficiency of the offset of the bitmap is improved, that is, the determination efficiency of the offset of the data to be filled is improved. After quickly determining the target offset, the data in the bitmap can be quickly filled into the data array, quickly realizing the purpose of filling the data to be filled into the data array, and improving the data filling efficiency of the data array; alternatively, the block size can be increased to increase the backtracking range of the sliding window. The sliding window can determine the target offset of the unique and available bitmap more accurately in a larger range of the data array, thereby improving the space utilization rate of the data array. Therefore, the method for determining the offset of the bitmap provided by the present invention can improve the data filling efficiency of the data array by reducing the preset block size, or can improve the space utilization rate of the data array by increasing the preset block size, that is, flexibly adjust the preset block size according to actual needs to achieve a balance between the data filling efficiency of the flexible data array and the space utilization rate of the data array; moreover, according to the bitmap, window information, and historical offset information, the availability of the current offset is determined, and when the current offset is available, the current offset is determined as the target offset, which can ensure the uniqueness and availability of the target offset and avoid conflicts in data array resource occupation; in addition, by combining the sliding window and the bitmap, the backtracking times of the sliding window are reduced, and then the time complexity of determining the offset of the bitmap is reduced, which can adapt to different scales of data to be filled, increasing the scalability of the method for determining the offset of the bitmap, and then increasing the scalability of data filling in the data array; finally, since the combination method of the sliding window and the bitmap is based on bit operations, it is easy to be efficiently implemented in various programming languages and systems, facilitating integration and application.

[0061] In some embodiments, after determining the current offset as the target offset, the historical offset information may be updated, so that when determining the offset of a new bitmap, the uniqueness of the target offset can be ensured based on the historical offset information and the current offset.

[0062] In an alternative implementation, the current offset may be added to the historical offset information to complete the update of the historical offset information.

[0063] The method for determining the offset of a bitmap provided by the embodiments of the present invention will be further described below. As Figure 6 shown, Figure 6 FIG. is another flowchart of the method for determining the offset of a bitmap provided by the embodiments of the present invention, which may specifically include the following steps:

[0064] Step 201: Obtain the data to be filled, and perform data processing on the data to be filled to obtain a bitmap.

[0065] Step 202: Obtain the preset block size of the data array and the historical scanning position of the sliding window, and determine the current scanning position of the sliding window according to the preset block size and the historical scanning position.

[0066] Step 203: Obtain the sliding window, and move the sliding window from the current scanning position by a fixed step size for a preset number of times to scan the data array, to obtain the current offset and window information.

[0067] Step 204: Perform an AND operation on the bit values stored in multiple bitmap bits and the bit values stored in multiple window bits to obtain multiple operation results.

[0068] Step 205: Determine whether all the multiple operation results are 0. If so, execute step 206; if not, execute step 207.

[0069] Step 206: Determine whether the current offset is unique according to the current offset and the historical offset information. If so, execute step 209; if not, execute step 207.

[0070] In an alternative implementation, the current offset is matched with multiple historical offsets to obtain a matching result; when the matching result is a failed match, it is determined that the current offset is unique; when the matching result is a successful match, it is determined that the current offset is not unique.

[0071] Exemplarily, the current offset is p1, and the historical offset information includes historical offsets p1, p2, and p3. As Figure 5As shown, perform an AND operation on the bit values stored in multiple bitmap bits of the bitmap Bitmap and the bit values stored in multiple window bits of the sliding window Window, and obtain that all multiple operation results are 0; then match the current offset with multiple historical offsets. The current offset p1 is the same as the historical offset p1, and the matching result is successful. It is determined that the current offset is not unique. To ensure the uniqueness of the offset of the bitmap, it is determined that the current offset is unavailable.

[0072] Step 207, determine that the current offset is unavailable.

[0073] Step 208, update the current scan position according to the current scan position, the current offset, and the preset increment of the current offset.

[0074] In an optional implementation manner, the current offset can be added to the preset increment to obtain a position increment; the position increment is determined as the updated current scan position.

[0075] Exemplarily, the preset increment is 1, the current offset is p, and p = 3. As Figure 4 shown, the current scan position is array position 3. The current offset can be added to the preset increment to obtain a position increment of 4; the position increment is determined as the updated current scan position (array position 4), and the sliding window is moved from array position 3 (the current scan position) to array position 4 (the updated current scan position), so that the sliding window scans the data array again at the updated current scan position (4) to obtain a new current offset and window information, achieving the goal of repeatedly iterating to determine the target offset until the sliding window scans to the stop scan position.

[0076] After executing step 208, return to execute step 203.

[0077] Step 209, determine that the current offset is available.

[0078] Step 210, determine the current offset as the target offset.

[0079] Step 211, update the historical offset information.

[0080] In the embodiments of the present invention, the data filling efficiency of the data array can be improved by reducing the preset block size, or the space utilization rate of the data array can be improved by increasing the preset block size, that is, the preset block size can be flexibly adjusted according to actual needs to achieve the balance between the data filling efficiency of the flexible data array and the space utilization rate of the data array; moreover, according to the bitmap, window information, and historical offset information, the availability of the current offset is determined, and when the current offset is available, the current offset is determined as the target offset, which can ensure the uniqueness and availability of the target offset and avoid the conflict of data array resource occupation; in addition, by combining the sliding window and the bitmap, the number of backtracking times of the sliding window is reduced, and further the time complexity of determining the offset of the bitmap is reduced, which can adapt to different scales of data to be filled, increasing the scalability of the method for determining the offset of the bitmap, and further increasing the scalability of the data filling of the data array; finally, since the combination method of the sliding window and the bitmap is based on bit operations, it is easy to be efficiently implemented in various programming languages and systems, facilitating integration and application.

[0081] Figure 7 FIG. 4 is a structural schematic diagram of an apparatus for determining the offset of a bitmap provided by an embodiment of the present invention, and this apparatus is applicable to execute the method for determining the offset of a bitmap provided by the embodiment of the present invention. As Figure 7 shown, this apparatus may specifically include:

[0082] A data processing module 301, configured to obtain data to be filled, and perform data processing on the data to be filled to obtain a bitmap;

[0083] A position determination module 302, configured to obtain the preset block size of the data array and the historical scan position of the sliding window, and determine the current scan position of the sliding window according to the preset block size and the historical scan position;

[0084] An array scanning module 303, configured to obtain a sliding window, and move the sliding window from the current scan position by a fixed step for a preset number of times to scan the data array, so as to obtain a current offset and window information;

[0085] A judgment module 304, configured to obtain historical offset information, and determine whether the current offset is available according to the bitmap, the window information, and the historical offset information;

[0086] An offset determination module 305, configured to determine the current offset as the target offset when the current offset is available;

[0087] A trigger module 306, configured to update the current scan position and trigger the execution of the step of obtaining the sliding window when the current offset is not available.

[0088] Optionally, the bitmap includes a plurality of bitmap bits, each bitmap bit stores a bit value, the sliding window includes a plurality of window bits, each window bit stores a bit value, the bit value is 0 or 1, the window information includes the bit values stored in the plurality of window bits, and the determination module 304 determines whether the current offset is available according to the bitmap, the window information, and the historical offset information, including:

[0089] Performing an AND operation on the bit values stored in the plurality of bitmap bits and the bit values stored in the plurality of window bits to obtain a plurality of operation results;

[0090] When all of the plurality of operation results are 0, determining whether the current offset is unique according to the current offset and the historical offset information;

[0091] When the current offset is unique, determining that the current offset is available;

[0092] When the current offset is not unique, determining that the current offset is unavailable.

[0093] When any one of the plurality of operation results is not 0, determining that the current offset is unavailable.

[0094] Optionally, the historical offset information includes a plurality of historical offsets, and the determination module 304 determines whether the current offset is unique according to the current offset and the historical offset information, including:

[0095] Matching the current offset with the plurality of historical offsets to obtain a matching result;

[0096] When the matching result is a failed match, determining that the current offset is unique;

[0097] When the matching result is a successful match, determining that the current offset is not unique.

[0098] Optionally, the position determination module 302 determines the current scan position of the sliding window according to the preset block size and the historical scan position, including:

[0099] Dividing the historical scan position by the preset block size and taking the integer part to obtain an integer value;

[0100] Multiplying the integer value by the preset block size to obtain the current scan position of the sliding window.

[0101] Optionally, the trigger module 306 updates the current scan position, including:

[0102] Updating the current scan position according to the current scan position, the current offset, and a preset increment of the current offset.

[0103] Optionally, the triggering module 306 updates the current scanning position according to the current scanning position, the current offset, and a preset increment of the current offset, including:

[0104] Adding the current offset to the preset increment to obtain a position increment;

[0105] Determining the position increment as the updated current scanning position.

[0106] Furthermore, the device further includes:

[0107] An offset update module, configured to update the historical offset information.

[0108] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the above division of each functional module is used as an example. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the above-described functional modules can refer to the corresponding process in the foregoing method embodiments, and will not be elaborated herein.

[0109] The bitmap offset determination device provided by the embodiments of the present invention can improve the data filling efficiency of the data array by reducing the preset block size, or can improve the space utilization rate of the data array by increasing the preset block size, that is, flexibly adjust the preset block size according to actual needs to achieve a balance between the data filling efficiency of the flexible data array and the space utilization rate of the data array; and, according to the bitmap, window information, and historical offset information, determine the availability of the current offset, and when the current offset is available, determine the current offset as the target offset, which can ensure the uniqueness and availability of the target offset and avoid conflicts in data array resource occupation; in addition, by combining the sliding window and the bitmap, the number of backtracking times of the sliding window is reduced, thereby reducing the time complexity of determining the offset of the bitmap, being able to adapt to different scales of data to be filled, increasing the scalability of the bitmap offset determination method, and further increasing the scalability of data filling of the data array; finally, since the combination method of the sliding window and the bitmap is based on bit operations, it is easy to be efficiently implemented in various programming languages and systems, facilitating integration and application.

[0110] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.

[0111] Please refer to Figure 8 which provides an electronic device 50, including:

[0112] A processor 51; and,

[0113] A memory 52 for storing executable instructions of the processor;

[0114] Wherein, the processor 51 is configured to execute the methods involved above by executing the executable instructions.

[0115] The processor 51 can communicate with the memory 52 via a bus 53.

[0116] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the methods involved above are implemented.

[0117] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions. The foregoing program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above method embodiments; and the foregoing storage medium includes: various media such as ROM, RAM, magnetic disk or optical disk that can store program codes.

[0118] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for determining a bitmap offset, characterized in that: The method comprises: Acquire data to be filled, and perform data processing on the data to be filled to obtain a bitmap; Acquire a preset block size of a data array and a historical scanning position of the sliding window, and determine a current scanning position of the sliding window according to the preset block size and the historical scanning position; Acquire a sliding window, and move the sliding window from the current scanning position by a fixed step length for a preset number of times to scan the data array, to obtain a current offset and window information; Acquire historical offset information, and determine whether the current offset is available according to the bitmap, the window information and the historical offset information; When the current offset is available, determining the current offset as a target offset; When the current offset is not available, the current scanning position is updated, triggering the step of acquiring a sliding window.

2. The method according to claim 1, characterized in that The bitmap includes a plurality of bitmap bits, each bitmap bit stores a bit value, the sliding window includes a plurality of window bits, each window bit stores a bit value, the bit value is 0 or 1, the window information includes the bit values ​​stored in the plurality of window bits, and determining whether the current offset is available according to the bitmap, the window information and the historical offset information includes: Performing AND operations on the bit values ​​stored in the plurality of bitmap bits and the bit values ​​stored in the plurality of window bits to obtain a plurality of operation results; When the multiple operation results are all 0, determining whether the current offset is unique according to the current offset and the historical offset information; When the current offset is unique, determining that the current offset is available; When the current offset is not unique, it is determined that the current offset is unavailable. When any one of the multiple calculation results is not 0, it is determined that the current offset is unavailable.

3. The method according to claim 2, characterized in that The historical offset information includes a plurality of historical offsets, and determining whether the current offset is unique according to the current offset and the historical offset information includes: Matching the current offset with the multiple historical offsets to obtain a matching result; When the matching result is a matching failure, determining that the current offset is unique; When the matching result is a successful match, it is determined that the current offset is not unique.

4. The method according to claim 1, characterized in that: The determining the current scanning position of the sliding window according to the preset block size and the historical scanning position includes: Divide the historical scanning position by the preset block size and take the integer to obtain an integer value; The integer value is multiplied by the preset block size to obtain a current scanning position of the sliding window.

5. The method according to claim 1, characterized in that The updating of the current scanning position comprises: The current scanning position is updated according to the current scanning position, the current offset, and a preset increment of the current offset.

6. The method according to claim 5, characterized in that The updating of the current scanning position according to the current scanning position, the current offset and a preset increment of the current offset comprises: Adding the current offset to the preset increment to obtain a position increment; The position increment is determined as the updated current scanning position.

7. The method according to claim 1, characterized in that After determining the current offset as the target offset, the method further includes: The historical offset information is updated.

8. A device for determining a bitmap offset, characterized in that: The device comprises: A data processing module, used for acquiring data to be filled, and performing data processing on the data to be filled to obtain a bitmap; a position determination module, configured to obtain a preset block size of a data array and a historical scanning position of the sliding window, and determine a current scanning position of the sliding window according to the preset block size and the historical scanning position; An array scanning module, used for acquiring a sliding window, and moving the sliding window from the current scanning position by a fixed step length for a preset number of times to scan the data array, to obtain a current offset and window information; A judgment module, used for obtaining historical offset information, and determining whether the current offset is available according to the bitmap, the window information and the historical offset information; an offset determination module, configured to determine the current offset as a target offset when the current offset is available; A trigger module is used to update the current scanning position when the current offset is not available, and trigger the step of acquiring the sliding window.

9. An electronic device, characterized in that: Including processor and memory, The memory is used to store codes and related data; The processor is used to execute the code in the memory to implement the method for determining the offset of the bitmap according to any one of claims 1 to 7.

10. A storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for determining the offset of a bitmap according to any one of claims 1 to 7 is implemented.