Special effect rendering method and device, electronic equipment, storage medium and program product

By creating special effects buffers and loading data in batches, special effects rendering problems caused by video memory limitations are solved and rendering performance and effects are improved.

CN118540543APending Publication Date: 2024-08-23SHENZHEN HUIDU TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410596092.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-14
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

When rendering special effects in images or videos, the display size of the special effects is large and exceeds the interface size of the display interface, resulting in video memory limitations, inability to render or poor rendering effects, affecting user experience.

Method used

By creating a special effects buffer, load the frame data to be rendered into the video memory in batches for rendering, use multiple special effects buffers to cache the frame data to be rendered of a single special effects video frame, and render them sequentially according to the predetermined buffer queue order. displayed on the display interface.

Benefits of technology

It improves the rendering performance of graphics during special effects rendering, enhances the effect of special effects rendering, and solves rendering problems caused by the limitation of video memory size.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540543A
    Figure CN118540543A
Patent Text Reader

Abstract

The invention discloses a special effect rendering method and device, electronic equipment, a storage medium and a program product. The method comprises the following steps: acquiring to-be-rendered frame data of a plurality of special effect video frames corresponding to a to-be-rendered special effect; under the condition that the special effect display size corresponding to the to-be-rendered special effect is greater than the interface size of the display interface, creating a plurality of special effect buffer areas; caching multiple pieces of frame data to be rendered to each special effect buffer area according to the special effect frame rendering sequence; wherein the special effect buffer area is used for caching to-be-rendered frame data corresponding to a single special effect video frame; and rendering the to-be-rendered frame data cached in the special effect buffer area in sequence according to the queue sequence of the buffer area to obtain a special effect video frame corresponding to the to-be-rendered special effect, and displaying the special effect video frame on a display interface. According to the technical scheme, the effect of loading the to-be-rendered frame data into the video memory in batches for rendering by creating the special effect buffer area when a special effect with a large special effect display size is rendered is achieved, and the rendering performance of the video memory during special effect rendering is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of special effect rendering technology, and in particular to a special effect rendering method, device, electronic equipment, storage medium and program product. Background Art

[0002] In image processing or video production scenarios, the application of special effects is very popular among users. Special effects can be added to images or videos so that the resulting image or video presents a special effect corresponding to the special effect.

[0003] In the related art, when rendering special effects, a rendering interface is usually used to render the animation special effects, so as to render the special effects to a display interface for display.

[0004] However, there are many types of special effects. In some special effects, the rendering area of ​​the special effects is large, which exceeds the interface size of the display interface, that is, the interface size, that is, multiple video frames need to be connected to display to fully display the special effects. Based on the above special effect rendering method, it may be limited by the size limit of the video memory, and then, it may be impossible to render the special effects to be rendered or the rendering effect is poor, affecting the user's viewing experience. Summary of the invention

[0005] The present invention provides a special effects rendering method, device, electronic device, storage medium and program product, so as to achieve the effect of loading the frame data to be rendered into the video memory in batches for rendering by creating a special effects buffer when rendering special effects with a large display size. The amount of data that needs to be loaded each time is small, which improves the rendering performance of the video memory during special effects rendering, and further improves the special effects rendering effect.

[0006] According to a first aspect of the present invention, a special effects rendering method is provided, the method comprising:

[0007] Obtaining frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered;

[0008] When the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, creating multiple special effect buffers;

[0009] Cache the frame data to be rendered corresponding to a plurality of special effect video frames into each of the special effect buffers respectively according to the special effect frame rendering order corresponding to the special effect to be rendered; wherein the special effect buffer is used to cache the frame data to be rendered corresponding to a single special effect video frame;

[0010] Rendering the to-be-rendered frame data cached in the special effect buffer in sequence according to a predetermined buffer queue order to obtain a special effect video frame corresponding to the to-be-rendered special effect, and displaying the special effect video frame on the display interface;

[0011] The buffer queue order is determined based on the video frame order of the special effect video frames corresponding to the frame data to be rendered cached in the special effect buffer in the special effect to be rendered.

[0012] According to a second aspect of the present invention, a special effects rendering device is provided, the device comprising:

[0013] The frame data acquisition module is used to obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered.

[0014] A buffer creation module, used to create multiple special effect buffers when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface;

[0015] A data caching module, used to cache the frame data to be rendered corresponding to multiple special effect video frames respectively into each of the special effect buffers according to the special effect frame rendering order corresponding to the special effect to be rendered; wherein the special effect buffer is used to cache the frame data to be rendered corresponding to a single special effect video frame;

[0016] A data rendering module is used to render the frame data to be rendered cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtain special effect video frames corresponding to the special effect to be rendered, and display the special effect video frames on the display interface; wherein the buffer queue order is determined based on the video frame order of the special effect video frames corresponding to the frame data to be rendered cached in the special effect buffer in the special effect to be rendered.

[0017] According to a third aspect of the present invention, there is provided an electronic device, the electronic device comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the special effects rendering method described in any embodiment of the present invention.

[0021] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the special effects rendering method described in any embodiment of the present invention when executed.

[0022] According to a fifth aspect of the present invention, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, the special effects rendering method described in any embodiment of the present invention is implemented.

[0023] The technical solution of the embodiment of the present invention obtains the to-be-rendered frame data of multiple special effect video frames corresponding to the special effect to be rendered, and then, when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, creates multiple special effect buffers, and then, according to the special effect frame rendering order corresponding to the special effect to be rendered, caches the to-be-rendered frame data corresponding to the multiple special effect video frames to each special effect buffer respectively, and then, according to the predetermined buffer queue order, sequentially renders the to-be-rendered frame data cached in the special effect buffer to obtain the special effect video frame corresponding to the special effect to be rendered, and displays the special effect video frame on The display interface solves the problem in the related technology that when rendering special effects with a large display size, the special effects to be rendered cannot be rendered or the rendering effect is poor due to the size limit of the video memory. When rendering special effects with a large display size, a special effects buffer is created, and the frame data to be rendered is cached in the special effects buffer. Then, the data cached in the special effects buffer is rendered, so as to achieve the effect of loading the frame data to be rendered into the video memory in batches for rendering. The amount of data that needs to be loaded each time is small, which improves the rendering performance of the video memory when rendering special effects, and further improves the special effects rendering effect.

[0024] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0026] Figure 1 is a flowchart of a special effects rendering method provided according to Embodiment 1 of the present invention;

[0027] Figure 2 is a flow chart of a special effects rendering method provided according to Embodiment 2 of the present invention;

[0028] Figure 3 is a flowchart of a special effects rendering method provided according to Embodiment 2 of the present invention;

[0029] Figure 4is a flowchart of a special effects rendering method provided according to Embodiment 2 of the present invention;

[0030] Figure 5 is a flowchart of a special effects rendering method provided according to Embodiment 2 of the present invention;

[0031] Figure 6 is a flowchart of a special effects rendering method provided according to Embodiment 2 of the present invention;

[0032] Figure 7 is a flowchart of a special effects rendering method provided according to Embodiment 3 of the present invention;

[0033] Figure 8 is a structural schematic diagram of a special effects rendering device provided according to a fourth embodiment of the present invention;

[0034] Fig. 9 It is a structural schematic diagram of an electronic device for implementing the special effects rendering method according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] Embodiment 1

[0038] Figure 1This is a flow chart of a special effect rendering method provided by the first embodiment of the present invention. This embodiment is applicable to the case where a special effect display size is larger than the interface size of the display interface for rendering special effects. The method can be executed by a special effect rendering device. The special effect rendering device can be implemented in the form of hardware and / or software. The special effect rendering device can be configured in a terminal and / or a server. Figure 1 As shown, the method includes:

[0039] S110: Obtain frame data to be rendered of a plurality of special effect video frames corresponding to the special effect to be rendered.

[0040] Among them, the special effects to be rendered can be understood as special effects to be rendered and can be added to a video or image. Exemplarily, the special effects to be rendered can be animation special effects. The special effects video frame can be understood as the video frame displayed when the special effects to be rendered are displayed. In this embodiment, the special effects to be rendered can be obtained, and the special effects to be rendered can be a special effect composed of multiple frames of video frames. Furthermore, based on the pre-written program, the special effects to be rendered are parsed to obtain multiple special effects video frames. The frame data to be rendered can be understood as special effects frame data corresponding to the special effects video frame and to be rendered. It can be understood that by rendering the frame data to be rendered, a special effects video frame corresponding to the frame data to be rendered can be obtained.

[0041] It should be noted that the special effect to be rendered may be a special effect whose special effect display size is not larger than the interface size of the display interface; that is, the special effect of the special effect to be rendered can be fully displayed on one display interface. Exemplarily, the special effect to be rendered may be composed of multiple special effect video frames, and the multiple special effect video frames can be displayed as animation special effects on the display interface by continuous jump. Alternatively, the special effect to be rendered may also be a special effect whose special effect display size is larger than the interface size of the display interface; that is, the special effect of the special effect to be rendered cannot be fully displayed on one display interface, and the special effect of the special effect to be rendered can be displayed on the display interface by moving the display. Exemplarily, the special effect to be rendered may be a special effect whose special effect display height is larger than the height of the display interface, and the special effect of the special effect to be rendered can be displayed by moving from bottom to top on the display interface. In other words, the special effect to be rendered is composed of multiple special effect video frames, and the special effect effects corresponding to two adjacent special effect video frames are connected, that is, the special effect of the special effect to be rendered can be fully displayed on the display interface by continuous connection display.

[0042] In this embodiment, the special effects to be rendered on the display interface can be determined, and the data to be rendered corresponding to the special effects to be rendered can be obtained, and the data to be rendered can be the special effects rendering data of multiple special effects video frames. Further, the data to be rendered can be segmented to obtain the frame data to be rendered of multiple special effects video frames corresponding to the special effects to be rendered.

[0043] In this embodiment, the special effect video frame is a video frame displayed on the display interface. When the data to be rendered is segmented, the data to be rendered can be segmented according to the maximum rendering memory supported by the display interface, so that the special effect video frame obtained by rendering the special effect frame data after segmentation can be displayed on the display interface. Alternatively, the data to be rendered can be segmented according to the maximum memory required for rendering a single video frame set by the corresponding application software, so that the special effect video frame obtained by rendering the special effect frame data after segmentation can be clearly displayed on the display interface. Alternatively, the data to be rendered can also be segmented based on other methods, which are not specifically limited in this embodiment.

[0044] S120: When the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, create multiple special effect buffers.

[0045] Among them, the special effect display size can be understood as the display size of the special effect. Optionally, the special effect display size may include the display height and display width of the special effect. The display interface is an interface that can display the special effects to be rendered. Optionally, the interface size may include the display height and display width of the display interface. It can be understood that the buffer can be understood as a cache, which is a part of the memory space. In other words, a certain amount of storage space can be reserved in the memory space, and this storage space can be used to buffer input or output data, and this part of the reserved space is the buffer. In this embodiment, the special effect buffer can be understood as a space used to buffer special effect rendering data.

[0046] In actual applications, when rendering special effects to be rendered, a rendering interface is usually used to render the special effects to be rendered so that the special effects are rendered on the display interface for display. However, during the rendering process, there may be a situation where the special effect display size of the special effect to be rendered is larger than the interface size of the display interface. In this case, if the special effect rendering is performed based on the above special effect rendering method, it may be limited by the size limit of the video memory, and thus, the special effect to be rendered cannot be rendered or the rendering effect is poor, affecting the user's viewing experience.

[0047] In view of the above situation, in this embodiment, after determining the special effect to be rendered, the special effect display size corresponding to the special effect to be rendered can be determined, and the special effect display size can be compared with the interface size of the display interface. Furthermore, when the special effect display size is larger than the interface size of the display interface, multiple special effect buffers can be created. Furthermore, the frame data to be rendered corresponding to a single special effect video frame can be cached based on the special effect buffer, that is, only the frame data to be rendered required at the current moment can be loaded based on the special effect buffer, and the frame data to be rendered can be rendered. Thereby, the burden on the graphics card can be reduced, the use of video memory can be optimized, and the rendering jam can be optimized.

[0048] S130 , cache the to-be-rendered frame data corresponding to the plurality of special effect video frames into each special effect buffer respectively according to the special effect frame rendering order corresponding to the special effect to be rendered.

[0049] The special effect frame rendering order can be understood as the order in which the special effect video frames are rendered. The special effect frame rendering order can also be understood as the order in which the special effect video frames are displayed on the display interface. In this embodiment, the special effect buffer is used to cache the to-be-rendered frame data corresponding to a single special effect video frame.

[0050] As an optional implementation of this embodiment, after creating multiple special effect buffers, the frame data to be rendered corresponding to multiple special effect video frames can be sorted according to the special effect frame rendering order corresponding to the special effect to be rendered. Further, the frame data to be rendered corresponding to the sorted multiple special effect video frames can be cached in each special effect buffer respectively, so that the frame data to be rendered corresponding to a single special effect video frame can be cached in each special effect buffer.

[0051] Exemplarily, it is assumed that four special effect buffers are created, namely, special effect buffer 1, special effect buffer 2, special effect buffer 3 and special effect buffer 4. Further, after sorting the frame data to be rendered corresponding to the multiple special effect video frames according to the special effect frame rendering order, the first four frame data to be rendered can be determined, which are respectively, frame data to be rendered 1, frame data to be rendered 2, frame data to be rendered 3 and frame data to be rendered 4. After that, frame data 1 to be rendered can be cached in special effect buffer 1, frame data 2 to be rendered can be cached in special effect buffer 2, frame data 3 to be rendered can be cached in special effect buffer 3, and frame data 4 to be rendered can be cached in special effect buffer 4.

[0052] It should be noted that the special effects buffer can also be used to cache the to-be-rendered frame data corresponding to a preset number of consecutive special effects video frames, and then, when rendering the to-be-rendered frame data cached in the special effects buffer, a preset number of multiple consecutive special effects video frames can be rendered. In other words, in addition to being used to cache the to-be-rendered frame data corresponding to a single special effects video frame, the special effects buffer can also be used to cache the to-be-rendered frame data corresponding to a preset number of multiple consecutive special effects video frames, and this embodiment does not specifically limit this.

[0053] S140 , rendering the to-be-rendered frame data cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtaining a special effect video frame corresponding to the special effect to be rendered, and displaying the special effect video frame on a display interface.

[0054] It should be noted that the process described in the above steps S110 - S140 may be executed in the rendering process.

[0055] The order of the buffer queues is determined based on the order of the special effect video frames corresponding to the to-be-rendered frame data cached in the special effect buffer in the video frames to be rendered in the special effect. For example, referring to the above example, the order of the buffer queues is special effect buffer 1, special effect buffer 2, special effect buffer 3 and special effect buffer 4.

[0056] In this embodiment, after the frame data to be rendered is cached in the special effect buffer, multiple special effect buffers can be sorted according to a predetermined buffer queue order. Then, the frame data to be rendered cached in the sorted special effect buffer can be rendered in sequence to obtain a special effect video frame corresponding to the special effect to be rendered, and the special effect video frame can be displayed on the display interface.

[0057] The technical solution of the embodiment of the present invention obtains the to-be-rendered frame data of multiple special effect video frames corresponding to the special effect to be rendered, and then, when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, creates multiple special effect buffers, and then, according to the special effect frame rendering order corresponding to the special effect to be rendered, caches the to-be-rendered frame data corresponding to the multiple special effect video frames to each special effect buffer respectively, and then, according to the predetermined buffer queue order, sequentially renders the to-be-rendered frame data cached in the special effect buffer to obtain the special effect video frame corresponding to the special effect to be rendered, and displays the special effect video frame on The display interface solves the problem in the related technology that when rendering special effects with a large display size, the special effects to be rendered cannot be rendered or the rendering effect is poor due to the size limit of the video memory. When rendering special effects with a large display size, a special effects buffer is created, and the frame data to be rendered is cached in the special effects buffer. Then, the data cached in the special effects buffer is rendered, so as to achieve the effect of loading the frame data to be rendered into the video memory in batches for rendering. The amount of data that needs to be loaded each time is small, which improves the rendering performance of the video memory when rendering special effects, and further improves the special effects rendering effect.

[0058] Embodiment 2

[0059] Figure 2 This is a flowchart of a special effects rendering method provided in the second embodiment of the present invention. On the basis of the above embodiment, when the special effects video frame corresponding to the special effects buffer is displayed, the frame data to be rendered cached in the special effects buffer is released. Furthermore, the released special effects buffer is updated based on the preload thread, and the updated special effects buffer is moved to the end of the special effects buffer queue. The steps of special effects rendering and data release are repeated, and when the preset stop execution condition is met, the step of updating the special effects buffer is stopped. The specific implementation method can be referred to the technical solution of this embodiment. Among them, the technical terms that are the same or similar to those in the above embodiment are not repeated here.

[0060] like Figure 2 As shown, the method includes:

[0061] S210: Obtain frame data to be rendered of a plurality of special effect video frames corresponding to the special effect to be rendered.

[0062] S220: When the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, create multiple special effect buffers.

[0063] S230 , cache the to-be-rendered frame data corresponding to the plurality of special effect video frames into each special effect buffer respectively according to the special effect frame rendering order corresponding to the special effect to be rendered.

[0064] S240 , rendering the to-be-rendered frame data cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtaining a special effect video frame corresponding to the special effect to be rendered, and displaying the special effect video frame on a display interface.

[0065] S250: When the special effect video frame corresponding to the special effect buffer is displayed, the frame data to be rendered cached in the special effect buffer is released.

[0066] Among them, display completion can be understood as the display process of the special effect video frame has reached the preset display completion condition. Optionally, the preset display completion condition may include that the display duration reaches a preset duration threshold; or the special effect video frame has been completely moved outside the display interface, etc. Releasing data can be understood as clearing the data cached in the special effect buffer so that the special effect buffer is restored to an initialized state, that is, a state where no data is stored.

[0067] In this embodiment, after rendering the frame data to be rendered cached in the special effect buffer, a corresponding special effect video frame is obtained, and the special effect video frame can be displayed on the display interface. Further, when the display of the special effect video frame is completed, the frame data to be rendered cached in the special effect buffer can be released to restore the special effect buffer to an initialized state.

[0068] Exemplarily, referring to the above example, by rendering the to-be-rendered frame data 1 cached in the special effect buffer 1, a special effect video frame 1 displayed on the display interface can be obtained. Furthermore, when the special effect video frame 1 is moved outside the display interface, the to-be-rendered frame data 1 cached in the special effect buffer 1 can be released.

[0069] S260, updating the released special effects buffer based on the preloading thread, moving the updated special effects buffer to the end of the special effects buffer queue, repeating the steps of special effects rendering and data release, and stopping the step of updating the special effects buffer when a preset stop execution condition is met.

[0070] Among them, the preloading thread can be understood as other threads different from the rendering thread. The preloading thread can be a thread used to execute the data resource preloading process. The special effect buffer queue is a queue composed of multiple special effect buffers according to the buffer queue order. Exemplarily, continuing to refer to the above example, the special effect buffer queues are special effect buffer 1, special effect buffer 2, special effect buffer 3 and special effect buffer 4 respectively. The preset stop execution condition can be used to indicate the condition for stopping updating the special effect buffer. Optionally, the preset stop execution condition may include the completion of rendering of the to-be-rendered frame data of multiple special effect video frames corresponding to the special effect to be rendered; or, the display of the last special effect video frame among the multiple special effect video frames corresponding to the special effect to be rendered is completed, etc.

[0071] In this embodiment, in order not to block the execution of the current rendering thread, a preloading thread may be started, and then the released special effects buffer may be updated based on the preloading thread to obtain an updated special effects buffer.

[0072] Optionally, updating the released special effects buffer based on the preloading thread includes: executing in the preloading thread caching the uncached frame data to be rendered to the released special effects buffer according to the special effects rendering order, so as to update the released special effects buffer.

[0073] As an optional implementation of this embodiment, a data caching process can be executed in the preloading thread, and the uncached frame data to be rendered can be determined from the frame data to be rendered corresponding to multiple special effect video frames according to the special effect rendering order, and the frame data to be rendered can be cached to the released special effects buffer to update the released special effects buffer.

[0074] Exemplarily, referring to the above example, the uncached frame data to be rendered is determined to be frame data to be rendered 5 according to the special effect rendering data. Then, the frame data to be rendered 5 is cached in the special effect buffer 1.

[0075] In this embodiment, after the released special effects buffer is updated, an updated special effects buffer can be obtained. Then, the updated special effects buffer can be moved to the end of the special effects buffer queue, and the steps of special effects rendering and data release can be repeated. Then, when it is determined that the preset stop execution condition is met, the step of updating the special effects buffer can be stopped.

[0076] In this embodiment, when multiple threads are working simultaneously, in order to ensure that only one thread can access the shared resource at the same time and avoid data inconsistency, a mutex lock may be created and initialized after creating multiple special effect buffers.

[0077] The working principle of the mutex lock involves two key operations: locking and unlocking. When a thread wants to enter the critical section, it first tries to acquire the mutex lock. If the lock is not held by other threads, the thread acquires the lock successfully and enters the critical section to perform operations. Otherwise, the thread is blocked and waits for the lock to be released. When the thread holding the lock completes the operation of the shared resource and releases the lock, one of the waiting threads will acquire the lock and continue to execute the code in the critical section.

[0078] In this embodiment, after creating multiple special effect buffers, a mutex lock may be created and initialized to make the mutex lock have default attributes.

[0079] In this embodiment, after the special effect frame corresponding to the special effect buffer is displayed, it also includes: locking the rendering thread based on the initialized mutex lock; after releasing the frame data to be rendered cached in the special effect buffer, it also includes: unlocking the rendering thread based on the initialized mutex lock.

[0080] In this embodiment, before the released special effects buffer is updated based on the preloading thread, it also includes: locking the preloading thread based on the initialized mutex lock; after the released special effects buffer is updated based on the preloading thread, it also includes: unlocking the preloading thread based on the initialized mutex lock.

[0081] For example, Figure 3-Figure 6 A flowchart of a case of the special effects rendering method provided in this embodiment. Assume that the special effect to be rendered is an ultra-long animation special effect, that is, the special effect display height is greater than the interface height of the display interface; the number of special effects buffers is four, namely special effects buffer 1, special effects buffer 2, special effects buffer 3 and special effects buffer 4, and the frame data to be rendered 1 is cached in special effects buffer 1, the frame data to be rendered 2 is cached in special effects buffer 2, the frame data to be rendered 3 is cached in special effects buffer 3, and the frame data to be rendered 4 is cached in special effects buffer 4. Figure 3 As shown, Figure 3 The middle shaded area is a display interface. First, the to-be-rendered frame data 1 cached in the special effect buffer 1 can be rendered, so that the special effect video frame 1 corresponding to the to-be-rendered frame data 1 is displayed on the display interface. Figure 4 As shown, the special effect video frame 1 is continuously moved up during the display process, and the to-be-rendered frame data 2 cached in the special effect buffer 2 is rendered, so that the special effect video frame 2 corresponding to the to-be-rendered frame data 2 is displayed on the display interface. Figure 5 and Figure 6As shown, when the special effects video frame 1 is completely moved out of the display interface, the frame data 1 to be rendered cached in the special effects buffer 1 is released, and the released special effects buffer 1 is updated based on the preloading thread, the frame data 5 to be rendered is cached in the special effects buffer 1, and the updated special effects buffer 1 is moved to the end of the special effects buffer queue.

[0082] The technical solution of the embodiment of the present invention is to release the to-be-rendered frame data cached in the special effects buffer when the special effects video frame corresponding to the special effects buffer is displayed. Further, based on the preloading thread, the released special effects buffer is updated, the updated special effects buffer is moved to the end of the special effects buffer queue, and the steps of special effects rendering and data release are repeated. When a preset stop execution condition is met, the step of updating the special effects buffer is stopped. This achieves the effect of loading the to-be-rendered frame data in batches into the video memory for rendering based on multiple special effects buffers on the basis of reducing the video memory occupancy, thereby improving the rendering performance of the video memory during special effects rendering and improving the special effects rendering effect.

[0083] Embodiment 3

[0084] Figure 7 This is a flowchart of a special effect rendering method provided by the third embodiment of the present invention. On the basis of the above embodiments, the data to be rendered corresponding to the special effect to be rendered is obtained based on the main thread. Furthermore, the special effect data to be rendered is segmented according to the preset memory threshold and the interface size of the display interface to obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered, and the frame data to be rendered of multiple special effect video frames are passed to the rendering thread. The specific implementation method can refer to the technical solution of this embodiment. Among them, the technical terms that are the same or similar to the above embodiments are not repeated here.

[0085] like Figure 7 As shown, the method includes:

[0086] S310: Acquire data to be rendered corresponding to the special effect to be rendered based on the main thread.

[0087] The main thread can be the thread that executes the main method, or it can be understood as the thread that starts running immediately when any application is started. In any application, multiple main threads can be included. The data to be rendered can be understood as all the special effect rendering data corresponding to the special effect to be rendered. In other words, by rendering the data to be rendered, the special effect display effect corresponding to the special effect to be rendered can be obtained.

[0088] In this embodiment, when the special effect to be rendered is determined, the process of rendering the special effect to be rendered can be started. Further, the data to be rendered corresponding to the special effect to be rendered can be obtained based on the main thread.

[0089] S320, dividing the data to be rendered according to a preset memory threshold and an interface size of the display interface, obtaining frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered, and transferring the frame data to be rendered of the multiple special effect video frames to the rendering thread.

[0090] The preset memory threshold is the maximum amount of memory required for rendering a single video frame.

[0091] In this embodiment, in order to be able to perform frame rendering on the special effect to be rendered, after obtaining the data to be rendered corresponding to the special effect to be rendered, the data to be rendered can be divided according to the preset memory threshold and the interface size of the display interface to obtain frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered.

[0092] In this embodiment, when the data to be rendered is divided according to the preset memory threshold and the interface size of the display interface, the preset memory threshold and the memory amount determined based on the interface size can be compared, and then the method for dividing the data to be rendered can be determined according to the comparison result.

[0093] Optionally, when a preset memory threshold is greater than a product determined based on the interface size and a single pixel memory, the data to be rendered is segmented according to the interface size and the single pixel memory to obtain frame data to be rendered for multiple special effect video frames.

[0094] The single pixel memory can be understood as the memory occupied by a single pixel. The memory occupied by the frame data to be rendered is the product of the interface size and the single pixel memory.

[0095] As an optional implementation of this embodiment, when the interface size is determined, the number of pixels included in the display interface can be determined, and then the product between the number of pixels and the memory of a single pixel can be determined, and the product can be compared with a preset memory threshold. Further, when the preset memory threshold is greater than the product, the data to be rendered can be segmented according to the product to obtain frame data to be rendered corresponding to multiple special effect video frames, so that the memory occupation of the frame data to be rendered is the product between the interface size and the memory of a single pixel.

[0096] Optionally, when the preset memory threshold is not greater than the product determined based on the interface size and the memory of a single pixel, the data to be rendered is segmented according to the preset memory threshold to obtain frame data to be rendered of multiple special effect video frames.

[0097] The memory usage corresponding to the frame data to be rendered is equal to the preset memory threshold.

[0098] As an optional implementation of this embodiment, when it is determined that the preset memory threshold is not greater than the product determined based on the interface size and the single pixel memory, the data to be rendered can be divided according to the preset memory threshold to obtain frame data to be rendered corresponding to multiple special effect video frames, so that the memory occupancy corresponding to the frame data to be rendered is equal to the preset memory threshold.

[0099] In this embodiment, after obtaining the frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered, the special effect frame data corresponding to the multiple special effect video frames can be passed to the rendering thread so that the rendering thread executes the process of rendering the frame data to be rendered.

[0100] S330, obtaining frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered.

[0101] S340: When the special effect display size corresponding to the special effect to be rendered is larger than the display size of the display interface, create multiple special effect buffers.

[0102] S350 , cache the to-be-rendered frame data corresponding to the plurality of special effect video frames into each special effect buffer respectively according to the special effect frame rendering order corresponding to the special effect to be rendered.

[0103] S360, rendering the to-be-rendered frame data cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtaining a special effect video frame corresponding to the special effect to be rendered, and displaying the special effect video frame on a display interface.

[0104] The technical solution of the embodiment of the present invention obtains the data to be rendered corresponding to the special effect to be rendered based on the main thread, and further divides the special effect data to be rendered according to a preset memory threshold and the display size of the display interface to obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered, and passes the frame data to be rendered of the multiple special effect video frames to the rendering thread, thereby achieving the effect of data segmentation of the rendering data of the special effect to be rendered, and laying a data foundation for the subsequent batch special effect rendering.

[0105] Embodiment 4

[0106] Figure 8 Schematic diagram of a special effects rendering device provided by Embodiment 4 of the present invention. Figure 8 As shown, the device includes: a frame data acquisition module 410, a buffer creation module 420, a data cache module 430 and a data rendering module 440.

[0107] Among them, the frame data acquisition module 410 is used to obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered; the buffer creation module 420 is used to create multiple special effect buffers when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface; the data cache module 430 is used to cache the frame data to be rendered corresponding to multiple special effect video frames to each of the special effect buffers according to the special effect frame rendering order corresponding to the special effect to be rendered; wherein the special effect buffer is used to cache the frame data to be rendered corresponding to a single special effect video frame; the data rendering module 440 is used to render the frame data to be rendered cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtain the special effect video frame corresponding to the special effect to be rendered, and display the special effect video frame on the display interface; wherein the buffer queue order is determined based on the video frame order of the special effect video frame corresponding to the frame data to be rendered cached in the special effect buffer in the special effect to be rendered.

[0108] The technical solution of the embodiment of the present invention obtains the to-be-rendered frame data of multiple special effect video frames corresponding to the special effect to be rendered, and then, when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, creates multiple special effect buffers, and then, according to the special effect frame rendering order corresponding to the special effect to be rendered, caches the to-be-rendered frame data corresponding to the multiple special effect video frames to each special effect buffer respectively, and then, according to the predetermined buffer queue order, sequentially renders the to-be-rendered frame data cached in the special effect buffer to obtain the special effect video frame corresponding to the special effect to be rendered, and displays the special effect video frame on The display interface solves the problem in the related technology that when rendering special effects with a large display size, the special effects to be rendered cannot be rendered or the rendering effect is poor due to the size limit of the video memory. When rendering special effects with a large display size, a special effects buffer is created, and the frame data to be rendered is cached in the special effects buffer. Then, the data cached in the special effects buffer is rendered, so as to achieve the effect of loading the frame data to be rendered into the video memory in batches for rendering. The amount of data that needs to be loaded each time is small, which improves the rendering performance of the video memory when rendering special effects, and further improves the special effects rendering effect.

[0109] Optionally, the device further includes: a data release module and a buffer zone update module.

[0110] A data release module, used for releasing the frame data to be rendered cached in the special effect buffer when the special effect video frame corresponding to the special effect buffer is displayed;

[0111] A buffer update module is used to update the special effect buffer after release based on the preloading thread, move the updated special effect buffer to the end of the special effect buffer queue, repeat the steps of special effect rendering and data release, and stop executing the special effect buffer update step when a preset stop execution condition is met; wherein the special effect buffer queue is a queue composed of the multiple special effect buffers according to the buffer queue order.

[0112] Optionally, the preset stop execution condition includes at least one of the following situations:

[0113] The rendering of the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered is completed;

[0114] The last special effect video frame among the multiple special effect video frames corresponding to the special effect to be rendered is displayed.

[0115] Optionally, the device also includes: a data acquisition module and a data segmentation module.

[0116] A data acquisition module, used for acquiring the to-be-rendered data corresponding to the to-be-rendered special effects based on the main thread;

[0117] A data segmentation module is used to segment the special effect data to be rendered according to a preset memory threshold and the interface size of the display interface, obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered, and pass the frame data to be rendered of the multiple special effect video frames to the rendering thread; wherein the preset memory threshold is the maximum amount of memory required for rendering a single frame of video.

[0118] Optionally, the data segmentation module includes: a first data segmentation unit and a second data segmentation unit.

[0119] A first data segmentation unit is used to segment the special effect data to be rendered according to the interface size and the single pixel memory to obtain frame data to be rendered of multiple special effect video frames when the preset memory threshold is greater than the product determined based on the interface size and the single pixel memory; wherein the memory occupancy corresponding to the frame data to be rendered is the product determined based on the interface size and the single pixel memory;

[0120] A second data segmentation unit is used to segment the special effect data to be rendered according to the preset memory threshold to obtain frame data to be rendered of multiple special effect video frames when the preset memory threshold is not greater than the product determined based on the interface size and the single pixel memory; wherein the memory occupancy corresponding to the frame data to be rendered is equal to the preset memory threshold.

[0121] Optionally, the buffer update module is specifically used to execute in the preloading thread to cache the uncached frame data to be rendered into the released special effects buffer according to the special effects rendering order, so as to update the released special effects buffer.

[0122] Optionally, the device further includes: a mutex lock creation module.

[0123] The mutex lock creation module is used to create a mutex lock and initialize the mutex lock after creating the multiple special effect buffers.

[0124] Optionally, the device further includes: a first thread locking module and a first thread unlocking module.

[0125] A first thread locking module is used to lock the rendering thread based on the initialized mutex lock after the special effect video frame corresponding to the special effect buffer is displayed;

[0126] The first thread unlocking module is used to unlock the rendering thread based on the initialized mutex lock after releasing the to-be-rendered frame data cached in the special effect buffer.

[0127] Optionally, the device further includes: a second thread locking module and a second thread unlocking module.

[0128] A second thread locking module is used for locking the preloading thread based on the initialized mutex lock before the preloading thread updates the released special effect buffer;

[0129] The second thread unlocking module is used for unlocking the preloading thread based on the initialized mutex lock after the preloading thread updates the released special effect buffer.

[0130] The special effects rendering device provided in the embodiment of the present invention can execute the special effects rendering method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0131] Embodiment 5

[0132] Fig. 9A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0133] like Fig. 9 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0134] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0135] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a special effects rendering method.

[0136] In some embodiments, the special effects rendering method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the special effects rendering method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the special effects rendering method in any other appropriate manner (e.g., by means of firmware).

