Animation generation method and device, electronic equipment and storage medium

By using downsampling to generate a low-resolution baseline layer during animation generation, the problem of high animation rendering latency on mobile devices is solved, improving animation effects and user experience, reducing device power consumption, and extending battery life.

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

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING XIAOMI MOBILE SOFTWARE CO LTD
Filing Date
2024-10-29
Publication Date
2026-05-01

AI Technical Summary

Technical Problem

The animation rendering process on mobile devices takes a long time, resulting in high latency, which affects the user experience. Furthermore, removing special effects from the animation algorithm will greatly sacrifice the animation quality.

Method used

By dividing the animation generation process into two parts, overlay compositing and rendering, a low-resolution base layer is generated using downsampling, and a high-resolution animation layer is generated on top of this, reducing the cache space and the computational pressure of the rendering algorithm.

Benefits of technology

Without compromising the animation algorithm, the animation effects and user experience are improved, frame generation latency and device power consumption are reduced, and device battery life is extended.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962364A_ABST
    Figure CN121962364A_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: determining an original layer set for generating animations in a to-be-drawn layer set of a current frame; according to the hierarchical relationship of the image layers, each original image layer in the original image layer set is superposed in sequence through downsampling processing to obtain a reference image layer, and the resolution of the reference image layer is lower than that of the image layers in the original image layer set; an animation layer corresponding to the current frame is determined according to the reference layer, and the resolution ratio of the animation layer is higher than that of the reference layer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of animation layer 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] Determine the original set of layers to be drawn in the current frame for generating the animation;

[0007] Based on the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a base layer, wherein the resolution of the base layer is lower than the resolution of the layers in the original layer set;

[0008] The animation layer corresponding to the current frame is determined based on the reference layer, wherein the resolution of the animation layer is higher than that of the reference layer.

[0009] Optionally, the step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy includes:

[0010] When the interval between the current frame and the first historical frame reaches a first threshold, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a reference layer, wherein the first historical frame is the previous frame in which each original layer in the original layer set was superimposed sequentially through downsampling to obtain the reference layer.

[0011] If the interval between the current frame and the first historical frame does not reach the first threshold, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0012] Optionally, determining the animation layer corresponding to the current frame based on the reference layer includes:

[0013] When the interval between the current frame and the second historical frame reaches a second threshold, the animation layer corresponding to the current frame is determined according to the reference layer, wherein the second threshold is less than the first threshold, and the second historical frame is the previous frame in which the animation layer corresponding to the current frame was determined according to the reference layer;

[0014] If the interval between the current frame and the second historical frame does not reach the second threshold, the animation layer of the second historical frame is used as the animation layer corresponding to the current frame.

[0015] Optionally, the method further includes:

[0016] The original layer set is divided into multiple original layer subsets, wherein each original layer subset contains at least one original layer;

[0017] The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy includes:

[0018] For each original layer subset, based on the layer hierarchy, each original layer in the original layer subset is superimposed sequentially through downsampling to obtain the base layer corresponding to the original layer subset;

[0019] Determining the animation layer corresponding to the current frame based on the reference layer includes:

[0020] Determine the animation layer corresponding to the current frame based on the base layer corresponding to each subset of original layers.

[0021] Optionally, for each subset of original layers, according to the layer hierarchy, each original layer in the subset is sequentially overlaid through downsampling to obtain the base layer corresponding to the subset of original layers, including:

[0022] For each subset of the original layers:

[0023] When the interval between the current frame and the third historical frame reaches the third threshold corresponding to the original layer subset, each original layer in the original layer subset is superimposed sequentially through downsampling processing according to the layer hierarchy to obtain the base layer corresponding to the original layer subset.

[0024] If the interval between the current frame and the third historical frame does not reach the third threshold corresponding to the original layer subset, the reference layer corresponding to the original layer subset in the third historical frame is used as the reference layer corresponding to the original layer subset in the current frame.

[0025] The third historical frame is the frame of the reference layer corresponding to the original layer subset obtained through downsampling processing, and the third threshold is different for each original layer subset.

[0026] Optionally, the step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy includes:

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

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

[0029] If the judgment results are different, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain the reference layer, and the reference layer of the current frame is recorded.

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

[0031] If the set of layers to be drawn in the current frame contains 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.

[0032] The method further includes:

[0033] The animation layer corresponding to the current frame is mapped to the placeholder layer so that the device can display the animation layer.

[0034] Optionally, the step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy includes:

[0035] Create the first display surface;

[0036] Based on the hierarchical relationship of each original layer in the original layer set, each original layer is downsampled sequentially, and the downsampling result is drawn onto the first display surface.

[0037] Optionally, determining the animation layer corresponding to the current frame based on the reference layer includes:

[0038] Based on the animation progress parameters of the current frame, the base layer of the current frame is upsampled using the rendering algorithm corresponding to the animation to obtain the animation layer corresponding to the current frame, wherein the resolution of the animation layer is the same as the resolution of the original layer.

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

[0040] The Original Layers module is used to determine the original set of layers to be drawn in the current frame for generating the animation;

[0041] The downsampling compositing module is used to sequentially overlay each original layer in the original layer set according to the layer hierarchy through downsampling processing to obtain a base layer, wherein the resolution of the base layer is lower than the resolution of the layers in the original layer set;

[0042] The animation generation module determines the animation layer corresponding to the current frame based on the reference layer, wherein the resolution of the animation layer is higher than the resolution of the reference layer.

[0043] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0044] When the interval between the current frame and the first historical frame reaches a first threshold, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a reference layer, wherein the first historical frame is the previous frame in which each original layer in the original layer set was superimposed sequentially through downsampling to obtain the reference layer.

[0045] If the interval between the current frame and the first historical frame does not reach the first threshold, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0046] Optionally, the downsampling synthesis module is used to determine the animation layer corresponding to the current frame based on the reference layer, specifically for:

[0047] When the interval between the current frame and the second historical frame reaches a second threshold, the animation layer corresponding to the current frame is determined according to the reference layer, wherein the second threshold is less than the first threshold, and the second historical frame is the previous frame in which the animation layer corresponding to the current frame was determined according to the reference layer;

[0048] If the interval between the current frame and the second historical frame does not reach the second threshold, the animation layer of the second historical frame is used as the animation layer corresponding to the current frame.

[0049] Optionally, the device further includes:

[0050] The subset partitioning module is used to divide the original layer set into multiple original layer subsets, wherein each original layer subset contains at least one original layer;

[0051] The downsampling synthesis module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0052] For each original layer subset, based on the layer hierarchy, each original layer in the original layer subset is superimposed sequentially through downsampling to obtain the base layer corresponding to the original layer subset;

[0053] The animation generation module is used to determine the animation layer corresponding to the current frame based on the reference layer, specifically for:

[0054] Determine the animation layer corresponding to the current frame based on the base layer corresponding to each subset of original layers.

[0055] Optionally, the downsampling synthesis module is used to, for each original layer subset, sequentially overlay each original layer in the original layer subset according to the layer hierarchy through downsampling processing to obtain the base layer corresponding to the original layer subset, specifically for:

[0056] For each subset of the original layers:

[0057] When the interval between the current frame and the third historical frame reaches the third threshold corresponding to the original layer subset, each original layer in the original layer subset is superimposed sequentially through downsampling processing according to the layer hierarchy to obtain the base layer corresponding to the original layer subset.

[0058] If the interval between the current frame and the third historical frame does not reach the third threshold corresponding to the original layer subset, the reference layer corresponding to the original layer subset in the third historical frame is used as the reference layer corresponding to the original layer subset in the current frame.

[0059] The third historical frame is the frame of the reference layer corresponding to the original layer subset obtained through downsampling processing, and the third threshold is different for each original layer subset.

[0060] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

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

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

[0063] If the judgment results are different, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain the reference layer, and the reference layer of the current frame is recorded.

[0064] Optionally, the original layer module is used to determine the original layer set for generating the animation from the set of layers to be drawn in the current frame, specifically for:

[0065] If the set of layers to be drawn in the current frame contains 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.

[0066] The device further includes:

[0067] 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.

[0068] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0069] Create the first display surface;

[0070] Based on the hierarchical relationship of each original layer in the original layer set, each original layer is downsampled sequentially, and the downsampling result is drawn onto the first display surface.

[0071] Optionally, when determining the animation layer corresponding to the current frame based on the reference layer, the animation generation module is specifically used for:

[0072] Based on the animation progress parameters of the current frame, the base layer of the current frame is upsampled using the rendering algorithm corresponding to the animation to obtain the animation layer corresponding to the current frame, wherein the resolution of the animation layer is the same as the resolution of the original layer.

[0073] 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.

[0074] 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.

[0075] 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.

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

[0077] The above embodiment divides the animation generation process into two parts: overlay compositing and rendering, with a base layer serving as the medium between the two parts. During the overlay compositing process, downsampling is performed to obtain a low-resolution base layer. Then, a higher-resolution animation layer is derived from this low-resolution base layer. This reduces the cache space occupied by the base layer and lowers the computational burden on the rendering algorithm by reducing the input to the base layer. Through this special optimization of the animation generation process, even relatively complex animations can be applied to mobile devices such as smartphones without compromising the animation algorithm, thus providing users with a more diverse and superior visual experience. Furthermore, the above method reduces frame generation latency and the time spent on display-related processes and threads. This not only serves as a prerequisite for improving the device's screen refresh rate (because it significantly reduces the time consumed in rendering each frame) but also helps reduce device power consumption and extend battery life.

[0078] 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

[0079] 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.

[0080] Figure 1 This is a flowchart illustrating an animation generation method using some exemplary embodiments.

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

[0082] Figure 3 These are schematic diagrams illustrating another animation generation method using some exemplary embodiments.

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

[0084] Figure 5 These are schematic diagrams illustrating another animation generation method using exemplary embodiments.

[0085] Figure 6 These are timing diagrams illustrating an animation generation method using some exemplary embodiments.

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

[0087] Figure 8 These are hardware structure diagrams of an electronic device illustrated by some exemplary embodiments. Detailed Implementation

[0088] 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.

[0089] 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.

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

[0091] 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.

[0092] 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.

[0093] The thread responsible for generating the display image for this frame can be a compositor thread, such as the SurfaceFlinger thread (SF 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.

[0094] 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 a certain layer 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., superimposed on the existing result, because the existing result is naturally the drawing result of a layer with a lower layer hierarchy than this layer), and so on.

[0095] Furthermore, 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".

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

[0097] 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.

[0098] Step S101: Determine the original layer set for generating the animation from the set of layers to be drawn in the current frame.

[0099] Typically, the SurfaceFlinger thread reads the set of layers to be drawn in the current frame, analyzes the processing required for each layer in the set, and then processes them separately based on the processing they require. In this disclosure, animation can refer to screen-on animation (e.g., the screen gradually dimming from off), screen-off animation (controls on the screen gradually dimming until the screen is completely off), smart voice assistant wake-up animation (e.g., the smart assistant pops up from the side of the screen and jumps to a preset position), charging animation (e.g., a water ripple effect is displayed on the device screen after the device is connected to a charger), etc.

[0100] Step S102: Based on the layer hierarchy, each original layer in the original layer set is sequentially overlaid through downsampling to obtain a reference layer, wherein the resolution of the reference layer is lower than the resolution of the layers in the original layer set.

[0101] In this disclosure, a layer set includes at least one layer; for example, an original layer set includes at least one original layer, and a layer set to be drawn includes at least one layer set to be drawn. In one example, layers A, B, and C are the layer set to be drawn in the current frame, and layer A is lower than layer B, and layer B is lower than layer C. B and C need to be input into rendering algorithm X for rendering, while A does not need to undergo rendering processing and can directly participate in the drawing of the displayed image. Since the number of layers has a high degree of uncertainty, and the occlusion relationships between layers may be complex, in such cases, please refer to... Figure 2First, layers B and C (the original set of layers) are overlaid to form a base layer, which serves as the input to 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, the base layer may simply be a string of temporary data in a buffer.) Then, rendering processing is performed on the base layer to obtain the animation layer, thereby unifying the input to the rendering algorithm and making it easier to simplify. Finally, layer A and the animation layer are overlaid to form the display image, resulting in the final display image.

[0102] In the above process, please refer to Figure 3 The baseline layer can be obtained by first downsampling each original layer in the original layer set and then overlaying them sequentially.

[0103] The downsampling process can be based on methods such as nearest neighbor interpolation, bilinear interpolation, and bicubic interpolation, etc., and this disclosure does not limit this. The upsampling process mentioned later is similar to the downsampling process described here. In the layer composition process, it is usually necessary to first draw the lower-level layers based on the layer hierarchy, and then draw the higher-level layers on top of the lower-level layers (that is, higher-level layers need to be drawn on top of lower-level layers). Therefore, combining... Figure 2 In the example shown, layer B can be drawn first, followed by layer C, to obtain the base layer. During the drawing process, layers B and C can be downsampled based on the scaling factor (i.e., the ratio of image resolution before and after scaling) to obtain a base layer with a lower resolution.

[0104] exist Figure 3 In this example, the scaling factor is 0.5, meaning the horizontal and vertical pixel counts of the new image are reduced to 0.5 times the original. Taking downsampling using mean pooling as an example, every four pixels in layers B and C can correspond to one pixel in the base layer. After reading in four pixels, the average value of these four pixels in each color channel can be plotted onto the corresponding pixel in the base layer, for example, the resulting pixels are superimposed onto the corresponding pixels in the base layer. This allows for... Figure 3 For pixel 210, it can be understood that this pixel is obtained by drawing the average pixel value of four pixels B1, B2, B3, and B4 of layer B onto the base layer (step ①), and then superimposing the average pixel value of four pixels C1, C2, C3, and C4 of layer C. Based on this, the downsampling process and the image superposition and synthesis process can be completed simultaneously, thereby directly obtaining a base layer with a lower resolution.

[0105] In the steps described above, the scaling factor is not necessarily a constant value. Instead, it can be determined based on factors such as the type of animation, the current operating load of the device, and the importance of the layers in the original layer set. For example, the scaling factor value can be negatively correlated with parameters such as the operating pressure of the rendering algorithm corresponding to the animation and the current operating load of the device, and positively correlated with parameters such as the importance of the layers in the original layer set.

[0106] The importance level can be used to characterize the layer's impact on the user's visual experience. This parameter can be preset, such as obtained directly from the layer's name or identifier, or it can be determined based on the layer's hierarchy and size. For example, mobile devices often have gesture operation feedback functions (such as swiping a finger from the edge of the screen inward, which usually represents a "back" operation; in this case, the phone usually generates a temporary back arrow at the location where the user performs the operation to provide visual feedback). When these functional components present animation effects to the user, they also need to generate specific layers and have them rendered by the hardware to obtain the animation effect. Therefore, based on the identifier, name, position, and size of these specific layers (that is, layers within a specific position or size range are considered these layers), it can be determined whether the current original layer set contains these layers. If so, since these animations are often located at the edge of the screen and have a very short duration, they can be considered to be of low importance. Therefore, step S102 can be performed based on a smaller scaling factor (the same applies to subsequent step S103). That is, when generating the base layer, the original layer set is scaled down to a smaller magnification image. This can further reduce the rendering overhead of these animations while taking into account the user's visual experience.

[0107] Similarly, if a layer is small, it can be considered less noticeable to the user, and therefore less important. Furthermore, if a layer is low-level, most of its content may be covered by the layers above it, or it may be low-level information such as wallpaper that doesn't attract the user's visual attention, thus also indicating lower importance.

[0108] Step S103: Determine the animation layer corresponding to the current frame based on the reference layer, wherein the resolution of the animation layer is higher than the resolution of the reference layer.

[0109] After obtaining the base layer, in step S103, the base layer can be rendered and upsampled based on a preset rendering algorithm to obtain the animation layer. For example, in a simple understanding, pixel 210 in the base layer corresponds to pixels 211 to 214 in the animation layer. The value of pixel 210 can be calculated based on the preset rendering algorithm, and then pixels 211 to 214 can be drawn according to the calculation results (e.g., the calculation results are superimposed onto pixels 211 to 214 respectively), and so on, to obtain the animation layer. The animation layer can then be used to composite and display images.

[0110] In the above animation rendering process, the rendering algorithm may also have other parameters. For example, determining the animation layer corresponding to the current frame based on the reference layer may include: upsampling the reference layer of the current frame according to the animation progress parameters of the current frame through the rendering algorithm corresponding to the animation to obtain the animation layer corresponding to the current frame, wherein the resolution of the animation layer is consistent with the resolution of the original layer.

[0111] In other words, the rendering algorithm can take an animation progress parameter as input, 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, 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.

[0112] The above embodiment divides the animation generation process into two parts: overlay compositing and rendering, with a base layer serving as the medium between the two parts. During the overlay compositing process, downsampling is performed to obtain a low-resolution base layer. Then, a higher-resolution animation layer is derived from this low-resolution base layer. This reduces the cache space occupied by the base layer and also reduces the computational burden on the rendering algorithm by decreasing the input to the base layer. Through this specific optimization of the animation generation process, even relatively complex animations can be applied to mobile devices such as smartphones without compromising the animation algorithm, thus providing 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 serves as a prerequisite for improving the device's screen refresh rate (because it significantly reduces the time consumed in rendering each frame) but also helps reduce device power consumption and extend battery life.

[0113] In some embodiments, steps S102 and S103 can be further optimized in terms of execution frequency, execution conditions, and other dimensions.

[0114] In one dimension, for example, the step of sequentially overlaying each original layer in the original layer set through downsampling processing to obtain a base layer based on the layer hierarchy may include:

[0115] When the interval between the current frame and the first historical frame reaches a first threshold, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a reference layer, wherein the first historical frame is the previous frame in which each original layer in the original layer set was superimposed sequentially through downsampling to obtain the reference layer.

[0116] If the interval between the current frame and the first historical frame does not reach the first threshold, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0117] In other words, the generated reference layer can be cached each time step S102 is executed for later use. Furthermore, the process of generating the reference layer in step S102 does not need to be repeated in every frame; instead, it can be executed only when a certain interval has elapsed between the current frame and the frame where this step was last executed. Since the user's visual focus is often on the animation itself, rather than the background layer behind it; and since the background layer behind the animation typically does not change significantly in scenarios requiring animation generation, the above implementation can further reduce the processor overhead when generating the reference layer without affecting the user's visual experience.

[0118] The following is a brief description of the caching and recording process for the reference layer. For example, the step of sequentially overlaying each original layer in the original layer set to obtain the reference layer through downsampling processing, based on the layer hierarchy, includes: creating a first display surface; performing downsampling processing on each original layer sequentially according to the layer hierarchy in the original layer set, and drawing the downsampling result onto the first display surface. This process effectively completes the caching and recording of the reference layer. In step S103, the animation layer corresponding to the current frame can be determined based on the content of the first display surface.

