CN111292387A - Dynamic picture loading method and device, storage medium and terminal equipment - Google Patents

Dynamic picture loading method and device, storage medium and terminal equipment Download PDF

Info

Publication number
CN111292387A
CN111292387A CN202010048524.3A CN202010048524A CN111292387A CN 111292387 A CN111292387 A CN 111292387A CN 202010048524 A CN202010048524 A CN 202010048524A CN 111292387 A CN111292387 A CN 111292387A
Authority
CN
China
Prior art keywords
dynamic picture
webp
frame
data
bitmap
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010048524.3A
Other languages
Chinese (zh)
Other versions
CN111292387B (en
Inventor
区永伦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaopeng Motors Technology Co Ltd
Original Assignee
Guangzhou Xiaopeng Motors Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaopeng Motors Technology Co Ltd filed Critical Guangzhou Xiaopeng Motors Technology Co Ltd
Priority to CN202010048524.3A priority Critical patent/CN111292387B/en
Publication of CN111292387A publication Critical patent/CN111292387A/en
Application granted granted Critical
Publication of CN111292387B publication Critical patent/CN111292387B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application relates to the field of image display development, in particular to a dynamic picture loading method, a dynamic picture loading device, a dynamic picture storage medium and a terminal device, wherein the method comprises the following steps: 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 as bitmap data to a resident bitmap container; and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures. According to the method and the device, the memory resources occupied by image processing can be reduced, and the Webp dynamic picture can be drawn smoothly.

Description

Dynamic picture loading method and device, storage medium and terminal equipment
Technical Field
The present application relates to the field of image display development, and in particular, to a method and an apparatus for loading a dynamic picture, a storage medium, and a terminal device.
Background
At present, more and more fields display information through images, including fields of games, movies, military affairs, aerospace, geography, medicine, mechanical design, visualization of various scientific data and the like, while a dynamic picture can provide another information display mode.
Disclosure of Invention
In order to overcome 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 provided:
in a first aspect, the present application provides a method for loading a dynamic 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 as bitmap data to a resident bitmap container;
and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures.
Further, after the loading the Webp dynamic picture file to obtain the frame sequence of the Webp dynamic picture, the method further includes:
generating cache data of the Webp dynamic picture file;
after the decoding the frame sequence to obtain the decoded frame data, the method further includes:
generating buffer 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 an Lrucache.
Further, after the LruCache is used to store the cache data of the Webp dynamic picture file and the cache data of the frame data, the method further includes:
receiving a request for loading a dynamic picture;
responding to the request, and judging whether the LrucCache stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data;
if so, acquiring cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from the LrucCache;
and if not, acquiring a path of the Webp dynamic picture file from the request, and acquiring the Webp dynamic picture file to be displayed according to the path.
Further, after the loading the Webp dynamic picture file to obtain the frame sequence of the Webp dynamic picture, the method further includes:
configuring a predicted duration for each frame of a sequence of frames;
counting the total prediction time of the Webp dynamic picture according to the prediction time of each frame;
determining the 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 the sequence of frames comprises:
if the target frame is not decoded, decoding the target frame, and performing time check on the frame duration of the target frame;
and if the target frame is decoded, time check is carried out on the frame duration of the target frame.
Further, after the time check is performed on the frame duration of the target frame, the method further includes:
and after time check is carried out on the frame duration of each frame of the frame sequence, checking 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 check of the frame sequence of the Webp dynamic picture is finished.
Further, before the obtaining of the Webp dynamic picture file to be displayed, the method further includes:
receiving a first request to load a 3D model;
judging that the first request contains a loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
and loading the Webp dynamic picture after the static picture is loaded preferentially.
Further, the step of loading the Webp dynamic picture is configured as an asynchronous process; and when the 3D model is displayed to a part with dynamic characteristics, loading the Webp dynamic picture.
In a second aspect, the present application provides a device for loading a moving picture, including:
an acquisition module: the method comprises the steps of acquiring a Webp dynamic picture file to be displayed;
loading a module: the Webp dynamic picture file is used for loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
a decoding module: the frame sequence is decoded to obtain decoded frame data, and the frame data is stored as bitmap data and stored in a resident bitmap container;
a display module: and the processor is used for converting the bitmap data acquired from the bitmap container into textures by using a graphic rendering engine and rendering the dynamic picture according to the textures.
In a third aspect, the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the loading method of the dynamic picture is implemented.
In a fourth aspect, the present application further provides a terminal device, which includes one or more processors, a memory, and one or more computer programs, where the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the above-mentioned loading method for dynamic pictures.
Compared with the prior art, the application has the following beneficial effects:
the application provides a method for loading a dynamic picture with low memory resource occupation and high efficiency, wherein the dynamic picture uses a Webp dynamic picture, the memory space can be saved compared with a common bitmap, a Webp dynamic picture file to be displayed is loaded through a Webp library to obtain a frame sequence of the Webp dynamic picture, the general information of the Webp dynamic picture is obtained, then the frame sequence is decoded to obtain decoded frame data, a resident bitmap container (mDecodeBitmap) is configured to store the frame data as bitmap data into the resident bitmap container, the main memory is 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, the graphic rendering engine can preferentially utilize the graphic rendering processing performance of graphic acceleration hardware to render the image, thereby smoothly drawing a moving picture.
Additional aspects and advantages of the present 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 present application.
Drawings
The foregoing and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flowchart illustrating an embodiment of a method for loading a dynamic picture according to the present application;
fig. 2 is a schematic diagram of an embodiment of storing cache data of the Webp dynamic picture file and cache data of the frame data by using LruCache in the present application;
FIG. 3 is a flowchart illustrating another embodiment of a method for loading a dynamic picture according to the present application;
FIG. 4 is a schematic diagram of an embodiment of a motion picture loading apparatus according to the present application;
fig. 5 is a schematic structural diagram of an embodiment of a terminal device according to the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. 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, or operations, but do not preclude the presence or addition of one or more other features, integers, steps, operations, or groups thereof.
It will be understood by those within the art that, unless otherwise defined, 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. 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.
An embodiment of the present application provides a method for loading a dynamic picture, as shown in fig. 1, the method includes the following steps:
s10: and acquiring a Webp dynamic picture file to be displayed.
The embodiment is applied to a picture presentation interactive interface, and when a dynamic picture needs to be presented in the interactive interface, a dynamic picture file to be displayed is acquired, further, the dynamic picture file of the embodiment is a dynamic picture file in a Webp format, the Webp format is a picture file format that provides lossy compression and lossless compression at the same time, supports a dynamic picture, and is derived from a video coding format VP 8.
S20: and loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture.
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.
S30: and decoding the frame sequence to obtain decoded frame data, and storing the frame data as bitmap data to a resident bitmap container.
After obtaining the frame sequence of the Webp dynamic picture, decoding the frame sequence to obtain the decoded frame data, in this embodiment, decoding the frame sequence by a getFrame (int frame, Bitmap output, int previous frame) method to obtain frame data, the frame data includes information such as frame duration, frame start time, frame end time, frame bitmap, etc., and the frame data is used for drawing and displaying a subsequent dynamic picture, and further, after the decoded frame data is obtained, the frame data is saved as bitmap data and stored in a resident bitmap container, in the decoding process of the embodiment, a bitmap container (bitmap) is configured for storing the decoded bitmap data, and further, in order to terminate the main memory and avoid the resources consumed by creating the bitmap container back and forth, the present embodiment configures a resident bitmap container (mdecodebytmap) specifically for storing the decoded bitmap data.
S40: and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures.
In this embodiment, a Graphics rendering engine is used to convert bitmap data obtained from the bitmap container into a texture, and render a dynamic picture according to the texture, in one embodiment, the Graphics rendering engine is OpenGL (Open Graphics Library), which is a software Library that is cross-platform and can access the characteristics of Graphics hardware devices, OpenGL can fully utilize the GPU and display memory performance of a terminal device to efficiently process an image, in this embodiment, OpenGL is used to convert bitmap data obtained from the bitmap container into a texture, specifically, an OpenGL model is first obtained, then a texture map is set, the bitmap data is converted into a texture, then each frame of a picture is rendered according to the texture, and a dynamic picture is synthesized according to each frame of a picture group, thereby rendering the dynamic picture efficiently; in another embodiment, the graphics rendering engine is DirectX, which is an application graphics programming interface, and in this embodiment, the DirectX is used to convert bitmap data acquired from the bitmap container into a texture, and then render each frame of picture according to the texture, and compose a dynamic picture according to each frame of picture, so as to render the dynamic picture efficiently.
The embodiment provides a method for loading a dynamic picture with low memory resource occupation and high efficiency, the dynamic picture uses a Webp dynamic picture, can save memory space compared with a common bitmap, loads a Webp dynamic picture file to be displayed through a Webp library to obtain a frame sequence of the Webp dynamic picture, namely general information of the Webp dynamic picture, decodes the frame sequence to obtain decoded frame data, and configures a resident bitmap container (mDecodeBitmap) for storing the frame data as bitmap data to be stored in the resident bitmap container, thereby ending a main memory and avoiding resources consumed by creating the bitmap container back and forth, then converts the bitmap data obtained from the bitmap container into textures by using a graphics rendering engine, and renders the dynamic picture according to the textures, the graphics rendering engine can preferentially utilize graphics rendering processing performance of graphics acceleration hardware to render the image, thereby smoothly drawing a moving picture.
In an embodiment of the present application, after loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture, the method further includes:
generating cache data of the Webp dynamic picture file;
after the decoding the frame sequence to obtain the decoded frame data, the method further includes:
generating buffer 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 an Lrucache.
In this embodiment, in order to multiplex a loaded Webp dynamic picture file and avoid that a large amount of terminal resources are consumed due to excessive repeated loading and decoding of the same Webp dynamic picture file, in this embodiment, after the Webp dynamic picture file is loaded to obtain a frame sequence of a Webp dynamic picture, cache data of the Webp dynamic picture file is generated, similarly, after the frame sequence is decoded to obtain decoded frame data, cache data of the frame data is generated, and then LruCache is used to store the cache data of the Webp dynamic picture file and the cache data of the frame data, LruCache uses a recent "least used algorithm", and when the cache is full, will preferentially eliminate those cache objects that are used least recently, in this embodiment, the cache data of the frame data is defined as frameData and includes frame start time, frame end time, and texture data, and the cache data of the Webp dynamic picture file includes a Webp dynamic picture path (webbp path), A Webp moving picture duration (duration), a Webp moving picture play count (loopCount), and frame data (frameData) of the Webp moving picture. In an implementation manner, as shown in fig. 2, an embodiment of using LruCache to store the cache data of the Webp dynamic picture file and the cache data of the frame data is shown, where the LruCache stores the loaded Webp dynamic picture file, and when the loaded Webp dynamic picture file needs to be multiplexed, the loaded Webp dynamic picture file can be directly obtained from the LruCache so as to quickly load a corresponding dynamic picture.
In an embodiment of the present application, after the using LruCache to store the cache data of the Webp dynamic picture file and the cache data of the frame data, the method further includes:
receiving a request for loading a dynamic picture;
responding to the request, and judging whether the LrucCache stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data;
if so, acquiring cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from the LrucCache;
and if not, acquiring a path of the Webp dynamic picture file from the request, and acquiring the Webp dynamic picture file to be displayed according to the path.
In this embodiment, in order to enable a program to efficiently and smoothly load a dynamic picture, a loading flow of the Webp data is configured to be asynchronous processing, and the LruCache stores cache data of a loaded Webp dynamic picture file and cache data of the frame data, when a request for loading a dynamic picture is received, it is determined whether the LruCache stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data in response to the request, if yes, the LruCache acquires the cache data of the Webp dynamic picture file corresponding to the dynamic picture and the cache data of the frame data from the LruCache, and without further loading and decoding operations, the frame data can be rapidly stored as bitmap data and stored in a resident bitmap container, and acquires the bitmap data from the bitmap container by using OpenGL to convert the bitmap data into a texture, and rendering the dynamic picture according to the texture, thereby rendering the dynamic picture efficiently and smoothly. And if the LrucCache does not store corresponding data, acquiring a path of the Webp dynamic picture file from the request, acquiring the Webp dynamic picture file to be displayed according to the path, loading and decoding the Webp dynamic picture file, storing the frame data as bitmap data to a resident bitmap container, acquiring the bitmap data from the bitmap container by using OpenGL, converting the bitmap data into textures, and rendering the dynamic picture according to the textures, thereby ensuring that the dynamic picture is normally rendered.
In an embodiment of the present application, after loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture, the method further includes:
configuring a predicted duration for each frame of a sequence of frames;
counting the total prediction time of the Webp dynamic picture according to the prediction time of each frame;
determining the 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 the sequence of frames comprises:
if the target frame is not decoded, decoding the target frame, and performing time check on the frame duration of the target frame;
and if the target frame is decoded, time check is carried out on the frame duration of the target frame.
In this embodiment, since the Webp dynamic picture file is loaded, only the general data of the Webp dynamic picture file, that is, the data of the frame sequence, such as the width, height, frame number, and cycle number, can be obtained, but the duration of each frame in the frame sequence cannot be obtained, if the duration of each frame in the frame sequence is obtained while the Webp dynamic picture file is loaded, it is necessary to decode all frames while the Webp dynamic picture file is loaded, and it takes a lot of time to load the Webp dynamic picture file, thereby causing a stuck phenomenon, in this embodiment, after the Webp dynamic picture file is loaded and the frame sequence of the Webp dynamic picture is obtained, the prediction duration of each frame in the frame sequence is configured, that is, the prediction frame duration of each frame in the frame sequence is, for example, the frame duration is 100ms, then the prediction total duration of the Webp dynamic picture is counted according to the prediction duration of each frame, the total duration of the Webp dynamic picture is predicted, the total duration of the frame to be drawn is determined according to the prediction total duration of the frame to be drawn, determining a target frame to be drawn according to the time point of the frame to be drawn, in one embodiment, determining the time point of the frame to be drawn according to a ratio of a difference value between a drawing start time point and a current time point and a prediction total duration, where the time point of the frame to be drawn is (currtime-startTime)% webpid duration, where currtime is the current time point and startTime is the drawing start time point, and then traversing from a first frame (frame 1): 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 the target frame to be drawn according to the time point of the frame to be drawn.
Further, after the target frame to be drawn is determined, whether the target frame is decoded or not is judged, if yes, time check is conducted on the frame duration of the target frame, if not, the target frame is decoded, time check is conducted on the frame duration of the target frame, and under the condition that the duration of the Webp dynamic picture is unknown, the duration of the Webp dynamic picture is checked while drawing is conducted through the embodiment, so that a large number of resources consumed by decoding all frames at the same time are avoided, and smooth rendering of the dynamic picture is guaranteed.
In an embodiment of the present application, after performing time check on the frame duration of the target frame, the method further includes:
and after time check is carried out on the frame duration of each frame of the frame sequence, checking 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 check of the frame sequence of the Webp dynamic picture is finished.
In this embodiment, time check is performed on the frame duration of each frame of a frame sequence, after the time check is performed on the frame duration of each frame of the frame sequence, the total duration of the Webp dynamic picture is checked, and if the total duration of the Webp dynamic picture is the same as a preset duration, it is determined that the total duration check of the Webp dynamic picture is passed, and it is determined that the check of the frame sequence of the Webp dynamic picture is completed, so that correct rendering of the dynamic picture is ensured.
In an embodiment of the present application, as shown in fig. 3, before the obtaining of the Webp dynamic picture file to be displayed, the method further includes:
s50: receiving a first request to load a 3D model;
s51: judging that the first request contains a loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
s52: and loading the Webp dynamic picture after the static picture is loaded preferentially.
In this embodiment, in an actual application scenario, a plurality of pictures need to be loaded on a picture display interactive interface, especially in the display of a 3D model, when a first request for loading the 3D model is received, a plurality of pictures that need to be loaded in the 3D model need to be sequenced so as to sequentially complete the loading of the 3D model, in this embodiment, it is determined that the first request includes a loaded picture type, if the pictures include a static picture and a Webp dynamic picture, the static picture in the picture display interactive interface is preferentially loaded, the static picture can be rendered faster than the dynamic picture, after the static picture is loaded, the Webp dynamic picture is loaded according to the method of the above embodiment, the static picture in the 3D model is displayed on the picture display interactive interface for the first time, and then the dynamic image in the 3D model is displayed, therefore, the rendering efficiency of the 3D model is improved, and the requirements in practical application scenes are met. For example, a 3D character with various expressions that can be switched is required to be displayed on a picture display interactive interface, and when a request for loading a 3D character model is received, static images that are not changed in the 3D character are preferentially loaded, and dynamic images of expressions that are changed in the 3D character are loaded, so that the face of the 3D character can be switched between various expressions during the process of displaying the 3D character.
In an embodiment of the present application, the step of loading the Webp dynamic picture is configured to be asynchronous processing; and when the 3D model is displayed to a part with dynamic characteristics, loading the Webp dynamic picture.
In this embodiment, the step of loading the Webp moving picture is configured to be asynchronously processed, and the step of loading the Webp moving picture is performed when the 3D model is displayed at a portion having a moving feature, and in one embodiment, the Webp moving picture is not loaded if the portion having the moving feature in the 3D model is not displayed on the front side of the picture display interactive interface, for example, the face of the 3D character image is not displayed on the front side of the picture display interactive interface during the rotation of the 3D model, and the moving image of the expression changing in the 3D character image is not loaded, and the moving image of the expression changing in the 3D character image is loaded only when the face of the 3D character image is rotated to the front side of the picture display interactive interface, the face can be switched to various expressions when the 3D character image is displayed on the front side, and the expressions are not switched when the 3D character image is not displayed on the front side, so that the consumption of resources is reduced.
In one embodiment of the present application, the graphics rendering engine includes a cross-language, cross-platform application programming interface or an application programming interface for use on a Microsoft Windows operating system.
In practical use, the terminal devices for rendering and displaying the dynamic pictures have different operating systems, and the embodiment aims to pack the loading method of the dynamic pictures into a solution suitable for multi-platform use, select different graphics rendering engines according to different platforms, and exert the advantages of the different platforms to quickly render the dynamic pictures. When a user applies the solution to practical use, before a graphics rendering engine is used for converting bitmap data acquired from the bitmap container into textures and rendering a dynamic picture according to the textures, the operating systems of terminal equipment currently loaded with the dynamic picture are determined, the programming languages used by different operating systems are different, if the operating systems are Microsoft Windows operating systems, the application programming interface used on the Microsoft Windows operating system is preferentially used for converting the bitmap data acquired from the bitmap container into the textures, and the dynamic picture is rendered according to the textures, and the application programming interface only used on the Microsoft Windows operating system can exert the advantages of the Microsoft Windows operating system to quickly render the dynamic picture; if the operating system is a non-Microsoft Windows operating system, the cross-language and cross-platform application programming interface is used for converting bitmap data acquired from the bitmap container into textures, and rendering a dynamic picture according to the textures, and the cross-language and cross-platform application programming interface breaks the limitation of the operating system, so that the method can be applied to 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 used in 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 a texture and render a dynamic picture according to the texture, OpenGL or DirectX performs rendering on the dynamic picture by using graphics acceleration hardware of a terminal device, converts bitmap data obtained from the bitmap container into a texture, and renders the dynamic picture according to the texture, where the graphics acceleration hardware includes a graphics processor GPU, and draws the dynamic picture in a flow by exerting a drawing capability of the GPU.
As shown in fig. 4, in another embodiment, the present application provides a moving picture loading apparatus, including:
the acquisition module 10: the method comprises the steps of acquiring a Webp dynamic picture file to be displayed;
the loading module 20: the Webp dynamic picture file is used for loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
the decoding module 30: the frame sequence is decoded to obtain decoded frame data, and the frame data is stored as bitmap data and stored in a resident bitmap container;
the display module 40: and the processor is used for converting the bitmap data acquired from the bitmap container into textures by using a graphic rendering engine and rendering the dynamic picture according to the textures.
In one embodiment of the present application, the apparatus further comprises:
LruCache cache module: and the buffer memory data is used for storing the buffer memory data of the generated Webp dynamic picture file and the buffer memory data of the frame data.
In an embodiment of the present application, the loading module 20 further performs: receiving a request for loading a dynamic picture, and responding to the request to judge whether the LruCache cache module stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data;
if so, acquiring cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from an LrucCache cache module;
and if not, acquiring a path of the Webp dynamic picture file from the request, 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:
a frame check module: for configuring a predicted duration of each frame of a sequence of frames; counting the total prediction time of the Webp dynamic picture according to the prediction time of each frame; determining the 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; 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 checking module carries out time checking on the frame duration of the target frame.
In an embodiment of the present application, the frame check module further performs:
and after time check is carried out on the frame duration of each frame of the frame sequence, checking 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 check of the frame sequence of the Webp dynamic picture is finished.
In an embodiment of the present application, the loading module 20 further performs:
receiving a first request to load a 3D model;
judging that the first request contains a 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 an embodiment of the present application, the step of loading the Webp dynamic picture is configured to be asynchronous processing; and when the 3D model is displayed to a part with dynamic characteristics, loading the Webp dynamic picture.
In one embodiment of the present application, the graphics rendering engine comprises a cross-language, cross-platform application programming interface or an application programming interface for use on a Microsoft Windows operating system; the display module 40 further performs:
determining an operating system of the terminal equipment for loading the dynamic picture;
if the operating system is a Microsoft Windows operating system, converting bitmap data acquired from the bitmap container into textures by preferentially using an application programming interface used 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, converting bitmap data acquired from the bitmap container into textures by using a cross-language and cross-platform application programming interface, and rendering a dynamic picture according to the textures.
In an embodiment of the present application, the cross-language and cross-platform application programming interface is OpenGL, and the application programming interface used on Microsoft Windows operating system is DirectX; the display module 40 further performs:
converting bitmap data acquired from the bitmap container into textures by using OpenGL or DirectX and graphics acceleration hardware, 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, and the computer program, when executed by a processor, implements the loading method of the dynamic picture according to the above embodiments. 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 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 a read-only memory, a magnetic or optical disk, or the like.
The computer-readable storage medium provided by the embodiment of the application can be used for acquiring 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 as bitmap data to a resident bitmap container; and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures. By providing a method for loading a dynamic picture with low memory resource occupation and high efficiency, the dynamic picture uses a Webp dynamic picture, can save memory space compared with a common bitmap, and loads a Webp dynamic picture file to be displayed through a Webp library to obtain a frame sequence of the Webp dynamic picture, namely the general information of the Webp dynamic picture, then decodes the frame sequence to obtain decoded frame data, and configures a resident bitmap container (mDecodeBitmap) for storing the frame data as bitmap data into the resident bitmap container, thereby ending a main memory and avoiding resources consumed by creating the bitmap container back and forth, then converts the bitmap data obtained from the bitmap container into textures by using a graphics rendering engine, and renders the dynamic picture according to the textures, wherein the graphics rendering engine can preferentially utilize the graphics rendering processing performance of graphics acceleration hardware to render the picture, thereby smoothly drawing a moving picture.
The computer-readable storage medium provided in the embodiment of the present application can implement the embodiment of the method for loading a dynamic picture, and for specific function implementation, reference is made to the description in the embodiment of the method, which is not repeated herein.
In addition, in another embodiment, the present application further provides a terminal device, as shown in fig. 5, the terminal device includes a processor 503, a memory 505, an input unit 507, a display unit 509, and other devices. It will be understood by those skilled in the art that the structural elements shown in fig. 5 do not constitute a limitation of all terminal devices and may include more or less elements than those shown, or some elements in combination. The memory 505 may be used to store the computer program 501 and the functional modules, and the processor 503 executes the computer program 501 stored in the memory 505, thereby executing 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 memory may comprise 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 signal input and receiving user input, and the input unit 507 may include a touch panel and other input devices, where the touch panel may collect touch operations of a user on or near the touch panel and drive a corresponding connection device 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 a control center of the computer device, connects various parts of the entire computer using various interfaces and lines, and performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 503 and calling data stored in the memory.
In one embodiment, the terminal device includes one or more processors 503, one or more memories 505, and one or more computer programs 501, wherein the one or more computer programs 501 are stored in the memory 505 and configured to be executed by the one or more processors 503, and the one or more computer programs 501 are configured to perform the loading method of the dynamic picture described in the above embodiment. The one or more processors 503 shown in fig. 5 can execute and implement 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 device provided by the embodiment of the application can acquire 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 as bitmap data to a resident bitmap container; and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures. By providing a method for loading a dynamic picture with low memory resource occupation and high efficiency, the dynamic picture uses a Webp dynamic picture, can save memory space compared with a common bitmap, and loads a Webp dynamic picture file to be displayed through a Webp library to obtain a frame sequence of the Webp dynamic picture, namely the general information of the Webp dynamic picture, then decodes the frame sequence to obtain decoded frame data, and configures a resident bitmap container (mDecodeBitmap) for storing the frame data as bitmap data into the resident bitmap container, thereby ending a main memory and avoiding resources consumed by creating the bitmap container back and forth, then converts the bitmap data obtained from the bitmap container into textures by using a graphics rendering engine, and renders the dynamic picture according to the textures, wherein the graphics rendering engine can preferentially utilize the graphics rendering processing performance of graphics acceleration hardware to render the picture, thereby smoothly drawing a moving picture.
The terminal device provided in the embodiment of the present application can implement the embodiment of the method for loading a dynamic picture provided above, and for specific function implementation, reference is made to the description in the method embodiment, which is not described herein again.
The foregoing is only a partial embodiment of the present application, and it should be noted that, for those skilled in the art, several modifications and decorations can be made without departing from the principle of the present application, and these modifications and decorations should also be regarded as the protection scope of the present application.

Claims (12)

1. A method for loading dynamic pictures is characterized by comprising the following steps:
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 as bitmap data to a resident bitmap container;
and converting bitmap data acquired from the bitmap container into textures by using a graphic rendering engine, and rendering the dynamic picture according to the textures.
2. The method according to claim 1, wherein after loading the Webp dynamic picture file to obtain the frame sequence of the Webp dynamic picture, the method further comprises:
generating cache data of the Webp dynamic picture file;
after the decoding the frame sequence to obtain the decoded frame data, the method further includes:
generating buffer 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 an Lrucache.
3. The method according to claim 2, wherein after the using LruCache to store the buffer data of the Webp dynamic picture file and the buffer data of the frame data, further comprising:
receiving a request for loading a dynamic picture;
responding to the request, and judging whether the LrucCache stores cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data;
if so, acquiring cache data of a Webp dynamic picture file corresponding to the dynamic picture and cache data of the frame data from the LrucCache;
and if not, acquiring a path of the Webp dynamic picture file from the request, and acquiring the Webp dynamic picture file to be displayed according to the path.
4. The method according to claim 1, wherein after loading the Webp dynamic picture file to obtain the frame sequence of the Webp dynamic picture, the method further comprises:
configuring a predicted duration for each frame of a sequence of frames;
counting the total prediction time of the Webp dynamic picture according to the prediction time of each frame;
determining the 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 the sequence of frames comprises:
if the target frame is not decoded, decoding the target frame, and performing time check on the frame duration of the target frame;
and if the target frame is decoded, time check is carried out on the frame duration of the target frame.
5. The method of claim 4, wherein after the time checking the frame duration of the target frame, further comprising:
and after time check is carried out on the frame duration of each frame of the frame sequence, checking 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 check of the frame sequence of the Webp dynamic picture is finished.
6. The method according to claim 1, wherein before the obtaining the Webp dynamic picture file to be displayed, the method further comprises:
receiving a first request to load a 3D model;
judging that the first request contains a loaded picture type, if the picture contains a static picture and a Webp dynamic picture;
and loading the Webp dynamic picture after the static picture is loaded preferentially.
7. The method according to claim 6, wherein said step of loading said Webp dynamic picture is configured as an asynchronous process; and when the 3D model is displayed to a part with dynamic characteristics, loading the Webp dynamic picture.
8. The method of claim 1, wherein the graphics rendering engine comprises a cross-language, cross-platform application programming interface or an application programming interface for use on a Microsoft Windows operating system; 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, wherein the steps of:
determining an operating system of the terminal equipment for loading the dynamic picture;
if the operating system is a Microsoft Windows operating system, converting bitmap data acquired from the bitmap container into textures by preferentially using an application programming interface used 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, converting bitmap data acquired from the bitmap container into textures by using a cross-language and cross-platform application programming interface, and rendering a dynamic picture according to the textures.
9. The method of claim 8, wherein the cross-language, cross-platform application programming interface is OpenGL, and the application programming interface for use on Microsoft Windows operating system is DirectX; 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, wherein the steps of:
converting bitmap data acquired from the bitmap container into textures by using OpenGL or DirectX and graphics acceleration hardware, and rendering a dynamic picture according to the textures; the graphics acceleration hardware includes a graphics processor.
10. A moving picture loading apparatus, comprising:
an acquisition module: the method comprises the steps of acquiring a Webp dynamic picture file to be displayed;
loading a module: the Webp dynamic picture file is used for loading the Webp dynamic picture file to obtain a frame sequence of the Webp dynamic picture;
a decoding module: the frame sequence is decoded to obtain decoded frame data, and the frame data is stored as bitmap data and stored in a resident bitmap container;
a display module: and the processor is used for converting the bitmap data acquired from the bitmap container into textures by using a graphic rendering engine and rendering the dynamic picture according to the textures.
11. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the loading method of moving pictures according to any one of claims 1 to 9.
12. A 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 computer programs being configured to perform the method of loading a dynamic picture according to any one of claims 1 to 9.
CN202010048524.3A 2020-01-16 2020-01-16 Dynamic picture loading method and device, storage medium and terminal equipment Active CN111292387B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010048524.3A CN111292387B (en) 2020-01-16 2020-01-16 Dynamic picture loading method and device, storage medium and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010048524.3A CN111292387B (en) 2020-01-16 2020-01-16 Dynamic picture loading method and device, storage medium and terminal equipment

Publications (2)

Publication Number Publication Date
CN111292387A true CN111292387A (en) 2020-06-16
CN111292387B CN111292387B (en) 2023-08-29

Family

ID=71025443

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010048524.3A Active CN111292387B (en) 2020-01-16 2020-01-16 Dynamic picture loading method and device, storage medium and terminal equipment

Country Status (1)

Country Link
CN (1) CN111292387B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111724469A (en) * 2020-06-28 2020-09-29 广州小鹏车联网科技有限公司 Loading method and display method of three-dimensional model, vehicle and storage medium
CN112363778A (en) * 2020-11-19 2021-02-12 微医云(杭州)控股有限公司 Dynamic picture loading method and device, electronic equipment and storage medium
CN112700507A (en) * 2020-12-28 2021-04-23 统信软件技术有限公司 Picture display method, computing device and storage medium
CN113419802A (en) * 2021-06-21 2021-09-21 网易(杭州)网络有限公司 Atlas generation method and apparatus, electronic device and storage medium
CN114143603A (en) * 2021-12-13 2022-03-04 乐府互娱(上海)网络科技有限公司 High-compatibility mp4 playing mode in client game
CN114222185A (en) * 2021-12-10 2022-03-22 洪恩完美(北京)教育科技发展有限公司 Video playing method, terminal equipment and storage medium
CN114385285A (en) * 2021-11-30 2022-04-22 重庆长安汽车股份有限公司 Image creating method based on automobile AI intelligent assistant

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100156932A1 (en) * 2005-06-24 2010-06-24 Nhn Corporation Method for inserting moving picture into 3-dimension screen and record medium for the same
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
CN106611435A (en) * 2016-12-22 2017-05-03 广州华多网络科技有限公司 Animation processing method and device
CN106980579A (en) * 2016-09-30 2017-07-25 阿里巴巴集团控股有限公司 A kind of picture loading method and device
CN107277616A (en) * 2017-07-21 2017-10-20 广州爱拍网络科技有限公司 Special video effect rendering intent, device and terminal
CN109697101A (en) * 2019-01-16 2019-04-30 广州虎牙信息科技有限公司 Image display method, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100156932A1 (en) * 2005-06-24 2010-06-24 Nhn Corporation Method for inserting moving picture into 3-dimension screen and record medium for the same
CN105427236A (en) * 2015-12-18 2016-03-23 魅族科技(中国)有限公司 Method and device for image rendering
CN106980579A (en) * 2016-09-30 2017-07-25 阿里巴巴集团控股有限公司 A kind of picture loading method and device
CN106611435A (en) * 2016-12-22 2017-05-03 广州华多网络科技有限公司 Animation processing method and device
CN107277616A (en) * 2017-07-21 2017-10-20 广州爱拍网络科技有限公司 Special video effect rendering intent, device and terminal
CN109697101A (en) * 2019-01-16 2019-04-30 广州虎牙信息科技有限公司 Image display method, device, computer equipment and storage medium

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111724469A (en) * 2020-06-28 2020-09-29 广州小鹏车联网科技有限公司 Loading method and display method of three-dimensional model, vehicle and storage medium
CN112363778A (en) * 2020-11-19 2021-02-12 微医云(杭州)控股有限公司 Dynamic picture loading method and device, electronic equipment and storage medium
CN112363778B (en) * 2020-11-19 2023-03-24 微医云(杭州)控股有限公司 Dynamic picture loading method and device, electronic equipment and storage medium
CN112700507A (en) * 2020-12-28 2021-04-23 统信软件技术有限公司 Picture display method, computing device and storage medium
CN113419802A (en) * 2021-06-21 2021-09-21 网易(杭州)网络有限公司 Atlas generation method and apparatus, electronic device and storage medium
CN113419802B (en) * 2021-06-21 2022-08-05 网易(杭州)网络有限公司 Atlas generation method and apparatus, electronic device and storage medium
CN114385285A (en) * 2021-11-30 2022-04-22 重庆长安汽车股份有限公司 Image creating method based on automobile AI intelligent assistant
CN114385285B (en) * 2021-11-30 2024-02-06 重庆长安汽车股份有限公司 Image creation method based on automobile AI intelligent assistant
CN114222185A (en) * 2021-12-10 2022-03-22 洪恩完美(北京)教育科技发展有限公司 Video playing method, terminal equipment and storage medium
CN114222185B (en) * 2021-12-10 2024-04-05 洪恩完美(北京)教育科技发展有限公司 Video playing method, terminal equipment and storage medium
CN114143603A (en) * 2021-12-13 2022-03-04 乐府互娱(上海)网络科技有限公司 High-compatibility mp4 playing mode in client game

Also Published As

Publication number Publication date
CN111292387B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN111292387B (en) Dynamic picture loading method and device, storage medium and terminal equipment
EP4198909A1 (en) Image rendering method and apparatus, and computer device and storage medium
US9904977B2 (en) Exploiting frame to frame coherency in a sort-middle architecture
US10002403B2 (en) Command remoting
EP2245598B1 (en) Multi-buffer support for off-screen surfaces in a graphics processing system
JP5805864B2 (en) Graphics rendering engine and method for implementing the same
US20080266287A1 (en) Decompression of vertex data using a geometry shader
KR102499397B1 (en) Method and apparatus for performing graphics pipelines
CN111737019B (en) Method and device for scheduling video memory resources and computer storage medium
US8941669B1 (en) Split push buffer rendering for scalability
US20160247310A1 (en) Systems and methods for reducing memory bandwidth using low quality tiles
US8988434B1 (en) Text rendering for browsers and mobile based applications
CN112529995B (en) Image rendering calculation method and device, storage medium and terminal
CN103003839A (en) Split storage of anti-aliased samples
US8907979B2 (en) Fast rendering of knockout groups using a depth buffer of a graphics processing unit
CN116185743B (en) Dual graphics card contrast debugging method, device and medium of OpenGL interface
TW201926239A (en) Tile-based low-resolution depth storage
KR102521654B1 (en) Computing system and method for performing graphics pipeline of tile-based rendering thereof
CN111798365B (en) Deep antialiasing data reading method, device, equipment and storage medium
US20210295584A1 (en) Graphics processing
CN118043842A (en) Rendering format selection method and related equipment thereof
CN111243069B (en) Scene switching method and system of Unity3D engine
CN112988609B (en) Data processing method, device, storage medium and client
CN115131481A (en) GPU rendering efficiency determination method, model construction method, device, medium and equipment
CN112752131B (en) Barrage information display method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant