Animation generation method and device, electronic equipment and storage medium

By utilizing the first and second processors of a multi-core processor to handle drawing and rendering tasks respectively during the animation generation process, the problem of high image rendering latency is solved, resulting in smoother animation effects and lower device power consumption, making it suitable for mobile phones and tablets.

CN121962362APending Publication Date: 2026-05-01BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411523846.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

Image rendering on mobile phones and tablets takes a long time, resulting in high rendering latency, which affects animation effects and user experience. Related technologies solve this problem by reducing special effects and animation algorithms, but at the expense of animation quality.

Method used

By communicating with the first thread during the animation generation process, the processing capacity of the set of layers to be drawn in the current frame is determined. The first and second processors are used to handle the drawing and rendering tasks respectively. Sub-threads are used for overlay and compositing to generate a base layer. The animation layer is determined based on the processing capacity and the base layer.

Benefits of technology

The animation generation process has been optimized, reducing frame generation latency and device power consumption, improving the visual experience, and making it suitable for multi-core processor devices, thus extending device battery life.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962362A_ABST
    Figure CN121962362A_ABST
Patent Text Reader

Abstract

The invention provides an animation generation method and device, electronic equipment and a storage medium. The method comprises the following steps: communicating with a first thread in an animation generation process to determine the processing capability of a first processor on a to-be-drawn layer set in a current frame; determining an original layer set used for generating the animation in the to-be-drawn layer set, and calling a sub-thread to perform superposition synthesis processing on the original layer set to obtain a reference layer; and after the processing capability is determined, an animation layer corresponding to the current frame is determined based on a second processor according to the processing capability and the reference layer, and the first processor and the second processor are both used for processing the layers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image rendering and generation technology, and in particular to animation generation methods, apparatus, electronic devices, and storage media. Background Technology

[0002] With the rapid development of mobile devices such as smartphones and tablets, their hardware processing capabilities have gradually improved. People have begun to pursue various special effects rendering processes on some controls or display areas of smartphones and tablets to obtain images before presenting them to users, thereby providing users with richer and more dazzling visual effects. For example, when a mobile phone screen is turned off, the content displayed on the screen is first made to gradually dim and blur before the screen is truly turned off.

[0003] The rendering process of images is quite complex, and therefore often takes a long time to run, resulting in extremely high rendering latency. As a result, related technologies often reduce special effects and animation algorithms to make the animation usable on mobile devices such as mobile phones and tablets, but this greatly sacrifices the animation effect and user experience. Summary of the Invention

[0004] To overcome the problems existing in related technologies, this disclosure provides an animation generation method, apparatus, electronic device, and storage medium.

[0005] The first aspect of this disclosure provides an animation generation method, the method comprising:

[0006] During the animation generation process, it communicates with the first thread to determine the processing capacity of the first processor for the set of layers to be drawn in the current frame;

[0007] The original layer set used to generate the animation is determined from the set of layers to be drawn, and a sub-thread is called to perform overlay and compositing processing on the original layer set to obtain the base layer;

[0008] After determining the processing capability, the animation layer corresponding to the current frame is determined based on the processing capability and the reference layer, using the second processor, wherein both the first processor and the second processor are used to process the layer.

[0009] Optionally, the step of calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer includes:

[0010] Determine whether the original layer set of the current frame is the same as the original layer set corresponding to the recorded reference layer;

[0011] If the judgment results are the same, the recorded reference layer is used as the reference layer of the current frame;

[0012] If the judgment results are different, the child thread is called to overlay and composite the original layer set of the current frame to obtain the base layer of the current frame, and the base layer of the current frame is recorded.

[0013] Optionally, the step of calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer includes:

[0014] If the interval between the current frame and the first historical frame reaches a preset number of frames, a sub-thread is invoked to overlay and synthesize the original layer set of the current frame to obtain a reference layer. The first historical frame is the frame in which the sub-thread was invoked to overlay and synthesize the original layer set to obtain the reference layer.

[0015] If the interval between the current frame and the first historical frame is less than a preset number of frames, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0016] Optionally, the step of calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer includes:

[0017] If the original layer set of the current frame is the same as the original layer set of the previous frame, the reference layer of the previous frame is used as the reference layer of the current frame.

[0018] If the original layer set of the current frame is different from the original layer set of the previous frame, a sub-thread is called to overlay and composite the original layer set to obtain the base layer.

[0019] Optionally, determining the original layer set for generating the animation from the set of layers to be drawn includes:

[0020] If the set of layers to be drawn includes a placeholder layer with preset attributes, the layers covered by the placeholder layer in the set of layers to be drawn are determined as the original set of layers for generating the animation, wherein the placeholder layer is created in response to the animation generation instruction and is used to indicate the coverage area of ​​the animation.

[0021] The method further includes:

[0022] Map the animation layer corresponding to the current frame to the placeholder layer so that the device can display the animation layer.

[0023] Optionally, determining the animation layer corresponding to the current frame based on the processing capability and the reference layer using the second processor includes:

[0024] If the processing capability characterizes a set of fallback layers in the set of layers to be drawn that the first processor cannot process, the fallback layer set and the reference layer are processed according to the hierarchical relationship between each fallback layer in the fallback layer set and the placeholder layer to obtain the animation layer corresponding to the current frame.

[0025] Optionally, the step of communicating with the first thread during animation generation to determine the processing capability of the first processor for the set of layers to be drawn in the current frame includes:

[0026] During the animation generation process, communication is made with the compositing service component to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, wherein the first processor includes a hardware compositor and the second processor includes a graphics processor.

[0027] Optionally, determining the animation layer corresponding to the current frame based on the processing capability and the reference layer using the second processor includes:

[0028] Based on the processing capability and the animation progress parameters of the current frame, the reference layer is rendered using the second processor to determine the animation layer corresponding to the current frame.

[0029] Optionally, the method further includes:

[0030] The set of layers to be drawn and the animation layers are sent to the first processor to generate the display image of the current frame, wherein the display image is used to present to the user.

[0031] A second aspect of this disclosure provides an animation generation apparatus, the apparatus comprising:

[0032] The communication module is used to communicate with the first thread during the animation generation process to determine the processing capability of the first processor for the set of layers to be drawn in the current frame;

[0033] The overlay compositing module is used to determine the original layer set for generating the animation from the set of layers to be drawn, and to call a sub-thread to perform overlay compositing processing on the original layer set to obtain a base layer;

[0034] An animation generation module is used to determine the animation layer corresponding to the current frame based on the processing capability and the reference layer after determining the processing capability, wherein both the first processor and the second processor are used to process the layer.

[0035] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0036] Determine whether the original layer set of the current frame is the same as the original layer set corresponding to the recorded reference layer;

[0037] If the judgment results are the same, the recorded reference layer is used as the reference layer of the current frame;

[0038] If the judgment results are different, the child thread is called to overlay and composite the original layer set of the current frame to obtain the base layer of the current frame, and the base layer of the current frame is recorded.

[0039] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0040] If the interval between the current frame and the first historical frame reaches a preset number of frames, a sub-thread is invoked to overlay and synthesize the original layer set of the current frame to obtain a reference layer. The first historical frame is the frame in which the sub-thread was invoked to overlay and synthesize the original layer set to obtain the reference layer.

[0041] If the interval between the current frame and the first historical frame is less than a preset number of frames, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0042] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0043] If the original layer set of the current frame is the same as the original layer set of the previous frame, the reference layer of the previous frame is used as the reference layer of the current frame.

[0044] If the original layer set of the current frame is different from the original layer set of the previous frame, a sub-thread is called to overlay and composite the original layer set to obtain the base layer.

[0045] Optionally, the overlay compositing module is used to determine the original layer set for generating the animation from the set of layers to be drawn, specifically for:

[0046] If the set of layers to be drawn includes a placeholder layer with preset attributes, the layers covered by the placeholder layer in the set of layers to be drawn are determined as the original set of layers for generating the animation, wherein the placeholder layer is created in response to the animation generation instruction and is used to indicate the coverage area of ​​the animation.

[0047] The device further includes:

[0048] The mapping module is used to map the animation layer corresponding to the current frame to the placeholder layer so that the device can display the animation layer.

[0049] Optionally, the animation generation module, when determining the animation layer corresponding to the current frame based on the second processor according to the processing capability and the reference layer, is specifically used for:

[0050] If the processing capability characterizes a set of fallback layers in the set of layers to be drawn that the first processor cannot process, the fallback layer set and the reference layer are processed according to the hierarchical relationship between each fallback layer in the fallback layer set and the placeholder layer to obtain the animation layer corresponding to the current frame.

[0051] Optionally, the communication module is used to communicate with the first thread during the animation generation process to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, specifically for:

[0052] During the animation generation process, communication is made with the compositing service component to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, wherein the first processor includes a hardware compositor and the second processor includes a graphics processor.

[0053] Optionally, the animation generation module, when determining the animation layer corresponding to the current frame based on the second processor according to the processing capability and the reference layer, is specifically used for:

[0054] Based on the processing capability and the animation progress parameters of the current frame, the reference layer is rendered using the second processor to determine the animation layer corresponding to the current frame.

[0055] Optionally, the device further includes:

[0056] The display image generation module is used to send the set of layers to be drawn and the animation layer to the first processor to generate the display image of the current frame, wherein the display image is used to present to the user.

[0057] A third aspect of this disclosure provides a computer program product including a computer program / instructions that, when executed by a processor, implement the method described in the first aspect.

[0058] A fourth aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in the first aspect.

[0059] The fifth aspect of this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0060] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0061] In light of the widespread adoption of multi-core processors, this disclosure specifically optimizes the animation generation process, enabling even relatively complex animations to be applied to mobile devices such as smartphones without compromising the animation algorithm. This provides users with a more diverse and superior visual experience. Furthermore, the method reduces frame generation latency and the time spent on display-related processes and threads. This not only improves the device's screen refresh rate but also helps reduce power consumption and extend battery life.

[0062] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0063] The accompanying drawings, which are incorporated in and form part of this disclosure, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0064] Figure 1 These are application scenario diagrams illustrating an animation generation method through some exemplary embodiments.

[0065] Figure 2 This is a process breakdown diagram illustrating an animation generation method using some exemplary embodiments.

[0066] Figure 3 This is a temporal relationship diagram illustrating an animation generation method using some exemplary embodiments.

[0067] Figure 4 These are schematic diagrams illustrating an animation generation method using some exemplary embodiments.

[0068] Figure 5 This is a branch diagram illustrating an animation generation method using some exemplary embodiments.

[0069] Figure 6 This is a block diagram illustrating an animation generation apparatus according to some exemplary embodiments.

[0070] Figure 7 These are hardware structure diagrams of an electronic device illustrating some exemplary embodiments. Detailed Implementation

[0071] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0072] As described in the background section, the rendering latency of animation layers is extremely high. Another equally serious problem is that this latency also causes prolonged occupation of screen refresh-related threads, potentially leading to issues during the screen refresh process. In related technologies, manufacturers often reduce the special effects and animation algorithms to make the animation usable on mobile devices such as phones and tablets, but this significantly sacrifices the animation quality and user experience.

[0073] In view of this, the present disclosure provides an animation generation method, apparatus, electronic device, and storage medium.

[0074] First, let's explain the concepts involved in this disclosure. Specifically, in a mobile device system, when the device screen needs to refresh a frame, one or more threads are required to generate the display image for that frame. This display image is then output to the device screen for presentation to the user (the process of outputting an image to the device screen and presenting it to the user can be simply referred to as "screen loading"). Within the device, each process or thread that has display content typically holds one or more layers. In addition to the pixel information of the image, these layers usually also have information such as size, layer (lower-level layers are covered by higher-level layers), and position.

[0075] During frame refresh, the thread responsible for generating the display image for this frame needs to traverse and read the layers that need to participate in the rendering of the display image (hereinafter referred to as the set of layers to be drawn), and then process these layers, such as rendering special effects (referred to as rendering, which is generating new layer content based on the layer content according to a preset rendering algorithm) and layer overlay compositing (referred to as overlay or compositing, which is drawing the layer content to the buffer according to the layer hierarchy). The set of layers to be drawn can usually be determined based on dimensions such as the layer's opacity, the layer's display area, and the layer's visibility state: for example, if the opacity of a certain layer is 0 (that is, completely transparent, where opacity can be understood as the degree of color rendering, 0 means that the color is not displayed at all), or it is completely off-screen, or its visibility state is invisible, then this thread does not belong to the layers to be drawn.

[0076] The thread responsible for generating the display image for this frame can be a compositor thread, such as the SurfaceFlinger thread in Android and the Desktop Window Manager (DWM) thread in Windows. The following description will use a mobile phone with an Android operating system and the SurfaceFlinger thread as the compositor thread as an example to illustrate the embodiments provided in this disclosure.

[0077] It should be understood that the rendering process and the compositing process are not necessarily two completely independent steps. For example, if a rendering algorithm is an algorithm that makes image A semi-transparent, then the algorithm can process each layer sequentially according to the layer hierarchy from low to high, and after reading each pixel, directly determine the semi-transparent processing result of that pixel and draw the result to the corresponding pixel position in the buffer (i.e., superimpose it on the existing result, because the existing result is naturally the drawing result of a layer with a lower layer hierarchy than that layer), and so on.

[0078] The embodiments of this disclosure will now be described in detail.

[0079] The first aspect of this disclosure provides an animation generation method. Please refer to [link / reference needed]. Figure 1 It may include steps S101 to S103.

[0080] Step S101: During the animation generation process, communicate with the first thread to determine the processing capability of the first processor for the set of layers to be drawn in the current frame.

[0081] Step S102: Determine the original layer set for generating the animation from the set of layers to be drawn, and call a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer.

[0082] Step S103: After determining the processing capability, based on the processing capability and the reference layer, determine the animation layer corresponding to the current frame based on the second processor, wherein both the first processor and the second processor are used to process the layer.

[0083] The layer compositing process itself can consist of multiple sub-compositing processes. For example, a portion of the layers can be composited and cached first, then another portion can be composited, and the composited result of the "other portion of the layers" can be rendered. Then, the result of the rendering process can be composited with the composited result of the previous "partial portion of the layers".

[0084] In one example, layers A, B, and C are the set of layers to be drawn in the current frame, with layer A below layer B, and layer B below layer C. Layers B and C need to be input into rendering algorithm X for rendering, while layer A does not require rendering and can directly participate in the drawing of the displayed image. Due to the significant uncertainty in the number of layers and the potentially complex occlusion relationships between them, in this case, please refer to... Figure 2 First, layers B and C are overlaid and combined into layer D to serve as input for the rendering algorithm (in this case, "layer" may be a logical concept and does not necessarily refer to data of a specific data type; for example, layer D may simply be a string of temporary data in a buffer). Then, rendering processing is performed on layer D to obtain layer E (thus unifying the input of the rendering algorithm and simplifying it). Finally, layers A, B (layers that have already been overlaid and combined may also participate in subsequent processing), and E are overlaid and combined into layer F to obtain the final display image.

[0085] Generally, the SurfaceFlinger thread reads the set of layers to be drawn in the current frame, analyzes the processing required for each layer, and then processes them separately based on the processing they require (e.g., "whether rendering is needed" in the example above). For example, simple drawing processing (overlaying pixels onto corresponding positions in a buffer) does not consume much computing power and does not rely on too many hardware units. Therefore, layers involving only drawing processing can be handled by a first processor with lower processing power (or computing power, hardware robustness) but lower power consumption. Rendering, on the other hand, requires relatively strong computing power and must be supported by relevant hardware units. Therefore, rendering may only be completed in other hardware, which can be called a second processor.

[0086] for Figure 2 In the example shown, the drawing process 1 can be performed by a first processor; the rendering process can be performed by a second processor. Optionally, the first processor may include a Hardware Composer (HWC), and the second processor may include a Graphics Processing Unit (GPU).

[0087] HWC is primarily responsible for compositing all layers into a display image. It can quickly composite layers, reducing the workload of the CPU (Central Processing Unit) and GPU, improving system performance, and its power consumption is extremely low. This is especially important in scenarios involving high frame rate execution, such as frame generation. However, it cannot provide support for certain computational and rendering tasks. GPUs, on the other hand, are typically specially designed to handle graphics-related computational and rendering tasks, including layer compositing, blending, and transformation. Their layer processing capabilities are superior to HWC. In the aforementioned Android system example, the SurfaceFlinger thread can send layer A to HWC for drawing and call a rendering thread (such as the RenderEngine thread, or RE thread) to render layer D in the GPU based on rendering algorithm X, thus maximizing the balance between power consumption, frame generation time, and method feasibility.

[0088] Of course, this disclosure does not limit the first processor and the second processor, as long as their functions or cooperative relationships are similar to those of HWC and GPU as described above (e.g., the first processor has lower power consumption than the second processor, the second processor has higher / more robust layer processing capabilities than the first processor, etc.). For example, HWC can also be replaced by hardware units such as RSXReality Synthesizer in PlayStation or Scorpio Engine in Xbox, and GPU can also be replaced by CPU, especially when the operating system integrates some specific APIs (Application Programming Interface), in which case CPU can also handle graphics rendering tasks.

[0089] exist Figure 2 Preferably, the drawing process 3 can be merged with the rendering process, as described above. This significantly reduces the cache usage and I / O overhead of the processing, which is particularly important in the specific scenario of "frame generation," as it can significantly reduce device power consumption and frame generation time. This is because there is no need to create a data structure to store layer E, nor is it necessary to perform frequent write and read operations; instead, the drawing process 3 is completed directly during the rendering process.

[0090] For layer E, since layer E is at a higher level than layer B (for example, layer E is a semi-transparent mask used to add a blur effect to layer B), and layer B also needs to participate in the drawing of layer F, then drawing process 3 can only be completed after drawing process 2 (because higher-level layers need to be drawn on top of lower-level layers, meaning the lower-level image must be drawn first). Furthermore, the rendering process is based on the compositing process, so the rendering process must be executed after the compositing process. Therefore, drawing process 2 and the compositing process can also be completed by the second processor, and drawing process 3 can be performed after the compositing and drawing process 2 are completed. In this process, as mentioned earlier, the rendering process can be merged with drawing process 3. In this case, the three processing tasks that the second processor needs to complete, in chronological order, are: compositing process, drawing process 2, and rendering process + drawing process 3. Of course, the rendering process can also be executed independently; this disclosure does not limit this. Furthermore, for ease of explanation, the concepts of "layer" and "processing task corresponding to the layer" are not strictly distinguished in the relevant descriptions of this disclosure.

[0091] The above processing steps may encounter special circumstances in practical applications, so... Figure 2 For example, the first processor may be unable to process drawing process 1 (that is, it cannot process the original tasks corresponding to layer A, and these layers that the first processor cannot process constitute the fallback layer set) due to various reasons such as hardware defects (that is, it is actually unable to complete the work assigned to it) or excessive tasks (for example, continuing to process in this way may cause excessive frame generation delay). In this case, drawing process 1 also needs to be processed by the second processor. Since layer A has the lowest level and needs to be drawn first, in this case, preferably, the four processing tasks that the second processor needs to complete are in chronological order as follows: compositing process, drawing process 1, drawing process 2, and rendering process + drawing process 3.

[0092] In other words, under the aforementioned special circumstances, the task logic to be executed by the second processor is altered. In the preferred embodiment that combines the rendering process with the drawing process 3, the rendering process is postponed until after the drawing processes 1 and 2 (while the compositing process is unaffected because the input upon which the rendering process is based is always handled by the second processor in the aforementioned strategy, and this compositing process can be completed independently).

[0093] It is evident that communicating with the first thread (this communication process may include the task dispatching process, i.e., sending layer A to HWC in the example above), and determining the processing capability of the first processor for layer A in the current frame (e.g., whether the first processor can complete the current processing task normally; furthermore, if the first processor cannot complete the current processing task normally, the processing capability may also include tasks that the first processor cannot complete, forming a set of fallback layers), can serve as the decision-making basis for GPU-related processing processes. Therefore, the above-mentioned drawing process 2, rendering process + drawing process 3 can be executed after determining the above-mentioned processing capability. Of course, the process of "determining the processing capability of the first processor for layer A in the current frame" can also be understood as the process of "determining the processing capability of the first processor for the set of layers to be drawn," only in the context of the above-mentioned... Figure 2 In the example, the processing capability of the first processor for a portion of the layers in the set to be drawn has been known in advance (i.e., those layers that need to be rendered by rendering algorithm X cannot be executed by HWC), so it is only necessary to know the processing capability of the first processor for layer A (the corresponding processing task) during the communication process.

[0094] The foregoing has provided an overall description of the ideas involved in some implementation methods using a specific example. Exemplarily, the first and second aspects of the embodiments of this disclosure can be applied to the main thread (this concept is relative to the sub-thread in step S102), such as the aforementioned SurfaceFlinger (hereinafter referred to as the SF thread or SF main thread) and other synthetic threads.

[0095] In step S101, the main thread communicates with the first thread, that is, exchanges information with other threads, to determine the processing capacity of the first processor for the set of layers to be drawn in the current frame (e.g., the frame targeted by the current frame generation process). This processing capacity can involve any number of layers to be drawn. For example, after reading the set of layers to be drawn, the SF thread can allocate some layers (which may be 0 layers or all layers) to the first processor for processing based on the processing procedures involved in each layer (e.g., ...). Figure 2 The first thread returns "processing capability" for layer A and its corresponding drawing process 1. During this process, layer processing tasks that need to be processed by the second processor may also be determined (e.g., layer B, C and their corresponding drawing processes 2, compositing, rendering, and drawing processes 3).

[0096] Here we continue with Figure 2The example shown will be used for illustration. While performing the above steps, in step S102, the main thread can create or call a sub-thread (such as the RE thread mentioned above, or other rendering threads) to composite layers B and C (the original layer set) to obtain layer D (the base layer). This layer D, as a unified layer, can be used as input to the rendering algorithm X to obtain the corresponding rendering output. Logically speaking, the base layer D in this compositing process can be seen as the layer obtained by overlaying and compositing layers B and C and then capturing frames (i.e., "screenshotting").

[0097] In step S103, the animation layer can refer to Figure 2 Layer E in the diagram. After layer A is rejected by the first processor, drawing process 1, drawing process 2, rendering process, and drawing process 3 may be completed by the GPU in the same process. At this time, the animation layer can also refer to layer F (it is worth noting that "animation" is not a strict limitation on the scope of application of the method; in this disclosure, "animation" can be used to refer to a processing process that "requires rendering based on a second processor"). The exemplary method of "determining the animation layer corresponding to the current frame based on the processing capability and the reference layer" has been illustrated with several examples above.

[0098] Please see Figure 3 The horizontal axis, from left to right, represents the data processing flow of a thread from beginning to end. In the commit phase, the SF main thread can obtain the set of layers to be drawn and then assign these layers. The first process indicated by the vertical arrow is an exemplary implementation of step S101, the second process indicated by the vertical arrow is an exemplary implementation of step S102, and the third process indicated by the vertical arrow is an exemplary implementation of step S103.

[0099] In the first process, hwcBinder serves as a medium for completing the communication process in step S101, and composer-service (composition service component) is used to communicate with the first processor. Therefore, the step of communicating with the first thread during animation generation to determine the processing capability of the first processor for the set of layers to be drawn in the current frame includes: communicating with the composition service component during animation generation to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, wherein the first processor includes a hardware compositor, and the second processor includes a graphics processor.

[0100] In the second process, the SF main thread creates a new thread via a dashed arrow, which is used to complete the above synthesis process.

[0101] As can be seen, in this embodiment, steps S101 and S102 are executed asynchronously. They can utilize different thread resources and be completed more flexibly by assigning more processor cores. This not only helps to utilize the multi-core resources of the processor more efficiently and optimize the execution efficiency of the method, but also ensures that steps S101 and S102 do not restrict or block each other. That is, during the time consumed by the communication process between the main thread and the first thread, the reference image has been drawn (or basically drawn), so the start time of step S103 is advanced, effectively reducing the frame generation delay. In the context of the current prevalence of multi-core processors (especially in devices involving image rendering, single-core processors have disappeared), the above method has optimized the animation generation process, enabling some relatively complex animations to be applied to mobile devices such as mobile phones without reducing the animation algorithm, thereby bringing users a more diverse and better visual experience. In addition, the above methods reduce frame generation latency and the time occupied by display-related processes and threads. This can not only serve as a prerequisite for improving the device screen refresh rate (because it can significantly reduce the time consumed in drawing each frame), but also help reduce device power consumption and extend device battery life.

[0102] In some embodiments, step S102 may be further simplified.

[0103] In a first exemplary approach, the invocation of a sub-thread to overlay and composite the original layer set to obtain a base layer may include:

[0104] Determine whether the original layer set of the current frame is the same as the original layer set corresponding to the recorded reference layer;

[0105] If the judgment results are the same, the recorded reference layer is used as the reference layer of the current frame;

[0106] If the judgment results are different, the child thread is called to overlay and composite the original layer set of the current frame to obtain the base layer of the current frame, and the base layer of the current frame is recorded.

[0107] In other words, the generated reference layer can be cached each time step S102 is executed for subsequent calls. For example, the step of calling the sub-thread to perform overlay and compositing processing on the original layer set of the current frame to obtain the reference layer may include: creating a first display surface; calling the sub-thread to perform overlay and compositing processing on the original layer set of the current frame, and outputting the processing result to the first display surface to record the reference layer of the current frame.

[0108] The display surface can be an interface for communication with the underlying graphics hardware and framework. It encapsulates image buffers to store image data for processing and display by the GPU or other hardware components. Generally, after creating the display surface, components such as BufferQueue and GraphicBuffer can be managed through it to cache images. For example, in the above steps, the first display surface acts as a data communication medium between steps S102 and S103, and also records the reference layer of the current frame (the first display surface can be temporarily retained so that it can be called and updated by subsequent frames). In other parts of this disclosure, the process of recording layers can also be performed based on the above implementation method.

[0109] Regarding the step of determining whether the original set of layers is the same, for example, when obtaining the set of layers to be drawn, it can be determined whether there are any changes compared to the set of layers to be drawn in the previous frame based on the label information of these layers (such as the layer ID); or, for example, the determination result can be determined based on functions provided by some system components, such as the updateLayerSnapshotsLegacy function. The above exemplary methods can further reduce the execution pressure of the above method.

[0110] In the second exemplary approach, the step of calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer may include:

[0111] If the interval between the current frame and the first historical frame reaches a preset number of frames, a sub-thread is invoked to overlay and synthesize the original layer set of the current frame to obtain a reference layer. The first historical frame is the frame in which the sub-thread was invoked to overlay and synthesize the original layer set to obtain the reference layer.

[0112] If the interval between the current frame and the first historical frame is less than a preset number of frames, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0113] The "interval" mentioned above refers to the difference between the current frame and the historical frame. For example, if the current frame is the 3rd frame and the historical frame is the 1st frame, then the interval between the current frame and the first historical frame is 2 frames. In other words, the step of "calling a sub-thread to overlay and composite the original layer set of the current frame to obtain the base layer" can be executed once every "preset number" frames. When the preset number is 1, this step is executed for every frame.

[0114] In other words, further, the step of calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer may include:

[0115] If the original layer set of the current frame is the same as the original layer set of the previous frame, the reference layer of the previous frame is used as the reference layer of the current frame.

[0116] If the original layer set of the current frame is different from the original layer set of the previous frame, a sub-thread is called to overlay and composite the original layer set to obtain the base layer.

[0117] The above steps can eliminate the process of judging the frame interval, and instead directly use "whether the original layer set (including the layers) has changed" as the execution logic of the SF thread, and execute it during the drawing process of each frame of the SF thread, which further reduces the running pressure of the method.

[0118] In the second exemplary approach, the content of the base layer can be updated every N frames (N is a positive integer), which can further reduce the execution pressure of the above method. The rendering of the animation layer in step S103 can be performed every M frames (M is a positive integer). When M is less than N, the rendering frequency of the animation layer is higher than the update frequency of the base layer, which can further balance the execution power consumption of the method and the smoothness of the animation. Here, M and N can be preset values ​​corresponding to the rendering algorithm (e.g., different types of animation can use different rendering strategies), or they can be values ​​determined in real time based on the current hardware pressure (e.g., CPU and GPU utilization). This disclosure does not limit them in this way.

[0119] Specifically, for example, determining the animation layer corresponding to the current frame based on the processing capability and the reference layer using the second processor may include: performing rendering processing on the reference layer based on the processing capability and the animation progress parameters of the current frame using the second processor to determine the animation layer corresponding to the current frame.

[0120] In other words, the rendering algorithm X can have an animation progress parameter, which represents the position of the current frame within the complete animation effect. For example, in a screen-off scene, all content on the screen gradually darkens. For rendering a single frame image, determining the specific degree to which the image should be darkened and using the parameter representing this degree as input to the rendering algorithm can more efficiently achieve the above step S103.

[0121] During this process, even if the update frequency of the base layer is lower than the rendering frequency of the animation layer, it will not have a significant impact on the user experience, because the user's visual focus is on the screen-off animation itself. In other words, the smoothness of the "gradual dimming effect" usually has a greater impact on the user experience than "what exactly is gradually dimming".

[0122] It should be understood that the various exemplary methods described above can be applied in combination. For example, the step of "calling a sub-thread to perform overlay and compositing processing on the original layer set to obtain a base layer" in the second exemplary method can be executed based on the first exemplary method. That is, the original layer set can be checked every N frames to see if it has changed. If it has not changed, the animation layer is generated using the previously cached base layer. If it has changed, the base layer is updated (i.e., step S102 is executed in this frame). This further enhances the flexibility of the method and makes adaptive optimizations to the execution process based on the actual situation to the greatest extent.

[0123] In addition to timed triggering and conditional triggering (such as executing a specific line of code or the occurrence of a specific event, where the specific event is such as low battery or fully charged battery), animation effects can also be triggered by user commands. For example, the screen-off animation can be triggered by the user pressing the power button.

[0124] For example, these specific events or user commands can be detected and processed by the business layer. When the business layer determines that a certain effect needs to be generated at a certain location (e.g., displaying a screen-off animation in full screen, or displaying a flashing animation within a hollow rectangle with a width of N pixels surrounding the screen edge), a placeholder layer can be created at that location. That is, determining the original layer set for generating the animation from the set of layers to be drawn can include:

[0125] If the set of layers to be drawn includes a placeholder layer with preset attributes, the layers covered by the placeholder layer in the set of layers to be drawn are determined as the original set of layers for generating the animation, wherein the placeholder layer is created in response to the animation generation instruction and is used to indicate the coverage area of ​​the animation.

[0126] The method may further include: mapping the animation layer corresponding to the current frame to the placeholder layer, so that the device renders the animation layer.

[0127] The placeholder layer can have functions such as instructing the SF thread to perform animation rendering, conveying the necessary parameters for animation rendering (such as what animation to render in which range) to the SF thread, and storing the GPU's rendering results (such as layer E).

[0128] Once the business layer determines the animation to be rendered and creates the corresponding placeholder layer, even without specifically notifying the SF thread, the SF thread can still find the placeholder layer and know the necessary parameters for animation rendering when reading the collection of layers to be drawn (these parameters can be either attributes of the placeholder layer or written to the corresponding configuration file). This can minimize the communication overhead between components and threads and greatly simplify the execution logic of the code, making it easier to develop business layer applications without having to actively call underlying functions to complete the rendering process.

[0129] Optionally, the above animations can be mask animation effects, such as flashing effects, blurring effects, and screen-off / screen-on effects. These effects usually need to be rendered by the system layer (because these effects usually involve the visual presentation of the entire system interface, while other effects or game screens within the application are usually rendered by the corresponding application process). When the SF thread detects the placeholder layer, it can use the layers covered by the placeholder layer as the original layer set. Here, layers with a lower layer level than the placeholder layer can be directly used as the original layer set, or the layers with a lower layer level than the placeholder layer can be further checked in terms of size and position (that is, to confirm whether the layer is indeed covered by the placeholder layer). Furthermore, these covered layers can be cropped, and the covered parts of these layers can be determined as the original layer set (of course, these cropping processes can also be completed in step S103, during the rendering of the display layer, or at the end of the screen display).

[0130] Finally, when step S103 is completed, the animation layer can be mapped to the placeholder layer. At this point, the animation layer can participate in the drawing process of the display layer together with other layers. Therefore, there is no need to make adaptive changes to processes and threads (including rendering pipelines, data channels, etc.) other than the thread responsible for executing the above methods. This greatly reduces the development cost related to the method and enhances the portability and maintainability of the method, making it extremely valuable in practice.

[0131] It should be understood that, generally speaking, layers need to be processed by hardware before being presented to the user. In the above processing, the content of the placeholder layer has actually been overwritten (replaced by the content of the animation layer). Therefore, the original content of the placeholder layer does not affect the implementation of the above technical effects of this disclosure.

[0132] Furthermore, in some embodiments, determining the animation layer corresponding to the current frame based on the second processor, according to the processing capability and the reference layer, may include:

[0133] If the processing capability characterizes a set of fallback layers in the set of layers to be drawn that the first processor cannot process, the fallback layer set and the reference layer are processed according to the hierarchical relationship between each fallback layer in the fallback layer set and the placeholder layer to obtain the animation layer corresponding to the current frame.

[0134] This embodiment has been described in detail in the previous example. For instance, HWC rolls back to layer A, the GPU takes over layer A, and then draws layers A, B, and E in sequence. If HWC can process layer A normally, the GPU can directly render layer E, and then hand E over to the relevant hardware for final overlay and compositing to obtain the displayed image.

[0135] For example, the method may further include: sending the set of layers to be drawn and the animation layer to the first processor to generate a display image of the current frame, wherein the display image is used to present to the user.

[0136] In this embodiment, the first processor can be used to overlay and composite the image to be displayed (at this point, the task that should have been performed by the second processor has been returned to the second processor and completed), and finally output to the display screen. Of course, the layers sent to the first processor are not necessarily sent simultaneously or continuously; they can also be sent in batches.

[0137] The following combination Figure 4 and Figure 5 The above-described at least one embodiment will be comprehensively described.

[0138] First, please see Figure 4 The business layer process that displays the page generates (holds) layers, and the parts of these layers that participate in drawing the displayed images can constitute a set of images to be drawn.

[0139] Please see Figure 5 In step 501, the SF process traverses the layers to be drawn that participate in the drawing of the current frame to obtain a set of layers to be drawn (corresponding to...). Figure 4 (process ① in the middle).

[0140] Next, the SF process can determine whether there are pre-defined placeholder layers in the set of layers to be drawn. These placeholder layers can usually be identified based on pre-defined attributes (such as the flag attribute). If no placeholder layers are found, normal overlay compositing and on-screen processes can be performed (of course, these normal processes may also be implemented based on the above steps S101 to S103, which have been described in detail above). If placeholder layers exist, each placeholder layer is considered to correspond to a rendering task. Then, in step 502, the effect parameters represented by the placeholder layer can be determined, and the layers covered by the placeholder layer can be used as the original layer set. For example, in a screen-off animation scene, the placeholder layer may be a layer located at the top and covering the entire screen, so all layers on the current screen may become the original layer set.

[0141] Next, the SF process can categorize tasks and, in step 5031, send tasks that do not involve GPU rendering (or all layers to be drawn, since animations are usually displayed on the upper layer, and existing layers can be drawn below them) to HWC, and wait for HWC's response. Before executing step 5031, or during the waiting process of step 5031, the SF thread can also call a sub-thread in step 5032 to asynchronously generate the reference image. This process corresponds to... Figure 4 ② and ③ in the text.

[0142] If the HWC response can handle the currently received task normally (of course, the HWC can also respond with other content, such as if the animation layer in the current frame stops drawing for some reason, then the method can stop execution in this frame and restart in the next frame), then the SF thread can, in step 504a, based on the recorded reference image (which has already been drawn by the sub-thread and output to the first display surface, i.e. Figure 4 (④) and animation progress parameters are used to generate an animation layer.

[0143] If the HWC responds by refusing to process some tasks, the layers corresponding to these tasks can form a set of fallback layers, which can be drawn by the GPU. For example, in step 504b, SF can identify the set of fallback layers that the HWC cannot draw (corresponding to...). Figure 4 (⑤) and confirm all layers related to the rendering process, namely the base layer, and other layers that may participate in the drawing of animation layers (such as those layers in the fallback layer set mentioned earlier that are below the animation layer and can be drawn in conjunction with the animation layer) and animation progress parameters, and generate the animation layer (the process of generating the animation layer corresponds to... Figure 4 (middle ⑥).

[0144] Finally, the relevant hardware (such as HWC or other hardware) overlays and synthesizes the animation layer obtained by the GPU rendering and other layers involved in drawing the display image to obtain the display image, which can be output to the device screen to be presented to the user, thereby completing one screen refresh.

[0145] For specific details in the above examples, please refer to the foregoing embodiments, which will not be repeated here.

[0146] Corresponding to the embodiments of the foregoing methods, this disclosure also provides embodiments of the apparatus and the terminal to which it is applied.

[0147] A second aspect of this disclosure provides an animation generation apparatus; please refer to [link / reference]. Figure 6 The device includes:

[0148] The communication module 601 is used to communicate with the first thread during the animation generation process to determine the processing capability of the first processor for the set of layers to be drawn in the current frame;

[0149] The overlay compositing module 602 is used to determine the original layer set for generating the animation from the set of layers to be drawn, and to call a sub-thread to perform overlay compositing processing on the original layer set to obtain a base layer;

[0150] Animation generation module 603 is used to determine the animation layer corresponding to the current frame based on the processing capability and the reference layer after determining the processing capability, wherein both the first processor and the second processor are used to process the layer.

[0151] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0152] Determine whether the original layer set of the current frame is the same as the original layer set corresponding to the recorded reference layer;

[0153] If the judgment results are the same, the recorded reference layer is used as the reference layer of the current frame;

[0154] If the judgment results are different, the child thread is called to overlay and composite the original layer set of the current frame to obtain the base layer of the current frame, and the base layer of the current frame is recorded.

[0155] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0156] If the interval between the current frame and the first historical frame reaches a preset number of frames, a sub-thread is invoked to overlay and synthesize the original layer set of the current frame to obtain a reference layer. The first historical frame is the frame in which the sub-thread was invoked to overlay and synthesize the original layer set to obtain the reference layer.

[0157] If the interval between the current frame and the first historical frame is less than a preset number of frames, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0158] Optionally, the overlay compositing module is used when the sub-thread is called to perform overlay compositing processing on the original layer set to obtain the base layer, specifically for:

[0159] If the original layer set of the current frame is the same as the original layer set of the previous frame, the reference layer of the previous frame is used as the reference layer of the current frame.

[0160] If the original layer set of the current frame is different from the original layer set of the previous frame, a sub-thread is called to overlay and composite the original layer set to obtain the base layer.

[0161] Optionally, the overlay compositing module is used to determine the original layer set for generating the animation from the set of layers to be drawn, specifically for:

[0162] If the set of layers to be drawn includes a placeholder layer with preset attributes, the layers covered by the placeholder layer in the set of layers to be drawn are determined as the original set of layers for generating the animation, wherein the placeholder layer is created in response to the animation generation instruction and is used to indicate the coverage area of ​​the animation.

[0163] The device further includes:

[0164] The mapping module is used to map the animation layer corresponding to the current frame to the placeholder layer so that the device can display the animation layer.

[0165] Optionally, the animation generation module, when determining the animation layer corresponding to the current frame based on the second processor according to the processing capability and the reference layer, is specifically used for:

[0166] If the processing capability characterizes a set of fallback layers in the set of layers to be drawn that the first processor cannot process, the fallback layer set and the reference layer are processed according to the hierarchical relationship between each fallback layer in the fallback layer set and the placeholder layer to obtain the animation layer corresponding to the current frame.

[0167] Optionally, the communication module is used to communicate with the first thread during the animation generation process to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, specifically for:

[0168] During the animation generation process, communication is made with the compositing service component to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, wherein the first processor includes a hardware compositor and the second processor includes a graphics processor.

[0169] Optionally, the animation generation module, when determining the animation layer corresponding to the current frame based on the second processor according to the processing capability and the reference layer, is specifically used for:

[0170] Based on the processing capability and the animation progress parameters of the current frame, the reference layer is rendered using the second processor to determine the animation layer corresponding to the current frame.

[0171] Optionally, the device further includes:

[0172] The display image generation module is used to send the set of layers to be drawn and the animation layer to the first processor to generate the display image of the current frame, wherein the display image is used to present to the user.

[0173] The specific implementation process of the functions and roles of each module in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.

[0174] A third aspect of this disclosure provides a computer program product including a computer program / instructions that, when executed by a processor, implement the method described in the first aspect.

[0175] For the device embodiments and computer program product embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. Furthermore, the device embodiments described above are merely illustrative; the modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs. Those skilled in the art can understand and implement this without any inventive effort.

[0176] Fourthly, embodiments of the animation generation apparatus provided in this disclosure can be applied to electronic devices. Please see [link to relevant documentation]. Figure 7The illustration exemplifies a hardware schematic of an electronic device. For example, device 700 could be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0177] Device 700 may include one or more of the following components: processing component 701, memory 702, power supply component 703, multimedia component 704, audio component 705, input / output (I / O) interface 706, sensor component 707, and communication component 708.

[0178] Processing component 701 typically controls the overall operation of device 700, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 701 may include one or more processors 709 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 701 may include one or more modules to facilitate interaction between processing component 701 and other components. For example, processing component 701 may include a multimedia module to facilitate interaction between multimedia component 704 and processing component 701.

[0179] Memory 702 is configured to store various types of data to support the operation of device 700. Examples of this data include instructions for any application or method operating on device 700, contact data, phonebook data, messages, pictures, videos, etc. Memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0180] The power supply component 703 provides power to the various components of the device 700. The power supply component 703 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power to the device 700.

[0181] Multimedia component 704 includes a screen that provides an output interface between the device 700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 704 includes a front-facing camera and / or a rear-facing camera. When the device 700 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0182] Audio component 705 is configured to output and / or input audio signals. For example, audio component 705 includes a microphone (MIC) configured to receive external audio signals when device 700 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 702 or transmitted via communication component 708. In some embodiments, audio component 705 also includes a speaker for outputting audio signals.

[0183] I / O interface 706 provides an interface between processing component 701 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0184] Sensor assembly 707 includes one or more sensors for providing state assessments of various aspects of device 700. For example, sensor assembly 707 can detect the on / off state of device 700, the relative positioning of components such as the display and keypad of device 700, changes in the position of device 700 or a component of device 700, the presence or absence of user contact with device 700, the orientation or acceleration / deceleration of device 700, and temperature changes of device 700. Sensor assembly 707 may also include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 707 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 707 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.

[0185] Communication component 708 is configured to facilitate wired or wireless communication between device 700 and other devices. Device 700 can access wireless networks based on communication standards, such as WiFi, 2G or 3G, 4G or 5G, or combinations thereof. In one exemplary embodiment, communication component 708 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 708 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0186] In an exemplary embodiment, device 700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the animation generation method of the aforementioned electronic device.

[0187] Fifthly, in exemplary embodiments, this disclosure also provides a non-transitory computer-readable storage medium including instructions, such as a memory 702 including instructions, which can be executed by a processor 709 of device 700 to complete the animation generation method of the aforementioned electronic device. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0188] The foregoing has described specific embodiments of this disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0189] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention applied herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the following claims.

[0190] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

[0191] The above description is merely a preferred embodiment of this disclosure and is not intended to limit this disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. An animation generation method, characterized in that, The method includes: During the animation generation process, it communicates with the first thread to determine the processing capacity of the first processor for the set of layers to be drawn in the current frame; The original layer set used to generate the animation is determined from the set of layers to be drawn, and a sub-thread is called to perform overlay and compositing processing on the original layer set to obtain the base layer; After determining the processing capability, the animation layer corresponding to the current frame is determined based on the processing capability and the reference layer, using the second processor, wherein both the first processor and the second processor are used to process the layer.

2. The animation generation method according to claim 1, characterized in that, The process of calling a sub-thread to overlay and composite the original layer set to obtain a base layer includes: Determine whether the original layer set of the current frame is the same as the original layer set corresponding to the recorded reference layer; If the judgment results are the same, the recorded reference layer is used as the reference layer of the current frame; If the judgment results are different, the child thread is called to overlay and composite the original layer set of the current frame to obtain the base layer of the current frame, and the base layer of the current frame is recorded.

3. The animation generation method according to claim 1 or 2, characterized in that, The process of calling a sub-thread to overlay and composite the original layer set to obtain a base layer includes: If the interval between the current frame and the first historical frame reaches a preset number of frames, a sub-thread is invoked to overlay and synthesize the original layer set of the current frame to obtain a reference layer. The first historical frame is the frame in which the sub-thread was invoked to overlay and synthesize the original layer set to obtain the reference layer. If the interval between the current frame and the first historical frame is less than a preset number of frames, the reference layer of the first historical frame is used as the reference layer of the current frame.

4. The animation generation method according to claim 1 or 2, characterized in that, The process of calling a sub-thread to overlay and composite the original layer set to obtain a base layer includes: If the original layer set of the current frame is the same as the original layer set of the previous frame, the reference layer of the previous frame is used as the reference layer of the current frame. If the original layer set of the current frame is different from the original layer set of the previous frame, a sub-thread is called to overlay and composite the original layer sets to obtain the base layer.

5. The animation generation method according to claim 1 or 2, characterized in that, The process of calling a sub-thread to overlay and composite the original layer set of the current frame to obtain a base layer includes: Create the first display surface; The sub-thread is invoked to perform overlay and compositing processing on the original layer set of the current frame, and the processing result is output to the first display surface to record the reference layer of the current frame.

6. The animation generation method according to claim 1, characterized in that, The step of determining the original layer set for generating the animation from the set of layers to be drawn includes: If the set of layers to be drawn includes a placeholder layer with preset attributes, the layers covered by the placeholder layer in the set of layers to be drawn are determined as the original set of layers for generating the animation, wherein the placeholder layer is created in response to the animation generation instruction and is used to indicate the coverage area of ​​the animation. The method further includes: The animation layer corresponding to the current frame is mapped to the placeholder layer so that the device can display the animation layer.

7. The animation generation method according to claim 6, characterized in that, The step of determining the animation layer corresponding to the current frame based on the processing capability and the reference layer, using the second processor, includes: If the processing capability characterizes a set of fallback layers in the set of layers to be drawn that the first processor cannot process, the fallback layer set and the reference layer are processed according to the hierarchical relationship between each fallback layer in the fallback layer set and the placeholder layer to obtain the animation layer corresponding to the current frame.

8. The animation generation method according to claim 1, characterized in that, The process of communicating with the first thread during animation generation to determine the processing capability of the first processor for the set of layers to be drawn in the current frame includes: During the animation generation process, communication is made with the compositing service component to determine the processing capability of the first processor for the set of layers to be drawn in the current frame, wherein the first processor includes a hardware compositor and the second processor includes a graphics processor.

9. The animation generation method according to claim 1, characterized in that, The step of determining the animation layer corresponding to the current frame based on the processing capability and the reference layer, using the second processor, includes: Based on the processing capability and the animation progress parameters of the current frame, the reference layer is rendered using the second processor to determine the animation layer corresponding to the current frame.

10. The animation generation method according to claim 1, characterized in that, The method further includes: The set of layers to be drawn and the animation layers are sent to the first processor to generate the display image of the current frame, wherein the display image is used to present to the user.

11. An animation generation device, characterized in that, The device includes: The communication module is used to communicate with the first thread during the animation generation process to determine the processing capability of the first processor for the set of layers to be drawn in the current frame; The overlay compositing module is used to determine the original layer set for generating the animation from the set of layers to be drawn, and to call a sub-thread to perform overlay compositing processing on the original layer set to obtain a base layer; An animation generation module is used to determine the animation layer corresponding to the current frame based on the processing capability and the reference layer after determining the processing capability, wherein both the first processor and the second processor are used to process the layer.

12. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the method as described in any one of claims 1 to 10.

13. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method as described in any one of claims 1 to 10.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1 to 10.