[0119] 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 graphics processor 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.

[0120] In the judgment process shown in the above exemplary method, the above "interval" 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 historical frame is 2 frames. In other words, the step of "calling the sub-thread to overlay and synthesize the original layer set of the current frame to obtain the base layer" can be understood as being executed once every "preset number" frames. When the preset number is 1, this step is executed for every frame.

[0121] During animation generation, the base layer is regenerated every N frames (N is a positive integer), and changes to the original layer set can be ignored during this period. Based on this, the above implementation method can further reduce the operational burden on the animation generation method.

[0122] Furthermore, determining the animation layer corresponding to the current frame based on the reference layer may include:

[0123] When the interval between the current frame and the second historical frame reaches a second threshold, the animation layer corresponding to the current frame is determined according to the reference layer, wherein the second threshold is less than the first threshold, and the second historical frame is the previous frame in which the animation layer corresponding to the current frame was determined according to the reference layer;

[0124] If the interval between the current frame and the second historical frame does not reach the second threshold, the animation layer of the second historical frame is used as the animation layer corresponding to the current frame.

[0125] In other words, step S103 can be executed once every M frames (M is a positive integer less than N), and the frame rate of the animation can be lower than the execution frequency of the method. For example, if the screen refresh rate is 120Hz, the animation can refresh at a frequency of 60Hz. Since users are relatively aware of the refresh rate when browsing web pages or scrolling through information messages, the relatively low frame rate is not easily perceived by users in animation generation scenarios such as screen-off animations. Therefore, the above implementation method can further reduce the execution overhead of the method without significantly affecting the user experience.

[0126] The above embodiments can be applied in combination; for example, please refer to [link to relevant documentation]. Figure 4 The base layer content can be updated every N frames (N is a positive integer), which can further reduce the execution pressure of the above method. Step S103, rendering the animation layer, 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. For example, the base layer can be refreshed at a frequency of 30Hz, while the animation can be refreshed at a frequency of 120Hz. In this case, taking a screen-off scene as an example, although the background update frequency is slower, the dimming effect produced by the animation can remain smooth, which meets the needs of the actual scene. 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 operating load of the device (e.g., CPU and GPU utilization rates), etc., as described above. This disclosure does not limit them in this way.

[0127] In another dimension, for example, the step of sequentially overlaying each original layer in the original layer set to obtain a base layer through downsampling processing according to the layer hierarchy may include:

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

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

[0130] If the judgment results are different, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain the reference layer, and the reference layer of the current frame is recorded.

[0131] If the above process is performed for each frame, then the step of sequentially overlaying each original layer in the original layer set to obtain a base layer through downsampling processing according to the layer hierarchy can include:

[0132] 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.

[0133] If the original layer set of the current frame is different from the original layer set of the previous frame, the original layers in the original layer set are superimposed sequentially through downsampling processing to obtain the base layer, according to the layer hierarchy.

[0134] 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. For an exemplary method of "recording", please refer to the aforementioned section on the first display surface.

[0135] The above exemplary method can avoid redundant overlay and compositing operations when the original layer set remains unchanged, thereby further reducing the execution pressure of the above method. It is worth noting that the above implementation method can be used in conjunction with the embodiment described above that performs an overlay and compositing operation once every N frames in step S102. For example, every N frames, it can be determined whether the original layer set has changed compared to the last time the base layer was generated, and if it has changed, the base layer can be updated.

[0136] In another dimension, for example, the method can also be optimized by refining the classification of layers. For instance, the method may further include:

[0137] The original layer set is divided into multiple original layer subsets, wherein each original layer subset contains at least one original layer;

[0138] The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy may include:

[0139] For each original layer subset, based on the layer hierarchy, each original layer in the original layer subset is superimposed sequentially through downsampling to obtain the base layer corresponding to the original layer subset;

[0140] Determining the animation layer corresponding to the current frame based on the reference layer may include:

[0141] Determine the animation layer corresponding to the current frame based on the base layer corresponding to each subset of original layers.

[0142] Please see Figure 5 Its effect on Figure 2 The example shown has been expanded upon, in Figure 5 In the example shown, the original layer set includes layers B and C, as well as layers D and E. The following explanation will use the example of layer D being a higher layer than layer C and layer E being a higher layer than layer D. In the above embodiment, layers B, C, D, and E can be overlaid to obtain a base layer. Furthermore, the original layer set can be further grouped, and layers in different groups can be overlaid separately to obtain different base layers.

[0143] These reference layers can be cached separately, for example, recorded based on their respective first display surfaces, and updated asynchronously. Furthermore, each subset of original layers is also subject to the technical details for the original layer set described in other parts of this disclosure. For example, when updating the reference layer corresponding to a subset, it is determined whether the original layer subset has changed, and the corresponding reference layer is updated only if it has changed; this will not be elaborated further here. During the rendering process, animation layers can be obtained based on these different reference layers, for example, by overlaying the currently existing reference layers, and using the overlay result as input to the rendering algorithm.

[0144] After grouping the original layer set, different groups can be processed using different strategies to more flexibly adapt to changes in the actual scenario. For example, the processing strategies corresponding to these groups (subsets) can differ in at least one dimension, such as the execution frequency of the steps or the value of the scaling factor.

[0145] Taking the different execution frequencies of the steps as an example, in the above exemplary method, the step of sequentially overlaying each original layer in the original layer subset according to the layer hierarchy through downsampling processing to obtain the base layer corresponding to the original layer subset may include, for each original layer subset:

[0146] When the interval between the current frame and the third historical frame reaches the third threshold corresponding to the original layer subset, each original layer in the original layer subset is superimposed sequentially through downsampling processing according to the layer hierarchy to obtain the base layer corresponding to the original layer subset.

[0147] If the interval between the current frame and the third historical frame does not reach the third threshold corresponding to the original layer subset, the reference layer corresponding to the original layer subset in the third historical frame is used as the reference layer corresponding to the original layer subset in the current frame.

[0148] The third historical frame is the frame of the reference layer corresponding to the original layer subset obtained through downsampling processing, and the third threshold is different for each original layer subset.

[0149] Please see Figure 5 Different subsets of the original layers can correspond to different third thresholds (i.e., how many frames are needed to generate the baseline layer). The third threshold for original subset 1 is N1, and the third threshold for original subset 2 is N2 (N1 and N2 are both positive integers). Baseline layer 1 and baseline layer 2 can be refreshed every N1 and N2 frames respectively (or it can be determined whether a refresh is needed). This further refines the optimization of the method for real-world scenarios. For example, when N1 is 3 and N2 is 2, the following can be obtained: Figure 6 The example shown illustrates this. In this example, f1 to f7 are all refresh frames of the device screen, and the animation can be refreshed in each frame from f1 to f7 by combining the constantly changing animation progress parameter values. However, the content of the base layer 1 is only refreshed in f1, f3, f5, and f7, and the content of the base layer 2 is only refreshed in f1, f4, and f7.

[0150] Specifically, in practical applications, animations can involve many layers. For example, in a screen-off animation, the original layer set may even be the same as the set of layers to be drawn. That is, all layers need to be superimposed and drawn to generate a base layer, and then the animation layer for the dimming effect is determined based on this base layer. Among these layers, some may be unimportant layers such as the wallpaper layer, navigation bar layer, or layer corresponding to gesture operation feedback function, as mentioned above, or layers that are likely to be covered by other layers and will not ultimately be presented to the user. Therefore, the number, capacity, and specific layers contained in the subset can be determined based on factors such as the type of animation, the current operating load of the device, and the importance of the layers contained in the original layer set. These layers can then be grouped to generate multiple original layer subsets, and the base layer corresponding to different original layer subsets can be refreshed based on different refresh rates, or the original layers can be downsampled based on different scaling factors to obtain base layers of different resolutions.

[0151] The above methods help reduce cache usage and I / O (input / output) overhead. Furthermore, the processing for different subsets is actually a decomposition of the original overlay process (i.e., directly overlaying layers B, C, D, and E to obtain the base layer). For example, in the original overlay process, layers B, C, D, and E need to be overlaid sequentially, while... Figure 5In the example shown, layers B and C can be overlaid to obtain base layer 1, while layers D and E can be overlaid to obtain base layer 2. (For example, when there are multiple original layer subsets in the current frame whose intervals with the third historical frame reach the corresponding third threshold, different original layer subsets can be overlaid using different sub-threads to asynchronously complete the above overlay process, further utilizing the device's multi-core resources.) Then, base layer 2 is overlaid on base layer 1 to obtain the original base layer. It is evident that the above process does not add redundant processing steps.

[0152] The above process can be referenced in conjunction with the previously described embodiment of determining a reference layer every N frames. In the above process, if different subsets are considered separately, N1 and N2 can correspond to N in the above text. Therefore, some repetitive concepts will not be elaborated here. In addition, the process of determining the reference layer in the above steps can also add a judgment on whether the original layer set has changed, and update the reference layer when a change is determined.

[0153] In this disclosure, the triggering conditions for animation effects include timed triggering, 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 power or fully charged battery), and can also be triggered by user commands. For example, the screen-off animation can be triggered by the user pressing the power button.

[0154] 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 in the current frame can include:

[0155] If the set of layers to be drawn in the current frame contains 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.

[0156] In addition, the method may also include: mapping the animation layer corresponding to the current frame to the placeholder layer, so that the device renders the animation layer.

[0157] Placeholder layers 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 within a specific range) to the SF thread, and storing the rendering results of the graphics processor (such as animation layers).

[0158] 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.

[0159] 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).

[0160] 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.

