CN-115512016-B - Cross-process image drawing method and device, equipment and medium thereof
Abstract
Responding to an image drawing event which acts on a first image drawing process executed by a central processing unit, and acquiring a target handle corresponding to an image to be drawn of the image drawing event; the method comprises the steps of generating a shared buffer zone of image data to be drawn based on a target handle, establishing address mapping between a memory address of an image to be drawn in a first image drawing process and a disk address in the shared buffer zone, reading the image data of the image to be drawn in the first image drawing process based on the memory address, storing the image data to the disk address in the shared buffer zone, and pushing the image to be drawn to an image processor to execute a second image drawing process after the image to be drawn is completely stored in the shared buffer zone, so as to drive the second image drawing process to draw the image to be drawn. The application can lighten the image drawing pressure of the CPU and save the running memory so as to improve the stability of the system.
Inventors
- LIANG WEIJIE
Assignees
- 广州方硅信息技术有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20220927
Claims (10)
- 1. A cross-process image drawing method is characterized by comprising the following steps: responding to an image drawing event acting on a first image drawing process, and acquiring a target handle corresponding to an image to be drawn of the image drawing event, wherein the first image drawing process is executed by a central processing unit, and the image to be drawn is a special effect image frame of an animation special effect control in a live broadcasting room interface; Generating a shared buffer zone of the image to be drawn, which is positioned in an external storage except for a running memory of a terminal device and a cache of a central processing unit, based on the target handle, and establishing an address mapping between a memory address of the image to be drawn in the first image drawing process and a disk address in the shared buffer zone, wherein the shared buffer zone comprises the target handle; Based on the memory address, reading the image data of the image to be drawn in the first image drawing process, and storing the image data to a disk address in the shared buffer area, wherein the method comprises the steps of determining a memory address pointer of the image to be drawn acting on the first image drawing process, determining a target memory address corresponding to the memory address pointer, determining an end memory address corresponding to the target memory address as an address starting point according to a preset address reading step number, determining a memory address interval between the target memory address and the end memory address, acquiring the image data stored in the memory address interval, and storing the image data to the disk address corresponding to the shared buffer area; After the image to be drawn is completely stored in the shared buffer area, the image to be drawn stored in the shared buffer area is pushed to a second image drawing process, the second image drawing process is driven to draw the image to be drawn, and the second image drawing process is executed by an image processor.
- 2. The method of claim 1, wherein the step of responding to the image rendering event acting on the first image rendering process comprises the steps of: responding to a virtual gift presentation event acted on a living broadcast room, and acquiring a target gift identification of the virtual gift presentation event; inquiring an animation special effect control corresponding to the target gift identification from a gift control library, wherein the animation special effect control comprises an image to be drawn; Pushing the image to be drawn contained in the animation special effect control to the first image drawing process, and triggering the image drawing event acting on the image to be drawn.
- 3. The method according to claim 1, wherein after the image to be drawn is completely stored in the shared buffer, the image to be drawn is pushed to a second image drawing process, and the step of driving the second image drawing process to draw the image to be drawn includes the steps of: based on each disk address in the shared buffer area, acquiring an image to be drawn formed by image data stored in each disk address; pushing the image to be drawn into the second image drawing process, and driving the second image drawing process to draw the image to be drawn according to a preset image filter algorithm; and acquiring a vector image output by the second image drawing process.
- 4. The method according to claim 1, wherein after the step of completely storing the image to be drawn in the shared buffer, pushing the image to be drawn to a second image drawing process, and driving the second image drawing process to draw the image to be drawn, the method comprises the steps of: acquiring a special effect image correspondingly generated by drawing an image to be drawn by the second image drawing process; calling an image callback method of the first image drawing process, and returning the special effect image to the first image drawing process; And driving the first image drawing process to output the special effect image to an animation special effect control for display.
- 5. The method according to claim 1, wherein after the step of completely storing the image to be drawn in the shared buffer, pushing the image to be drawn to a second image drawing process, and driving the second image drawing process to draw the image to be drawn, the method comprises the steps of: Responding to an image display completion event acting on the animation special effect control, and acquiring a target handle corresponding to the image display completion event; and determining a target shared buffer area corresponding to the target handle, and removing the target shared buffer area.
- 6. A cross-process image rendering apparatus, comprising: The system comprises a drawing event response module, a first image drawing process and a second image drawing process, wherein the drawing event response module is used for responding to an image drawing event acting on a first image drawing process and obtaining a target handle corresponding to an image to be drawn of the image drawing event, the first image drawing process is executed by a central processing unit, and the image to be drawn is an effect image frame of an animation effect control in a live broadcasting room interface; The buffer generating module is used for generating a shared buffer of the image to be drawn based on the target handle, wherein the shared buffer is positioned in an external storage except a running memory of a terminal device and a cache of a central processing unit, and establishes an address mapping between a memory address of the image to be drawn and a disk address in the shared buffer in the first image drawing process; The image data buffer module is used for reading the image data of the image to be drawn in the first image drawing process based on the memory address, and storing the image data to the disk address in the shared buffer area, and comprises the steps of determining a memory address pointer of the image to be drawn acting on the first image drawing process, determining a target memory address corresponding to the memory address pointer, determining an end memory address corresponding to the target memory address as an address starting point according to a preset address reading step number, determining a memory address interval between the target memory address and the end memory address, acquiring the image data stored in the memory address interval, and storing the image data to the corresponding disk address in the shared buffer area; And the image sharing drawing module is used for pushing the image to be drawn stored in the shared buffer area to a second image drawing process after the image to be drawn is completely stored in the shared buffer area, and driving the second image drawing process to draw the image to be drawn, wherein the second image drawing process is executed by an image processor.
- 7. The cross-process image rendering apparatus of claim 6, wherein the rendering event response module comprises: The gift presentation event response sub-module is used for responding to a virtual gift presentation event acted on a living broadcast room and acquiring a target gift identification of the virtual gift presentation event; the special effect control inquiry sub-module is used for inquiring the animation special effect control corresponding to the target gift identification from a gift control library, and the animation special effect control comprises an image to be drawn; and the drawing event triggering sub-module is used for pushing the image to be drawn contained in the animation special effect control to the first image drawing process and triggering the image drawing event acting on the image to be drawn.
- 8. The cross-process image rendering apparatus of claim 6, wherein the image sharing rendering module comprises: the image to be drawn obtaining sub-module is used for obtaining an image to be drawn formed by image data stored in each disk address based on each disk address in the shared buffer area; The image drawing sub-module to be drawn is used for pushing the image to be drawn into the second image drawing process, and driving the second image drawing process to draw the image to be drawn according to a preset image filter algorithm; and the vector image acquisition sub-module is used for acquiring the vector image output by the second image drawing process.
- 9. An electronic device comprising a central processor and a memory, characterized in that the central processor is adapted to invoke a computer program stored in the memory for performing the steps of the method according to any of claims 1 to 5.
- 10. A non-volatile storage medium, characterized in that it stores in form of computer readable instructions a computer program implemented according to the method of any one of claims 1 to 5, which when invoked by a computer, performs the steps comprised by the method.
Description
Cross-process image drawing method and device, equipment and medium thereof Technical Field The application relates to the field of network live broadcast special effects, in particular to a cross-process image drawing method, and further relates to a device, equipment and a nonvolatile storage medium corresponding to the method. Background When the existing terminal device draws the animation special effects to output and display, the advanced drawing engines such as the Core Graphic and the like executed by the central processing unit of the device are usually used for drawing graphics, for example, the advanced drawing engines such as the Core Graphic and the like are used for drawing the animation special effects in the live broadcasting room so as to promote the live broadcasting atmosphere in the live broadcasting room, but if the advanced drawing engines need to draw high-resolution images or draw animation special effects of a large number of images, such as the high-resolution high-frame gift animation special effects in the live broadcasting room generally have a large number of high-resolution images, a large amount of running memory of the terminal device is occupied during drawing, the stability of an running system is influenced, and a large amount of running memory is applied to buffer the images to be drawn in a moment, so that the running memory overflows, the system has an OOM problem, the image drawing process is forcibly closed, the animation special effects are drawn in a break, the application program is caused to flash back, and the use experience of a user is seriously influenced. Besides, when the CPU in the device performs Graphic drawing, other processes are required to be executed for the device to ensure the operation of the application program and the operation system, and a huge number of processes are responsible for the operation of the CPU, so that the overall execution efficiency and response speed of the CPU are affected, and even the problems of heating of the CPU, blocking of the device system and the like are caused. In view of the problems with existing animated special effect image rendering, the present inventors have made a corresponding exploration in view of solving the problems. Disclosure of Invention The application aims to meet the requirements of users and provides a cross-process image drawing method, and further relates to a corresponding device, equipment, a nonvolatile storage medium and a computer program product of the method. In order to achieve the purpose of the application, the following technical scheme is adopted: the application provides a cross-process image drawing method which is suitable for the purpose of the application, and comprises the following steps: Responding to an image drawing event acting on a first image drawing process, and acquiring a target handle corresponding to an image to be drawn of the image drawing event, wherein the first image drawing process is executed by a central processing unit; Generating a shared buffer zone of the image to be drawn based on the target handle, and establishing address mapping between a memory address of the image to be drawn and a disk address in the shared buffer zone in the first image drawing process; Based on the memory address, reading image data of the image to be drawn in the first image drawing process, and storing the image data to a disk address in the shared buffer area; After the image to be drawn is completely stored in the shared buffer zone, the image to be drawn is pushed to a second image drawing process, the second image drawing process is driven to draw the image to be drawn, and the second image drawing process is executed by an image processor. In a further embodiment, the step of responding to the image drawing event applied to the first image drawing process includes the steps of: responding to a virtual gift presentation event acted on a living broadcast room, and acquiring a target gift identification of the virtual gift presentation event; inquiring an animation special effect control corresponding to the target gift identification from a gift control library, wherein the animation special effect control comprises an image to be drawn; Pushing the image to be drawn contained in the animation special effect control to the first image drawing process, and triggering the image drawing event acting on the image to be drawn. In a further embodiment, the step of generating the shared buffer of the image to be drawn based on the target handle and establishing an address mapping between the memory address of the image to be drawn and the disk address in the shared buffer in the first image drawing process includes the following steps: generating a shared buffer with the target handle; acquiring a first memory address of the image to be drawn acting on the first image drawing process; and establishing address mapping between the first memory address and the first disk address