Disclosure of Invention
In order to solve the technical problems, in particular to the problems of low drawing efficiency and large memory consumption of the dynamic pictures in the prior art, the following technical scheme is specially provided:
in a first aspect, the present application provides a method for loading a moving picture, including:
acquiring a Webp dynamic picture file to be displayed;
loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
decoding the frame sequence to obtain decoded frame data, and storing the frame data into a resident bitmap container as bitmap data;
converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering a dynamic picture according to the textures.
Further, after the loading the Webp moving picture file to obtain the frame sequence of the Webp moving picture, the method further includes:
generating cache data of the Webp dynamic picture file;
the decoding of the frame sequence to obtain decoded frame data further includes:
generating cache data of frame data;
and storing the cache data of the Webp dynamic picture file and the cache data of the frame data by using LruCache.
Further, after the storing the cache data of the Webp moving picture file and the cache data of the frame data by using the LruCache, the method further includes:
Receiving a request for loading a dynamic picture;
responding to the request, judging whether the LruCache stores the cache data of the Webp dynamic picture file corresponding to the dynamic picture and the cache data of the frame data;
if yes, obtaining cache data of the Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from LruCache;
and whether a path of the Webp dynamic picture file is acquired from the request or not, and acquiring the Webp dynamic picture file to be displayed according to the path.
Further, after the loading the Webp moving picture file to obtain the frame sequence of the Webp moving picture, the method further includes:
configuring a prediction duration of each frame of the frame sequence;
counting the predicted total duration of the Webp dynamic picture according to the predicted duration of each frame;
determining a time point of a frame to be drawn according to the predicted total duration, and determining a target frame to be drawn according to the time point of the frame to be drawn;
the decoding of the sequence of frames includes:
if the target frame is not decoded, decoding the target frame, and performing time verification on the frame duration of the target frame;
and if the target frame is decoded, performing time verification on the frame duration of the target frame.
Further, after the time verification is performed on the frame duration of the target frame, the method further includes:
and after the time verification of the frame duration of each frame of the frame sequence is completed, verifying the total duration of the Webp dynamic picture, and if the total duration of the Webp dynamic picture is the same as the preset duration, determining that the verification of the frame sequence of the Webp dynamic picture is completed.
Further, before the obtaining the Webp moving picture file to be displayed, the method further includes:
receiving a first request for loading a 3D model;
judging that the first request contains the loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
and loading the Webp dynamic picture after preferentially loading the static picture.
Further, the step of loading the Webp moving picture is configured to be asynchronously processed; and loading the Webp dynamic picture when the 3D model is displayed on a part with dynamic characteristics.
In a second aspect, the present application provides a loading device for a moving picture, including:
the acquisition module is used for: the method comprises the steps of obtaining a Webp dynamic picture file to be displayed;
and a loading module: the method comprises the steps of loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
And a decoding module: the frame sequence is used for decoding the frame sequence to obtain decoded frame data, and the frame data is stored as bitmap data and stored in a resident bitmap container;
and a display module: the graphics rendering engine is used for converting bitmap data acquired from the bitmap container into textures, and rendering dynamic pictures according to the textures.
In a third aspect, the present application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the above-mentioned method for loading a moving picture.
In a fourth aspect, the present application also provides a terminal device, the terminal device comprising one or more processors, a memory, one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method for loading a moving picture as described above.
Compared with the prior art, the application has the following beneficial effects:
the application provides a loading method for a dynamic picture with low memory resource occupation and high efficiency, wherein the dynamic picture uses a Webp dynamic picture, compared with a common bitmap, the memory space can be saved, in addition, a Webp dynamic picture file to be displayed is loaded through a Webp library, the frame sequence of the Webp dynamic picture is obtained, the general information of the Webp dynamic picture is obtained, then the frame sequence is decoded, decoded frame data is obtained, a resident bitmap container (mdecodbitmap) is configured and used for storing the frame data into the resident bitmap container, the main memory is further ended, resources consumed by creating the bitmap container back and forth are avoided, then a graphic rendering engine is used for converting the bitmap data obtained from the bitmap container into textures, the dynamic picture is rendered according to the textures, and the graphic rendering engine can preferentially and smoothly manufacture the dynamic picture by utilizing the graphic rendering processing performance of graphic acceleration hardware.
Additional aspects and advantages of the application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application.
Detailed Description
Embodiments of the present application are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, but do not preclude the presence or addition of one or more other features, integers, steps, operations.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The embodiment of the application provides a loading method of a dynamic picture, as shown in fig. 1, the method comprises the following steps:
s10: and obtaining a Webp dynamic picture file to be displayed.
The embodiment is applied to a picture display interactive interface, when a dynamic picture needs to be displayed in the interactive interface, a dynamic picture file to be displayed is obtained, further, the dynamic picture file in the embodiment is a dynamic picture file in a Webp format, the Webp format is a picture file format which provides lossy compression and lossless compression at the same time, the dynamic picture is supported and derived from a video coding format VP8, and in one implementation mode, when the picture display interactive interface receives a request for loading the Webp dynamic picture, the dynamic picture file to be displayed is obtained.
S20: and loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture.
After the Webp dynamic picture file to be displayed is obtained, in order to enable the picture display interaction interface to normally display the dynamic picture, the Webp dynamic picture file needs to be loaded, in this embodiment, the Webp dynamic picture file is loaded through a Webp library to obtain a frame sequence of the Webp dynamic picture, specifically, the Webp dynamic picture file is loaded through a FrameSequence. Decode byte array (data) method, that is, the Webp dynamic picture file is parsed to obtain a FrameSequence object, the FrameSequence object contains information such as width, height, frame number, cycle number and the like of the dynamic picture, and the FrameSequence object contains the information of the dynamic picture and is defined as the frame sequence of the Webp dynamic picture.
S30: and decoding the frame sequence to obtain decoded frame data, and storing the frame data into a resident bitmap container as bitmap data.
In this embodiment, the Bitmap container (Bitmap) is configured to store the decoded Bitmap data, and further, in order to end the main memory and avoid resources consumed by creating the Bitmap container back and forth, the present embodiment configures a resident Bitmap container (mdecodbitmap) to be specially used for storing the decoded Bitmap data.
S40: converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering a dynamic picture according to the textures.
After decoded frame data is obtained, a dynamic picture can be rendered, in this embodiment, a graphics rendering engine is used to convert bitmap data obtained from the bitmap container into textures, and render the dynamic picture according to the textures, in one mode, the graphics rendering engine is OpenGL (Open Graphics Library ), which is a cross-platform software library capable of accessing graphics hardware equipment characteristics, the OpenGL can make full use of GPU and video memory performance of terminal equipment to perform efficient processing on the image, in this embodiment, the OpenGL is used to convert the bitmap data obtained from the bitmap container into textures, specifically, firstly obtain an OpenGL model, then set a texture map, convert the bitmap data into textures, then render each frame of picture according to the textures, and combine the dynamic picture according to each frame of picture, thereby efficiently rendering the dynamic picture; in another embodiment, the graphics rendering engine DirectX, directX is an application drawing programming interface, and the present embodiment uses DirectX to convert bitmap data obtained from the bitmap container into textures, then renders each frame of picture according to the textures, and combines each frame of picture into a dynamic picture, so as to render the dynamic picture efficiently.
The embodiment provides a loading method for a dynamic picture with low memory resource occupation and high efficiency, wherein the dynamic picture uses a Webp dynamic picture, compared with a common bitmap, the memory space can be saved, in addition, a Webp dynamic picture file to be displayed is loaded through a Webp library, a frame sequence of the Webp dynamic picture is obtained, namely, the general information of the Webp dynamic picture is obtained, then the frame sequence is decoded, decoded frame data is obtained, a resident bitmap container (mdecodbitmap) is configured and used for storing the frame data into the resident bitmap container, resources consumed by the main memory and the bitmap container is avoided being created back and forth are further ended, then a graphic rendering engine is used for converting the bitmap data obtained from the bitmap container into textures, the dynamic picture is rendered according to the textures, and the graphic rendering engine can preferentially utilize graphic rendering processing performance of graphic acceleration hardware to draw images, so that the dynamic picture is smoothly manufactured.
In an embodiment of the present application, after the loading the Webp moving picture file, a frame sequence of the Webp moving picture is obtained, the method further includes:
generating cache data of the Webp dynamic picture file;
The decoding of the frame sequence to obtain decoded frame data further includes:
generating cache data of frame data;
and storing the cache data of the Webp dynamic picture file and the cache data of the frame data by using LruCache.
In this embodiment, in order to multiplex the loaded Webp moving picture file, avoid that the same Webp moving picture file is excessively repeatedly loaded and decoded and consume a large amount of terminal resources, in this embodiment, after loading the Webp moving picture file to obtain a frame sequence of the Webp moving picture, buffer data of the Webp moving picture file is generated, and similarly, after decoding the frame sequence to obtain decoded frame data, buffer data of the frame data is generated, then, the LruCache is used to store the buffer data of the Webp moving picture file and the buffer data of the frame data, and when the buffer is full, the LruCache uses a recent "least-used algorithm", and when the buffer is full, the buffer data of the frame data is defined as frameData, including a frame start time, a frame end time and texture data, and the buffer data of the Webp moving picture file includes a Webp moving picture file path (Webp path), a Webp moving picture (duration), and a play count of Webp moving picture (Webp moving picture) and a count of Webp moving picture data (Webp moving picture). In one embodiment, as shown in fig. 2, an embodiment of storing the cache data of the Webp moving picture file and the cache data of the frame data by using an LruCache is shown, the loaded Webp moving picture file is stored by using the LruCache, and when the loaded Webp moving picture file needs to be multiplexed, the loaded Webp moving picture file can be directly obtained from the LruCache, so as to quickly load the corresponding moving picture.
In an embodiment of the present application, after the storing the cached data of the Webp moving picture file and the cached data of the frame data by using an LruCache, the method further includes:
receiving a request for loading a dynamic picture;
responding to the request, judging whether the LruCache stores the cache data of the Webp dynamic picture file corresponding to the dynamic picture and the cache data of the frame data;
if yes, obtaining cache data of the Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from LruCache;
and whether a path of the Webp dynamic picture file is acquired from the request or not, and acquiring the Webp dynamic picture file to be displayed according to the path.
In this embodiment, in order to enable a program to load a moving picture efficiently and smoothly, the loading process of Webp data is configured to be asynchronously processed, the lrucche stores the cache data of the loaded Webp moving picture file and the cache data of the frame data, when a request for loading the moving picture is received, it is determined, in response to the request, whether the lrucche stores the cache data of the Webp moving picture file and the cache data of the frame data corresponding to the moving picture, if so, the cache data of the Webp moving picture file and the cache data of the frame data corresponding to the moving picture are obtained from the lrucche, and the operations of loading and decoding are not needed any more, so that the frame data can be stored as bitmap data into a resident bitmap container quickly, the bitmap data is obtained from the bitmap container by using OpenGL, the bitmap data is converted into a texture, and the moving picture is rendered according to the texture, thereby efficiently and smoothly rendering the moving picture. If the LruCache does not store the corresponding data, the path of the Webp dynamic picture file is required to be acquired from the request, the Webp dynamic picture file to be displayed is acquired according to the path, loading and decoding operations are carried out on the Webp dynamic picture file, the frame data are stored as bitmap data and stored in a resident bitmap container, the bitmap data are acquired from the bitmap container by using OpenGL, the bitmap data are converted into textures, and the dynamic picture is rendered according to the textures, so that the normal rendering of the dynamic picture is ensured.
In an embodiment of the present application, after the loading the Webp moving picture file, a frame sequence of the Webp moving picture is obtained, the method further includes:
configuring a prediction duration of each frame of the frame sequence;
counting the predicted total duration of the Webp dynamic picture according to the predicted duration of each frame;
determining a time point of a frame to be drawn according to the predicted total duration, and determining a target frame to be drawn according to the time point of the frame to be drawn;
the decoding of the sequence of frames includes:
if the target frame is not decoded, decoding the target frame, and performing time verification on the frame duration of the target frame;
and if the target frame is decoded, performing time verification on the frame duration of the target frame.
In this embodiment, since the general data of the Webp moving picture file can only be obtained after the Webp moving picture file is loaded, that is, the data of the width, height, frame number, cycle number and the like of the frame sequence, the duration of each frame in the frame sequence cannot be obtained, if the duration of each frame in the frame sequence needs to be obtained while the Webp moving picture file is loaded, all frames need to be decoded while the Webp moving picture file is loaded, and a great amount of time is consumed when the Webp moving picture file is loaded, so that a carton phenomenon is caused. for (int i=0; i < count; i++) getFrame (i); and if the time point of the frame to be drawn meets the preset requirement, determining a target frame to be drawn according to the time point of the frame to be drawn.
Further, after determining the target frame to be drawn, judging whether the target frame is decoded, if yes, performing time verification on the frame duration of the target frame, if not, decoding the target frame, performing time verification on the frame duration of the target frame, and under the condition that the duration of the Webp dynamic picture is unknown, drawing and checking the duration of the Webp dynamic picture at the same time by adopting the embodiment, thereby avoiding a large amount of resources consumed by decoding all frames simultaneously, and ensuring smooth rendering of the dynamic picture.
In one embodiment of the present application, after the time verification is performed on the frame duration of the target frame, the method further includes:
and after the time verification of the frame duration of each frame of the frame sequence is completed, verifying the total duration of the Webp dynamic picture, and if the total duration of the Webp dynamic picture is the same as the preset duration, determining that the verification of the frame sequence of the Webp dynamic picture is completed.
In this embodiment, time verification is performed on the frame duration of each frame of the frame sequence, after time verification is performed on the frame duration of each frame of the frame sequence, the total duration of the Webp dynamic picture is verified, if the total duration of the Webp dynamic picture is the same as the preset duration, the verification of the total duration of the Webp dynamic picture is confirmed to pass, and verification of the frame sequence of the Webp dynamic picture is confirmed to be completed, thereby ensuring correct rendering of the dynamic picture.
In an embodiment of the present application, as shown in fig. 3, before the obtaining the Webp moving picture file to be displayed, the method further includes:
s50: receiving a first request for loading a 3D model;
s51: judging that the first request contains the loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
s52: and loading the Webp dynamic picture after preferentially loading the static picture.
In this embodiment, in an actual application scenario, a plurality of pictures need to be loaded on a picture display interaction interface, especially in the display of a 3D model, when a first request for loading the 3D model is received, a plurality of pictures needed to be loaded in the 3D model need to be ordered so as to orderly complete the loading of the 3D model. For example, the 3D character image with various expressions needs to be displayed on the picture display interactive interface, when a request for loading the 3D character model is received, a static image which is unchanged in the 3D character image is loaded preferentially, and then a dynamic image with various expressions in the 3D character image is loaded, so that the face of the 3D character image can be switched with various expressions in the process of displaying the 3D character image.
In one embodiment of the present application, the step of loading the Webp moving picture is configured as asynchronous processing; and loading the Webp dynamic picture when the 3D model is displayed on a part with dynamic characteristics.
In this embodiment, in the 3D model, there are static feature parts and dynamic feature parts, the step of loading the Webp moving picture is configured to be asynchronously processed, and when the 3D model displays the part with the dynamic feature, the step of loading the Webp moving picture is performed, in one embodiment, if the part with the dynamic feature in the 3D model is not displayed on the front of the picture display interactive interface, the Webp moving picture is not loaded at this time, for example, during the process of rotating the 3D model, the face of the 3D character is not displayed on the front of the picture display interactive interface, at this time, the moving picture of the expression which changes in the 3D character is not loaded, and only when the face of the 3D character rotates to the front of the picture display interactive interface, the moving picture of the expression which changes in the 3D character is loaded, so that when the face of the 3D character is displayed on the front, the face can switch various expressions, and when the face is not displayed on the front, so as to reduce consumption of resources.
In one embodiment of the application, the graphics-rendering engine includes a cross-language, cross-platform application programming interface or application programming interface for use on the Microsoft Windows operating system.
In practical use, the operating systems of the terminal device applications for rendering and displaying the dynamic pictures are different, and the embodiment aims to package the loading method of the dynamic pictures into a solution suitable for multi-platform use, select different graphic rendering engines according to different platforms, and quickly dye the dynamic pictures by playing the advantages of the different platforms. In the practical use of the solution, before converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine and rendering dynamic pictures according to the textures, determining the operating systems of the terminal equipment currently loading the dynamic pictures, wherein programming languages used by different operating systems are different, if the operating systems are Microsoft Windows operating systems, converting the bitmap data acquired from the bitmap container into textures by preferentially using an application programming interface on the Microsoft Windows operating system, rendering the dynamic pictures according to the textures, and enabling an application programming interface only on the Microsoft Windows operating system to exert the advantages of the Microsoft Windows operating system to quickly dye the dynamic pictures; if the operating system is a non-Microsoft Windows operating system, a cross-language and cross-platform application programming interface is used for converting bitmap data obtained from the bitmap container into textures, and rendering dynamic pictures according to the textures, so that the cross-language and cross-platform application programming interface breaks the limit of the operating system and can be suitable for terminal equipment of any operating system, and the adaptation operation of a user is reduced.
In an embodiment of the present application, the cross-language and cross-platform application programming interface is OpenGL, the application programming interface on the Microsoft Windows operating system is DirectX, and when a graphics rendering engine is used to convert bitmap data obtained from the bitmap container into textures and render dynamic pictures according to the textures, openGL or DirectX uses graphics acceleration hardware of a terminal device to perform o-rendering on the dynamic pictures, the bitmap data obtained from the bitmap container is converted into textures and render the dynamic pictures according to the textures, where the graphics acceleration hardware includes a graphics processor GPU, and draws the dynamic pictures by playing drawing capabilities of the GPU.
As shown in fig. 4, in another embodiment, the present application provides a loading device for a moving picture, including:
the acquisition module 10: the method comprises the steps of obtaining a Webp dynamic picture file to be displayed;
loading module 20: the method comprises the steps of loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
decoding module 30: the frame sequence is used for decoding the frame sequence to obtain decoded frame data, and the frame data is stored as bitmap data and stored in a resident bitmap container;
Display module 40: the graphics rendering engine is used for converting bitmap data acquired from the bitmap container into textures, and rendering dynamic pictures according to the textures.
In one embodiment of the present application, the apparatus further comprises:
LruCache buffer module: and the buffer data is used for storing the buffer data of the generated Webp dynamic picture file and the buffer data of the frame data.
In one embodiment of the present application, the loading module 20 further includes performing: receiving a request for loading a dynamic picture, and responding to the request, and judging whether the LruCache cache module stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of frame data;
if yes, obtaining cache data of the Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from an LruCache cache module;
and whether a path of the Webp dynamic picture file is acquired from the request or not, and acquiring the Webp dynamic picture file to be displayed according to the path.
In one embodiment of the present application, the apparatus further comprises:
and a frame checking module: a prediction duration for configuring each frame of the sequence of frames; counting the predicted total duration of the Webp dynamic picture according to the predicted duration of each frame; determining a time point of a frame to be drawn according to the predicted total duration, and determining a target frame to be drawn according to the time point of the frame to be drawn; and when the decoding module 30 decodes the target frame, the frame checking module performs time checking on the frame duration of the target frame; or when the target frame is decoded, the frame verification module performs time verification on the frame duration of the target frame.
In one embodiment of the present application, the frame verification module further includes performing:
and after the time verification of the frame duration of each frame of the frame sequence is completed, verifying the total duration of the Webp dynamic picture, and if the total duration of the Webp dynamic picture is the same as the preset duration, determining that the verification of the frame sequence of the Webp dynamic picture is completed.
In one embodiment of the present application, the loading module 20 further includes performing:
receiving a first request for loading a 3D model;
judging that the first request contains the loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
loading the Webp dynamic picture after preferentially loading the static picture
In one embodiment of the present application, the step of loading the Webp moving picture is configured as asynchronous processing; and loading the Webp dynamic picture when the 3D model is displayed on a part with dynamic characteristics.
In one embodiment of the application, the graphics-rendering engine includes a cross-language, cross-platform application programming interface or application programming interface for use on Microsoft Windows operating system; the display module 40 further includes performing:
determining an operating system of a terminal device for loading the dynamic picture;
If the operating system is a Microsoft Windows operating system, converting the bitmap data acquired from the bitmap container into textures by preferentially using an application programming interface on the Microsoft Windows operating system, and rendering a dynamic picture according to the textures;
if the operating system is a non-Microsoft Windows operating system, using a cross-language and cross-platform application programming interface to convert bitmap data obtained from the bitmap container into textures, and rendering a dynamic picture according to the textures.
In one embodiment of the present application, the cross-language and cross-platform application programming interface is OpenGL, and the application programming interface used on the Microsoft Windows operating system is DirectX; the display module 40 further includes performing:
converting bitmap data obtained from the bitmap container by using OpenGL or DirectX by using a graphic acceleration hardware into textures, and rendering a dynamic picture according to the textures; the graphics acceleration hardware includes a graphics processor. In another embodiment, the present application provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor, implements the method for loading a moving picture according to the above embodiment. The computer readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS Memory, random access memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device, and may be read-only memory, magnetic or optical disk, or the like.
The computer readable storage medium provided by the embodiment of the application can realize the acquisition of the Webp dynamic picture file to be displayed; loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture; decoding the frame sequence to obtain decoded frame data, and storing the frame data into a resident bitmap container as bitmap data; converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering a dynamic picture according to the textures. By providing a loading method of low memory resource occupation and high efficiency for dynamic pictures, the dynamic pictures use Webp dynamic pictures, compared with a common bitmap, memory space can be saved, webp dynamic picture files to be displayed are loaded through a Webp library, a frame sequence of the Webp dynamic pictures is obtained, namely, general information of the Webp dynamic pictures is obtained, then the frame sequence is decoded, decoded frame data are obtained, a resident bitmap container (mdecodbitmap) is configured and used for storing the frame data into the resident bitmap container, resources consumed by the main memory and the bitmap container is avoided being created back and forth are further ended, then a graphic rendering engine is used for converting the bitmap data obtained from the bitmap container into textures, the dynamic pictures are rendered according to the textures, and the graphic rendering engine can preferentially utilize graphic rendering processing performance of graphic acceleration hardware to draw images, so that the dynamic pictures can be smoothly manufactured.
The embodiment of the loading method of the moving picture can be implemented by the computer readable storage medium provided by the embodiment of the application, and the specific function implementation is shown in the description of the embodiment of the method and is not repeated herein.
In addition, in another embodiment, the present application further provides a terminal device, as shown in fig. 5, where the terminal device includes a processor 503, a memory 505, an input unit 507, and a display unit 509. It will be appreciated by those skilled in the art that the structural elements shown in fig. 5 do not constitute a limitation on all terminal devices, and may include more or fewer components than shown, or may combine certain components. The memory 505 may be used to store a computer program 501 and functional modules, and the processor 503 runs the computer program 501 stored in the memory 505 to perform various functional applications of the device and data processing. The memory 505 may be an internal memory or an external memory, or include both internal and external memories. The internal memory may include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory.
The input unit 507 is used for receiving input of signals and receiving input of users, the input unit 507 may include a touch panel and other input devices, and the touch panel may collect touch operations of users thereon or nearby and drive corresponding connection devices according to a preset program. The display unit 509 may be used to display information input by a user or information provided to the user and various menus of the computer device. The display unit 509 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 503 is the control center of the computer device, connects the various parts of the overall computer using various interfaces and lines, performs various functions and processes data by running or executing software programs and/or modules stored in the memory 505, and invoking data stored in the memory.
In an embodiment, the terminal device comprises one or more processors 503 and one or more memories 505, one or more computer programs 501, wherein the one or more computer programs 501 are stored in the memories 505 and configured to be executed by the one or more processors 503, the one or more computer programs 501 being configured to perform the loading method of dynamic pictures described in the above embodiments. The one or more processors 503 shown in fig. 5 are capable of performing and implementing the functions of the acquisition module 10, the loading module 20, the decoding module 30, and the display module 40 shown in fig. 4.
The terminal equipment provided by the embodiment of the application can realize the acquisition of the Webp dynamic picture file to be displayed; loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture; decoding the frame sequence to obtain decoded frame data, and storing the frame data into a resident bitmap container as bitmap data; converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering a dynamic picture according to the textures. By providing a loading method of low memory resource occupation and high efficiency for dynamic pictures, the dynamic pictures use Webp dynamic pictures, compared with a common bitmap, memory space can be saved, webp dynamic picture files to be displayed are loaded through a Webp library, a frame sequence of the Webp dynamic pictures is obtained, namely, general information of the Webp dynamic pictures is obtained, then the frame sequence is decoded, decoded frame data are obtained, a resident bitmap container (mdecodbitmap) is configured and used for storing the frame data into the resident bitmap container, resources consumed by the main memory and the bitmap container is avoided being created back and forth are further ended, then a graphic rendering engine is used for converting the bitmap data obtained from the bitmap container into textures, the dynamic pictures are rendered according to the textures, and the graphic rendering engine can preferentially utilize graphic rendering processing performance of graphic acceleration hardware to draw images, so that the dynamic pictures can be smoothly manufactured.
The terminal device provided by the embodiment of the present application can implement the embodiment of the method for loading a moving picture provided above, and specific functional implementation is described in the method embodiment and is not described herein.
The foregoing is only a partial embodiment of the present application, and it should be noted that it will be apparent to those skilled in the art that modifications and adaptations can be made without departing from the principles of the present application, and such modifications and adaptations are intended to be comprehended within the scope of the present application.