Animation playback methods, devices, storage media and electronic devices

CN115965718BActive Publication Date: 2026-09-01GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111187744.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2026-09-01
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

然而,由于相关技术在播放帧动画时,需要占用大量的系统资源,可能导致播放卡顿

Benefits of technology

[0016]采用本申请所提供的技术方案,将帧动画划分为动态区域和静态区域,并仅保留帧动画中一帧对应静态区域的目标帧图像数据,在播放帧动画时,通过持续展示帧动画中保留的一帧对应静态区域的目标帧图像数据,并依次展示帧动画中每帧图像对应动态区域的图像数据,能够达到逐帧展示帧动画中所有图像数据相同的动画播放效果。另外,相较于逐帧展示帧动画中的所有图像数据,本申请仅逐帧展示帧动画中部分区域的图像数据,能够降低播放帧动画时对系统资源的占用,提高图像加载的速度,进而提高电子设备播放帧动画的帧率。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115965718B_ABST
    Figure CN115965718B_ABST
Patent Text Reader

Abstract

This application discloses an animation playback method, apparatus, storage medium, and electronic device. The method involves acquiring a frame animation comprising N consecutive images, where N is a positive integer greater than 1; determining the dynamic and static regions of the frame animation; identifying target frame image data corresponding to the static regions that need to be retained in the frame animation, and discarding non-target frame image data corresponding to the static regions in frames N-1 of the frame animation; and, in response to a playback command for the frame animation, continuously displaying the target frame image data of the static regions, and sequentially displaying the image data of the dynamic regions corresponding to each frame image in the frame animation. This application can improve the frame rate of frame animation playback on electronic devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image processing technology, specifically to an animation playback method, apparatus, storage medium, and electronic device. Background Technology

[0002] Frame-by-frame animation, also known as sequential animation, is a common form of animation. Its principle is to break down animation actions into consecutive keyframes, essentially drawing and displaying different content frame by frame to create the animation effect. However, because related technologies require significant system resources to play frame-by-frame animation, it can cause playback stuttering. Summary of the Invention

[0003] This application provides an animation playback method, apparatus, storage medium, and electronic device that can improve the frame rate of electronic devices playing frame animations.

[0004] In a first aspect, this application provides an animation playback method applied to an electronic device, comprising:

[0005] Obtain frame animation, which includes N consecutive frames of images, where N is a positive integer greater than 1;

[0006] Determine the dynamic and static regions of the frame animation;

[0007] The frame animation determines which target frame image data corresponding to the static region needs to be retained, and discards the non-target frame image data corresponding to the static region in frames N-1 of the frame animation.

[0008] In response to the playback command for the frame animation, the target frame image data of the static area is continuously displayed, and the image data of the dynamic area corresponding to each frame image in the frame animation is displayed sequentially.

[0009] Secondly, this application provides an animation playback device for use in electronic devices, comprising:

[0010] An animation acquisition module is used to acquire frame animations, wherein the frame animations include N consecutive frames of images, where N is a positive integer greater than 1;

[0011] The region determination module is used to determine the dynamic and static regions of the frame animation;

[0012] The data processing module is used to determine the target frame image data corresponding to the static region that needs to be retained in the frame animation, and to discard the non-target frame image data corresponding to the static region in frames N-1 of the frame animation;

[0013] An animation playback module is used to respond to a playback command for the frame animation, continuously display the target frame image data of the static area, and sequentially display the image data of the dynamic area corresponding to each frame image in the frame animation.

[0014] Thirdly, this application provides a storage medium having a computer program stored thereon, which executes any of the animation playback methods provided in this application when the computer program is loaded by the processor of an electronic device.

[0015] Fourthly, this application also provides an electronic device, which includes a processor and a memory, the memory storing a computer program, and the processor executing any of the animation playback methods provided in this application by loading the computer program.

[0016] The technical solution provided in this application divides frame animation into dynamic and static regions, and retains only the target frame image data corresponding to the static region of one frame in the frame animation. When playing the frame animation, by continuously displaying the target frame image data corresponding to the static region of one frame retained in the frame animation, and sequentially displaying the image data corresponding to the dynamic region of each frame in the frame animation, the same animation playback effect of displaying all image data in the frame animation frame by frame can be achieved. Furthermore, compared to displaying all image data in the frame animation frame by frame, this application only displays the image data of a portion of the frame animation frame by frame, which can reduce the system resource consumption when playing frame animation, improve image loading speed, and thus increase the frame rate of frame animation playback on electronic devices. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating an animation playback method provided in an embodiment of this application.

[0019] Figure 2 This is an example diagram of the dynamic and static regions of the frame animation as determined in the embodiments of this application.

[0020] Figure 3 This is an example diagram of image data of static regions in non-first frame images in the discarded frame animation of this application embodiment.

[0021] Figure 4 This is an example diagram illustrating how the dynamic region is divided into three sub-dynamic regions in this embodiment of the application.

[0022] Figure 5 This is a structural block diagram of the animation playback device provided in the embodiments of this application.

[0023] Figure 6 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0024] It should be noted that the terms "first," "second," and "third," etc., used in this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.

[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0026] This application provides an animation playback method, an animation playback device, a storage medium, and an electronic device. The entity executing the animation playback method can be the animation playback device provided in this application, or an electronic device integrating the animation playback device. The animation playback device can be implemented in hardware or software. The electronic device can be a television, smartphone, tablet computer, PDA, laptop computer, or other device equipped with a processor and possessing data processing capabilities.

[0027] Taking a television as an example, a television may include a display screen for displaying images and a radio frequency (RF) circuit for data transmission. The RF circuit can communicate with other terminals through at least one wireless communication protocol, which may include, but is not limited to, mobile communication network protocols (such as 3G, 4G, 5G, etc.), Bluetooth communication protocols, and Wi-Fi image protocols. For example, the television can access a network access point through the RF circuit to obtain network access services provided by the network access point. Based on the network access services provided by the network access point, the television can obtain frame animations from the network server, determine the dynamic and static regions of the frame animations, and determine the target frame image data that needs to be retained in the corresponding static regions of the frame animations. Accordingly, it discards the non-target frame image data of the static regions corresponding to N-1 frames in the frame animations. Then, in response to the playback command for the frame animation, it continuously displays the target frame image data of the corresponding static regions through the display screen, and sequentially displays the image data of the dynamic regions corresponding to each frame image in the frame animations through the display screen.

[0028] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the animation playback method provided in an embodiment of this application. This animation playback method is applied to the electronic device provided in this application, such as... Figure 1 As shown, the animation playback method provided in this application embodiment can be described as follows:

[0029] In 110, obtain the frame animation, which consists of N consecutive frames of images, where N is a positive integer greater than 1.

[0030] In this embodiment, the electronic device first acquires a frame animation. This frame animation can be obtained by the electronic device from a specified location, or it can be obtained by the electronic device processing multiple consecutive frames of original images. For example, the electronic device can acquire a frame animation that achieves a birthday greeting effect from a server on the network. This frame animation includes 220 consecutive PNG format images, with a total data size of 224MB.

[0031] Frame animation includes multiple consecutive images. Here, "consecutive" can be understood as the image content of multiple frames having a temporal continuity. For example, the same object in different images presents a continuous action in time.

[0032] It is understood that the image size and image format of each frame in the frame animation acquired by the electronic device should be the same. In other embodiments, after acquiring the frame animation, the electronic device first identifies whether the image size and image format of each frame in the frame animation are the same. If they are not the same, the image size and image format of each frame in the frame animation are adjusted to be the same.

[0033] In 120, the dynamic and static regions of the frame animation are determined.

[0034] After acquiring the frame animation, the electronic device further determines the dynamic and static regions of the frame animation. The static region can be understood as the region where the frame animation remains still during playback, that is, the region where all images in the frame animation have the same image content. The dynamic region can be understood as the region where the frame animation continuously changes during playback, that is, the region outside the static region.

[0035] As described above, electronic devices can analyze the image content of each frame in a frame animation to determine the static area of ​​the frame animation and directly define the area outside the static area in the frame animation as the dynamic area.

[0036] For example, for a single frame of animation, the dynamic and static regions determined by the electronic device are as follows: Figure 2 As shown, electronic devices can record dynamic and static regions through configuration files:

[0037] Center=365,138,1236,914, true;

