US-20260124535-A1 - IMAGE PROCESSING METHOD AND APPARATUS, COMPUTER DEVICE, AND STORAGE MEDIUM
Abstract
An image processing method includes: obtaining a target compression texture resource of a target image, the target compression texture resource including a plurality of compression texture blocks; allocating a plurality of target work groups for decoding to the plurality of compression texture blocks in a graphic card shader, and distributing each compression texture block to a corresponding target work group; and decoding in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks.
Inventors
- Zhiqiang YUAN
- Xinda Zhao
- Yandong Yang
Assignees
- TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Dates
- Publication Date
- 20260507
- Application Date
- 20251231
- Priority Date
- 20210517
Claims (20)
- 1 . An image processing method, performed by a computer device comprising a graphic card, and comprising: obtaining, by a graphic card shader of the graphic card, a target compression texture resource of a target image, the target compression texture resource having a corresponding compression texture format, the target compression texture resource comprising a plurality of compression texture blocks, wherein the graphic card shader includes a plurality of work groups, each work group is a sub-processing unit having a decoding capability; allocating a plurality of target work groups for decoding to the plurality of compression texture blocks in the graphic card shader, and distributing each compression texture block to a corresponding target work group of the plurality of work groups in the graphic card shader; and decoding in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks; and performing, by rendering pipelines of the graphic card, image rendering according to the target texture data to obtain the target image.
- 2 . The method according to claim 1 , wherein the target work groups are independent of each other; and a target work group decodes the received compression texture block by using an algorithm instruction used for decoding the target compression texture resource.
- 3 . The method according to claim 1 , wherein the graphic card further comprises a decoding pipeline, and the graphic card shader works according to a procedure specified in the decoding pipeline.
- 4 . The method according to claim 3 , wherein each of the rendering pipelines comprises a virtual first graphic card address space, and the decoding pipeline comprises a virtual second graphic card address space; and each of the first graphic card address space and the second graphic card address space has a mapping relationship with the same texture storage space.
- 5 . The method according to claim 4 , further comprising: buffering, in the texture storage space according to the mapping relationship between the second graphic card address space and the texture storage space, decoded data obtained through the decoding by the target work group; and the performing image rendering comprises: after the decoded data corresponding to the compression texture blocks are stored in the texture storage space, performing, according to the mapping relationship between the first graphic card address space and the texture storage space, the image rendering according to the target texture data in the texture storage space by using the rendering pipelines to obtain the target image.
- 6 . The method according to claim 4 , further comprising: allocating the texture storage space to the target image in a local space of the computer device by using the rendering pipeline; mapping the first graphic card address space to the texture storage space by using the rendering pipeline, and transferring a space identifier of the texture storage space to the decoding pipeline; and mapping the second graphic card address space to the texture storage space by using the decoding pipeline according to the space identifier.
- 7 . The method according to claim 3 , wherein the obtaining a target compression texture resource of a target image comprises: loading the target compression texture resource of the target image from a local space of the computer device by using the rendering pipeline; and the method further comprises: distributing the target compression texture resource to the decoding pipeline by using the rendering pipeline; and after the decoding pipeline successfully receives the target compression texture resource, transmitting a decoding notification to the graphic card shader through the decoding pipeline, to notify the graphic card shader to allocate the plurality of target work groups for decoding to the plurality of compression texture blocks.
- 8 . The method according to claim 7 , wherein the computer device has a graphic card decoding mode indicating whether to perform decoding by using the graphic card shader; and the method further comprises: detecting a mode status of the graphic card decoding mode by using the rendering pipeline, the mode status comprising a mode on state or a mode off state; in response to the mode status being the mode on state, performing the operation of distributing the target compression texture resource to the decoding pipeline by using the rendering pipeline; and in response to the mode status being the mode off state, invoking a graphic card driver central processing unit (CPU) by using the rendering pipeline to decode the compression texture blocks in the target compression texture resource to obtain the target texture data of the target image.
- 9 . The method according to claim 8 , wherein the target image is a target game picture image in a target game; and the method further comprises: obtaining an offline decoded data set of the target game by using the rendering pipeline, the offline decoded data set comprising an image identifier of one or more game picture images in the target game and texture data associated with each image identifier, texture data associated with an image identifier being obtained by performing offline decoding on a compression texture resource of a game picture image indicated by the image identifier; performing identifier hitting on the image identifier in the offline decoded data set by using the rendering pipeline according to an image identifier of the target image; in response to that a hit on the image identifier fails, performing the operation of detecting a mode status of the graphic card decoding mode by using the rendering pipeline; and in response to that the hit on the image identifier succeeds, loading texture data associated with the hit image identifier from the offline decoded data set by using the rendering pipeline, and using the loaded texture data as the target texture data of the target image.
- 10 . The method according to claim 9 , wherein the operation of allocating the plurality of target work groups for decoding to the plurality of compression texture blocks in the graphic card shader is performed in response to that the image identifier of the target image does not exist in the offline decoded data set; and in response to that the image identifier of the target image exists in the offline decoded data set, the target texture data of the target image is loaded from the offline decoded data set.
- 11 . The method according to claim 9 , further comprising: detecting a decoding capability related to the target compression texture resource of the graphic card driver CPU by using the rendering pipeline; in response to detecting that the graphic card driver CPU has the decoding capability, performing the operation of obtaining an offline decoded data set of the target game by using the rendering pipeline; and in response to detecting that the graphic card driver CPU does not have the decoding capability, invoking a game engine CPU of the target game by using the rendering pipeline to decode the compression texture blocks in the target compression texture resource to obtain the target texture data of the target image.
- 12 . The method according to claim 1 , further comprising: in response to that one or more of the compression texture blocks in the target compression texture resource fail to be decoded by the graphic card shader, invoking a graphic card driver central processing unit (CPU) to decode the compression texture blocks in the target compression texture resource to obtain the target texture data of the target image.
- 13 . The method according to claim 1 , wherein the graphic card shader comprises M work groups, M being an integer greater than 1; and the allocating the plurality of target work groups for decoding to the plurality of compression texture blocks in a graphic card shader comprises: traversing the plurality of compression texture blocks, and determining a current compression texture block being traversed currently; in response to that an unallocated remaining work group exists in the M work groups in the graphic card shader, allocating one target work group for decoding to the current compression texture block from the remaining work group; and in response to that all the work groups in the M work groups have been allocated to compression texture blocks, allocating one target work group for decoding to the current compression texture block from the M work groups.
- 14 . The method according to claim 1 , wherein a decoding procedure performed by the graphic card shader is independently encapsulated in one software development kit (SDK), to perform decoding by invoking the SDK when a compression texture resource of an image needs to be decoded.
- 15 . An image processing apparatus, the apparatus being deployed on a computer device, and comprising: a graphic card and a computer storage medium, the graphic card comprising at least a graphic card shader and rendering pipelines, the computer storage medium storing one or more instructions, the one or more instructions being suitable to be loaded by the graphic card and perform: obtaining, by a graphic card shader of the graphic card, a target compression texture resource of a target image, the target compression texture resource having a corresponding compression texture format, the target compression texture resource comprising a plurality of compression texture blocks, wherein the graphic card shader includes a plurality of work groups, and each work group is a sub-processing unit having a decoding capability; allocating a plurality of target work groups for decoding to the plurality of compression texture blocks in the graphic card shader, and distributing each compression texture block to a corresponding target work group of the plurality of work groups in the graphic card shader; and decoding in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks; and performing, by rendering pipelines of the graphic card, image rendering according to the target texture data to obtain the target image.
- 16 . The apparatus according to claim 15 , wherein the target work groups are independent of each other; and a target work group decodes the received compression texture block by using an algorithm instruction used for decoding the target compression texture resource.
- 17 . The apparatus according to claim 15 , further comprising a graphic card driver central processing unit (CPU) configured to: in response to that one or more of the compression texture blocks in the target compression texture resource fail to be decoded by the graphic card shader, decode the compression texture blocks in the target compression texture resource to obtain the target texture data of the target image.
- 18 . The apparatus according to claim 15 , wherein the graphic card shader comprises M work groups, M being an integer greater than 1; and the allocating the plurality of target work groups for decoding to the plurality of compression texture blocks in the graphic card shader comprises: traversing the plurality of compression texture blocks, and determining a current compression texture block being traversed currently; in response to that an unallocated remaining work group exists in the M work groups in the graphic card shader, allocating one target work group for decoding to the current compression texture block from the remaining work group; and in response to that all the work groups in the M work groups have been allocated to compression texture blocks, allocating one target work group for decoding to the current compression texture block from the M work groups.
- 19 . The apparatus according to claim 15 , wherein a decoding procedure performed by the graphic card shader is independently encapsulated in one software development kit (SDK), to perform decoding by invoking the SDK when a compression texture resource of an image needs to be decoded.
- 20 . A non-transitory computer storage medium, the computer storage medium storing one or more instructions, the one or more instructions being suitable to be loaded and executed by a graphic card and perform: obtaining, by a graphic card shader of the graphic card, a target compression texture resource of a target image, the target compression texture resource having a corresponding compression texture format, the target compression texture resource comprising a plurality of compression texture blocks, wherein the graphic card shader includes a plurality of work groups, and each work group is a sub-processing unit having a decoding capability; allocating a plurality of target work groups for decoding to the plurality of compression texture blocks in the graphic card shader, and distributing each compression texture block to a corresponding target work group of the plurality of work groups in the graphic card shader; and decoding in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks; and performing, by rendering pipelines of the graphic card, image rendering according to the target texture data to obtain the target image.
Description
CROSS-REFERENCES TO RELATED APPLICATIONS This application is a continuation of U.S. application Ser. No. 17/989,506 filed on Nov. 17, 2022; U.S. application Ser. No. 17/989,506 is a continuation application of PCT Patent Application No. PCT/CN2022/085728, filed on Apr. 8, 2022, which claims priority to Chinese Patent Application No. 202110536966.7, entitled “IMAGE PROCESSING METHOD AND APPARATUS, COMPUTER DEVICE, AND STORAGE MEDIUM” and filed with the National Intellectual Property Administration, PRC on May 17, 2021, the entire contents of all of which are incorporated herein by reference. FIELD OF THE TECHNOLOGY The present disclosure relates to the field of Internet technologies, and specifically to image processing technologies. BACKGROUND OF THE DISCLOSURE At present, in the process of creating an image, to reduce memory occupied by the image and network resources required to transmit the image, an image creator may use compression texture format to perform compression encoding on the image to obtain a compression texture resource and release the compression texture resource to external receivers. Accordingly, a receiver device may decode the compression texture resource of the image after obtaining the compression texture resource. SUMMARY Embodiments of the present disclosure provide an image processing method and apparatus, a computer device, and a storage medium, so that while the decoding of a target compression texture resource is implemented, the decoding efficiency can be effectively improved. According to an aspect, the embodiments of the present disclosure provide an image processing method, the method being performed by a computer device, the method including: obtaining a target compression texture resource of a target image, the target compression texture resource having a corresponding compression texture format, the target compression texture resource including a plurality of compression texture blocks; allocating a plurality of target work groups for decoding to the plurality of compression texture blocks in a graphic card shader, and distributing each compression texture block to a corresponding target work group; and decoding in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks. According to another aspect, the embodiments of the present disclosure provide an image processing apparatus, the apparatus being deployed on a computer device, the apparatus including: an obtaining unit, configured to obtain a target compression texture resource of a target image, the target compression texture resource being obtained by encoding the target image by using a compression texture format, the target compression texture resource including a plurality of compression texture blocks; and a processing unit, configured to: allocate a plurality of target work groups for decoding to the plurality of compression texture blocks in a graphic card shader, and distribute each compression texture block to a corresponding target work group, the processing unit being further configured to: decode in parallel, by the target work groups in the graphic card shader, the compression texture blocks according to the compression texture format, to obtain target texture data of the target image, the target texture data comprising decoded data corresponding to the compression texture blocks. According to still another aspect, the embodiments of the present disclosure provide a computer device, the computer device including an input interface and an output interface, the computer device further including: a graphic card shader and a computer storage medium, the computer storage medium storing one or more instructions, the one or more instructions being suitable to perform the image processing method in the foregoing aspects. According to still another aspect, the embodiments of the present disclosure provide a non-transitory computer storage medium, the computer storage medium storing one or more instructions, the one or more instructions being suitable to perform the image processing method in the foregoing aspects. In the embodiments of the present disclosure, a graphic card shader is introduced, and a plurality of work groups independent of each other are deployed in advance in the graphic card shader. A target compression texture resource obtained by encoding a target image by using a compression texture format includes a plurality of compression texture blocks. After the target compression texture resource of the target image is obtained, one target work group for decoding may be respectively allocated to each compression texture block in the graphic card shader, and each compression texture block is distributed to a corresponding target work group. Next, a received compression texture