[0161] 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.

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

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

[0164] Original Layers, 701, is used to determine the original set of layers to be drawn in the current frame for generating the animation;

[0165] The downsampling compositing module 702 is used to sequentially overlay each original layer in the original layer set according to the layer hierarchy by downsampling to obtain a reference layer, wherein the resolution of the reference layer is lower than the resolution of the layers in the original layer set;

[0166] The animation generation module 703 determines the animation layer corresponding to the current frame based on the reference layer, wherein the resolution of the animation layer is higher than the resolution of the reference layer.

[0167] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0168] When the interval between the current frame and the first historical frame reaches a first threshold, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a reference layer, wherein the first historical frame is the previous frame in which each original layer in the original layer set was superimposed sequentially through downsampling to obtain the reference layer.

[0169] If the interval between the current frame and the first historical frame does not reach the first threshold, the reference layer of the first historical frame is used as the reference layer of the current frame.

[0170] Optionally, the downsampling synthesis module is used to determine the animation layer corresponding to the current frame based on the reference layer, specifically for:

[0171] When the interval between the current frame and the second historical frame reaches a second threshold, the animation layer corresponding to the current frame is determined according to the reference layer, wherein the second threshold is less than the first threshold, and the second historical frame is the previous frame in which the animation layer corresponding to the current frame was determined according to the reference layer;

[0172] If the interval between the current frame and the second historical frame does not reach the second threshold, the animation layer of the second historical frame is used as the animation layer corresponding to the current frame.

[0173] Optionally, the device further includes:

[0174] The subset partitioning module is used to divide the original layer set into multiple original layer subsets, wherein each original layer subset contains at least one original layer;

[0175] The downsampling synthesis module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0176] For each original layer subset, based on the layer hierarchy, each original layer in the original layer subset is superimposed sequentially through downsampling to obtain the base layer corresponding to the original layer subset;

[0177] The animation generation module is used to determine the animation layer corresponding to the current frame based on the reference layer, specifically for:

[0178] Based on the reference layer corresponding to each original layer subset, the animation layer corresponding to the current frame is determined. Optionally, the downsampling compositing module is used to, for each original layer subset, sequentially overlay each original layer in the original layer subset through downsampling processing according to the layer hierarchy to obtain the reference layer corresponding to the original layer subset, specifically for:

[0179] For each subset of the original layers:

[0180] When the interval between the current frame and the third historical frame reaches the third threshold corresponding to the original layer subset, each original layer in the original layer subset is superimposed sequentially through downsampling processing according to the layer hierarchy to obtain the base layer corresponding to the original layer subset.

[0181] If the interval between the current frame and the third historical frame does not reach the third threshold corresponding to the original layer subset, the reference layer corresponding to the original layer subset in the third historical frame is used as the reference layer corresponding to the original layer subset in the current frame.

[0182] The third historical frame is the frame of the reference layer corresponding to the original layer subset obtained through downsampling processing, and the third threshold is different for each original layer subset.

[0183] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

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

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

[0186] If the judgment results are different, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain the reference layer, and the reference layer of the current frame is recorded.

[0187] Optionally, the original layer module is used to determine the original layer set for generating the animation from the set of layers to be drawn in the current frame, specifically for:

[0188] If the set of layers to be drawn in the current frame contains 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.

[0189] The device further includes:

[0190] 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.

[0191] Optionally, the downsampling compositing module is used to, when obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing according to the layer hierarchy, specifically for:

[0192] Create the first display surface;

[0193] Based on the hierarchical relationship of each original layer in the original layer set, each original layer is downsampled sequentially, and the downsampling result is drawn onto the first display surface.

[0194] Optionally, when determining the animation layer corresponding to the current frame based on the reference layer, the animation generation module is specifically used for:

[0195] Based on the animation progress parameters of the current frame, the base layer of the current frame is upsampled using the rendering algorithm corresponding to the animation to obtain the animation layer corresponding to the current frame, wherein the resolution of the animation layer is the same as the resolution of the original layer.

[0196] 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.

[0197] 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.

[0198] 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.

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

[0200] Device 800 may include one or more of the following components: processing component 801, memory 802, power supply component 803, multimedia component 804, audio component 805, input / output (I / O) interface 806, sensor component 807, and communication component 808.

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

[0202] Memory 802 is configured to store various types of data to support the operation of device 800. Examples of this data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. Memory 802 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.

[0203] The power supply component 803 provides power to the various components of the device 800. The power supply component 803 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device 800.

[0204] Multimedia component 804 includes a screen that provides an output interface between the device 800 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 804 includes a front-facing camera and / or a rear-facing camera. When the device 800 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.

[0205] Audio component 805 is configured to output and / or input audio signals. For example, audio component 805 includes a microphone (MIC) configured to receive external audio signals when device 800 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 802 or transmitted via communication component 808. In some embodiments, audio component 805 also includes a speaker for outputting audio signals.