[0038] In this context, `Center` represents the name of the static region in the frame animation (here, `Center` indicates that the region is roughly located in the middle of the frame animation), `365` represents the x-coordinate of the top-left vertex of the region in pixel coordinates, `138` represents the y-coordinate of the top-left vertex of the region in pixel coordinates, `1236` represents the length of the region in pixel coordinates, `914` represents the width of the region in pixel coordinates, and `true` indicates that the region is a static region. It can be understood that the dynamic region is the area outside the static region.

[0039] In step 130, it is determined that the target frame image data corresponding to the static area needs to be retained in the frame animation, and the non-target frame image data corresponding to the static area in frame N-1 of the frame animation is discarded.

[0040] In this embodiment, only the image data of the static area corresponding to one frame of the frame animation is retained.

[0041] Specifically, the electronic device determines a target image frame in the frame animation from which image data of the corresponding static region needs to be retained, according to the configured target image selection strategy. The image data of the corresponding static region in this target image is then recorded as the target frame image data. The configuration of the target image selection strategy is not specifically limited here and can be configured by those skilled in the art according to actual needs.

[0042] For example, the target image selection strategy can be configured as follows:

[0043] Randomly select one frame from the frame animation as the target image; or

[0044] Select the first frame image in the frame animation as the target image; or

[0045] Select the last frame image from the frame animation as the target image.

[0046] As shown above, after determining the target frame image data of the target image corresponding to the static region that needs to be retained in the frame animation, the electronic device further discards the image data of the static region corresponding to the non-target image in frames N-1 of the frame animation, that is, discards the non-target frame image data of the static region corresponding to frames N-1 of the frame animation. For example, please refer to... Figure 3 For the 220 consecutive PNG images obtained above, the total data size is 224M. The frame animation used to achieve the birthday greeting effect is assumed to be the first frame image. The electronic device discards the non-target frame image data of the corresponding static area in the 219 frames of the frame animation other than the first frame image, and reduces the data size of the frame animation to 100MB.

[0047] In 140, in response to the playback command for the frame animation, the target frame image data of the static area is continuously displayed, and the image data of the dynamic area corresponding to each frame image in the frame animation is displayed sequentially.

[0048] In this embodiment, when the electronic device receives an input playback command for a frame animation, it responds to the playback command by continuously displaying image data of the static region corresponding to the target image in the frame animation (i.e., target frame image data), and sequentially displaying image data of the dynamic region corresponding to each frame image in the frame animation. For example, assuming the determined target image is the first frame image in the frame animation, the electronic device continuously displays image data of the static region corresponding to the first frame image in the frame animation (i.e., target frame image data), and sequentially displays image data of the dynamic region corresponding to each frame image in the frame animation.

[0049] It is understood that static regions are areas in frame animation where images have the same image content, while dynamic regions are areas in frame animation where images have different image content. In this embodiment, the frame animation is divided into dynamic and static regions, and only the target frame image data corresponding to the static region of one frame in the frame animation is retained. When playing the frame animation, by continuously displaying the target frame image data corresponding to the static region of one frame in the frame animation, and sequentially displaying the image data corresponding to the dynamic region of each frame in the frame animation, the animation playback effect of displaying all image data in the frame animation with the same content frame by frame can be achieved. In addition, compared to displaying all image data in the frame animation frame by frame, this embodiment only displays the image data of a portion of the frame animation frame by frame, which can reduce the occupation of system resources when playing the frame animation, improve the image loading speed, and thus improve the frame rate of the electronic device playing the frame animation.

[0050] In an optional embodiment, in response to a playback command for a frame animation, before continuously displaying the target frame image data of the static region and sequentially displaying the image data of the dynamic region corresponding to each frame image in the frame animation, the method further includes:

[0051] Divide the dynamic region of the frame animation into M sub-dynamic regions, where M is a positive integer greater than 1;

[0052] In response to playback commands for frame animation, the system continuously displays the target frame image data for the static region and sequentially displays the image data for the dynamic region corresponding to each frame in the frame animation, including:

[0053] In response to playback commands for frame animation, the target frame image data of the static area is loaded into memory through a single decoding thread and then drawn and displayed through the main thread.