[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0138] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0139] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0140] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0141] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0142] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0144] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A special effects rendering method, characterized in that: include: Obtaining frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered; When the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface, creating multiple special effect buffers; Cache the frame data to be rendered corresponding to a plurality of special effect video frames into each of the special effect buffers respectively according to the special effect frame rendering order corresponding to the special effect to be rendered; wherein the special effect buffer is used to cache the frame data to be rendered corresponding to a single special effect video frame; Rendering the to-be-rendered frame data cached in the special effect buffer in sequence according to a predetermined buffer queue order to obtain a special effect video frame corresponding to the to-be-rendered special effect, and displaying the special effect video frame on the display interface; The buffer queue order is determined based on the video frame order of the special effect video frames corresponding to the frame data to be rendered cached in the special effect buffer in the special effect to be rendered.

2. The special effects rendering method according to claim 1, characterized in that: Also includes: When the special effect video frame corresponding to the special effect buffer is displayed, releasing the frame data to be rendered cached in the special effect buffer; Based on the preloading thread, the released special effect buffer is updated, the updated special effect buffer is moved to the end of the special effect buffer queue, the steps of special effect rendering and data release are repeated, and when a preset stop condition is met, the step of updating the special effect buffer is stopped; The special effect buffer queue is a queue composed of the multiple special effect buffers according to the buffer queue order.

3. The special effects rendering method according to claim 2, characterized in that: The preset stop execution condition includes at least one of the following situations: The rendering of the frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered is completed; The last special effect video frame among the multiple special effect video frames corresponding to the special effect to be rendered is displayed.

4. The special effects rendering method according to claim 1, characterized in that: Also includes: Acquire the to-be-rendered data corresponding to the to-be-rendered special effects based on the main thread; The special effect data to be rendered is divided according to a preset memory threshold and the interface size of the display interface to obtain frame data to be rendered of multiple special effect video frames corresponding to the special effect to be rendered, and the frame data to be rendered of the multiple special effect video frames is passed to the rendering thread; wherein the preset memory threshold is the maximum amount of memory required for rendering a single frame of video.

5. The special effects rendering method according to claim 4, characterized in that: The step of segmenting the special effect data to be rendered according to a preset memory threshold and the interface size of the display interface to obtain frame data to be rendered of a plurality of special effect video frames corresponding to the special effect to be rendered includes: In the case where the preset memory threshold is greater than the product determined based on the interface size and the single pixel memory, the special effect data to be rendered is divided according to the interface size and the single pixel memory to obtain frame data to be rendered of multiple special effect video frames; wherein the memory occupancy corresponding to the frame data to be rendered is the product determined based on the interface size and the single pixel memory; When the preset memory threshold is not greater than the product of the interface size and the memory of a single pixel, the special effect data to be rendered is divided according to the preset memory threshold to obtain frame data to be rendered of multiple special effect video frames; wherein the memory occupancy corresponding to the frame data to be rendered is equal to the preset memory threshold.

6. The special effects rendering method according to claim 2, characterized in that: The updating of the released special effect buffer based on the preloading thread includes: In the preloading thread, the uncached frame data to be rendered is cached into the released special effects buffer according to the special effects rendering order, so as to update the released special effects buffer.

7. The special effects rendering method according to claim 2, characterized in that: After creating the multiple special effect buffers, the method further includes: Creates a mutex and initializes the mutex.

8. The special effects rendering method according to claim 7, characterized in that: After the special effect video frame corresponding to the special effect buffer is displayed, the method further includes: Lock the rendering thread based on the initialized mutex lock; After releasing the to-be-rendered frame data cached in the special effect buffer, the method further includes: The rendering thread is unlocked based on the initialized mutex lock.

9. The special effects rendering method according to claim 7, characterized in that: Before the preloading thread is used to update the released special effect buffer, the method further includes: Lock the preloading thread based on the initialized mutex lock; After the released special effect buffer is updated based on the preloading thread, the method further includes: The preloading thread is unlocked based on the initialized mutex lock.

10. A special effects rendering device, characterized in that: include: The frame data acquisition module is used to obtain the frame data to be rendered of multiple special effect video frames corresponding to the special effects to be rendered. A buffer creation module, used to create multiple special effect buffers when the special effect display size corresponding to the special effect to be rendered is larger than the interface size of the display interface; A data caching module, used to cache the frame data to be rendered corresponding to multiple special effect video frames respectively into each of the special effect buffers according to the special effect frame rendering order corresponding to the special effect to be rendered; wherein the special effect buffer is used to cache the frame data to be rendered corresponding to a single special effect video frame; A data rendering module is used to render the frame data to be rendered cached in the special effect buffer in sequence according to a predetermined buffer queue order, obtain special effect video frames corresponding to the special effect to be rendered, and display the special effect video frames on the display interface; wherein the buffer queue order is determined based on the video frame order of the special effect video frames corresponding to the frame data to be rendered cached in the special effect buffer in the special effect to be rendered.