[0206] I / O interface 806 provides an interface between processing component 801 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.

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

[0208] Communication component 808 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 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 808 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 808 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.

[0209] In an exemplary embodiment, device 800 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.

[0210] Fifthly, in exemplary embodiments, this disclosure also provides a non-transitory computer-readable storage medium including instructions, such as a memory 802 including instructions, which can be executed by a processor 809 of device 800 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.

[0211] 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.

[0212] 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.

[0213] 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.

[0214] 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: Determine the original set of layers to be drawn in the current frame for generating the animation; Based on the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a base layer, wherein the resolution of the base layer is lower than the resolution of the layers in the original layer set; The animation layer corresponding to the current frame is determined based on the reference layer, wherein the resolution of the animation layer is higher than that of the reference layer.

2. The animation generation method according to claim 1, characterized in that, The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy includes: When the interval between the current frame and the first historical frame reaches a first threshold, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain a reference layer, wherein the first historical frame is the previous frame in which each original layer in the original layer set was superimposed sequentially through downsampling to obtain the reference layer. If the interval between the current frame and the first historical frame does not reach the first threshold, the reference layer of the first historical frame is used as the reference layer of the current frame.

3. The animation generation method according to claim 2, characterized in that, Determining the animation layer corresponding to the current frame based on the reference layer includes: When the interval between the current frame and the second historical frame reaches a second threshold, the animation layer corresponding to the current frame is determined according to the reference layer, wherein the second threshold is less than the first threshold, and the second historical frame is the previous frame in which the animation layer corresponding to the current frame was determined according to the reference layer; If the interval between the current frame and the second historical frame does not reach the second threshold, the animation layer of the second historical frame is used as the animation layer corresponding to the current frame.

4. The animation generation method according to claim 1, characterized in that, The method further includes: The original layer set is divided into multiple original layer subsets, wherein each original layer subset contains at least one original layer; The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy includes: For each original layer subset, based on the layer hierarchy, each original layer in the original layer subset is superimposed sequentially through downsampling to obtain the base layer corresponding to the original layer subset; Determining the animation layer corresponding to the current frame based on the reference layer includes: Determine the animation layer corresponding to the current frame based on the base layer corresponding to each subset of original layers.

5. The animation generation method according to claim 4, characterized in that, For each subset of original layers, based on the layer hierarchy, downsampling is performed to sequentially overlay each original layer in the subset to obtain a base layer corresponding to the subset of original layers, including: For each subset of the original layers: When the interval between the current frame and the third historical frame reaches the third threshold corresponding to the original layer subset, each original layer in the original layer subset is superimposed sequentially through downsampling processing according to the layer hierarchy to obtain the base layer corresponding to the original layer subset. If the interval between the current frame and the third historical frame does not reach the third threshold corresponding to the original layer subset, the reference layer corresponding to the original layer subset in the third historical frame is used as the reference layer corresponding to the original layer subset in the current frame. The third historical frame is the frame of the reference layer corresponding to the original layer subset obtained through downsampling processing, and the third threshold is different for each original layer subset.

6. The animation generation method according to any one of claims 1 to 5, characterized in that, The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy 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, according to the layer hierarchy, each original layer in the original layer set is superimposed sequentially through downsampling to obtain the reference layer, and the reference layer of the current frame is recorded.

7. The animation generation method according to claim 1, characterized in that, The step of determining the original set of layers to be drawn in the current frame for generating the animation includes: If the set of layers to be drawn in the current frame contains 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.

8. The animation generation method according to claim 1, characterized in that, The step of obtaining a base layer by sequentially overlaying each original layer in the original layer set through downsampling processing based on the layer hierarchy includes: Create the first display surface; Based on the hierarchical relationship of each original layer in the original layer set, each original layer is downsampled sequentially, and the downsampling result is drawn onto the first display surface.

9. The animation generation method according to claim 1, characterized in that, Determining the animation layer corresponding to the current frame based on the reference layer includes: Based on the animation progress parameters of the current frame, the base layer of the current frame is upsampled using the rendering algorithm corresponding to the animation to obtain the animation layer corresponding to the current frame, wherein the resolution of the animation layer is the same as the resolution of the original layer.

10. An animation generation device, characterized in that, The device includes: The Original Layers module is used to determine the original set of layers to be drawn in the current frame for generating the animation; The downsampling compositing module is used to sequentially overlay each original layer in the original layer set according to the layer hierarchy through downsampling processing to obtain a base layer, wherein the resolution of the base layer is lower than the resolution of the layers in the original layer set; The animation generation module determines the animation layer corresponding to the current frame based on the reference layer, wherein the resolution of the animation layer is higher than the resolution of the reference layer.

11. 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 9.

12. An electronic device, characterized in that, The method 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 9.

13. 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 9.