[0054] The image data of the corresponding M sub-dynamic regions in the i-th frame of the frame animation are loaded into memory in parallel by M decoding threads, and then drawn and displayed by the main thread, i∈[1,N].

[0055] To further improve the frame rate of frame animation playback on electronic devices, this embodiment provides an optional parallel loading strategy for frame animation.

[0056] In this process, after determining the dynamic and static regions of the frame animation, the electronic device further divides the dynamic region of the frame animation into M sub-dynamic regions, where M is a positive integer greater than 1. There are no specific restrictions on the shape of the sub-dynamic regions or the value of M; these can be configured by those skilled in the art according to actual needs.

[0057] For example, please refer to Figure 4 For a single frame of animation, the electronic device divides the dynamic region of that frame into three rectangular sub-dynamic regions: sub-dynamic region 1, sub-dynamic region 2, and sub-dynamic region 3. Furthermore, the electronic device records the sub-dynamic region division information using the aforementioned configuration file. The division information for sub-dynamic region 1 is as follows:

[0058] Left = 0, 0, 365, 914, false;

[0059] Where Left represents the name of sub-dynamic region 1 (here Left means that the region is roughly located on the left side of the frame animation), 0,0 represent the x and y coordinates of the top left corner vertex of the region in the pixel coordinate system, 365 represents the length of the region in the pixel coordinate system, 914 represents the width of the region in the pixel coordinate system, and false indicates that the region is not a static region.

[0060] In this embodiment, upon receiving an input playback command for a frame animation, the electronic device, based on the partitioning information recorded in the configuration file, converts one idle thread in the thread pool into a decoding thread. This decoding thread then decodes the target frame image data of the static region into bitmap data and loads it into the memory queue. It is understood that this embodiment does not impose specific limitations on the type of queue used; it can be configured by those skilled in the art according to actual needs. For example, a blocking queue (also known as a blocking queue) can be used.

[0061] For the bitmap data of the target image loaded into the memory queue, the electronic device draws it through the main thread and displays the drawing results accordingly. For example, taking an electronic device using the Android system as an example, the electronic device can call the surface view component through the main thread to draw the bitmap data of the target image in the memory queue and display the drawing results.

[0062] Furthermore, the electronic device determines the number M of sub-dynamic regions based on the dynamic region division information in the configuration file, and sets M as the number of threads used for image loading. Since one decoding thread has already been converted, the electronic device further converts M-1 idle threads in the thread pool into decoding threads, adding to the previous one decoding thread, for a total of M available decoding threads. Accordingly, the electronic device uses these M decoding threads to decode the image data of the corresponding M sub-dynamic regions in the i-th frame of the frame animation into bitmap data in parallel, and loads it into the memory queue. Then, the main thread draws the bitmap data (including only the dynamic regions) of the i-th frame image in memory and displays the drawing results accordingly, where i∈[1,N].

[0063] In other embodiments, the electronic device may also release the M decoding threads and convert them into idle threads after loading the image data of the Nth frame image in the frame animation is complete.

[0064] As shown above, since the dynamic region of the frame animation is divided into M sub-dynamic regions for parallel loading frame by frame, the loading time can be reduced and the loading efficiency can be improved, thereby further increasing the frame rate of electronic devices playing frame animation.

[0065] In an optional embodiment, image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel using M decoding threads, and then drawn and displayed using the main thread, including:

[0066] During the display of the (i-1)th frame of the frame animation, the image data of the M sub-dynamic regions corresponding to the i-th frame image are loaded into memory in parallel by M decoding threads;

[0067] When the (i-1)th frame of the image is displayed, the main thread draws and displays the image data of the i-th frame loaded in memory.

[0068] To further improve the frame rate of frame animation playback on electronic devices, this embodiment provides an optional parallel loading strategy for frame animation.

[0069] In this design, the electronic device does not load the image data of the i-th frame after displaying the drawing result of the (i-1)-th frame image. Instead, during the process of displaying the drawing result of the (i-1)-th frame image, the image data of the M sub-dynamic regions corresponding to the i-th frame image are decoded into bitmap data in parallel by M decoding threads and loaded into the memory queue. When the drawing result of the (i-1)-th frame is displayed, the main thread draws and displays the bitmap data of the i-th frame image in the memory queue.

[0070] For example, suppose the dynamic area of ​​a frame animation is divided into 5 sub-dynamic areas. When the electronic device is displaying the image data of the dynamic area corresponding to the second frame image, the image data of the five sub-dynamic areas corresponding to the third frame image are decoded into bitmap data in parallel by 5 decoding threads and loaded into the memory queue. When the second frame image is finished being displayed, the main thread draws and displays the bitmap data of the third frame image in memory.

[0071] In an optional embodiment, the animation playback method provided in this application further includes:

[0072] During the display of the i-th frame image, the loaded data of the (i-1)-th frame image is deleted from memory.

[0073] To reduce the memory space occupied when playing frame animations, this embodiment cleans up the loaded data that has been drawn and displayed in real time.

[0074] During the display of the i-th frame image, the electronic device deletes the loaded data of the (i-1)-th frame image from memory, which means deleting the bitmap data obtained by decoding the image data of the (i-1)-th frame from memory.

[0075] For example, during the display of the third frame of an image, the electronic device deletes the bitmap data obtained by decoding the image data of the second frame of the image from memory.

[0076] In an optional embodiment, before determining the dynamic and static regions of the frame animation, the animation playback method provided in this application further includes:

[0077] Remove blank pixels from each frame of an animation.

[0078] In this context, blank pixels, also known as transparent pixels, are not used to compose image content. In this embodiment, before dividing the frame animation into dynamic and static regions, blank pixels in each frame of the frame animation are identified and removed. This reduces the data size of the frame animation without affecting its content.

[0079] In an optional embodiment, in response to a playback command for a frame animation, before loading the target frame image data of the static region into memory via a decoding thread and rendering and displaying it via the main thread, the animation playback method provided in this application further includes:

[0080] The target frame image data of the static region is compressed row by row using one compression thread;

[0081] The image data of the M sub-dynamic regions corresponding to the i-th frame are compressed by M compression threads respectively.

[0082] In this embodiment, after dividing the dynamic region of the frame animation into M sub-dynamic regions, the electronic device further compresses each frame image of the frame animation to reduce the data size of the frame animation.

[0083] The electronic device, based on the partitioning information recorded in the configuration file, converts one idle thread in the thread pool into a compression thread, and uses this compression thread to compress the image data (i.e., the target frame image data) of the static region corresponding to the target image in the frame animation. No specific limitation is placed on the compression method used here; it can be selected by those skilled in the art according to actual needs. For example, in this embodiment, the electronic device can use one compression thread to compress the target frame image data of the static region, changing the target frame image data from its original format to WebP format.

[0084] Furthermore, the electronic device determines the number M of sub-dynamic regions based on the dynamic region division information in the configuration file. M is then designated as the number of threads used for image compression. Since one compression thread has already been converted, the electronic device further converts M-1 idle threads in the thread pool into compression threads, adding to the previous one, resulting in a total of M available compression threads. Correspondingly, the electronic device uses these M compression threads to compress the image data of the M sub-dynamic regions corresponding to the i-th frame of the animation in parallel, where i∈[1,N]. The compression method for the image data of the dynamic region corresponding to the i-th frame can be the same as or different from the compression method for the image data of the static region corresponding to the target image.

[0085] For example, the total data size of the 224MB frame animation, which includes 220 consecutive PNG images, used to achieve the birthday greeting effect, is reduced to 100MB by discarding the non-target frame image data in the corresponding static area of ​​the animation. Furthermore, by compressing the image format of each frame from PNG to WebP, the total data size is further reduced to 19MB. It can be seen that by discarding the target frame image data in the corresponding static area and compressing the image data, the data size of the animation is reduced to less than one-tenth of the original data size.

[0086] In other embodiments, the electronic device may also release the M compression threads and convert them into idle threads after completing the compression of the image data of the Nth frame image in the frame animation.

[0087] In an optional embodiment, after compressing the image data of the M sub-dynamic regions in the i-th frame image using M compression threads, the animation playback method provided in this application further includes:

[0088] The compressed frame animation is backed up to the network access point so that the network access point can intercept requests for the frame animation sent to the server by other electronic devices and transmit the compressed frame animation to the other electronic devices.

[0089] A network access point provides network access services to electronic devices, enabling them to access the network. The type of network access point is not specifically limited here; it can be a wireless or wired network access point. It can be understood that, in addition to providing network access services to electronic devices, a network access point can also provide network access services to other electronic devices. For example, when a network access point receives a frame animation retrieval request from another electronic device to a server in the network, it forwards the frame animation retrieval request to the server and forwards the frame animation returned by the server in response to the request to the other electronic device.

[0090] To conserve network bandwidth, after compressing the image data of the M sub-dynamic regions corresponding to the i-th frame image using M compression threads, the electronic device also backs up the compressed frame animation to the network access point. In this way, the network access point can intercept frame animation retrieval requests sent by other connected electronic devices to the server in the network, and instead of sending the request to the server, return the backed-up compressed frame animation as a response to the request to the other electronic device that made the request, allowing it to play the animation when needed.

[0091] Since requests from other electronic devices are intercepted at the network access point, there is no need to repeatedly retrieve the same frame animation from the network, which saves network bandwidth. Furthermore, the frame animation backed up by electronic devices to the network access point is compressed, which can also improve the playback frame rate of other electronic devices playing the frame animation.

[0092] Please refer to Figure 5 , Figure 5 This is a schematic diagram of the structure of an animation playback device 300 provided in an embodiment of this application. The animation playback device 300 is applied to the electronic device provided in this application. Figure 5 As shown, the animation playback device 300 may include:

[0093] The animation acquisition module 310 is used to acquire frame animation, which includes N consecutive frames of images, where N is a positive integer greater than 1;

[0094] The region determination module 320 is used to determine the dynamic and static regions of the frame animation;

[0095] The data processing module 330 is used to determine the target frame image data that needs to be retained in the corresponding static area in the frame animation, and to discard the non-target frame image data of the corresponding static area in frame N-1 of the frame animation.

[0096] The animation playback module 340 is used to respond to the playback command for the frame animation, continuously display the target frame image data of the static area, and sequentially display the image data of the dynamic area corresponding to each frame image in the frame animation.

[0097] In an optional embodiment, the animation playback device 300 provided in this application further includes a region division module, which is used to divide the dynamic region of the frame animation into M sub-dynamic regions before the animation playback module 340 continuously displays the target frame image data of the static region in response to the playback instruction for the frame animation and sequentially displays the image data of the dynamic region corresponding to each frame image in the frame animation. M is a positive integer greater than 1.

[0098] The animation playback module 340, in response to playback commands for frame animations, loads the target frame image data of the static area into memory via a decoding thread and renders and displays it via the main thread; and

[0099] The image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel by M decoding threads, and then drawn and displayed by the main thread, i∈[1,N].

[0100] In an optional embodiment, when the image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel by M decoding threads and drawn and displayed by the main thread, the animation playback module 340 is used to:

[0101] During the display of the (i-1)th frame of the frame animation, M decoding threads load the image data of the M sub-dynamic regions corresponding to the i-th frame image into memory in parallel; and

[0102] When the (i-1)th frame of the image is displayed, the main thread draws and displays the image data of the i-th frame loaded in memory.

[0103] In an optional embodiment, the animation playback module 340 is further configured to:

[0104] During the display of the i-th frame, the image data of the (i-1)-th frame loaded in memory is deleted.

[0105] In an optional embodiment, the animation playback device 300 provided in this application further includes an image compression module, which is used to: Before the animation playback module 340, in response to a playback command for frame animation, loads the target frame image data of the static area into memory through a decoding thread and performs drawing and display through the main thread, compress the image data.

[0106] The target frame image data of the static region is compressed using a single compression thread; and

[0107] The image data of the M sub-dynamic regions corresponding to the i-th frame are compressed by M compression threads respectively.

[0108] In an optional embodiment, the animation playback device 300 provided in this application further includes an animation backup module, which, after the image compression module compresses the image data of the M sub-dynamic regions corresponding to the i-th frame image through M compression threads, is used for:

[0109] The compressed frame animation is backed up to the network access point so that the network access point can intercept requests for the frame animation sent to the server by other electronic devices and transmit the compressed frame animation to the other electronic devices.

