Graphic data processing method and device, storage medium and program product
By obtaining layer description information and eliminating non-transparent data blocks before GPU processing, the problems of real-time and time overhead in graphics processing are solved, and efficient and real-time graphics processing is achieved.
Patent Information
- Application Number
- CN202510178177.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art is difficult to meet the real-time requirements in graphics processing, and the limited-time adjustments when rendering graphics data by GPUs affect the original graphics processing flow and increase time overhead.
By obtaining layer description information of multiple layers, the state to be displayed of each data block is determined, and the data blocks to be displayed are removed before the GPU process is removed, reducing the amount of data processed and improving efficiency.
While ensuring the requirements and expected effects of graphics processing, it reduces the requirements for real-time, reduces time overhead, and improves the efficiency and completion of graphics processing.
Smart Images

Figure CN119991404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graphics processing technology, and in particular to a graphics data processing method, device, storage medium and program product. Background Art
[0002] With the continuous development of data processing technology, the requirements for real-time graphics processing in the graphics field are gradually increasing. However, in the existing technology, GPU (Graphics Processing Unit) processes specific drawing instructions and data, which makes it difficult to achieve the expected results. In addition, there are also some solutions that make limited-time adjustments to the drawing instructions related to the displayed screen during the GPU rendering of graphics data. This solution has high requirements for real-time performance, which is easy to affect the processing flow of the original graphics and increase time overhead. Summary of the invention
[0003] In view of this, the purpose of the present invention is to provide a method, device, storage medium and program product for processing graphic data, which can reduce the requirements for real-time performance and time overhead while ensuring the graphic processing requirements and expected effects. The specific scheme is as follows:
[0004] In a first aspect, the present application discloses a method for processing graphic data, comprising:
[0005] Acquire layer description information corresponding to the plurality of layers respectively, so as to determine the to-be-displayed state of each data block in the plurality of layers, wherein the layer description information is generated when the involved graphic data is written into the corresponding layer, and the data block is formed by dividing the graphic data;
[0006] Before the GPU performs graphics processing, a data block corresponding to the position of the first data block in the first layer is removed, the first layer is a layer below the layer where the first data block is located, and the first data block is a data block to be displayed in a non-transparent state.
[0007] In some implementations, the acquiring of layer description information corresponding to the multiple layers to determine the to-be-displayed status of each data block in the multiple layers includes:
[0008] Acquire the Z order of the multiple layers and the transparency status information corresponding to the multiple data blocks in each layer from the layer description information respectively corresponding to the multiple layers, wherein the transparency status information is arranged according to the positions of the multiple data blocks in the layer;
[0009] According to the Z order of the multiple layers and the transparency status information corresponding to the multiple data blocks in each layer, the to-be-displayed status of each data block in the multiple layers is determined.
[0010] In some implementations, the layer description information also includes layer display information of each layer;
[0011] The step of determining the to-be-displayed state of each data block in the multiple layers according to the Z order of the multiple layers and the transparency state information corresponding to the multiple data blocks in each layer includes:
[0012] According to the layer display information of each layer, the transparent layer in each layer is determined;
[0013] The to-be-displayed state of each data block in the multiple layers is determined according to the Z order of the multiple layers, the transparency state information corresponding to the multiple data blocks in each transparent layer, and each non-transparent layer.
[0014] In some implementations, the step of generating layer description information includes:
[0015] Get the transparency value of the pixels to be displayed in multiple data blocks in each layer;
[0016] When the transparency value of any pixel to be displayed in the second data block in any layer is not a preset value, setting the transparency state information corresponding to the second data block to a transparent state, wherein the plurality of data blocks in any layer include the second data block;
[0017] When the transparency values of all pixels to be displayed in the second data block in any layer are preset values, the transparency state information corresponding to the second data block is set to a non-transparent state.
[0018] In some implementations, obtaining transparency values of pixels to be displayed in a plurality of data blocks in each layer includes:
[0019] Get the RGBA data corresponding to the graphic data, and map the transparency of the pixels to be displayed in each layer from the RGBA data;
[0020] The transparency values of the pixels to be displayed in each layer are mapped into a pixel value table corresponding to each layer, and the pixel value table corresponding to each layer is divided into regions to obtain multiple data blocks in each layer.
[0021] In some implementations, dividing the pixel value table corresponding to each layer into regions includes:
[0022] Divide the pixel value table corresponding to each layer into regions according to the region division accuracy;
[0023] The layer description information includes the area division accuracy, and the area division accuracy of each layer is related to the resolution of the layer.
[0024] In some implementations, determining the to-be-displayed status of each data block in the multiple layers includes:
[0025] When the description range of the layer description information corresponding to the target layer does not include all the data blocks in the target layer, determining the to-be-displayed state of the data blocks in the target layer within the description range, wherein the multiple layers include the target layer;
[0026] Accordingly, the graphic data processing method further includes:
[0027] The data blocks in the target layer that are not within the description range are retained.
[0028] In a second aspect, the present application discloses an electronic device, comprising:
[0029] Memory, used to store computer programs;
[0030] A processor is used to execute the computer program to implement the aforementioned graphic data processing method.
[0031] In a third aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned graphic data processing method when executed by a processor.
[0032] In a fourth aspect, the present application discloses a computer program product, including a computer program / instruction, which implements the steps of the aforementioned graphics data processing method when executed by a processor.
[0033] The present application can determine the to-be-displayed state of each data block in the multiple layers by obtaining the layer description information corresponding to the multiple layers respectively, the layer description information is generated when the involved graphic data is written into the corresponding layer, and the data block is formed by dividing the graphic data; before the GPU performs graphics processing, the data block corresponding to the position of the first data block in the first layer is removed, the first layer is the layer below the layer where the first data block is located, and the first data block is a data block whose to-be-displayed state is non-transparent. It can be seen from this that the present application can remove the data blocks of the layers below the data blocks whose to-be-displayed state is non-transparent according to the to-be-displayed state before the GPU performs graphics processing, so that the covered graphic data can be removed before the graphics processing, thereby reducing the amount of data for graphics processing, improving the efficiency of graphics processing, and ensuring the graphics processing requirements and expected effects. Because the display status of each data block in the multiple layers based on which the above-mentioned elimination of graphic data is based is obtained by obtaining the layer description information corresponding to the multiple layers, and the layer description information is generated when the graphic data involved is written into the corresponding layer, the transparency status of each display block of the graphic data can be determined in advance with the help of the key graphic description information generated synchronously when the effective graphic data is generated, so as to complete the preprocessing of the data block before sending it to the GPU, avoid the time-limited adjustment of the drawing instructions related to the displayed screen, and ensure the completion and timeliness of the graphics processing. While ensuring the graphics processing requirements and expected effects, it does not affect the processing flow of the original graphics, reduces the requirements for real-time performance, and reduces time overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0035] Figure 1 A flowchart of a method for processing graphic data disclosed in this application;
[0036] Figure 2 A schematic diagram of the relationship between memory and layers disclosed in this application;
[0037] Figure 3 A state diagram of a layer information scanning completed part and an unfinished part disclosed in the present application;
[0038] Figure 4 A schematic diagram of the relationship between the positions of the layers disclosed in this application;
[0039] Figure 5A schematic diagram of a process for synchronously generating layer transparent information disclosed in this application;
[0040] Figure 6 A schematic diagram of a data judgment process in a data block disclosed in this application;
[0041] Figure 7 A schematic diagram of the structure of a graphics data processing device disclosed in this application;
[0042] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] With the continuous development of graphics processing technology, the complexity of the front-end user interface (UI) is getting higher and higher, so the real-time requirements for graphics processing are also getting higher and higher. In the existing technology, graphics that optimize the culling sequence such as Overdraw are mainly achieved by not processing or culling the occluded part, but this method has no better implementation method when applied in transparent color scenes.
[0045] On the other hand, graphics acceleration hardware such as GPU (Graphics Processing Unit) has certain de-redundancy mechanisms, but as the last level of the graphics framework, GPU processes specific drawing instructions and data, and it is difficult to understand the intentions of the intended party. Therefore, it is unable to filter or integrate the received drawing instructions and data according to its own limitations and advantages and disadvantages, resulting in limited coverage of scenes and content.
[0046] In addition, there are some solutions in the related technology, which mainly adjust the drawing instructions related to the currently displayed screen within a limited time. This solution has high real-time requirements and is therefore easy to affect the original graphics processing flow, thereby increasing the graphics processing time and affecting the graphics processing efficiency.
[0047] In order to improve at least one of the above-mentioned technical problems, the embodiment of the present application determines in advance the transparency status of multiple display blocks in each layer of the graphic data by scanning the graphic description information, so as to complete the preprocessing of the data block before sending it to the GPU. The layer description information is synchronously generated when the CPU (Central Processing Unit) or GPU and other processors write valid graphic data into the layer, which can be used as "preprocessing information". In this way, invalid data can be eliminated according to the limitations of the graphics itself. On the basis of ensuring the final GPU graphics data processing effect, the generation of the layer description information is completed with the minimum time consumption, without affecting the original graphics processing process or increasing the time overhead, and can ensure the completeness and timeliness of the graphics processing.
[0048] The embodiment of the present invention discloses a method for processing graphic data. Figure 1 As shown, the method includes:
[0049] Step S11, obtaining layer description information corresponding to the multiple layers respectively to determine the display status of each data block in the multiple layers, wherein the layer description information is generated when the graphic data involved is written into the corresponding layer, and the data block is formed by dividing the graphic data.
[0050] Step S12: before the GPU performs graphics processing, remove the data block corresponding to the position of the first data block in the first layer, the first layer is a layer below the layer where the first data block is located, and the first data block is a data block to be displayed in a non-transparent state.
[0051] This embodiment can determine the display status of each data block in multiple layers by obtaining layer description information corresponding to multiple layers respectively, the layer description information is generated when the graphic data involved is written into the corresponding layer, and the data block is formed by dividing the graphic data; before the GPU performs graphics processing, the data block corresponding to the position of the first data block in the first layer is removed, the first layer is the layer below the layer where the first data block is located, and the first data block is a data block with a non-transparent display status. It can be seen that the present application can remove the data blocks of the layers below the data blocks with a non-transparent display status according to the display status before the GPU performs graphics processing. In this way, the covered graphic data can be removed before graphics processing, thereby reducing the amount of data for graphics processing, improving the efficiency of graphics processing, and ensuring the graphics processing requirements and expected effects. Because the display status of each data block in the multiple layers based on which the above-mentioned elimination of graphic data is based is obtained by obtaining the layer description information corresponding to the multiple layers, and the layer description information is generated when the graphic data involved is written into the corresponding layer, the transparency status of each display block of the graphic data can be determined in advance with the help of the key graphic description information generated synchronously when the effective graphic data is generated, so as to complete the preprocessing of the data block before sending it to the GPU, avoid the time-limited adjustment of the drawing instructions related to the displayed screen, and ensure the completion and timeliness of the graphics processing. While ensuring the graphics processing requirements and expected effects, it does not affect the processing flow of the original graphics, reduces the requirements for real-time performance, and reduces time overhead.
[0052] In this embodiment, before the GPU performs graphics processing, the graphics data to be processed may be pre-processed by a processor such as a CPU and / or a GPU.
[0053] First, it is necessary to obtain the layer description information corresponding to multiple layers respectively, so as to understand the position relationship of each data block between layers and the transparent status information of each data block, and then determine the display status of each data block in multiple layers.
[0054] It should be noted that the layer description information is the key preprocessing information generated synchronously during the data acquisition stage when the relevant graphic data is written into the corresponding layer to generate valid graphic data. The layer description information can effectively improve the efficiency of the subsequent graphic processing content.
[0055] The layer description information is stored in the memory info_buffer requested in advance for each layer. The layer description information corresponding to multiple layers can be obtained by scanning the memory.
[0056] For example, a small piece of memory can be applied for each layer after the memory corresponding to the layer data storage as info_buffer, which is used to store layer description information. The layer description information can describe the data block division and transparent color of the current layer, and reflects the interaction mode between the current layer and other layers. Further layer description information can be saved in info_buffer through the preset data structure layer_info.
[0057] In some examples, the layer description information includes at least one of the layer Z order, the layer start coordinates, and the layer transparency status information.
[0058] In some examples, the layer description information includes the Z order of multiple layers and transparency status information corresponding to multiple data blocks in each layer.
[0059] The transparent state information of the layer includes the layer display information of each layer, such as the transparent state of the whole map, the transparent state information corresponding to the multiple data blocks in the above-mentioned layer, and the area division accuracy.
[0060] like Figure 2 As shown in FIG. 1 , the relationship between the memory info_buffer and the layer is shown, where the info_buffer corresponding to each layer is used to store the layer description information.
[0061] Take the layer description information including the layer Z order, layer start coordinates and layer transparency status information as an example. Accordingly, the size of the memory info_buffer is 9+M Byte, where the layer Z order of each layer occupies one byte, the layer start coordinates occupy 8 bytes (x coordinates occupy four bytes, y coordinates occupy four bytes), and the layer transparency status information occupies M bytes.
[0062] Among them, the size of M is related to the layer resolution and the area division accuracy N. The larger the ratio of the layer resolution to the divided data block accuracy, the larger M is, and vice versa, the smaller M is.
[0063] The setting of the area division precision N divides the graphic data into multiple data blocks, and the multiple data blocks do not overlap. The area division precision N can be set according to the needs. That is, the area division precision of each layer can be set to different values, so that the appropriate precision can be adaptively configured according to different layers, and the layer thumbnail information of appropriate precision (the content covered in the layer description) can be obtained, thereby balancing the performance and precision of graphic data processing.
[0064] It should be noted that the layer Z order indicates the front and back position relationship of the layers when they are displayed, which can also be understood as the stacking order.
[0065] Layers with lower Z values are located below other layers, while layers with higher Z values are located above other layers. It is stipulated that the closer the layer is to the screen, the smaller the Z value is, and the minimum value is 0. Conversely, the farther away from the screen, the larger the Z value is. If the total number of superimposed layers is X, the maximum Z value of the layer is (X-1).
[0066] Taking the layer resolution of 1920x1080 and the area division accuracy of 16 as an example, the size of each data block is 16*16, so the number of data blocks of this layer is: number of blocks = total data volume / block size = 1920 * 1080 / (16 * 16) = 8100 blocks.
[0067] Since each data block occupies 1 bit, the total amount of data occupied by the data block is: 8100 / 8 = 1012.5 bytes, which is rounded up to 1013 bytes. In addition, the full image transparency state and area division accuracy each occupy a fixed byte, so M=2+1013=1015 bytes.
[0068] In order to facilitate data processing and improve data compatibility on different platforms, the data can be aligned upward to an even number, so M is 1016 bytes after even alignment. Therefore, only 1016 bytes are needed to fully describe the transparent information of the entire layer, which conveniently and quickly realizes the customization of pre-processing information. At the same time, this customization method has sufficient expansion space, and other settings and refinements can also be made according to needs.
[0069] Furthermore, before the GPU processes the graphics data, the CPU and / or GPU can determine the layer description information corresponding to each layer by scanning the info_buffer corresponding to each layer, and determine the Z order of each layer and the transparency status information corresponding to multiple data blocks in each layer from the layer description information, thereby obtaining preprocessing information that can predict the layer to be processed, and then determine the to-be-displayed status of each data block in the multiple layers according to the Z order of the multiple layers and the transparency status information corresponding to the multiple data blocks in each layer, so as to know the status of each data block in the layer to be processed in advance, and can quickly determine whether to retain or discard part of the data, thereby improving the efficiency of data processing.
[0070] It should be noted that the transparency status information is arranged according to the positions of multiple data blocks in the layer. For example, assuming the precision of the divided area block is 16, that is, the layer is divided into several 16*16 data blocks, and the first byte is 1100 1111 in binary, then the states of the first eight 16*16 data blocks of the layer are: opaque, opaque, transparent, transparent, opaque, opaque, opaque, and opaque.
[0071] Compared with the traditional solution that only distinguishes between transparent and opaque states in the entire layer, this solution innovatively proposes the concept of transparent blocks in the layer, which makes the description of transparent data inside the layer more accurate, the subsequent processing scope is smaller, and less data is processed.
[0072] In summary, the layer description information is generated synchronously when the involved graphic data is written to the corresponding layer. Therefore, the graphic data can be preprocessed in the data acquisition stage to obtain the layer description information corresponding to each layer, and saved in the memory info_buffer pre-applied for each layer. In this way, before subsequent data processing, the data structure layer_info in the memory info_buffer can be scanned to obtain the layer description information, pre-judge the layer to be processed, and grasp the status of the graphic data to be processed in advance. Based on the layer transparency status information and the transparency status information corresponding to the data blocks in each layer, it can quickly determine whether to retain or discard part of the data in the graphic data, thereby improving the efficiency of data processing.
[0073] It is further necessary to explain that, according to the above content, the layer description information is generated synchronously when the graphic data involved is written into the corresponding layer, and the layer description information includes the transparent state information of the layer. Therefore, when the graphic data involved is written into the corresponding layer, the graphic data processing method may further include, that is, the partial process of generating the layer description information includes:
[0074] Get the transparency value of the pixels to be displayed in multiple data blocks in each layer;
[0075] When the transparency value of any pixel to be displayed in the second data block in any layer is not a preset value, setting the transparency state information corresponding to the second data block to a transparent state;
[0076] When the transparency values of all pixels to be displayed in the second data block in any layer are preset values, the transparency state information corresponding to the second data block is set to a non-transparent state.
[0077] Among them, the multiple data blocks in any layer include the second data block.
[0078] This embodiment describes the process of generating the transparency status information in the layer description information. It is understandable that, in any data block of any layer, as long as there is a pixel whose transparency value is not the preset value, it means that the pixel is transparent and the data block is a transparent block. The preset value may be 255, or may be an approximate value of 255 in other cases. The status of each data block may be determined in turn until the transparency status information of all data blocks in the entire layer is determined.
[0079] The above-mentioned solution for determining whether a pixel in a data block is transparent can be performed by combining "assembly instructions + SIMD (Single Instruction Multiple Data)". According to experience, the data processing speed of the combination of the two methods can reach 107G B / s, and the processing performance is sufficient to fully meet the scene requirements.
[0080] For example, assuming that in the data block division stage, the precision of the configured area block is 16, that is, the size of a single area block is 16*16. The judgment of the pixel point in the area block that is not 255 (corresponding to 0xff in hexadecimal) can be terminated immediately. When the value of any point is not 0xff, there is transparent data in the pixel point in the block, indicating that the block is a transparent area, the mark state is 0, and the judgment of the remaining content in the block can be skipped. The data offset between the two blocks is 16*16, then the data amount offset by 16*16 from the starting position of the current data block enters the next data block for judgment.
[0081] When judging data within a block, a single instruction multiple data (SIMD) method can be used for processing. Continuing with the 16*16 block as an example, assuming that each 4 lines are a group, each group has 4 lines of data, when judging non-0xff, the four groups of data execute the same processing command at the same time, and the group that first recognizes that there is non-0xff in the group sends a synchronization message in time to stop the processing of all groups of data, and directly jumps to the corresponding position of the next data block to perform the same operation.
[0082] Considering the high efficiency of the above method, we can set the minimum partition size to half byte when partitioning the data block, and we can support data processing above this size. In actual use, the partition precision size is at least full byte size or an even multiple of full byte size for processing, so that the efficiency can be maximized.
[0083] In addition, in SIMD mode, the CPU registers are usually larger. If 512-bit registers are used, 8 int64 numbers can be loaded at one time, and the calculation can be performed at a parallelism of 8. The overall generation speed of layer description information is faster, without delaying the original processing flow of image data.
[0084] In some examples, if all data blocks in a layer are in a transparent state, the overall transparency state of the layer may also be set to a transparent state, wherein the overall transparency state may be marked as transparent by 00 and as opaque by 01.
[0085] Alternatively, the transparent state of the entire image may be set by referring to the prior art.
[0086] In this way, by dividing the layer / graphics data into data blocks and judging the transparent status information of the data blocks based on the transparency values of the pixels therein, the transparent status of the layer can be described more accurately, which is beneficial to reduce the workload of eliminating transparent data during the graphics processing process, thereby improving the efficiency of graphics processing.
[0087] Furthermore, due to the mismatch between the synchronous layer information generation processing speed and the layer transmission data rate, the main process data processing may be extremely fast, and the synchronous generation information is not completely completed, resulting in incomplete layer description information recording. Therefore, when determining the status of each data block in multiple layers to be displayed, the following steps can be performed:
[0088] When the description range of the layer description information corresponding to the target layer does not include all the data blocks in the target layer, the to-be-displayed status of the data blocks in the description range in the target layer is determined, and multiple layers include the target layer; subsequently, part of the data blocks in the description range can be normally removed according to the to-be-displayed status of the data blocks in the description range.
[0089] Accordingly, the data blocks in the target layer that are not within the description scope need to be retained.
[0090] like Figure 3 As shown in the figure, only half of the layer status information is generated. At this time, a single layer can be "regarded" as two layers. The data blocks corresponding to A, B, and C are the transparent content parts of the layer. The layer description information of the scanned part is saved in buffer0.
[0091] The unscanned areas are all recorded as transparent, and their transparent state information can be saved in buffer1. When the graphic data is processed later, all data in the area are retained according to the graphic description information stored in buffer1.
[0092] Buffer0 and buffer1 may be different areas of the same info_buffer corresponding to the layer.
[0093] In step S12 of this embodiment, before the GPU performs graphics processing, the processor may remove the graphics data in the corresponding data block masked by the data block to be displayed in a non-transparent state from the layer to reduce the workload of the GPU during graphics processing.
[0094] It should be noted that the above correspondence means that the first data block and the eliminated data block are in the same two-dimensional spatial position, and may be in an up-and-down relationship or a front-and-back relationship in the layer direction. In fact, from the perspective of naked eye observation, the data block at the position covered by the first data block is eliminated.
[0095] The above-mentioned non-transparent data blocks can be data blocks whose to-be-displayed state and transparent state information are transparent. In some examples, when performing graphic data culling, referring to information such as Z order, regardless of whether the first data block is covered or not, the data blocks corresponding to the layers below the first data block will be culled.
[0096] In some examples, in order to improve the accuracy and scope of culling, the first data block may be an uncovered non-transparent data block, which may refer to a data block whose upper layer is transparent or does not exist, but which itself is not transparent.
[0097] According to the status of each data block to be displayed in each layer, this solution can remove the covered graphic data, and can also retain the data blocks whose upper layers are transparent or whose upper layers do not exist but are not transparent. Therefore, for layers with multiple layers containing multiple transparent contents, this solution can achieve accurate removal.
[0098] Furthermore, the present solution also includes layer display information of each layer in the layer description information, that is, retaining the bytes indicating whether a single layer is fully transparent or fully opaque. Correspondingly, when processing graphic data, the above-mentioned determination of the to-be-displayed status of each data block in multiple layers may include:
[0099] The to-be-displayed state of each data block in the multiple layers is determined according to the Z order of the multiple layers, the transparency state information corresponding to the multiple data blocks in each transparent layer, and each non-transparent layer.
[0100] It can be understood that for the non-transparent layer in which all data is non-transparent, it does not affect the data processing of the bottom layer. Therefore, when determining the status to be displayed of each data block, the entire layer can be used as a unit combined with the transparent status information corresponding to multiple data blocks in each transparent layer and the Z order of the layer for processing. This can reduce the overall amount of data when determining the status to be displayed, helping to quickly determine the status to be displayed of each data block.
[0101] like Figure 4 As shown in the figure, Layer0 is a completely opaque layer, its layer Z sequence value is 0, and the full-image transparency state (layer display information) is 00; Layer1 is a partially opaque layer, its layer Z sequence value is 1, and the full-image transparency state is 01. And the area A in Layer1 is transparent, so between Layer0 and Layer1, Layer0 is the first layer, and the data block except area A in Layer1 is the first data block, so Layer0 can retain the graphic data below area A in Layer1, and other graphic data covered by Layer1 can be completely removed.
[0102] In this way, the amount of data used by the GPU for graphics processing can be effectively reduced, thereby improving the efficiency of graphics processing and reducing the resource usage and time overhead of graphics data processing.
[0103] It can be seen that, through the graphic data processing method of the present application, the display status of each data block in multiple layers can be determined by obtaining the layer description information corresponding to the multiple layers before the processor performs graphic processing, and the data blocks corresponding to each layer are obtained by dividing the graphic data corresponding to each layer; further, the data blocks can be eliminated according to the display status, and when the graphics are eliminated, the data blocks of the layers below the data blocks to be displayed that are non-transparent can be eliminated. In this way, on the one hand, since the graphic data is pre-processed before the graphics are processed, the covered graphic data is eliminated, so the amount of data for graphics processing can be reduced and the efficiency of graphics processing can be improved. On the other hand, it avoids the situation where the displayed picture is adjusted during the graphics rendering process of the processor, thereby affecting the graphics processing process and reducing time overhead.
[0104] Based on the contents in the foregoing embodiments, it can be known that the layer description information is generated synchronously when the graphic data involved is written into the corresponding layer, so that before the subsequent graphic data processing, the display status of each data block in multiple layers involved in the graphic data to be processed can be grasped in advance based on the layer description information, thereby improving the efficiency of data processing and reducing time overhead.
[0105] To this end, the embodiment of the present invention discloses a process of how to obtain the transparency value of a pixel point and how to implement data block segmentation in the graphic data processing method of the above embodiment.
[0106] When determining the transparency status information corresponding to the data block, the process of obtaining the transparency values of the pixels to be displayed in the multiple data blocks in each layer may include:
[0107] Get the RGBA data corresponding to the graphic data, and map the transparency of the pixels to be displayed in each layer from the RGBA data.
[0108] The transparency values of the pixels to be displayed in each layer are mapped into a pixel value table corresponding to each layer, and the pixel value table corresponding to each layer is divided into regions to obtain multiple data blocks in each layer.
[0109] In this embodiment, Figure 5 As shown, the RGBA data corresponding to each pixel in the graphic data can be obtained, and then the data of the Alpha channel representing the transparency in the pixel can be mapped into a linked list structure. The RGBA data can be scanned from top to bottom and from left to right to obtain and record its Alpha channel value.
[0110] When scanning the pixels corresponding to the graphic data from top to bottom and from left to right, the info_buffer or the memory requested by the GPU will map the alpha channel data of each pixel separately into a Figure 5 The linked list shown in the upper right corner only includes transparent channel information, and then the Alpha pixel value table can be generated according to the linked lists corresponding to each layer.
[0111] The transparency value Pixels in the interval [0, preset value) are transparent pixels, and pixels with transparency values equal to the preset value are non-transparent pixels.
[0112] In this embodiment, it is necessary to map the transparency values of the pixels to be displayed in each layer into a pixel value table corresponding to each layer, and divide the pixel value table corresponding to each layer into regions to obtain multiple data blocks in each layer. After reading the pixel transparency values and dividing the data blocks within the layer, the transparency values of the pixels in each data block are finally obtained.
[0113] Specifically, Figure 5 As shown in the lower right corner, the pixel value table corresponding to each layer can be divided into regions according to the region division accuracy, wherein the region division accuracy of each layer can be related to the resolution of the layer. The region division accuracy can also be configured in the layer description information with reference to the above embodiment.
[0114] Taking the area division precision of 4 as an example, when the pixel value table is divided, the precision of each data block is 4*4, so we can get the following Figure 5 The four data blocks corresponding to the pixel value table are shown. The determination process of the transparent state information corresponding to the data block can refer to the above embodiment, which will not be described in detail here.
[0115] Please continue to see Figure 5 In the lower right diagram, there are four data blocks in the pixel value table. The transparency values of each pixel in the upper right data block are all preset values, so the transparency state of this data block can be set to non-transparent, and 1 can be used to represent the non-transparent state. The transparency values of the pixels in the remaining three data blocks are not preset values, so the brightness state of the remaining three data blocks can be set to transparent, and 0 can be used to represent the transparent state. Therefore, Figure 5 The transparency status information of each data block in the middle layer is 0100, and this information can be stored in the buffer corresponding to the layer data.
[0116] As described in the above embodiment, when judging the transparent state of a data block, in order to improve the efficiency of judging the transparent state, the judgment of the data block that is not 0xff / non-preset value adopts an immediate end method. When there is a value of any point that is not 0xff / non-preset value, it indicates that there is transparent data in the pixel point in the data block, indicating that the transparency state of the data block is transparent, and the transparent state can be marked as 0, and then the judgment of the remaining content is skipped. Among them, 0xff is a hexadecimal number, representing 255 in decimal. In this embodiment, the corresponding pixel transparency value is in a non-transparent state.
[0117] In order to further improve the efficiency of transparent state judgment, the data in the data block can be processed in parallel by SIMD. Taking the area division precision of 16 as an example, assuming that each 4 lines are a group, and each group has 4 lines of data, then Figure 6 As shown, when judging the non-0xff / non-preset value in the group, the four groups of data execute the same processing command at the same time. When any group recognizes that there is a non-0xff / non-preset value in the group, it sends synchronization information in time to stop all groups from judging and processing the data, and judge the non-0xff / non-preset value in the next data block.
[0118] It should be noted that the data offset between data blocks is related to the area division accuracy. For example, if the area division accuracy is 16, the data offset is 16*16. The data offset by 16*16 from the starting position of the current block enters the next data block for judgment.
[0119] Furthermore, the speed of parallel processing of data in a data block by SIMD (Single Instruction Multiple Data) is related to the register size. For example, if a 512-bit register is used, 8 int64 numbers can be loaded at the same time, so the processing can be performed at a parallelism of 8. On the other hand, when dividing the area blocks, the minimum division accuracy is half byte, but in order to facilitate data processing, full byte size or even multiple of full byte size is usually used for processing to maximize processing efficiency.
[0120] In this way, by using the immediate end method and SIMD method when judging the data block, the amount of data processed during the transparent judgment of the data block can be effectively reduced, the resource occupation can be reduced, and the overhead can be reduced, and the efficiency of the transparent status judgment of the data block can be effectively improved.
[0121] It can be seen that in this embodiment, the transparency values of the pixels in the layer can be mapped to a data table by mapping a separate linked list, and then the data table is divided to obtain corresponding data blocks, and the data in the data block is judged by using the instant end method and the SIMD method to obtain the transparency state of each data block and the transparency state of the layer. In this way, on the one hand, by mapping a separate linked list, the memory can be effectively managed and the memory fragmentation can be reduced. Since the linked list nodes do not have to be stored continuously in the memory, it can be more easily adapted to memory blocks of different sizes, thereby improving memory utilization; on the other hand, the instant end method can reduce the amount of data that needs to be processed when judging the data, and judging the data in the data block by the SIMD method can process the data in parallel to improve the efficiency of data processing.
[0122] See also Figure 7 As shown, an embodiment of the present invention discloses a graphics data processing device, including:
[0123] The information scanning module 11 is used to obtain layer description information corresponding to the multiple layers respectively, so as to determine the to-be-displayed status of each data block in the multiple layers, wherein the layer description information is generated when the involved graphic data is written into the corresponding layer, and the data block is formed by dividing the graphic data;
[0124] The data elimination module 12 is used to eliminate the data block corresponding to the position of the first data block in the first layer before the GPU performs graphics processing, the first layer is a layer below the layer where the first data block is located, and the first data block is a data block to be displayed in a non-transparent state.
[0125] In some embodiments, the information scanning module 11 may specifically include:
[0126] An information acquisition submodule, used to acquire the Z order of multiple layers and the transparency status information corresponding to multiple data blocks in each layer from the layer description information corresponding to the multiple layers respectively, wherein the transparency status information is arranged according to the positions of the multiple data blocks in the layer;
[0127] The to-be-displayed state determination submodule is used to determine the to-be-displayed state of each data block in the multiple layers according to the Z order of the multiple layers and the transparency state information corresponding to the multiple data blocks in each layer.
[0128] In some embodiments, the graphics data processing device may further include:
[0129] The transparency value acquisition submodule is used to obtain the transparency values of pixels to be displayed in multiple data blocks in each layer;
[0130] A first transparency state determination submodule, configured to set the transparency state information corresponding to the second data block to a transparent state when the transparency value of any pixel to be displayed in the second data block in any layer is not a preset value, wherein the plurality of data blocks in any layer include the second data block;
[0131] The second transparency state determination submodule is used to set the transparency state information corresponding to the second data block to a non-transparent state when the transparency values of all pixels to be displayed in the second data block in any layer are preset values.
[0132] In some embodiments, the transparency value acquisition submodule may specifically include:
[0133] A data mapping unit, used to obtain RGBA data corresponding to the graphic data, and map the RGBA data to obtain the transparency of the pixels to be displayed in each layer;
[0134] The data partitioning unit is used to map the transparency values of the pixels to be displayed in each layer into a pixel value table corresponding to each layer, and to perform area partitioning on the pixel value table corresponding to each layer to obtain multiple data blocks in each layer.
[0135] In some embodiments, the data partitioning unit may specifically include:
[0136] A region division unit is used to divide the pixel value table corresponding to each layer into regions according to the region division accuracy;
[0137] The layer description information includes the area division accuracy, and the area division accuracy of each layer is related to the resolution of the layer.
[0138] In some embodiments, the layer description information also includes layer display information of each layer.
[0139] In some embodiments, the to-be-displayed state determination submodule may specifically include:
[0140] A transparent layer determination unit, used for determining a transparent layer in each layer according to the layer display information of each layer;
[0141] The first to-be-displayed state determining unit is used to determine the to-be-displayed state of each data block in the multiple layers according to the Z order of the multiple layers, the transparency state information corresponding to the multiple data blocks in each transparent layer and each non-transparent layer.
[0142] In some embodiments, the information scanning module 11 may specifically include:
[0143] The second to-be-displayed state determination unit is used to determine the to-be-displayed state of the data blocks in the target layer within the description range when the description range of the layer description information corresponding to the target layer does not include all the data blocks in the target layer, and multiple layers include the target layer.
[0144] In some embodiments, the graphics data processing device may further include:
[0145] The data block saving unit is used to save the data blocks in the target layer that are not within the description range.
[0146] Furthermore, the present application also discloses an electronic device. Figure 8 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0147] Figure 8 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the graphic data processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.
[0148] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0149] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0150] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the graphic data processing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.
[0151] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed method for processing graphic data. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0152] Furthermore, the present application also discloses a computer program product, which includes a computer program / instruction, wherein the computer program / instruction, when executed by a processor, implements the aforementioned disclosed method for processing graphic data. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the aforementioned embodiments, and no further description will be given here.
[0153] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0154] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0155] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0156] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0157] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for processing graphic data, characterized in that: include: Acquire layer description information corresponding to the plurality of layers respectively, so as to determine the to-be-displayed state of each data block in the plurality of layers, wherein the layer description information is generated when the involved graphic data is written into the corresponding layer, and the data block is formed by dividing the graphic data; Before the GPU performs graphics processing, a data block corresponding to the position of the first data block in the first layer is removed, the first layer is a layer below the layer where the first data block is located, and the first data block is a data block to be displayed in a non-transparent state.
2. The method for processing graphic data according to claim 1, characterized in that: The step of acquiring the layer description information corresponding to the multiple layers to determine the to-be-displayed status of each data block in the multiple layers includes: Acquire the Z order of the multiple layers and the transparency status information corresponding to the multiple data blocks in each layer from the layer description information respectively corresponding to the multiple layers, wherein the transparency status information is arranged according to the positions of the multiple data blocks in the layer; According to the Z order of the multiple layers and the transparency status information corresponding to the multiple data blocks in each layer, the to-be-displayed status of each data block in the multiple layers is determined.
3. The method for processing graphic data according to claim 2, characterized in that: The layer description information also includes layer display information of each layer; The step of determining the to-be-displayed state of each data block in the multiple layers according to the Z order of the multiple layers and the transparency state information corresponding to the multiple data blocks in each layer includes: According to the layer display information of each layer, the transparent layer in each layer is determined; The to-be-displayed state of each data block in the multiple layers is determined according to the Z order of the multiple layers, the transparency state information corresponding to the multiple data blocks in each transparent layer, and each non-transparent layer.
4. The method for processing graphic data according to claim 1, characterized in that: The steps to generate layer description information include: Get the transparency value of the pixels to be displayed in multiple data blocks in each layer; When the transparency value of any pixel to be displayed in the second data block in any layer is not a preset value, setting the transparency state information corresponding to the second data block to a transparent state, and the multiple data blocks in any layer include the second data block; When the transparency values of all pixels to be displayed in the second data block in any layer are preset values, the transparency state information corresponding to the second data block is set to a non-transparent state.
5. The method for processing graphic data according to claim 4, characterized in that: The step of obtaining the transparency values of pixels to be displayed in a plurality of data blocks in each layer includes: Get the RGBA data corresponding to the graphic data, and map the transparency of the pixels to be displayed in each layer from the RGBA data; The transparency values of the pixels to be displayed in each layer are mapped into a pixel value table corresponding to each layer, and the pixel value table corresponding to each layer is divided into regions to obtain multiple data blocks in each layer.
6. The method for processing graphic data according to claim 5, characterized in that: The step of dividing the pixel value tables corresponding to each layer into regions includes: Divide the pixel value table corresponding to each layer into regions according to the region division accuracy; The layer description information includes the area division accuracy, and the area division accuracy of each layer is related to the resolution of the layer.
7. The method for processing graphic data according to any one of claims 1 to 6, characterized in that: The step of determining the to-be-displayed status of each data block in the multiple layers includes: When the description range of the layer description information corresponding to the target layer does not include all the data blocks in the target layer, determining the to-be-displayed state of the data blocks in the target layer within the description range, wherein the multiple layers include the target layer; Accordingly, the graphic data processing method further includes: The data blocks in the target layer that are not within the description range are retained.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the graphics data processing method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the graphics data processing method according to any one of claims 1 to 7.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the steps of the graphics data processing method according to any one of claims 1 to 7 are implemented.