[0110] In an optional embodiment, the animation playback device 300 provided in this application further includes a pixel removal module, which removes blank pixels from each frame of the frame animation before determining the dynamic and static regions of the frame animation.

[0111] It should be noted that the animation playback device 300 provided in this application embodiment and the animation playback method suitable for electronic devices in the above embodiments belong to the same concept. The specific implementation process can be found in the above related embodiments, and will not be repeated here.

[0112] This application provides a storage medium storing a computer program. When the stored computer program is executed on the processor of the electronic device provided in this application, the processor of the electronic device performs any of the steps in the above-described animation playback method suitable for the electronic device. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0113] This application also provides an electronic device, please refer to Figure 6 The electronic device 400 includes a processor 410 and a memory 420.

[0114] The processor 410 in this embodiment can be a general-purpose processor, such as an ARM architecture processor.

[0115] The memory 420 stores a computer program and can be a high-speed random access memory or a non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 420 may also include a memory controller to provide the processor 401 with access to the memory 420. The processor 410 executes the computer program in the memory 420 to perform any of the above-mentioned animation playback methods suitable for electronic devices, such as:

[0116] Get the frame animation, which consists of N consecutive frames of images, where N is a positive integer greater than 1;

[0117] Determine the dynamic and static regions of the frame animation;

[0118] Determine which target frame image data for the corresponding static region needs to be retained in the frame animation, and discard the non-target frame image data for the corresponding static region in frames N-1 of the frame animation;

[0119] In response to playback commands for frame animation, the target frame image data of the static area is continuously displayed, and the image data of the dynamic area corresponding to each frame image in the frame animation is displayed sequentially.

[0120] In an optional embodiment, before continuously displaying the target frame image data of the static region and sequentially displaying the image data of the dynamic region corresponding to each frame image in the frame animation in response to a playback instruction for the frame animation, the processor 410 is further configured to perform:

[0121] Divide the dynamic region of the frame animation into M sub-dynamic regions, where M is a positive integer greater than 1;

[0122] In response to a playback command for a frame animation, while continuously displaying the target frame image data of the static region and sequentially displaying the image data of the dynamic region corresponding to each frame image in the frame animation, the processor 410 performs the following:

[0123] In response to playback commands for frame animations, the target frame image data for the static area is loaded into memory via a single decoding thread and then drawn and displayed via the main thread; and

[0124] The image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel by M decoding threads, and then drawn and displayed by the main thread, i∈[1,N].

[0125] In an optional embodiment, when the image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel by M decoding threads and drawn and displayed by the main thread, the processor 410 is used to execute:

[0126] During the display of the (i-1)th frame of the frame animation, M decoding threads load the image data of the M sub-dynamic regions corresponding to the i-th frame image into memory in parallel; and

[0127] When the (i-1)th frame of the image is displayed, the main thread draws and displays the image data of the i-th frame loaded in memory.

[0128] In an optional embodiment, the processor 410 is also configured to perform:

[0129] During the display of the i-th frame, the image data of the (i-1)-th frame loaded in memory is deleted.

[0130] In an optional embodiment, before loading the target frame image data of the static region into memory via a decoding thread and rendering and displaying it via the main thread in response to a playback instruction for the frame animation, the processor 410 is also configured to perform:

[0131] The target frame image data of the static region is compressed using a single compression thread; and

[0132] The image data of the M sub-dynamic regions corresponding to the i-th frame are compressed by M compression threads respectively.

[0133] In an optional embodiment, after compressing the image data of the M sub-dynamic regions corresponding to the i-th frame image through M compression threads, the processor 410 is further configured to perform:

[0134] The compressed frame animation is backed up to the network access point so that the network access point can intercept requests for the frame animation sent to the server by other electronic devices and transmit the compressed frame animation to the other electronic devices.

[0135] In an optional embodiment, before determining the dynamic and static regions of the frame animation, the processor 410 is further configured to perform:

[0136] Remove blank pixels from each frame of an animation.

[0137] It should be noted that the electronic device 400 provided in this application embodiment and the animation playback method suitable for electronic devices in the above embodiments belong to the same concept. The specific implementation process can be found in the above related embodiments, and will not be repeated here.

[0138] The above provides a detailed description of an animation playback method, apparatus, storage medium, and electronic device provided by this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. An animation playback method, applied to an electronic device, characterized in that, include: Obtain frame animation, which includes N consecutive frames of images, where N is a positive integer greater than 1; Determine the dynamic and static regions of the frame animation; wherein the dynamic region is divided into M sub-dynamic regions, where M is a positive integer greater than 1; The frame animation determines which target frame image data corresponding to the static region needs to be retained, and discards the non-target frame image data corresponding to the static region in frames N-1 of the frame animation. In response to a playback command for the frame animation, the target frame image data of the static region is continuously displayed, and the image data of the dynamic region corresponding to each frame image in the frame animation is displayed sequentially. This includes: in response to a playback command for the frame animation, converting one idle thread in the thread pool into a decoding thread, loading the target frame image data of the static region into a memory queue through this decoding thread, and displaying it through the main thread; converting M idle threads in the thread pool into M decoding threads, loading the image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation into the memory queue in parallel through these M decoding threads, and displaying them through the main thread.

2. The animation playback method as described in claim 1, characterized in that, The image data of the M sub-dynamic regions corresponding to the i-th frame image in the frame animation are loaded into memory in parallel by M decoding threads, and then drawn and displayed by the main thread, including: During the display of the (i-1)th frame of the frame animation, the image data of the M sub-dynamic regions corresponding to the i-th frame image are loaded into the memory in parallel by M decoding threads; When the (i-1)th frame image is displayed, the main thread draws and displays the image data of the i-th frame image loaded in memory.

3. The animation playback method as described in claim 2, characterized in that, Also includes: During the display of the i-th frame image, the image data of the (i-1)-th frame image loaded in the memory is deleted.

4. The animation playback method as described in claim 1, characterized in that, Before loading the target frame image data of the static area into memory via a decoding thread and displaying it via the main thread in response to a playback command for the frame animation, the method further includes: The target frame image data of the static region is compressed using one compression thread; The image data of the i-th frame corresponding to the M sub-dynamic regions are compressed by M compression threads respectively.

5. The animation playback method as described in claim 4, characterized in that, After compressing the image data of the M sub-dynamic regions corresponding to the i-th frame image through M compression threads, the method further includes: The compressed frame animation is backed up to the network access point so that the network access point can intercept requests from other electronic devices to the server for the frame animation and transmit the compressed frame animation to the other electronic devices.

6. The animation playback method according to any one of claims 1-5, characterized in that, Before determining the dynamic and static regions of the frame animation, the method further includes: Remove blank pixels from each frame of the animation.

7. An animation playback device, applied to electronic devices, characterized in that, include: An animation acquisition module is used to acquire frame animations, wherein the frame animations include N consecutive frames of images, where N is a positive integer greater than 1; The region determination module is used to determine the dynamic region and static region of the frame animation; wherein, the dynamic region is divided into M sub-dynamic regions, where M is a positive integer greater than 1; The data processing module is used to determine the target frame image data corresponding to the static region that needs to be retained in the frame animation, and to discard the non-target frame image data corresponding to the static region in frames N-1 of the frame animation; An animation playback module is used to respond to a playback command for the frame animation, continuously display the target frame image data of the static area, and sequentially display the image data of the dynamic area corresponding to each frame image in the frame animation. This includes: responding to a playback command for the frame animation, converting one idle thread in the thread pool into a decoding thread, loading the target frame image data of the static area into a memory queue through this decoding thread, and drawing and displaying it through the main thread; converting M idle threads in the thread pool into M decoding threads, loading the image data of the M sub-dynamic areas corresponding to the i-th frame image in the frame animation into the memory queue in parallel through these M decoding threads, and drawing and displaying it through the main thread.

8. A storage medium having a computer program stored thereon, characterized in that, When the computer program is loaded by the processor of the electronic device, the animation playback method as described in any one of claims 1-6 is executed.

9. An electronic device comprising a processor and a memory, the memory storing a computer program, characterized in that, The processor executes the animation playback method as described in any one of claims 1-6 by loading the computer program.

Citation Information

Patent Citations

  • Display method and device for dynamic image

    CN104462470A

  • Achievement method of animation effect for saving network resources on webpages

    CN106991162A