A method of image frame prediction and electronic device

By distinguishing between color data of moving and static objects in the rendering frame and generating prediction frames, the problem of improving the smoothness of the video interface while saving power is solved, achieving higher frame rates and lower power consumption.

CN115398907BActive Publication Date: 2026-03-27HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-16
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

How to improve the smoothness of video interfaces while saving power consumption of electronic devices, especially by reducing the number of frames drawn to reduce power consumption when rendering game scenes in real time, while maintaining a high frame rate.

Method used

By distinguishing between the color data of moving and static objects in the rendering frame and using color attachments to generate prediction frames, unnecessary computation is reduced to improve the frame rate.

Benefits of technology

It improves the smoothness of video display interfaces on electronic devices while reducing power consumption, and more accurately predicts motion vectors, especially in the calculation of distinguishing between moving and static objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115398907B_ABST
    Figure CN115398907B_ABST
Patent Text Reader

Abstract

A method for image frame prediction and an electronic device, in the method, the electronic device can draw a first moving object in a first memory space according to drawing instructions of an Nth drawing frame, and draw a first static object in a second memory space; draw a second moving object in a third memory space according to drawing instructions of an N+2th drawing frame, and draw a second static object in a fourth memory space; the electronic device predicts a moving object in an N+3th prediction frame according to the first moving object and the second moving object, and predicts a static object in the N+3th prediction frame according to the first static object and the second static object. Finally, the electronic device synthesizes the N+3th prediction frame according to the moving object and the static object in the Nth prediction frame. By implementing the technical solution provided in the present application, the electronic device can more accurately predict image frames, and use the predicted image frames to improve the frame rate of the played video of the application, so as to improve the fluency of the video interface.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application claims priority to Chinese Patent Application No. 202011069443.8, filed September 30, 2020, and titled “Frame Prediction Method, Electronic Device, and Computer-Readable Storage Medium”; Chinese Patent Application No. 202011063375.4, filed September 30, 2020, and titled “Image Frame Generation Method and Electronic Device”; Chinese Patent Application No. 202011197968.X, filed October 31, 2020, and titled “Method for Predicting Image Frame and Electronic Device”; Chinese Patent Application No. 202011377449.1, filed November 30, 2020, and titled “Method for Predicting Image Frame and Electronic Device”; Chinese Patent Application No. 202011377306.0, filed November 30, 2020, and titled “Image Frame Generation Method and Electronic Device”; Chinese Patent Application No. 202011493948.7, filed December 16, 2020, and titled “Method for Predicting Image Frame and Electronic Device”; Chinese Patent Application No. 202011629171.2, filed December 30, 2020, and titled “Method for Predicting Image Frame and Electronic Device”; the contents of the above applications are incorporated herein by reference in their entirety. TECHNICAL FIELD

[0002] The present application relates to the technical field of electronic technology, and the technical field of image processing, and in particular, relates to a method for predicting an image frame and an electronic device. BACKGROUND

[0003] A video interface (a video playing interface such as a TV series or a movie, a game screen, etc.) displayed by an electronic device is essentially a series of continuous pictures. Taking a game screen as an example, the higher the frame rate of the game screen, the smoother the game screen displayed by the electronic device, and the better the visual experience of a user. For a game screen that needs to be rendered in real time, the higher the frame rate, the more image frames (referred to as drawing frames) that need to be drawn and rendered by an application (a video application, a game application, etc.) of the electronic device, and the greater the power consumption of the electronic device. Therefore, how to improve the smoothness of the video interface displayed by the electronic device while saving the power consumption of the electronic device is an urgent problem to be solved. SUMMARY

[0004] The present application provides a method for predicting an image frame and an electronic device, which can improve the smoothness of a video interface displayed by the electronic device while saving the power consumption of the electronic device.

[0005] In a first aspect, the present application provides a method for image frame prediction, which can include: when drawing a first drawing frame, determining, by an electronic device, according to a drawing instruction of a first drawing object, that spatial information of the first drawing object has changed, and determining, according to a drawing instruction of a second drawing object, that spatial information of the second drawing object has not changed, writing, by the electronic device, color data of the first drawing object into a first color attachment, and writing color data of the second drawing object into a second color attachment; when drawing a second drawing frame, determining, by the electronic device, according to a drawing instruction of a third drawing object, that spatial information of the first drawing object has changed, and determining, according to a drawing instruction of a fourth drawing object, that spatial information of the fourth drawing object has not changed, writing, by the electronic device, color data of the third drawing object into a third color attachment, and writing color data of the fourth drawing object into a fourth color attachment; generating, by the electronic device, a fifth color attachment of a first prediction frame according to the first color attachment and the third color attachment, and generating a sixth color attachment of the first prediction frame according to the second color attachment and the fourth color attachment; and combining, by the electronic device, the fifth color attachment and the sixth color attachment into the first prediction frame.

[0006] According to the method provided by the first aspect, the electronic device can determine, according to a drawing instruction of a drawing object, whether spatial information of the drawing object has changed. That is, the electronic device can determine, according to the drawing instruction of the drawing object, whether the drawing object is a moving object. If the drawing instruction of the drawing object indicates that the spatial information has changed, the drawing object is a moving object. If the drawing instruction of the drawing object does not indicate that the spatial information has changed, the drawing object is a static object. If the drawing object is a moving object, the electronic device writes color data of the drawing object into a first color attachment. If the drawing object is a static object, the electronic device writes color data of the drawing object into a second color attachment. In this way, the electronic device can store color data of moving objects and color data of static objects in the first drawing frame separately. Similarly, the electronic device can store color data of moving objects and color data of static objects in the second drawing frame separately. Then, the electronic device can predict moving objects in the first prediction frame according to moving objects in the first drawing frame and moving objects in the second drawing frame. The electronic device can predict static objects in the first prediction frame according to static objects in the first drawing frame and static objects in the second drawing frame. In this way, the electronic device can use the prediction frame predicted by the drawing frame, can improve the frame rate, and thus improve the smoothness of the video interface displayed by the electronic device.

[0007] With reference to the first aspect, in a possible implementation manner, the electronic device generates the fifth color attachment of the first predicted frame according to the first color attachment and the third color attachment, including: the electronic device determines a first motion vector of the third color attachment according to the first color attachment and the third color attachment; and the electronic device generates the fifth color attachment of the first predicted frame according to the second color attachment and the first motion vector.

[0008] In the implementation manner, the electronic device calculates the motion vector of the moving object only by using the color data of the moving object, so that the motion vector of the moving object can be more accurately calculated. In addition, the electronic device calculates the motion vector of the moving object only according to the color data of the moving object. The electronic device will not incorrectly calculate the motion vector of the moving object as the motion vector of the static object. Therefore, the moving object in the predicted frame predicted by the electronic device is more accurate.

[0009] With reference to the first aspect, in a possible implementation manner, the electronic device determines a first motion vector of the third color attachment according to the first color attachment and the third color attachment, including: the electronic device divides the third color attachment into Q pixel blocks, the electronic device takes out a first pixel block from the Q pixel blocks of the third color attachment, the electronic device determines a second pixel block matched with the first pixel block in the first color attachment, the electronic device obtains a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block, and the electronic device determines the first motion vector of the third color attachment according to the motion vector of the first pixel block. According to the steps in the implementation manner, the electronic device can determine the motion vector of each pixel block in the Q pixel blocks of the third color attachment. Each pixel block includes f*f (for example, 16*16) pixel points.

[0010] In the implementation manner, the electronic device divides the color attachment of the moving object into blocks to calculate the motion vector, without calculating the motion vector of each pixel point of the motion vector. In this way, the calculation amount can be reduced, and the power consumption of the electronic device can be reduced.

[0011] With reference to the first aspect, in a possible implementation manner, the electronic device determines a second pixel block matched with the first pixel block in the first color attachment, including: the electronic device determines a plurality of candidate pixel blocks in the first color attachment by using a first pixel point in the first pixel block, the electronic device calculates a color value difference between the plurality of candidate pixel blocks and the first pixel block, the electronic device determines the second pixel block matched with the first pixel block according to the color value difference between the plurality of candidate pixel blocks and the first pixel block, and the second pixel block is a candidate pixel block with the smallest color value difference with the first pixel block in the plurality of candidate pixel blocks. In this way, the electronic device can more accurately find the matched pixel block of each pixel block, so that the motion vector of each pixel block can be more accurately calculated.

[0012] With reference to the first aspect, in a possible implementation manner, the electronic device generates a fifth color attachment of the first predicted frame according to the second color attachment and the first motion vector, and specifically includes: the electronic device determines a motion vector of the fifth color attachment according to the first motion vector, and generates the fifth color attachment according to the motion vector of the second color attachment and the fifth color attachment. The motion vector of the fifth color attachment is K times of the first motion vector, K is greater than 0 and less than 1.

[0013] With reference to the first aspect, in a possible implementation manner, K is equal to 0.5. In this way, the object in each image frame moves at a constant speed, which facilitates the calculation of the electronic device and can also make the user experience better when watching the video.

[0014] With reference to the first aspect, in a possible implementation manner, the electronic device generates a sixth color attachment of the first predicted frame according to the second color attachment and the fourth color attachment; and specifically includes: the electronic device determines a second motion vector of the fourth color attachment according to the second color attachment and the fourth color attachment; and the electronic device generates the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector.

[0015] In the above implementation manner, the electronic device only needs to use the color data of the static object to calculate the motion vector of the static object, so that the motion vector of the static object can be more accurately calculated. Moreover, the electronic device only calculates the motion vector of the static object according to the color data of the static object. The electronic device will not incorrectly calculate the motion vector of the static object as the motion vector of the moving object. Therefore, the static object in the predicted frame predicted by the electronic device is more accurate.

[0016] With reference to the first aspect, in a possible implementation manner, the electronic device determines a second motion vector of the fourth color attachment according to the second color attachment and the fourth color attachment; and specifically includes: the electronic device divides the fourth color attachment into Q pixel blocks, the electronic device takes out a third pixel block in the fourth color attachment, the electronic device calculates a first position of the third pixel block in the second color attachment, the electronic device determines a motion vector of the third pixel block according to the first position and a second position of the third pixel block in the fourth color attachment, and the electronic device determines the second motion vector of the fourth color attachment according to the motion vector of the third pixel block. According to the steps in this implementation manner, the electronic device can determine the motion vector of each pixel block in the Q pixel blocks of the fourth color attachment.

[0017] In the above implementation manner, the electronic device divides the color attachment of the static object into blocks to calculate the motion vector, without calculating the motion vector of each pixel point of the static vector. In this way, the calculation amount can be reduced, thereby reducing the power consumption of the electronic device.

[0018] With reference to the first aspect, in a possible implementation manner, the electronic device calculates the first position of the third pixel block in the second color attachment, specifically comprising: the electronic device acquires a first matrix in a drawing instruction of the first drawing frame and a second matrix in a drawing instruction of the second drawing frame, the first matrix being used to record rotation angle information of a camera position of the first drawing frame, and the second matrix being used to record rotation angle information of a camera position of the second drawing frame; and the electronic device calculates the first position of the third pixel block in the second color attachment according to the first matrix and the second matrix and a depth value of the third pixel block.

[0019] With reference to the first aspect, in a possible implementation manner, the electronic device generates the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector, specifically comprising: the electronic device determines a motion vector of the sixth color attachment according to the second motion vector, and generates the sixth color attachment according to the fourth color attachment and the motion vector of the sixth color attachment. The motion vector of the sixth color attachment is K times of the second motion vector, and K is greater than 0 and less than 1.

[0020] With reference to the first aspect, in a possible implementation manner, K is equal to 0.5. In this way, the object in each image frame moves at a constant speed, which facilitates the calculation of the electronic device and can also make the experience of the user when watching the video better.

[0021] With reference to the first aspect, in a possible implementation manner, the drawing instruction of the first drawing object comprises an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing instruction of the first drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the first drawing object and generate a drawing result; the drawing state device instruction of the first drawing object is used to set the drawing state data on which the execution drawing instruction of the first drawing object depends; and the drawing state data of the first drawing object comprises vertex information data, vertex index, texture information and vertex information cache index of the first drawing object.

[0022] With reference to the first aspect, in a possible implementation manner, the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, comprising: the electronic device determines that a transition matrix parameter exists in the drawing instruction of the first drawing object, and the electronic device determines that the transition matrix parameter existing in the drawing instruction of the first drawing object is different from a corresponding transition matrix parameter of the first drawing object, the transition matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0023] With reference to the first aspect, in a possible implementation manner, the drawing instruction of the second drawing object comprises an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, the execution drawing instruction of the second drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the second drawing object, and generate a drawing result, the drawing state device instruction of the second drawing object is used to set the drawing state data on which the execution drawing instruction of the second drawing object depends, and the drawing state data of the second drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the second drawing object.

[0024] With reference to the first aspect, in a possible implementation manner, the electronic device determines, according to the drawing instruction of the second drawing object, that the spatial information of the second drawing object does not change, comprising: the electronic device determines that there is no transformation matrix parameter in the drawing instruction of the second drawing object, and the electronic device determines that the transformation matrix parameter existing in the drawing instruction of the second drawing object is the same as the transformation matrix parameter corresponding to the second drawing object, the transformation matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.

[0025] With reference to the first aspect, in a possible implementation manner, the drawing instruction of the third drawing object comprises an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, the execution drawing instruction of the third drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the third drawing object, and generate a drawing result, the drawing state device instruction of the third drawing object is used to set the drawing state data on which the execution drawing instruction of the third drawing object depends, and the drawing state data of the third drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the third drawing object.

[0026] With reference to the first aspect, in a possible implementation manner, the electronic device determines, according to the drawing instruction of the third drawing object, that the spatial information of the first drawing object changes, comprising: the electronic device determines that there is a transformation matrix parameter in the drawing instruction of the third drawing object, and the electronic device determines that the transformation matrix parameter existing in the drawing instruction of the third drawing object is different from the transformation matrix parameter corresponding to the third drawing object, the transformation matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.

[0027] With reference to the first aspect, in a possible implementation manner, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information and vertex information cache index of the fourth drawing object.

[0028] With reference to the first aspect, in a possible implementation manner, the electronic device determines, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, comprising: the electronic device determines that there is no transformation matrix parameter in the drawing instruction of the fourth drawing object, and the electronic device determines that the transformation matrix parameter existing in the drawing instruction of the fourth drawing object is the same as the corresponding transformation matrix parameter of the fourth drawing object, the transformation matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system.

[0029] With reference to the first aspect, in a possible implementation manner, the electronic device determines, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, comprising: the electronic device determines that there is no transformation matrix parameter in the drawing instruction of the fourth drawing object, and the electronic device determines that the transformation matrix parameter existing in the drawing instruction of the fourth drawing object is the same as the corresponding transformation matrix parameter of the fourth drawing object, the transformation matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system.

[0030] With reference to the first aspect, in a possible implementation manner, in the process of drawing the first drawing frame, the electronic device determines, according to the drawing instruction of the first drawing object, that the spatial information of the first drawing object changes, and determines, according to the drawing instruction of the second drawing object, that the spatial information of the second drawing object does not change, and the electronic device writes the color data of the first drawing object into the first color attachment and writes the color data of the second drawing object into the second color attachment, and the method further comprises: the electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.

[0031] With reference to the first aspect, in a possible implementation manner, when the second drawing frame is drawn, the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the third drawing object, and determines that the spatial information of the fourth drawing object does not change according to the drawing instruction of the fourth drawing object, the electronic device writes the color data of the third drawing object into the third color attachment, and writes the color data of the fourth drawing object into the fourth color attachment, and the method further includes: the electronic device combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.

[0032] With reference to the first aspect, in a possible implementation manner, the electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space, and specifically includes: the electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space according to the first depth attachment and the second depth attachment, the first depth attachment is used to write the depth data of the first drawing object, and the second depth attachment is used to write the depth data of the second drawing object.

[0033] With reference to the first aspect, in a possible implementation manner, the electronic device combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space, and specifically includes: the electronic device combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space according to the third depth attachment and the fourth depth attachment; the third depth attachment is used to write the depth data of the third drawing object, and the fourth depth attachment is used to write the depth data of the fourth drawing object.

[0034] The second aspect provides an electronic device, which can include: one or more processors and a memory; the memory is coupled with the one or more processors, and the memory is used to store computer program codes, the computer program codes include computer instructions, and the one or more processors invoke the computer instructions to enable the electronic device to execute the method in any possible manner of the first aspect.

[0035] The third aspect provides an electronic device, which includes: one or more processors CPU, a graphics processing unit GPU, a memory, and a display screen; the memory is coupled with the one or more processors; the CPU is coupled with the GPU; and wherein:

[0036] The memory can be used to store computer program code, which includes computer instructions. The CPU can be used, when drawing a first drawing frame, to determine that the spatial information of the first drawing object has changed based on the drawing instructions of the first drawing object, and to determine that the spatial information of the second drawing object has not changed based on the drawing instructions of the second drawing object, and to instruct the GPU to write the color data of the first drawing object to a first color attachment and the color data of the second drawing object to a second color attachment, wherein the drawing instructions of the first drawing object indicate that the spatial information of the first drawing object has changed, and the drawing instructions of the second drawing object do not indicate that the spatial information of the second drawing object has changed. The CPU can also be used, when drawing a second drawing frame, to determine that the spatial information of the first drawing object has changed based on the drawing instructions of a third drawing object, and to determine that the spatial information of the fourth drawing object has not changed based on the drawing instructions of a fourth drawing object, and to instruct the GPU to write the color data of the third drawing object to a third color attachment and the color data of the fourth drawing object to a fourth color attachment, wherein the drawing instructions of the third drawing object indicate that the spatial information of the third drawing object has changed, and the drawing instructions of the fourth drawing object do not indicate that the spatial information of the fourth drawing object has changed.

[0037] The GPU can be used to write the color data of a first drawn object into a first color attachment, write the color data of a second drawn object into a second color attachment, write the color data of a third drawn object into a third color attachment, write the color data of a fourth drawn object into a fourth color attachment, generate a fifth color attachment for a first prediction frame based on the first and third color attachments, generate a sixth color attachment for the first prediction frame based on the second and fourth color attachments, and combine the fifth and sixth color attachments into the first prediction frame.

[0038] The display screen can be used to display the first drawing frame, the second drawing frame, and the first prediction frame.

[0039] According to the electronic device provided in the third aspect, the electronic device can determine whether the spatial information of the drawing object changes according to the drawing instruction of the drawing object. That is, the electronic device can determine whether the drawing object is a moving object according to the drawing instruction of the drawing object. If the drawing instruction of the drawing object indicates that the spatial information changes, the drawing object is a moving object. If the drawing instruction of the drawing object does not indicate that the spatial information changes, the drawing object is a static object. If the drawing object is a moving object, the electronic device writes the color data of the drawing object into the first color attachment. If the drawing object is a static object, the electronic device writes the color data of the drawing object into the second color attachment. In this way, the electronic device can separately store the color data of the moving object and the color data of the static object in the first drawing frame. Similarly, the electronic device can separately store the color data of the moving object and the color data of the static object in the second drawing frame. Then, the electronic device can predict the moving object in the first prediction frame according to the moving object in the first drawing frame and the moving object in the second drawing frame. The electronic device can predict the static object in the first prediction frame according to the static object in the first drawing frame and the static object in the second drawing frame. In this way, the electronic device can use the prediction frame predicted by the drawing frame, can improve the frame rate, and thus improves the smoothness of the video interface displayed by the electronic device.

[0040] With reference to the third aspect, in a possible implementation, the GPU can be further configured to: determine a first motion vector of the third color attachment according to the first color attachment and the third color attachment; and generate a fifth color attachment of the first prediction frame according to the second color attachment and the first motion vector.

[0041] In the implementation described above, the GPU in the electronic device only uses the color data of the moving object to calculate the motion vector of the moving object, so that the motion vector of the moving object can be more accurately calculated. Moreover, the GPU only calculates the motion vector of the moving object according to the color data of the moving object. The GPU will not incorrectly calculate the motion vector of the moving object as the motion vector of the static object. Therefore, the moving object in the prediction frame predicted by the electronic device is more accurate.

[0042] With reference to the third aspect, in a possible implementation, the GPU can be further configured to: divide the third color attachment into Q pixel blocks, and obtain a first pixel block from the Q pixel blocks of the third color attachment; determine a second pixel block matched with the first pixel block in the first color attachment; obtain a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block; and determine a first motion vector of the third color attachment according to the motion vector of the first pixel block.

[0043] In the implementation manner, the GPU divides the color attachment of the moving object into blocks to calculate the motion vector, without calculating the motion vector of each pixel point. In this way, the calculation amount is reduced, and the power consumption of the GPU is reduced.

[0044] With reference to the third aspect, in a possible implementation manner, the GPU can be further configured to: determine a plurality of candidate pixel blocks in the first color attachment through the first pixel point in the first pixel block, and calculate a difference value of color values of the plurality of candidate pixel blocks and the first pixel block respectively; determine the second pixel block matched with the first pixel block according to the difference value of color values of the plurality of candidate pixel blocks and the first pixel block; and the second pixel block is a candidate pixel block with the minimum difference value of color values among the plurality of candidate pixel blocks. In this way, the GPU of the electronic device can more accurately find the matched pixel block of each pixel block, and thus can more accurately calculate the motion vector of each pixel block.

[0045] With reference to the third aspect, in a possible implementation manner, the GPU can be further configured to: determine the second motion vector of the fourth color attachment according to the second color attachment and the fourth color attachment; and generate the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector.

[0046] In the implementation manner, the GPU of the electronic device calculates the motion vector of the static object only by using the color data of the static object, so that the motion vector of the static object can be more accurately calculated. Moreover, the GPU calculates the motion vector of the static object only according to the color data of the static object. The GPU will not incorrectly calculate the motion vector of the static object as the motion vector of the moving object. Therefore, the static object in the predicted frame predicted by the GPU is more accurate.

[0047] With reference to the third aspect, in a possible implementation manner, the GPU can be further configured to: divide the fourth color attachment into Q pixel blocks, and take out the third pixel block in the fourth color attachment; calculate a first position of the third pixel block in the second color attachment; determine the motion vector of the third pixel block according to the first position and a second position of the third pixel block in the fourth color attachment; and determine the second motion vector of the fourth color attachment according to the motion vector of the third pixel block.

[0048] In the implementation manner, the GPU divides the color attachment of the static object into blocks to calculate the motion vector, without calculating the motion vector of each pixel point. In this way, the calculation amount is reduced, and the power consumption of the GPU is reduced.

[0049] With reference to the third aspect, in a possible implementation manner, the electronic device can further be configured to: obtain a first matrix in the drawing instruction of the first drawing frame and a second matrix in the drawing instruction of the second drawing frame, the first matrix being used to record rotation angle information of a camera position of the first drawing frame, and the second matrix being used to record rotation angle information of a camera position of the second drawing frame; and calculate a first position of the third pixel block in the second color attachment according to the first matrix and the second matrix and the depth value of the third pixel block.

[0050] With reference to the third aspect, in a possible implementation manner, the GPU can further be configured to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, a sixth memory space and a seventh memory space; wherein the first memory space is used to store the first color attachment, the second memory space is used to store the second color attachment, the third memory space is used to store the third color attachment, the fourth memory space is used to store the fourth color attachment, the fifth memory space is used to store the fifth color attachment, the sixth memory space is used to store the sixth color attachment, and the seventh memory space is used to store the first prediction frame.

[0051] With reference to the third aspect, in a possible implementation manner, the GPU can further be configured to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.

[0052] With reference to the third aspect, in a possible implementation manner, the GPU can further be configured to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space according to the first depth attachment and the second depth attachment; the third depth attachment is used to write depth data of the first drawing object, and the fourth depth attachment is used to write depth data of the second drawing object.

[0053] With reference to the third aspect, in a possible implementation manner, the GPU can further be configured to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.

[0054] With reference to the third aspect, in a possible implementation manner, the GPU can further be configured to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space according to the third depth attachment and the fourth depth attachment; the third depth attachment is used to write depth data of the third drawing object, and the fourth depth attachment is used to write depth data of the fourth drawing object.

[0055] In a possible implementation manner of the third aspect, the drawing instruction of the first drawing object comprises an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, the execution drawing instruction of the first drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the first drawing object, and generate a drawing result, the drawing state device instruction of the first drawing object is used to set the drawing state data on which the execution drawing instruction of the first drawing object depends, and the drawing state data of the first drawing object comprises vertex information data, a vertex index, texture information, and a vertex information cache index of the first drawing object.

[0056] In a possible implementation manner of the third aspect, the CPU determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, and the CPU can be specifically configured to: determine that a transformation matrix parameter exists in the drawing instruction of the first drawing object, and determine that the transformation matrix parameter existing in the drawing instruction of the first drawing object is different from a corresponding transformation matrix parameter of the first drawing object, the transformation matrix is used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system. In a possible implementation manner of the third aspect, the drawing instruction of the second drawing object comprises an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, the execution drawing instruction of the second drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the second drawing object, and generate a drawing result, the drawing state device instruction of the second drawing object is used to set the drawing state data on which the execution drawing instruction of the second drawing object depends, and the drawing state data of the second drawing object comprises vertex information data, a vertex index, texture information, and a vertex information cache index of the second drawing object.

[0057] In a possible implementation manner of the third aspect, the CPU determines that the spatial information of the second drawing object does not change according to the drawing instruction of the second drawing object, and the CPU can be specifically configured to: determine that a transformation matrix parameter does not exist in the drawing instruction of the second drawing object, and determine that the transformation matrix parameter existing in the drawing instruction of the second drawing object is the same as a corresponding transformation matrix parameter of the second drawing object, the transformation matrix is used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0058] In a possible implementation manner of the third aspect, the drawing instruction of the third drawing object comprises an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, the execution drawing instruction of the third drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the third drawing object, and generate a drawing result, the drawing state device instruction of the third drawing object is used to set the drawing state data on which the execution drawing instruction of the third drawing object depends, and the drawing state data of the third drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the third drawing object.

[0059] In a possible implementation manner of the third aspect, the CPU determines, according to the drawing instruction of the third drawing object, that the spatial information of the third drawing object does not change, and the CPU can be specifically configured to: determine that there is no transformation matrix parameter in the drawing instruction of the third drawing object, or determine that the transformation matrix parameter present in the drawing instruction of the third drawing object is the same as the transformation matrix parameter corresponding to the third drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0060] In a possible implementation manner of the third aspect, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

[0061] In a possible implementation manner of the third aspect, the CPU determines, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, and the CPU can be specifically configured to: determine that there is no transformation matrix parameter in the drawing instruction of the fourth drawing object, or determine that the transformation matrix parameter present in the drawing instruction of the fourth drawing object is the same as the transformation matrix parameter corresponding to the fourth drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0062] In a possible implementation manner of the third aspect, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

[0061] In a possible implementation manner of the third aspect, the CPU determines, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, and the CPU can be specifically configured to: determine that there is no transformation matrix parameter in the drawing instruction of the fourth drawing object, or determine that the transformation matrix parameter present in the drawing instruction of the fourth drawing object is the same as the transformation matrix parameter corresponding to the fourth drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0062] In a possible implementation manner of the third aspect, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

[0061] In a possible implementation manner of the third aspect, the CPU determines, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, and the CPU can be specifically configured to: determine that there is no transformation matrix parameter in the drawing instruction of the fourth drawing object, or determine that the transformation matrix parameter present in the drawing instruction of the fourth drawing object is the same as the transformation matrix parameter corresponding to the fourth drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0062] In a possible implementation manner of the third aspect, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

[0063] The drawing unit can be configured to, when drawing the first drawing frame, determine, according to the drawing instruction of the first drawing object, that the spatial information of the first drawing object changes, determine, according to the drawing instruction of the second drawing object, that the spatial information of the second drawing object does not change, write the color data of the first drawing object into the first color attachment, and write the color data of the second drawing object into the second color attachment; when drawing the second drawing frame, determine, according to the drawing instruction of the third drawing object, that the spatial information of the first drawing object changes, determine, according to the drawing instruction of the fourth drawing object, that the spatial information of the fourth drawing object does not change, write the color data of the third drawing object into the third color attachment, and write the color data of the fourth drawing object into the fourth color attachment.

[0064] The prediction unit can be configured to generate a fifth color attachment of the first prediction frame according to the first color attachment and the third color attachment, and generate a sixth color attachment of the first prediction frame according to the second color attachment and the fourth color attachment.

[0065] The synthesis unit can be configured to synthesize the fifth color attachment and the sixth color attachment into the first prediction frame.

[0066] The image frame prediction device provided by the fourth aspect can determine, according to the drawing instruction of a drawing object, whether the spatial information of the drawing object changes. That is, the image frame prediction device can determine, according to the drawing instruction of the drawing object, whether the drawing object is a moving object. If the drawing instruction of the drawing object indicates that the spatial information changes, the drawing object is a moving object. If the drawing instruction of the drawing object does not indicate that the spatial information changes, the drawing object is a static object. If the drawing object is a moving object, the image frame prediction device writes the color data of the drawing object into the first color attachment. If the drawing object is a static object, the image frame prediction device writes the color data of the drawing object into the second color attachment. In this way, the image frame prediction device can separately store the color data of the moving object and the color data of the static object in the first drawing frame. Similarly, the image frame prediction device can separately store the color data of the moving object and the color data of the static object in the second drawing frame. Then, the image frame prediction device can predict the moving object in the first prediction frame according to the moving object in the first drawing frame and the moving object in the second drawing frame. The image frame prediction device can predict the static object in the first prediction frame according to the static object in the first drawing frame and the static object in the second drawing frame. In this way, the image frame prediction device can use the prediction frame predicted by the drawing frame, can improve the frame rate, and thus improve the smoothness of the video interface displayed by the image frame prediction device.

[0067] In combination with the fourth aspect, in a possible implementation manner, the prediction unit is further configured to: determine a first motion vector of the third color attachment according to the first color attachment and the third color attachment; and generate a fifth color attachment of the first predicted frame according to the second color attachment and the first motion vector.

[0068] In the implementation manners, the image frame prediction apparatus calculates the motion vector of the motion object only by using the color data of the motion object, so that the motion vector of the motion object can be calculated more accurately. In addition, the image frame prediction apparatus calculates the motion vector of the motion object only according to the color data of the motion object. The image frame prediction apparatus will not incorrectly calculate the motion vector of the motion object as the motion vector of the static object. Therefore, the motion object in the predicted frame predicted by the image frame prediction apparatus is more accurate.

[0069] In combination with the fourth aspect, in a possible implementation manner, the prediction unit is further configured to: divide the third color attachment into Q pixel blocks, and take out a first pixel block from the Q pixel blocks of the third color attachment; determine a second pixel block matched with the first pixel block in the first color attachment; obtain a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block; and determine a first motion vector of the third color attachment according to the motion vector of the first pixel block. According to the steps in the implementation manner, the prediction unit can determine the motion vectors of all the pixel blocks in the Q pixel blocks of the third color attachment. Each pixel block includes f*f (for example, 16*16) pixels.

[0070] In the implementation manners, the prediction unit divides the color attachment of the motion object into blocks to calculate the motion vector, without calculating the motion vector of each pixel. In this way, the calculation amount can be reduced, and the power consumption of the image frame prediction apparatus can be reduced.

[0071] In combination with the fourth aspect, in a possible implementation manner, the prediction unit is further configured to: determine a plurality of candidate pixel blocks in the first color attachment by using a first pixel in the first pixel block, and calculate a difference value of color values of the plurality of candidate pixel blocks and the first pixel block respectively; determine a second pixel block matched with the first pixel block according to the difference value of the color values of the plurality of candidate pixel blocks and the first pixel block; and the second pixel block is a candidate pixel block with the smallest difference value of the color values of the plurality of candidate pixel blocks and the first pixel block. In this way, the prediction unit can more accurately find the matched pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.

[0072] In combination with the fourth aspect, in a possible implementation manner, the prediction unit is further configured to: determine a motion vector of the fifth color attachment according to the first motion vector, and generate the fifth color attachment according to the second color attachment and the motion vector of the fifth color attachment. The motion vector of the fifth color attachment is K times of the first motion vector, and K is greater than 0 and less than 1.

[0073] In a possible implementation manner of the fourth aspect, K is equal to 0.5. In this way, the object in each image frame moves at a constant speed.

[0074] In a possible implementation manner of the fourth aspect, the prediction unit is further configured to: determine a second motion vector of the fourth color attachment according to the second color attachment and the fourth color attachment; and generate a sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector.

[0075] In the implementation manner, the prediction unit calculates the motion vector of the static object only by using the color data of the static object, so that the motion vector of the static object can be more accurately calculated. In addition, the prediction unit calculates the motion vector of the static object only according to the color data of the static object. The prediction unit will not incorrectly calculate the motion vector of the static object as the motion vector of the moving object. Therefore, the static object in the predicted frame predicted by the prediction unit is more accurate.

[0076] In a possible implementation manner of the fourth aspect, the prediction unit is further configured to: divide the fourth color attachment into Q pixel blocks, and obtain a third pixel block in the fourth color attachment; calculate a first position of the third pixel block in the second color attachment; determine a motion vector of the third pixel block according to a second position of the third pixel block in the fourth color attachment and the first position; and determine a second motion vector of the fourth color attachment according to the motion vector of the third pixel block. According to the steps in the implementation manner, the prediction unit can determine the motion vector of each pixel block in the Q pixel blocks of the fourth color attachment.

[0077] In the implementation manner, the prediction unit divides the color attachment of the static object into blocks to calculate the motion vector, without calculating the motion vector of each pixel point of the static vector. In this way, the calculation amount can be reduced, and the power consumption of the image frame prediction device can be reduced.

[0078] In a possible implementation manner of the fourth aspect, the prediction unit is further configured to: obtain a first matrix in a drawing instruction of the first drawing frame and a second matrix in a drawing instruction of the second drawing frame, the first matrix being used to record rotation information of a camera position of the first drawing frame, and the second matrix being used to record rotation information of a camera position of the second drawing frame; and calculate the first position of the third pixel block in the second color attachment according to the first matrix and the second matrix and the depth value of the third pixel block.

[0079] In a possible implementation manner of the fourth aspect, the prediction unit is further configured to: determine a motion vector of the sixth color attachment according to the second motion vector, and generate the sixth color attachment according to the fourth color attachment and the motion vector of the sixth color attachment. The motion vector of the sixth color attachment is K times of the second motion vector, and K is greater than 0 and less than 1.

[0080] In a possible implementation manner of the fourth aspect, the drawing instruction of the first drawing object comprises an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, the execution drawing instruction of the first drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the first drawing object, and generate a drawing result, and the drawing state device instruction of the first drawing object is used to set the drawing state data on which the execution drawing instruction of the first drawing object depends, and the drawing state data of the first drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the first drawing object.

[0081] In a possible implementation manner of the fourth aspect, the drawing instruction of the second drawing object comprises an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, the execution drawing instruction of the second drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the second drawing object, and generate a drawing result, and the drawing state device instruction of the second drawing object is used to set the drawing state data on which the execution drawing instruction of the second drawing object depends, and the drawing state data of the second drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the second drawing object.

[0082] In a possible implementation manner of the fourth aspect, the drawing instruction of the third drawing object comprises an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, the execution drawing instruction of the third drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the third drawing object, and generate a drawing result, and the drawing state device instruction of the third drawing object is used to set the drawing state data on which the execution drawing instruction of the third drawing object depends, and the drawing state data of the third drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the third drawing object.

[0083] In a possible implementation manner of the fourth aspect, the drawing instruction of the fourth drawing object comprises an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, the execution drawing instruction of the fourth drawing object is used to trigger the electronic device to perform drawing rendering on the drawing state data of the fourth drawing object, and generate a drawing result, and the drawing state device instruction of the fourth drawing object is used to set the drawing state data on which the execution drawing instruction of the fourth drawing object depends, and the drawing state data of the fourth drawing object comprises vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

[0084] With reference to the fourth aspect, in a possible implementation manner, the drawing unit can be further configured to: determine that the transformation matrix parameter exists in the drawing instruction of the first drawing object, and determine that the transformation matrix parameter existing in the drawing instruction of the first drawing object is different from the transformation matrix parameter of the corresponding first drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0085] With reference to the fourth aspect, in a possible implementation manner, the drawing unit can be further configured to: determine that the transformation matrix parameter does not exist in the drawing instruction of the second drawing object, and determine that the transformation matrix parameter existing in the drawing instruction of the second drawing object is the same as the transformation matrix parameter of the corresponding second drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0086] With reference to the fourth aspect, in a possible implementation manner, the drawing unit can be further configured to: determine that the transformation matrix parameter does not exist in the drawing instruction of the fourth drawing object, and determine that the transformation matrix parameter existing in the drawing instruction of the fourth drawing object is the same as the transformation matrix parameter of the corresponding fourth drawing object, the transformation matrix being used to describe a mapping relationship from a local coordinate system of a drawing object to a world coordinate system.

[0087] With reference to the fourth aspect, in a possible implementation manner, the drawing unit can be further configured to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, a sixth memory space and a seventh memory space, wherein the first memory space is used to store the first color attachment, the second memory space is used to store the second color attachment, the third memory space is used to store the third color attachment, the fourth memory space is used to store the fourth color attachment, the fifth memory space is used to store the fifth color attachment, the sixth memory space is used to store the sixth color attachment, and the seventh memory space is used to store the first predicted frame.

[0088] With reference to the fourth aspect, in a possible implementation manner, the drawing unit can be further configured to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.

[0089] In a possible implementation manner of the fourth aspect, the synthesis unit can be further configured to: synthesize the first color attachment and the second color attachment into a first drawing frame in the seventh memory space according to the first depth attachment and the second depth attachment, the third depth attachment being used to write depth data of the first drawing object, and the fourth depth attachment being used to write depth data of the second drawing object.

[0090] In a possible implementation manner of the fourth aspect, the synthesis unit can be further configured to: synthesize the third color attachment and the fourth color attachment into a second drawing frame in the seventh memory space.

[0091] In a possible implementation manner of the fourth aspect, the synthesis unit can be further configured to: synthesize the third color attachment and the fourth color attachment into a second drawing frame in the seventh memory space according to the third depth attachment and the fourth depth attachment, the third depth attachment being used to write depth data of the third drawing object, and the fourth depth attachment being used to write depth data of the fourth drawing object.

[0092] In a fifth aspect, the present application provides a method for image frame prediction, which can include: determining a tenth motion object in a tenth drawing frame according to a tenth drawing instruction, and determining an eleventh motion object in an eleventh drawing frame according to an eleventh drawing instruction by an electronic device; determining that the tenth motion object and the eleventh motion object match according to attributes of the tenth motion object and attributes of the eleventh motion object by the electronic device; and determining a drawing result of a twelfth motion object in a tenth prediction frame according to the tenth motion object and the eleventh motion object by the electronic device.

[0093] Through the method provided by the embodiments of the present application, the electronic device can obtain a prediction frame according to two drawing frames of an application. In this way, the frame rate of the video interface of the application can be improved. Thus, the smoothness of the electronic device displaying the video interface of the application can be improved.

[0094] In a possible implementation manner of the fifth aspect, the tenth drawing frame is displayed on the display screen of the electronic device before the eleventh drawing frame, and the tenth prediction frame is displayed on the display screen of the electronic device after the eleventh drawing frame. That is, the electronic device can predict the prediction frame behind according to the first two drawing frames, so as to improve the frame rate.

[0095] In a possible implementation manner of the fifth aspect, there is one image frame between the tenth drawing frame and the eleventh drawing frame, and the tenth prediction frame is an adjacent image frame after the eleventh drawing frame. For example, the electronic device predicts the fifth prediction frame by using the second drawing frame and the fourth drawing frame. In this way, the electronic device can have enough time to calculate the motion vector and draw the prediction frame, so as to avoid the situation that the fifth drawing frame is not drawn after the electronic device displays the fourth drawing frame, resulting in the video interface being stuck.

[0096] With reference to the fifth aspect, in a possible implementation manner, the electronic device determines that the tenth motion object and the eleventh motion object match according to the first attribute of the tenth motion object and the second attribute of the eleventh motion object, and specifically includes: the electronic device establishes a first index table, the first index table is used to save motion objects and attributes of the motion objects in the tenth drawing frame, and the first index table includes the tenth motion object and the attribute of the tenth motion object; the electronic device establishes a second index table, the second index table is used to save motion objects and attributes of the motion objects in the eleventh drawing frame, and the second index table includes the eleventh motion object and the attribute of the eleventh motion object; and the electronic device takes the eleventh motion object from the second index table and determines the tenth motion object that matches the eleventh motion object from the first index table. In this way, the electronic device can quickly find the tenth motion object that matches the eleventh motion object through the index table.

[0097] With reference to the fifth aspect, in a possible implementation manner, the tenth motion object and the eleventh motion object match includes that the first attribute of the tenth motion object is the same as the second attribute of the eleventh motion object.

[0098] With reference to the fifth aspect, in a possible implementation manner, the electronic device determines the drawing result of the twelfth motion object in the tenth prediction frame according to the tenth motion object and the eleventh motion object, and specifically includes: the electronic device determines a first coordinate of a first point of the tenth motion object and a second coordinate of a second point of the eleventh motion object; the electronic device determines a tenth motion vector of the tenth motion object to the eleventh motion object according to a displacement from the first coordinate to the second coordinate; and the electronic device determines the drawing result of the twelfth motion object in the tenth prediction frame according to the tenth motion vector and the eleventh motion object. In this way, the electronic device can use the motion vector of one point of an object to represent the motion vector of the entire object, without separately determining the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, and thus the power consumption of the electronic device can be saved.

[0099] With reference to the fifth aspect, in a possible implementation manner, the electronic device determines a first coordinate of a first point of the tenth motion object, and specifically includes: the electronic device determines the first coordinate of the first point according to coordinates of all pixel points of the tenth motion object; and the electronic device determines a second coordinate of a second point of the eleventh motion object, and specifically includes: the electronic device determines the second coordinate of the second point according to coordinates of all pixel points of the eleventh motion object.

[0100] Furthermore, the electronic device can obtain the coordinates of each pixel of the tenth moving object from the template image of the tenth moving object using a shader in the GPU. The template image of the tenth moving object is drawn in the GPU. The electronic device can also obtain the coordinates of each pixel of the eleventh moving object from the template image of the eleventh moving object using a shader in the GPU. The template image of the eleventh moving object is drawn in the GPU.

[0101] In conjunction with the fifth aspect, in one possible implementation, the first point is the geometric center point of the tenth moving object, and the second point is the geometric center point of the eleventh moving object. The center point of the moving object is easier to calculate than other points of the moving object, thus reducing the computational load on the electronic device and consequently lowering its power consumption.

[0102] In conjunction with the fifth aspect, in one possible implementation, the electronic device determines the rendering result of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the eleventh moving object. Specifically, the electronic device determines the second pixel of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the first pixel of the eleventh moving object.

[0103] In conjunction with the fifth aspect, in one possible implementation, the electronic device determines the second pixel of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the first pixel of the eleventh moving object. Specifically, this includes: the electronic device determining the eleventh motion vector from the eleventh moving object to the twelfth moving object based on the tenth motion vector; and the electronic device determining the second pixel of the twelfth moving object in the tenth prediction frame based on the eleventh motion vector and the first pixel of the eleventh moving object, wherein the second pixel is the pixel from the first pixel that moved from the eleventh drawing frame to the tenth prediction frame according to the eleventh motion vector.

[0104] In conjunction with the fifth aspect, in one possible implementation, the eleventh motion vector is K times the tenth motion vector, where K is greater than 0 and less than 1.

[0105] In conjunction with the fifth aspect, in one possible implementation, K equals 0.5. This ensures that objects in each image frame move at a constant speed, facilitating calculations by electronic devices and improving the user's video viewing experience.

[0106] Sixthly, an electronic device is provided, comprising: one or more processors (CPU), a graphics processing unit (GPU), a memory, and a display screen; the memory is coupled to one or more processors; the CPU is coupled to the GPU; wherein:

[0107] Memory is used to store computer program code, which includes computer instructions;

[0108] The CPU is used to determine the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and to determine the eleventh moving object in the eleventh drawing frame according to the second drawing instruction;

[0109] The GPU is used to determine the matching of the tenth and eleventh motion objects based on the attributes of the tenth and eleventh motion objects; and to determine the rendering result of the twelfth motion object in the tenth prediction frame based on the tenth and eleventh motion objects.

[0110] The display screen is used to show the tenth drawing frame, the eleventh drawing frame, and the tenth prediction frame.

[0111] The electronic device provided in this application embodiment can obtain a predicted frame based on two frames drawn from the application. This can improve the frame rate of the application's video interface. Therefore, the smoothness of the electronic device displaying the application's video interface can be improved.

[0112] In conjunction with the sixth aspect, in one possible implementation, the tenth rendered frame is displayed on the screen before the eleventh rendered frame, and the tenth predicted frame is displayed on the screen after the eleventh rendered frame. That is, the electronic device can predict the subsequent predicted frames based on the first two rendered frames, thereby improving the frame rate.

[0113] In conjunction with the sixth aspect, in one possible implementation, there is a one-frame interval between the tenth and eleventh drawing frames, and the tenth prediction frame is the image frame immediately following the eleventh drawing frame. For example, the electronic device uses the second and fourth drawing frames to predict the fifth prediction frame. This allows the electronic device sufficient time to calculate the motion vector and draw the prediction frame, avoiding the situation where the fifth drawing frame is not fully drawn after the fourth drawing frame has been displayed, thus preventing video interface stuttering.

[0114] In conjunction with the sixth aspect, in one possible implementation, the CPU is specifically used to: establish a first index table, which stores the moving objects and their attributes in the tenth rendering frame; and establish a second index table, which stores the moving objects and their attributes in the eleventh rendering frame; the GPU is specifically used to: retrieve the eleventh moving object from the second index table and determine the tenth moving object that matches the eleventh moving object from the first index table. In this way, the electronic device can quickly find the tenth moving object that matches the eleventh moving object from the index table.

[0115] With reference to the sixth aspect, in a possible implementation manner, the matching of the tenth motion object and the eleventh motion object includes that attributes of the tenth motion object are same as attributes of the eleventh motion object.

[0116] With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine the first coordinate of the first point of the tenth motion object, and determine the second coordinate of the second point of the eleventh motion object; determine the tenth motion vector of the tenth motion object to the eleventh motion object according to a displacement of the first coordinate to the second coordinate; and determine the rendering result of the twelfth motion object in the tenth prediction frame according to the tenth motion vector and the eleventh motion object. In this way, the electronic device can use the motion vector of one point of an object to represent the motion vector of the entire object, without separately determining the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, and thus the power consumption of the electronic device can be saved.

[0117] With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine the first coordinate of the first point according to coordinates of all pixel points of the tenth motion object; and determine the second coordinate of the second point according to coordinates of all pixel points of the eleventh motion object.

[0118] With reference to the sixth aspect, in a possible implementation manner, the first point is a geometric center point of the tenth motion object, and the second point is a geometric center point of the eleventh motion object.

[0119] With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine a second pixel point of the twelfth motion object in the tenth prediction frame according to the tenth motion vector and a first pixel point of the eleventh motion object.

[0120] With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine an eleventh motion vector of the eleventh motion object moving to the twelfth motion object according to the tenth motion vector; and determine a second pixel point of the twelfth motion object in the tenth prediction frame according to the eleventh motion vector and a first pixel point of the eleventh motion object, the second pixel point being a pixel point of the first pixel point moving from the eleventh rendering frame to the tenth prediction frame according to the eleventh motion vector.

[0121] With reference to the sixth aspect, in a possible implementation manner, the eleventh motion vector is K times of the tenth motion vector, K being greater than 0 and less than 1.

[0122] With reference to the sixth aspect, in a possible implementation manner, K is equal to 0.5.

[0123] The seventh aspect, the embodiment of the present application provides a frame prediction method, characterized in that, the method comprises:

[0124] The electronic device determines a predicted motion vector of the first vertex from the target reference frame to the predicted frame according to predicted motion vectors of blocks around the first vertex from the target reference frame to the predicted frame, wherein the first vertex is one vertex in a first block, the first block is one block in the target reference frame, the target reference frame is one frame determined from a first reference frame or a second reference frame according to a position of the predicted frame relative to the first reference frame or the second reference frame, and the first reference frame and the second reference frame are two adjacent frames in a video stream; determines coordinates of the first vertex in the predicted frame according to coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex; determines a pixel block of the first block in the predicted frame according to coordinates of the vertices of the first block in the predicted frame and in the target reference frame; and displays the predicted frame, which includes the pixel block.

[0125] According to the frame prediction method provided in the seventh aspect of the embodiments of the present application, the electronic device first determines the position of each vertex of a block in a predicted frame according to predicted motion vectors of blocks around the vertex from a target reference frame to the predicted frame, and then calculates the position of each pixel of the block in the predicted frame according to the correspondence between the vertices of the block in the reference frame and in the predicted frame, to finally obtain the entire predicted frame.

[0126] In the frame prediction method described above, the first block in the reference frame is stretched according to the predicted motion vectors of the blocks around the first block, so that the vertices of adjacent blocks in the predicted frame coincide and the blocks are continuous without any holes.

[0127] In combination with the seventh aspect, in a possible implementation, the electronic device obtains the correspondence between the coordinates of the pixels of the first block in the predicted frame and in the target reference frame according to the coordinates of the vertices of the first block in the predicted frame and in the target reference frame, and then determines the coordinates of the pixels in the predicted frame according to the coordinates of the pixels in the target reference frame and the correspondence.

[0128] In combination with the seventh aspect, in a possible implementation, the electronic device inputs the coordinates of the four vertices of the first block in the predicted frame and in the target reference frame into a homographic transformation formula respectively, to obtain a homographic equation set, which includes four equations. The electronic device solves the homographic equation set to obtain a homographic transformation matrix corresponding to the first block, and then obtains a homographic transformation formula corresponding to the first block according to the homographic transformation matrix corresponding to the first block, wherein the homographic transformation formula corresponding to the first block is used to represent the correspondence between the coordinates of the pixels of the first block in the predicted frame and in the target reference frame.

[0129] With reference to the seventh aspect, in a possible implementation manner, the electronic device inputs the coordinates of the first pixel in the target reference frame into the homography transformation formula corresponding to the first block to obtain the coordinates of the first pixel in the predicted frame, and the first pixel is one pixel of the first block.

[0130] With reference to the seventh aspect, in a possible implementation manner, the region of the pixel block includes a number of coordinates greater than the number of coordinates of the first block in the predicted frame, and the region of the pixel block is determined by the vertices of the first block. In this case, the electronic device excludes the coordinates of the pixels of the first block in the predicted frame from the coordinates in the region of the pixel block to obtain first coordinates, and then inputs the first coordinates into the homography transformation formula corresponding to the first block to obtain the pixel in the target reference frame.

[0131] With reference to the seventh aspect, in a possible implementation manner, before the electronic device performs the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the blocks around the first vertex, the electronic device obtains the first reference frame and the second reference frame, and then determines the target reference frame from the first reference frame and the second reference frame according to the position of the frame to be predicted. The target reference frame is divided into blocks according to the first size of the square block, and then the motion vector of the block from the target reference frame to the predicted frame is calculated.

[0132] With reference to the seventh aspect, in a possible implementation manner, when the target reference frame is the first reference frame, the electronic device obtains the motion vector of the first block from the first reference frame to the second reference frame, and then determines half of the motion vector of the first block from the first reference frame to the second reference frame as the predicted motion vector of the first block from the target reference frame to the predicted frame.

[0133] With reference to the seventh aspect, in a possible implementation manner, when the target reference frame is the first reference frame, the electronic device obtains the motion vector of the first block from the second reference frame to the first reference frame, and then determines half of the negative value of the motion vector of the first block from the second reference frame to the first reference frame as the predicted motion vector of the first block from the target reference frame to the predicted frame.

[0134] With reference to the seventh aspect, in a possible implementation manner, the electronic device determines the average value of the predicted motion vectors of the blocks around the first vertex from the target reference frame to the predicted frame as the predicted motion vector of the first vertex from the target reference frame to the predicted frame.

[0135] With reference to the seventh aspect, in a possible implementation manner, the electronic device adds the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex to obtain the coordinates of the first vertex in the predicted frame.

[0136] In an eighth aspect, an electronic device is provided. The electronic device includes one or more processors, a memory, and a display screen. The memory is coupled to the one or more processors. The memory is configured to store computer program codes including computer instructions. The one or more processors are configured to invoke the computer instructions to cause the electronic device to perform the following steps: determining a predicted motion vector of a first vertex from a target reference frame to a predicted frame according to predicted motion vectors of blocks around the first vertex from the target reference frame to the predicted frame, wherein the first vertex is a vertex in a first block, the first block is a block in the target reference frame, the target reference frame is a frame determined from a first reference frame or a second reference frame according to a position of the predicted frame relative to the first reference frame or the second reference frame, and the first reference frame and the second reference frame are two adjacent frames in a video stream; determining coordinates of the first vertex in the predicted frame according to coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex; determining a pixel block of the first block in the predicted frame according to coordinates of vertices of the first block in the predicted frame and in the target reference frame; and displaying the predicted frame including the pixel block through the display screen.

[0137] With reference to the eighth aspect, in a possible implementation, the processor is specifically configured to: obtain a correspondence between coordinates of pixels of the first block in the predicted frame and in the target reference frame according to the coordinates of the vertices of the first block in the predicted frame and in the target reference frame; and determine coordinates of the pixels in the first block in the predicted frame according to the coordinates of the pixels in the target reference frame and the correspondence.

[0138] With reference to the eighth aspect, in a possible implementation, the processor is specifically configured to: input the coordinates of the four vertices of the first block in the predicted frame and in the target reference frame into a homographic transformation formula respectively to obtain a homographic equation set, the homographic equation set including four equations; solve the homographic equation set to obtain a homographic transformation matrix corresponding to the first block; and obtain a homographic transformation formula corresponding to the first block according to the homographic transformation matrix corresponding to the first block, the homographic transformation formula corresponding to the first block being used to represent the correspondence between the coordinates of the pixels of the first block in the predicted frame and in the target reference frame.

[0139] With reference to the eighth aspect, in a possible implementation, the processor is specifically configured to: input the coordinates of the first pixel in the target reference frame into the homographic transformation formula corresponding to the first block to obtain the coordinates of the first pixel in the predicted frame, the first pixel being a pixel of the first block.

[0140] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: obtain the first reference frame and the second reference frame; determine the target reference frame from the first reference frame and the second reference frame according to a position of the frame to be predicted; divide the target reference frame into blocks according to the first size of the square block; and calculate the motion vector of the block from the target reference frame to the predicted frame.

[0141] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: obtain the first reference frame and the second reference frame; determine the target reference frame from the first reference frame and the second reference frame according to a position of the frame to be predicted; divide the target reference frame into blocks according to the first size of the square block; and calculate the motion vector of the block from the target reference frame to the predicted frame.

[0142] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: obtain the motion vector of the first block from the first reference frame to the second reference frame; and determine the half of the negative value of the motion vector of the first block from the second reference frame to the first reference frame as the predicted motion vector of the first block from the target reference frame to the predicted frame.

[0143] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: obtain the motion vector of the first block from the first reference frame to the second reference frame; and determine the half of the negative value of the motion vector of the first block from the second reference frame to the first reference frame as the predicted motion vector of the first block from the target reference frame to the predicted frame.

[0144] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: determine the average value of the predicted motion vectors of the blocks around the first vertex from the target reference frame to the predicted frame as the predicted motion vector of the first vertex from the target reference frame to the predicted frame.

[0145] In a possible implementation manner of the eighth aspect, the processor is specifically configured to: add the coordinate of the first vertex in the target reference frame and the predicted motion vector of the first vertex to obtain the coordinate of the first vertex in the predicted frame.

[0146] In a ninth aspect, the present application provides a method for generating an image frame, which can include: determining the tenth position coordinate of the eleventh vertex of the predicted block in the predicted image frame according to the depth values of the eleventh block and the twelfth block, and the position coordinates of the eleventh block and the twelfth block in the image frame; wherein the eleventh block is a block in the first image frame; the twelfth block is a block matched with the eleventh block in the second image frame determined according to a matching algorithm; generating the predicted block according to the color data of the reference block and the tenth position coordinate, wherein the reference block is one of the eleventh block and the twelfth block; and generating the predicted image frame, wherein the predicted image frame includes the predicted block.

[0147] In a possible implementation manner of the ninth aspect, the color data can be the RGB value of each pixel included in the block.

[0148] It can be seen that, in the embodiments of the present application, the depth value is combined to predict the block, so that the generated prediction block can be scaled according to the depth value, and then the picture displayed by the prediction image frame is more consistent with the scene drawn by the electronic device according to the actual data; when the electronic device inserts the prediction image frame in the original image frame drawn according to the actual data, the transition between the original image frame and the prediction image frame is more natural and smooth, and the user experience is improved.

[0149] In combination with the ninth aspect, in a possible implementation manner, the position coordinates in the image frame are position coordinates in a first coordinate system, the first coordinate system is a two-dimensional coordinate system, and the determination of the tenth position coordinate of the eleventh vertex of the prediction block in the prediction image frame includes: calculating a thirteenth position coordinate in a second coordinate system according to the first depth value of the eleventh block and a twelfth position coordinate of the eleventh block in the first coordinate system, the second coordinate system being a three-dimensional coordinate system; calculating a fifteenth position coordinate in the second coordinate system according to a second depth value of the twelfth block and a fourteenth position coordinate of the twelfth block in the first coordinate system; calculating a sixteenth position coordinate in the second coordinate system according to the thirteenth position coordinate and the fifteenth position coordinate; and calculating the tenth position coordinate in the first coordinate system according to the sixteenth position coordinate.

[0150] In the present application, the first coordinate system can be a screen coordinate system, and the second coordinate system can be a camera coordinate system. Specifically, the position coordinates in the image frame in the present application are coordinates in the screen coordinate system.

[0151] It can be seen that, in the embodiments of the present application, the electronic device can convert the position coordinates in the two-dimensional coordinate system to the three-dimensional space in combination with the depth value, and then realize the prediction of the position coordinates in the three-dimensional space in combination with the changes of three dimensions, and then convert the position coordinates predicted in the three-dimensional space to the two-dimensional space to determine the position coordinates in the two-dimensional coordinate system. In the present example, the prediction of the position coordinates is realized in combination with the data of three dimensions, and then the prediction block can be enlarged and reduced by a certain ratio based on the reference block when the prediction block is generated, so that the finally generated prediction image frame is more similar to the result drawn by the electronic device according to the data of the application.

[0152] In a possible implementation manner of the ninth aspect, before the generating the predicted block, the method further includes: determining a seventeenth position coordinate of a twelfth vertex of the predicted block in the predicted image frame according to depth values of a thirteenth block and a fourteenth block, and position coordinates of the thirteenth block and the fourteenth block in the image frame, wherein the thirteenth block is a block adjacent to the eleventh block, the fourteenth block is a block adjacent to the twelfth block, and the thirteenth block and the fourteenth block are mutually matched blocks determined according to the matching algorithm; determining an eighteenth position coordinate of a thirteenth vertex of the predicted block in the predicted image frame according to depth values of a fifteenth block and a sixteenth block, and position coordinates of the fifteenth block and the sixteenth block in the image frame, wherein the fifteenth block is a block adjacent to the thirteenth block, the sixteenth block is a block adjacent to the fourteenth block, and the fifteenth block and the sixteenth block are mutually matched blocks determined according to the matching algorithm; and determining a nineteenth position coordinate of a fourteenth vertex of the predicted block in the predicted image frame according to depth values of a seventeenth block and an eighteenth block, and position coordinates of the seventeenth block and the eighteenth block in the image frame, wherein the seventeenth block is a block adjacent to both the eleventh block and the fifteenth block, the eighteenth block is a block adjacent to both the twelfth block and the sixteenth block, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.

[0153] It can be seen that the electronic device can determine the position coordinates of the remaining vertices of the predicted block according to the adjacent blocks, so that there is no overlap or gap in the finally generated predicted image frame, which is beneficial to improve the picture display effect of the image frame.

[0154] In a possible implementation manner of the ninth aspect, the position coordinates in the image frame are position coordinates in a first coordinate system, and the determining the seventeenth position coordinate of the twelfth vertex of the predicted block in the predicted image frame according to the depth values of the thirteenth block and the fourteenth block, and the position coordinates of the thirteenth block and the fourteenth block in the image frame includes: calculating a twenty-first position coordinate in a second coordinate system according to the third depth value of the thirteenth block and a twentieth position coordinate of the thirteenth block in the first coordinate system, the second coordinate system being a three-dimensional coordinate system; calculating a twenty-third position coordinate in the second coordinate system according to the second depth value of the fourteenth block and a twenty-second position coordinate of the fourteenth block in the first coordinate system; calculating a twenty-fourth position coordinate in the second coordinate system according to the twenty-first position coordinate and the twenty-third position coordinate; and calculating the seventeenth position coordinate in the first coordinate system according to the twenty-fourth position coordinate.

[0155] In a possible implementation manner of the ninth aspect, the generating the prediction block according to the color data of the reference block and the tenth position coordinate, the reference block being one of the eleventh block or the twelfth block, comprises: determining a correspondence between the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate and position coordinates of four vertices in the reference block; and generating the prediction block according to the correspondence and the color data of the reference block.

[0156] In a possible implementation manner of the ninth aspect, the color data comprises color data of each pixel in the reference block, and the generating the prediction block according to the correspondence and the color data of the reference block comprises: generating a homographic transformation formula according to the correspondence; determining position coordinates of the each pixel in the prediction image frame according to the homographic transformation formula and position coordinates of the each pixel in the reference image frame; and generating the prediction block according to color data of the each pixel and the position coordinates of the each pixel in the prediction image frame.

[0157] In a possible implementation manner of the ninth aspect, the reference block comprises: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and the determining the correspondence between the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate and position coordinates of four vertices in the reference block comprises: determining that the tenth position coordinate and position coordinates of the fifteenth vertex are a group of corresponding position coordinates; determining that the seventeenth position coordinate and position coordinates of the sixteenth vertex are a group of corresponding position coordinates; determining that the eighteenth position coordinate and position coordinates of the seventeenth vertex are a group of corresponding position coordinates; and determining that the nineteenth position coordinate and position coordinates of the eighteenth vertex are a group of corresponding position coordinates; wherein the reference block is a quadrilateral, the fifteenth vertex has the same position relative to a center point of the reference block as the eleventh block relative to the fifteenth block; the sixteenth vertex has the same position relative to the center point of the reference block as the thirteenth block relative to the seventeenth block; the seventeenth vertex has the same position relative to the center point of the reference block as the fifteenth block relative to the eleventh block; and the eighteenth vertex has the same position relative to the center point of the reference block as the seventeenth block relative to the thirteenth block.

[0158] For example, the reference block is a square, the fifteenth vertex is a vertex of the upper left corner of the reference block, the sixteenth vertex is a vertex of the upper right corner of the reference block, the seventeenth vertex is a vertex of the upper left corner of the reference block, and the eighteenth vertex is a vertex of the upper right corner of the reference block; the thirteenth block is a block adjacent to the eleventh block on the right side, the seventeenth block is a block adjacent to the eleventh block on the lower side, the fifteenth block is a block adjacent to the thirteenth block and the seventeenth block, and a vertex of the upper left corner of the fifteenth block coincides with a vertex of the lower right corner of the eleventh block.

[0159] With reference to the ninth aspect, in a possible implementation, the calculating, according to the thirteenth position coordinate and the fifteenth position coordinate, of a sixteenth position coordinate in the second coordinate system includes: calculating a displacement vector from the thirteenth position coordinate to the fifteenth position coordinate to obtain a first displacement vector; and calculating the sixteenth position coordinate according to the thirteenth position coordinate or the fifteenth position coordinate and a first proportion of the first displacement vector.

[0160] With reference to the ninth aspect, in a possible implementation, the first proportion is equal to a preset value.

[0161] It can be seen that, in the case where the first proportion is equal to a preset value, the electronic device can quickly determine the sixteenth position coordinate.

[0162] With reference to the ninth aspect, in a possible implementation, the image frame in which the reference block is located is a reference image frame, the first image frame is located before the second image frame in a data stream, and before the calculating of the sixteenth position coordinate, the method further includes: determining that the first proportion is equal to a ratio of an absolute value of a first time difference value to an absolute value of a second time difference value; the first time difference value is equal to a difference between a time point of the prediction image frame in the data stream and a time point of the reference frame in the data stream; and the second time difference value is equal to a difference between a time point of the first image frame in the data stream and a time point of the second image frame in the data stream.

[0163] It can be seen that the electronic device can determine the first proportion according to a difference between the prediction image frame and the reference image frame, so that a scene (relative to the reference image frame, a position of a block and a scaling degree) displayed by the prediction image frame is more consistent with a scene constructed by the electronic device according to actual running data at a time when the prediction image frame is displayed.

[0164] With reference to the ninth aspect, in a possible implementation manner, the image frame in which the reference block is located is a reference image frame, the first image frame is located before the second image frame in a data stream, and before the calculation of the sixteenth position coordinate, the method further includes: determining that the first ratio is equal to a ratio of a first number plus one to a second number plus one, the first number is equal to a number of image frames that are spaced between the reference image frame and the prediction image frame in the data stream, and the second number is equal to the number of image frames that are spaced between the reference image frame and the prediction image frame in the data stream.

[0165] It can be seen that the electronic device can determine the first ratio according to the number of image frames that are spaced between the prediction image frame and the reference image frame, so that the scene (relative to the reference image frame, the position and the scaling degree of the block) displayed by the prediction image frame is more consistent with the scene constructed by the electronic device according to the actual running data at the time when the prediction image frame is displayed in the process of displaying each image frame at a constant speed.

[0166] With reference to the ninth aspect, in a possible implementation manner, the calculation of the sixteenth position coordinate according to the thirteenth position coordinate or the fifteenth position coordinate and the first displacement vector of the first ratio includes: if the reference image frame is the first image frame, the sixteenth position coordinate is calculated according to the thirteenth position coordinate and the first displacement vector of the first ratio; or if the reference image frame is the second image frame, the sixteenth position coordinate is calculated according to the fifteenth position coordinate and the first displacement vector of the first ratio.

[0167] With reference to the ninth aspect, in a possible implementation manner, the image frame in which the reference block is located is a reference image frame, the first image frame is located before the second image frame in a data stream, and before the determination of the tenth position coordinate of the eleventh vertex of the prediction block in the prediction image frame, the method further includes: determining that one of the first image frame and the second image frame is the reference image frame; determining that the other of the first image frame and the second image frame, which is different from the reference image frame, is a matching image frame; performing block division on the reference image frame to obtain the reference block; and determining, according to the matching algorithm, that a block in the matching image frame that matches the reference block is a matching block; wherein if the reference block is the eleventh block, the matching block is the twelfth block; or if the reference block is the twelfth block, the matching block is the eleventh block.

[0168] The electronic device can specify one of the first image frame or the second image frame as a reference image frame, for example, the electronic device can specify the first image frame before the prediction image frame in the data stream as the reference image frame. Alternatively, the electronic device can determine one of the first image frame and the second image frame as the reference image frame based on a position of the prediction image frame relative to the first image frame and the second image frame; specifically, if the prediction image frame is located between the first image frame and the second image frame in the data stream, the electronic device can determine the first image frame as the reference image frame; if the prediction image frame is located after the first image frame and the second image frame in the data stream, the electronic device can determine the second image frame as the reference image frame.

[0169] It can be seen that the electronic device can perform block division on the reference image frame, and search for a block in the matching image frame in units of blocks in the reference image frame, and then determine the blocks in the first image frame and the second image frame that match each other.

[0170] With reference to the ninth aspect, in a possible implementation, the determining, according to the matching algorithm, of the block in the matching image frame that matches the reference block as the matching block includes: determining, as the matching block, the block in a first region of the matching image frame that has the highest similarity with the reference block; the first region is a region of a preset shape with a first area and centered at a reference position coordinate in the matching image frame, and the reference position coordinate is a position coordinate of the reference block in the reference image frame.

[0171] It can be seen that the electronic device can determine the first region in the matching image frame according to the position coordinate of the reference block, which can reduce the search range to a certain extent, and thus is conducive to improving the matching efficiency and accuracy of the block.

[0172] With reference to the ninth aspect, in a possible implementation, before the determining, as the matching block, of the block in the first region of the matching image frame that has the highest similarity with the reference block, the method further includes: calculating the first area according to a reference depth value of the reference block, where the greater the reference depth value, the smaller the calculated first area.

[0173] It can be seen that the electronic device can adjust the size of the first area according to the size of the depth value, which is conducive to improving the efficiency of determining the matching block.

[0174] In a possible implementation manner of the ninth aspect, before the determining the block in the first area of the matching image frame that has the highest similarity with the reference block as the matching block, the method further includes: if a reference depth value of the reference block is greater than or equal to a first threshold value, determining that the first area is equal to a first preset area; if the reference depth value is greater than a second threshold value and less than the first threshold value, calculating the first area according to the reference depth value, wherein the greater the reference depth value is, the smaller the first area is; if the reference depth value is less than or equal to the second threshold value, determining that the first area is equal to a second preset area; wherein the first threshold value is greater than the second threshold value, and the second preset area is greater than the first preset area.

[0175] For example, the depth value can be greater than or equal to 0 and less than or equal to 1, the first threshold value is equal to 0.8, the second threshold value is equal to 0.2, the first preset area can be twice the area of the reference block, and the second preset area can be equal to the area of the reference image frame.

[0176] It can be seen that when the depth value is large, the electronic device searches for the matching block of the reference block in a small range; and when the depth value is small, the electronic device searches for the matching block of the reference block in the entire image frame. This is beneficial to improving the efficiency of determining the matching block.

[0177] In a tenth aspect, the present application provides an electronic device, which includes one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes, the computer program codes include computer instructions, and the one or more processors invoke the computer instructions to enable the electronic device to perform: determining a tenth position coordinate of an eleventh vertex of a prediction block in a prediction image frame according to a depth value of an eleventh block and a twelfth block, and position coordinates of the eleventh block and the twelfth block in an image frame; wherein the eleventh block is a block in a first image frame; the twelfth block is a block matched with the eleventh block in a second image frame according to a matching algorithm; generating the prediction block according to color data of a reference block and the tenth position coordinate, the reference block being one of the eleventh block and the twelfth block; and generating the prediction image frame, the prediction image frame including the prediction block.

[0178] In a possible implementation manner of the tenth aspect, the position coordinates in the image frame are position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system. In the determination of the tenth position coordinate of the eleventh vertex of the prediction block in the prediction image frame, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: calculating a thirteenth position coordinate in a second coordinate system according to the first depth value of the eleventh block and a twelfth position coordinate of the eleventh block in the first coordinate system, the second coordinate system being a three-dimensional coordinate system; calculating a fifteenth position coordinate in the second coordinate system according to a second depth value of the twelfth block and a fourteenth position coordinate of the twelfth block in the first coordinate system; calculating a sixteenth position coordinate in the second coordinate system according to the thirteenth position coordinate and the fifteenth position coordinate; and calculating the tenth position coordinate in the first coordinate system according to the sixteenth position coordinate.

[0179] In a possible implementation manner of the tenth aspect, before the generation of the prediction block, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: determining a seventeenth position coordinate of a twelfth vertex of the prediction block in the prediction image frame according to depth values of a thirteenth block and a fourteenth block, and position coordinates of the thirteenth block and the fourteenth block in the image frame, wherein the thirteenth block is a block adjacent to the eleventh block, the fourteenth block is a block adjacent to the twelfth block, and the thirteenth block and the fourteenth block are mutually matched blocks determined according to the matching algorithm; determining an eighteenth position coordinate of a thirteenth vertex of the prediction block in the prediction image frame according to depth values of a fifteenth block and a sixteenth block, and position coordinates of the fifteenth block and the sixteenth block in the image frame, wherein the fifteenth block is a block adjacent to the thirteenth block, the sixteenth block is a block adjacent to the fourteenth block, and the fifteenth block and the sixteenth block are mutually matched blocks determined according to the matching algorithm; and determining a nineteenth position coordinate of a fourteenth vertex of the prediction block in the prediction image frame according to depth values of a seventeenth block and an eighteenth block, and position coordinates of the seventeenth block and the eighteenth block in the image frame, wherein the seventeenth block is a block adjacent to both the eleventh block and the fifteenth block, the eighteenth block is a block adjacent to both the twelfth block and the sixteenth block, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.

[0180] In a possible implementation manner of the tenth aspect, in the aspect of determining the seventeenth position coordinate of the twelfth vertex of the prediction block in the prediction image frame according to the depth values of the thirteenth block and the fourteenth block, the position coordinates of the thirteenth block and the fourteenth block in the image frame, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: calculating a twenty-first position coordinate in a second coordinate system according to the third depth value of the thirteenth block and a twentieth position coordinate of the thirteenth block in the first coordinate system, the second coordinate system being a three-dimensional coordinate system; calculating a twenty-third position coordinate in the second coordinate system according to the second depth value of the fourteenth block and a twenty-second position coordinate of the fourteenth block in the first coordinate system; calculating a twenty-fourth position coordinate in the second coordinate system according to the twenty-first position coordinate and the twenty-third position coordinate; and calculating the seventeenth position coordinate in the first coordinate system according to the twenty-fourth position coordinate.

[0181] In a possible implementation manner of the tenth aspect, in the aspect of generating the prediction block according to the color data of the reference block and the tenth position coordinate, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining a correspondence relationship between the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate and position coordinates of four vertices in the reference block; and generating the prediction block according to the correspondence relationship and the color data of the reference block.

[0182] In a possible implementation manner of the tenth aspect, in the aspect of including the color data of each pixel in the reference block in the color data, and generating the prediction block according to the correspondence relationship and the color data of the reference block, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: generating a homographic transformation formula according to the correspondence relationship; determining a position coordinate of each pixel in the prediction image frame according to the homographic transformation formula and the position coordinate of each pixel in the reference image frame; and generating the prediction block according to the color data of each pixel and the position coordinate of each pixel in the prediction image frame.

[0183] With reference to the tenth aspect, in a possible implementation manner, the reference block includes: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, in the determination of the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate corresponding to the position coordinates of the four vertices in the reference block, the one or more processors are specifically configured to invoke the computer instructions to enable the electronic device to perform: determining that the tenth position coordinate and the position coordinate of the fifteenth vertex are a set of corresponding position coordinates; determining that the seventeenth position coordinate and the position coordinate of the sixteenth vertex are a set of corresponding position vertices; determining that the eighteenth position coordinate and the position coordinate of the seventeenth vertex are a set of corresponding position coordinates; and determining that the nineteenth position coordinate and the position coordinate of the eighteenth vertex are a set of corresponding position coordinates; wherein the reference block is a quadrilateral, the position direction of the fifteenth vertex relative to the center point of the reference block is the same as the position direction of the eleventh block relative to the fifteenth block; the position direction of the sixteenth vertex relative to the center point of the reference block is the same as the position direction of the thirteenth block relative to the seventeenth block; the position direction of the seventeenth vertex relative to the center point of the reference block is the same as the position direction of the fifteenth block relative to the eleventh block; and the position direction of the eighteenth vertex relative to the center point of the reference block is the same as the position direction of the seventeenth block relative to the thirteenth block.

[0184] With reference to the tenth aspect, in a possible implementation manner, in the calculation of the sixteenth position coordinate in the second coordinate system according to the thirteenth position coordinate and the fifteenth position coordinate, the one or more processors are specifically configured to invoke the computer instructions to enable the electronic device to perform: calculating a displacement vector from the thirteenth position coordinate to the fifteenth position coordinate to obtain a first displacement vector; and calculating the sixteenth position coordinate according to the thirteenth position coordinate or the fifteenth position coordinate and a first proportion of the first displacement vector.

[0185] With reference to the tenth aspect, in a possible implementation manner, the first proportion is equal to a preset value.

[0186] With reference to the tenth aspect, in a possible implementation manner, the image frame in which the reference block is located is a reference image frame, the first image frame is located before the second image frame in a data stream, and before the calculation of the sixteenth position coordinate, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: determining that the first ratio is equal to a ratio of an absolute value of a first time difference value to an absolute value of a second time difference value; the first time difference value is equal to a difference between a time point of the prediction image frame in the data stream and a time point of the reference frame in the data stream; and the second time difference value is equal to a difference between a time point of the first image frame in the data stream and a time point of the second image frame in the data stream.

[0187] With reference to the tenth aspect, in a possible implementation manner, the image frame in which the reference block is located is a reference image frame, the first image frame is located before the second image frame in a data stream, and before the calculation of the sixteenth position coordinate, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: determining that the first ratio is equal to a ratio of a first value to a second value; the first value is equal to a first quantity plus one; the second value is equal to a second quantity plus one; the first quantity is equal to a quantity of image frames that are spaced between the reference image frame and the prediction image frame in the data stream; and the second quantity is equal to a quantity of image frames that are spaced between the reference image frame and the prediction image frame in the data stream.

[0188] With reference to the tenth aspect, in a possible implementation manner, in the calculation of the sixteenth position coordinate according to the thirteenth position coordinate or the fifteenth position coordinate and the first displacement vector of the first ratio, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: if the reference image frame is the first image frame, calculating the sixteenth position coordinate according to the thirteenth position coordinate and the first displacement vector of the first ratio; or if the reference image frame is the second image frame, calculating the sixteenth position coordinate according to the fifteenth position coordinate and the first displacement vector of the first ratio.

[0189] With reference to the tenth aspect, in a possible implementation manner, the image frame in which the reference block is located is a reference image frame, and the first image frame is located before the second image frame in a data stream, before the determining the tenth position coordinate of the eleventh vertex of the prediction block in the prediction image frame, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: determining one of the first image frame and the second image frame as the reference image frame; determining another of the first image frame and the second image frame other than the reference image frame as a matching image frame; performing block division on the reference image frame to obtain the reference block; determining, according to the matching algorithm, a block in the matching image frame that matches the reference block as a matching block; and wherein, if the reference block is the eleventh block, the matching block is the twelfth block; and if the reference block is the twelfth block, the matching is the eleventh block.

[0190] With reference to the tenth aspect, in a possible implementation manner, in the determining, according to the matching algorithm, a block in the matching image frame that matches the reference block as a matching block, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: determining, as the matching block, a block in a first region of the matching image frame that has the highest similarity with the reference block; the first region is a region of a preset shape with a first area in the matching image frame and centered at a reference position coordinate, and the reference position coordinate is a position coordinate of the reference block in the reference image frame.

[0191] With reference to the tenth aspect, in a possible implementation manner, before the determining, as the matching block, a block in a first region of the matching image frame that has the highest similarity with the reference block, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: calculating the first area according to a reference depth value of the reference block, wherein the greater the reference depth value, the smaller the calculated first area.

[0192] With reference to the tenth aspect, in a possible implementation manner, before the one or more processors determine the block in the first area of the matching image frame that has the highest similarity with the reference block as the matching block, the one or more processors further invoke the computer instructions to cause the electronic device to perform: if a reference depth value of the reference block is greater than or equal to a first threshold value, determining that the first area is equal to a first preset area; if the reference depth value is greater than a second threshold value and less than the first threshold value, calculating the first area according to the reference depth value, wherein the greater the reference depth value, the smaller the first area; if the reference depth value is less than or equal to the second threshold value, determining that the first area is equal to a second preset area; wherein the first threshold value is greater than the second threshold value, and the second preset area is greater than the first preset area.

[0193] With reference to the eleventh aspect, a method for generating an image frame is provided, which can include: in a first drawing period, according to a drawing instruction of a target application program, when the drawing instruction satisfies a first condition, storing a drawing result in a seventh storage space as a first drawing result, and when the drawing instruction satisfies a second condition, storing the drawing result in an eighth storage space as a second drawing result; generating a seventh image frame according to the first drawing result and the second drawing result; in a second drawing period, according to the drawing instruction of the target application program, when the drawing instruction satisfies the first condition, storing a drawing result in the seventh storage space as a third drawing result, and when the drawing instruction satisfies the second condition, not performing drawing; generating an eighth image frame according to the third drawing result and the second drawing result. Wherein, the effect of the drawing result generated when the drawing instruction satisfies the first condition presented on a display screen can be a dynamic interface. The effect of the drawing result generated when the drawing instruction satisfies the second condition presented on the display screen can be a control. In this way, by implementing the method of the first aspect, the electronic device can store the drawing results obtained according to the drawing instructions under different conditions in different storage spaces according to the drawing instruction of the target application program, so that one drawing result can be shared in two drawing periods; the drawing time of the electronic device when the drawing instruction satisfies the second condition is reduced, and the power consumption of the electronic device is reduced.

[0194] With reference to the eleventh aspect, in a possible implementation manner, the method further includes: in a third drawing cycle, according to the drawing instruction of the target application program, when the drawing instruction meets the first condition, storing a drawing result in the seventh storage space as a fourth drawing result, and when the drawing instruction meets the second condition, storing the drawing result in the eighth storage space as a fifth drawing result, the third drawing cycle is after the first drawing cycle; generating a ninth image frame according to the fourth drawing result and the fifth drawing result; in a fourth drawing cycle, generating a sixth drawing result according to the first drawing result and the fourth drawing result; generating a tenth image frame according to the sixth drawing result and the seventh drawing result; the seventh drawing result is a drawing result obtained when the drawing instruction of the target application program meets the second condition in a fifth drawing cycle, and the fifth drawing cycle is before the fourth drawing cycle. In this example, the method can be used in an interpolation scene. The electronic device can generate a predicted sixth drawing result according to a drawing result when two drawing instructions meet the first condition, and generate a predicted interpolation image frame in combination with a seventh drawing result obtained when a drawing instruction meets the second condition in a previous drawing cycle. In the process of generating the predicted interpolation image frame, the electronic device can reuse the seventh drawing result, thereby reducing power consumption when generating the interpolation image frame. In the process of generating the interpolation image frame, the effect of the seventh drawing result in the image frame does not need to be predicted and calculated, the electronic device only needs to calculate and predict according to a drawing result when two drawing instructions meet the first condition, compared with a general interpolation method, the electronic device does not need to calculate according to data of an entire image frame, thereby further reducing power consumption of the electronic device.

[0195] With reference to the eleventh aspect, in a possible implementation manner, in the process in which the electronic device generates the seventh image frame according to the first drawing result and the second drawing result, the method includes: storing the first drawing result and the second drawing result in a ninth storage space; and generating the seventh image frame according to the first drawing result and the second drawing result in the ninth storage space.

[0196] With reference to the eleventh aspect, in a possible implementation manner, in the process in which the electronic device generates the ninth image frame according to the fourth drawing result and the fifth drawing result, the method includes: storing the fourth drawing result and the fifth drawing result in the ninth storage space; and generating the ninth image frame according to the fourth drawing result and the fifth drawing result in the ninth storage space.

[0197] With reference to the eleventh aspect, in a possible implementation manner, in the generating the tenth image frame according to the sixth rendering result and the seventh rendering result, the method includes: storing the sixth rendering result and the seventh rendering result in the ninth storage space; and generating the tenth image frame according to the sixth rendering result and the seventh rendering result in the ninth storage space.

[0198] With reference to the eleventh aspect, in a possible implementation manner, the seventh storage space is composed of a tenth storage space and an eleventh storage space, the first rendering result is stored in the tenth storage space, and the fourth rendering result is stored in the eleventh storage space. In the generating the sixth rendering result according to the first rendering result and the fourth rendering result, the method includes: storing the first rendering result in the eleventh storage space; and generating the sixth rendering result according to the first rendering result and the fourth rendering result in the eleventh storage space.

[0199] With reference to the eleventh aspect, in a possible implementation manner, the seventh storage space is composed of at least three storage spaces, and the at least three storage spaces include a tenth storage space, an eleventh storage space and a twelfth storage space. The first rendering result is stored in the tenth storage space, and the fourth rendering result is stored in the eleventh storage space. In the generating the sixth rendering result according to the first rendering result and the fourth rendering result, the method includes: storing the first rendering result and the fourth rendering result in the twelfth storage space; and generating the sixth rendering result according to the first rendering result and the fourth rendering result in the twelfth storage space.

[0200] With reference to the eleventh aspect, in a possible implementation manner, the third rendering period is adjacent to the fourth rendering period, the fifth rendering period is the same as the third rendering period, and the fifth rendering result is the same as the seventh rendering result. In generating the inserted image frame, the electronic device can reuse the rendering result used to generate the previous frame of image, thereby reducing the power consumption of the electronic device.

[0201] With reference to the eleventh aspect, in a possible implementation manner, in the generating the seventh image frame according to the first rendering result and the second rendering result, the method includes: storing the second rendering result in the seventh storage space; and generating the seventh image frame according to the first rendering result and the second rendering result in the seventh storage space.

[0202] With reference to the eleventh aspect, in a possible implementation manner, the electronic device applying the method comprises a counting unit; an initial value of the counting unit is a first value; a value of the counting unit is switched between the first value and a second value every time the value is updated; the counting unit is updated at a beginning of a drawing period; in a drawing period, if the updated value of the counting unit is the second value, the eighth storage space is emptied at the beginning of the drawing period; and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space; if the updated value of the counting unit is the first value, the eighth storage space is not emptied at the beginning of the drawing period; and when the drawing instruction satisfies the second condition, the drawing is not performed. It can be seen that, by setting the counting unit, the electronic device can share the drawing result obtained when the drawing instruction satisfies the second condition every two adjacent drawing periods in the process of drawing according to the drawing instruction of the target application program, thereby reducing the data processing amount in the drawing process of the electronic device and reducing the power consumption of the electronic device.

[0203] With reference to the eleventh aspect, in a possible implementation manner, the method further comprises: generating a fourth drawing result according to the first drawing result and the third drawing result at a third drawing period; and generating a ninth image frame according to the second drawing result and the fourth drawing result.

[0204] With reference to the eleventh aspect, in a possible implementation manner, the electronic device applying the method comprises a counting unit, an initial value of the counting unit is a first value, and the counting unit is repeatedly updated and switched among the first value, a second value, and a third value in sequence. The counting unit is updated at a beginning of a drawing period, in a drawing period, if the updated value of the counting unit is the second value, the eighth storage space is emptied at the beginning of the drawing period; and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space; if the updated value of the counting unit is the first value or the third value, the eighth storage space is not emptied at the beginning of the drawing period; and when the drawing instruction satisfies the second condition, the drawing is not performed. It can be seen that, by setting the counting unit, the electronic device can share the drawing result obtained when the drawing instruction satisfies the second condition every three drawing periods in the process of drawing according to the drawing instruction of the target application program, thereby reducing the data processing amount in the drawing process of the electronic device and reducing the power consumption of the electronic device.

[0205] With reference to the eleventh aspect, in a possible implementation manner, the ninth storage space is formed by at least two storage spaces, and the at least two storage spaces are alternated between the first state and the second state according to the first instruction of the target application program when the target application program runs; at the same time point, only one of the at least two storage spaces is in the first state, and the rest of the storage spaces are in the second state; when the at least two storage spaces are in the first state, the image frames in the at least two storage spaces can be transmitted to the display device for display; when the at least two storage spaces are in the second state, the electronic device can draw in the at least two storage spaces; two image frames generated in two adjacent drawing periods are respectively stored in two different storage spaces in the ninth storage space. It can be seen that the electronic device can alternate the storage spaces storing the image frames, draw the next image frame in the process of displaying the previous image frame, and improve the efficiency of generating and displaying the image frames by the electronic device.

[0206] With reference to the eleventh aspect, in a possible implementation manner, the first condition is that the drawing instruction includes an instruction of enabling the depth test, and the second condition is that the drawing instruction includes an instruction of disabling the depth test. It can be seen that, by using the instructions of enabling or disabling the depth test, the drawing result is divided, and then the layer for the display space is reused, the data processing amount in the process of drawing the image frame is reduced under the condition that the display effect according to the image frame is less affected or even not affected, and the power consumption of the electronic device is reduced.

[0207] With reference to the eleventh aspect, in a possible implementation manner, the time nodes of any two adjacent drawing periods are time points at which the second instruction is called by the target application program. The first instruction and the second instruction can be the same instruction. That is, the electronic device can be regarded as the end of the previous drawing period and the start of the next drawing period in the two adjacent drawing periods when the storage space storing the image frame is alternated once.

[0208] In a twelfth aspect, an electronic device is provided, which includes one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is configured to store computer program codes including computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the electronic device to perform: in a first drawing cycle, according to drawing instructions of a target application program, when the drawing instructions meet a first condition, storing a drawing result in a seventh storage space as a first drawing result, and when the drawing instructions meet a second condition, storing the drawing result in an eighth storage space as a second drawing result; generating a seventh image frame according to the first drawing result and the second drawing result; in a second drawing cycle, according to the drawing instructions of the target application program, when the drawing instructions meet the first condition, storing a drawing result in the seventh storage space as a third drawing result, and when the drawing instructions meet the second condition, not performing drawing; and generating an eighth image frame according to the third drawing result and the second drawing result.

[0209] With reference to the twelfth aspect, in a possible implementation, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: in a third drawing cycle, according to drawing instructions of a target application program, when the drawing instructions meet a first condition, storing a drawing result in the seventh storage space as a fourth drawing result, and when the drawing instructions meet a second condition, storing the drawing result in the eighth storage space as a fifth drawing result, the third drawing cycle being subsequent to the first drawing cycle; generating a ninth image frame according to the fourth drawing result and the fifth drawing result; in a fourth drawing cycle, generating a sixth drawing result according to the first drawing result and the fourth drawing result; generating a tenth image frame according to the sixth drawing result and the seventh drawing result; the seventh drawing result being a drawing result obtained when the drawing instructions of the target application program meet the second condition in a fifth drawing cycle, the fifth drawing cycle being prior to the fourth drawing cycle.

[0210] With reference to the twelfth aspect, in a possible implementation, in the aspect of generating the seventh image frame according to the first drawing result and the second drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the first drawing result and the second drawing result in a ninth storage space; and generating the seventh image frame according to the first drawing result and the second drawing result in the ninth storage space.

[0211] With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the ninth image frame according to the fourth drawing result and the fifth drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the fourth drawing result and the fifth drawing result into the ninth storage space; and generating the ninth image frame according to the fourth drawing result and the fifth drawing result in the ninth storage space.

[0212] With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the tenth image frame according to the sixth drawing result and the seventh drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the sixth drawing result and the seventh drawing result into the ninth storage space; and generating the tenth image frame according to the sixth drawing result and the seventh drawing result in the ninth storage space.

[0213] With reference to the twelfth aspect, in a possible implementation manner, the seventh storage space is composed of a tenth storage space and an eleventh storage space, the first drawing result is stored in the tenth storage space, and the fourth drawing result is stored in the eleventh storage space; in the aspect of generating the sixth drawing result according to the first drawing result and the fourth drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the first drawing result into the eleventh storage space; and generating the sixth drawing result according to the first drawing result and the fourth drawing result in the eleventh storage space.

[0214] With reference to the twelfth aspect, in a possible implementation manner, the seventh storage space is composed of at least three storage spaces, the at least three storage spaces include a tenth storage space, an eleventh storage space and a twelfth storage space; the first drawing result is stored in the tenth storage space, and the fourth drawing result is stored in the eleventh storage space; in the aspect of generating the sixth drawing result according to the first drawing result and the fourth drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the first drawing result and the fourth drawing result into the twelfth storage space; and generating the sixth drawing result according to the first drawing result and the fourth drawing result in the twelfth storage space.

[0215] With reference to the twelfth aspect, in a possible implementation manner, the third drawing period is adjacent to the fourth drawing period; the fifth drawing period is the same as the third drawing period, and the fifth drawing result is the same as the seventh drawing result.

[0216] With reference to the twelfth aspect, in a possible implementation manner, in the generating the seventh image frame according to the first drawing result and the second drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: storing the second drawing result into the seventh storage space; and generating the seventh image frame according to the first drawing result and the second drawing result in the seventh storage space.

[0217] With reference to the twelfth aspect, in a possible implementation manner, the electronic device comprises a counting unit, an initial value of the counting unit is a first value, a value of the counting unit is switched between a first value and a second value once every time the value is updated, the counting unit is updated at a beginning of a drawing period, in a drawing period, if the updated value of the counting unit is the second value, the eighth storage space is emptied at the beginning of the drawing period, and the drawing result is stored into the eighth storage space when the drawing instruction meets the second condition; if the updated value of the counting unit is the first value, the eighth storage space is not emptied at the beginning of the drawing period, and the drawing is not performed when the drawing instruction meets the second condition.

[0218] With reference to the twelfth aspect, in a possible implementation manner, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to perform: generating a fourth drawing result according to the first drawing result and the third drawing result at a third drawing period; and generating a ninth image frame according to the second drawing result and the fourth drawing result.

[0219] With reference to the twelfth aspect, in a possible implementation manner, the electronic device comprises a counting unit, an initial value of the counting unit is a first value, the counting unit is repeatedly updated and switched among three values in a sequence of the first value, the second value and the third value, the counting unit is updated at a beginning of a drawing period, in a drawing period, if the updated value of the counting unit is the second value, the eighth storage space is emptied at the beginning of the drawing period, and the drawing result is stored into the eighth storage space when the drawing instruction meets the second condition; if the updated value of the counting unit is the first value or the third value, the eighth storage space is not emptied at the beginning of the drawing period, and the drawing is not performed when the drawing instruction meets the second condition.

[0220] With reference to the twelfth aspect, in a possible implementation manner, the ninth storage space is composed of at least two storage spaces, and the at least two storage spaces are alternated between the first state and the second state according to the first instruction of the target application when the target application is running; at the same time point, only one of the at least two storage spaces is in the first state, and the rest of the storage spaces are in the second state; when the at least two storage spaces are in the first state, the image frames in the at least two storage spaces can be transmitted to the display device for display; when the at least two storage spaces are in the second state, the electronic device can draw in the at least two storage spaces; two image frames generated in two adjacent drawing periods are respectively stored in two different storage spaces in the ninth storage space.

[0221] With reference to the twelfth aspect, in a possible implementation manner, the first condition is that the drawing instruction contains an instruction of enabling the depth test; and the second condition is that the drawing instruction contains an instruction of disabling the depth test.

[0222] With reference to the twelfth aspect, in a possible implementation manner, the time points of any two adjacent drawing periods are time points at which the second instruction is called by the target application.

[0223] With reference to the thirteenth aspect, an embodiment of the present application provides a method for image frame prediction, which can include: when a twenty-first drawing frame of a first application is drawn, an electronic device draws drawing instructions of the twenty-first drawing frame according to a first drawing range to obtain a twenty-first drawing result, a size of the first drawing range is greater than a size of the twenty-first drawing frame of the first application; when a twenty-second drawing frame of the first application is drawn, the electronic device draws drawing instructions of the twenty-second drawing frame according to a second drawing range to obtain a twenty-second drawing result, a size of the twenty-second memory space is greater than a size of the twenty-second drawing frame, wherein the size of the twenty-first drawing frame is the same as the size of the twenty-second drawing frame; and the electronic device generates a twenty-third prediction frame of the first application according to the twenty-first drawing result and the twenty-second drawing result, wherein the size of the twenty-third prediction frame is the same as the size of the twenty-first drawing frame.

[0224] In this way, the electronic device can obtain a prediction frame. Without increasing the drawing frame, the frame rate of the electronic device can be improved. In this way, the video interface displayed by the electronic device can be more fluent while saving the power consumption of the electronic device. Further, the prediction frame predicted by the electronic device can contain drawing content that is not contained in the twenty-first drawing frame and the twenty-second drawing frame displayed by the electronic device. Thus, the drawing content in the prediction frame predicted by the electronic device is closer to the shooting content in the shooting field of view of the camera. Therefore, the image frame predicted by the electronic device can be more accurate.

[0225] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device draws the drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, and the specific process includes: the electronic device modifies a first parameter in the first drawing instruction of the twenty-first drawing frame issued by the first application to the first drawing range; the first parameter is used to set the size of the drawing range of the twenty-first drawing frame; and the electronic device draws the modified drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result.

[0226] With reference to the thirteenth aspect, in a possible implementation manner, the size of the first drawing range is greater than the size of the twenty-first drawing frame of the first application, and the specific process includes: the width of the first drawing range is K3 times the width of the twenty-first drawing frame, and the height of the first drawing range is K4 times the height of the twenty-first drawing frame, K3 and K4 are greater than 1.

[0227] With reference to the thirteenth aspect, in a possible implementation manner, K3 and K4 are fixed values configured by the system of the electronic device, or are determined by the electronic device according to a drawing parameter contained in the drawing instruction of the twenty-first drawing frame.

[0228] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device draws the drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, and the specific process includes: the electronic device generates a first conversion matrix according to K3 and K4, the electronic device adjusts the size of the drawing content in the modified drawing instruction of the twenty-first drawing frame according to the first conversion matrix, and draws the adjusted drawing content into the first drawing range to obtain the twenty-first drawing result.

[0229] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain the twenty-first drawing result, and the specific process includes: the electronic device modifies a second parameter in the second drawing instruction of the twenty-second drawing frame issued by the first application to the second drawing range; the second parameter is used to set the size of the drawing range of the twenty-second drawing frame; and the electronic device draws the modified drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain the twenty-second drawing result.

[0230] With reference to the thirteenth aspect, in a possible implementation manner, the size of the second drawing range is greater than the size of the twenty-second drawing frame of the first application, and the specific process includes: the width of the second drawing range is K5 times the width of the twenty-second drawing frame, and the height of the second drawing range is K6 times the height of the twenty-second drawing frame, K5 and K6 are greater than 1.

[0231] With reference to the thirteenth aspect, in a possible implementation manner, K5 and K6 are fixed values configured by a system of the electronic device, or are determined by the electronic device according to a drawing parameter contained in the drawing instruction of the twenty-first drawing frame.

[0232] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device draws the drawing instruction of the modified twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result, specifically including: the electronic device generates a second conversion matrix according to K5 and K6, and the electronic device draws the size of the drawing content in the drawing instruction of the modified twenty-second drawing frame into the second drawing range after adjusting according to the second conversion matrix to obtain the twenty-first drawing result.

[0233] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device predicts and generates a twenty-third prediction frame of the first application according to the twenty-first drawing result and the twenty-second drawing result, specifically including: the electronic device predicts and generates a twenty-third drawing result of the twenty-third prediction frame according to the twenty-first drawing result and the twenty-second drawing result; and the electronic device cuts the twenty-third drawing result into the twenty-third prediction frame.

[0234] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device predicts and generates a twenty-third drawing result of the twenty-third prediction frame according to the twenty-first drawing result and the twenty-second drawing result, specifically including: the electronic device determines a first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result; and the electronic device predicts and generates the twenty-third drawing result of the twenty-third prediction frame according to the twenty-second drawing result and the first motion vector.

[0235] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device determines a first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result, specifically including: the electronic device divides the twenty-second drawing result into Q pixel blocks, the electronic device takes out a first pixel block from the Q pixel blocks of the twenty-second drawing result; the electronic device determines a second pixel block matched with the first pixel block in the twenty-first drawing result; the electronic device obtains a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block; and the electronic device determines the first motion vector of the twenty-second drawing result according to the motion vector of the first pixel block.

[0236] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device determines the second pixel block matched with the first pixel block in the twenty-first drawing result, specifically including: the electronic device determines a plurality of candidate pixel blocks in the twenty-first drawing result through the first pixel point in the first pixel block; the electronic device respectively calculates the difference values of the color values of the plurality of candidate pixel blocks and the first pixel block; and the electronic device determines the second pixel block matched with the first pixel block according to the difference values of the color values of the plurality of candidate pixel blocks and the first pixel block, the second pixel block being the candidate pixel block with the minimum difference value of the color values among the plurality of candidate pixel blocks.

[0237] With reference to the thirteenth aspect, in a possible implementation manner, when drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, specifically including: when drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instruction of the twenty-first drawing frame in the twenty-first memory space according to the first drawing range to obtain the twenty-first drawing result, the size of the twenty-first memory space being greater than or equal to the size of the first drawing range.

[0238] With reference to the thirteenth aspect, in a possible implementation manner, when drawing the twenty-second drawing frame of the first application, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain the twenty-second drawing result, specifically including: when drawing the twenty-second drawing frame of the first application, the electronic device draws the drawing instruction of the twenty-second drawing frame in the twenty-second memory space according to the second drawing range to obtain the twenty-second drawing result, the size of the twenty-second memory space being greater than or equal to the size of the second drawing range.

[0239] With reference to the thirteenth aspect, in a possible implementation manner, the electronic device generates the twenty-third drawing result of the twenty-third predicted frame according to the twenty-second drawing result and the first motion vector, specifically including: the electronic device generates the twenty-third drawing result according to the twenty-second drawing result and the first motion vector according to the third drawing range; and the size of the third drawing range is greater than the size of the twenty-third predicted frame.

[0240] With reference to the thirteenth aspect, in a possible implementation manner, when drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, and the method further includes: the electronic device cuts the twenty-first drawing result into the twenty-first drawing frame.

[0241] With reference to the thirteenth aspect, in a possible implementation manner, when the twenty-second drawing frame of the first application is drawn, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result, and the method further includes: the electronic device cuts the twenty-second drawing result into the twenty-second drawing frame.

[0242] With reference to the thirteenth aspect, in a possible implementation manner, when the twenty-second drawing frame of the first application is drawn, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result, and the method further includes: the electronic device cuts the twenty-second drawing result into the twenty-second drawing frame.

[0243] In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be improved without increasing the drawing frame. In this way, the video interface displayed by the electronic device can be smoother while saving the power consumption of the electronic device. Further, the predicted frame predicted by the electronic device can include drawing content that is not included in the twenty-first drawing frame and the twenty-second drawing frame displayed by the electronic device. Therefore, the drawing content in the predicted frame predicted by the electronic device is closer to the shooting content in the shooting field of view of the camera. Thus, the image frame predicted by the electronic device can be more accurate.

[0244] With reference to the thirteenth aspect, in a possible implementation manner, when the twenty-second drawing frame of the first application is drawn, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result, and the method further includes: the electronic device cuts the twenty-second drawing result into the twenty-second drawing frame.

[0245] With reference to the thirteenth aspect, in a possible implementation manner, when the twenty-second drawing frame of the first application is drawn, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result, and the method further includes: the electronic device cuts the twenty-second drawing result into the twenty-second drawing frame.

[0246] The size of the twenty-third memory space is greater than the size of the default memory space, and specifically includes that the seventh size of the twenty-third memory space is K1 times the third size of the default memory space, and the eighth size of the twenty-third memory space is K2 times the fourth size of the default memory space.

[0247] Here, the first size of the twenty-first memory space can be a width of the twenty-first memory space, and the second size of the twenty-first memory space can be a height of the twenty-first memory space. The third size of the default memory space can be a width of the default memory space, and the fourth size of the default memory space can be a height of the default memory space. The fifth size of the twenty-second memory space can be a width of the twenty-second memory space, and the sixth size of the twenty-second memory space can be a height of the twenty-second memory space. The seventh size of the twenty-third memory space can be a width of the twenty-third memory space, and the eighth size of the twenty-third memory space can be a height of the twenty-third memory space. In this way, the electronic device can enlarge the width and the height of the twenty-first memory space according to different sizes. The electronic device can enlarge the width and the height of the twenty-second memory space according to different sizes. The electronic device can enlarge the width and the height of the twenty-third memory space according to different sizes.

[0248] In combination with the fourteenth aspect, in a possible implementation manner, when the twenty-first drawing frame is drawn, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space to obtain the twenty-first drawing result, and specifically includes that when the twenty-first drawing frame is drawn, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the first drawing range of the twenty-first memory space to obtain the twenty-first drawing result. The size of the first drawing range is less than or equal to the size of the twenty-first memory space, and the size of the first drawing range is greater than the size of the default memory space.

[0249] In combination with the fourteenth aspect, in a possible implementation manner, the size of the first drawing range is less than or equal to the size of the twenty-first memory space, and the size of the first drawing range is greater than the size of the default memory space, and specifically includes that the ninth size of the first drawing range is K3 times the third size of the default memory space, and the tenth size of the first drawing range is K4 times the fourth size of the default memory space. K3 is greater than 1 and less than or equal to K1, and K4 is greater than 1 and less than or equal to K2.

[0250] The ninth size of the first drawing range can be a width of the first drawing range, and the tenth size of the first drawing range can be a height of the first drawing range.

[0251] With reference to the fourteenth aspect, in a possible implementation manner, K3 is equal to K1, and K4 is equal to K1, and K1, K2, K3, and K4 are fixed values of a system configuration of the electronic device. The electronic device can configure K1, K2, K3, and K4 according to experience values. The electronic device directly configuring the fixed values can reduce a calculation amount.

[0252] With reference to the fourteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, K3 and K4 set by the electronic device can be determined according to the drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, the magnification of the drawing range of different drawing frames can be different. In this way, the magnification of the drawing range set by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.

[0253] With reference to the fourteenth aspect, in a possible implementation manner, when the twenty-second drawing frame is drawn, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame into the twenty-second memory space to obtain a twenty-second drawing result, and specifically includes: when the twenty-second drawing frame is drawn, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame into a second drawing range of the twenty-second memory space to obtain a twenty-second drawing result; a size of the second drawing range is less than or equal to a size of the twenty-second memory space, and the size of the second drawing range is greater than a size of the default memory space.

[0254] With reference to the fourteenth aspect, in a possible implementation manner, the size of the second drawing range is less than or equal to the size of the twenty-second memory space, and the size of the second drawing range is greater than the size of the default memory space, and specifically includes: an eleventh size of the second drawing range is K5 times a third size of the default memory space, and a twelfth size of the second drawing range is K6 times a fourth size of the default memory space, K5 is greater than 1 and less than or equal to K1, and K6 is greater than 1 and less than or equal to K2.

[0255] The eleventh size of the second drawing range can be a width of the second drawing range, and the twelfth size of the second drawing range can be a height of the second drawing range.

[0256] With reference to the fourteenth aspect, in a possible implementation manner, K5 and K6 are fixed values of a system configuration of the electronic device. The electronic device directly configuring the fixed values can reduce a calculation amount.

[0257] With reference to the fourteenth aspect, in a possible implementation manner, K5 and K6 are determined by the electronic device according to drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, K5 and K6 set by the electronic device can be determined according to the drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, the magnification of the drawing range of different drawing frames can be different. In this way, the magnification of the drawing range set by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.

[0258] With reference to the fourteenth aspect, in a possible implementation manner, the electronic device generates a twenty-third drawing result in a twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result, and the size of the twenty-third memory space is greater than the size of the default memory space, and specifically includes: the electronic device determines a first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result; and the electronic device generates the twenty-third drawing result in the twenty-third memory space according to the twenty-second drawing result and the first motion vector. In this way, the electronic device can predict the twenty-third drawing result of the twenty-third prediction frame according to the twenty-first drawing frame and the twenty-second drawing frame.

[0259] With reference to the fourteenth aspect, in a possible implementation manner, the electronic device determines a first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result, and specifically includes: the electronic device divides the twenty-second drawing result into Q pixel blocks, the electronic device takes out a first pixel block from the Q pixel blocks of the twenty-second drawing result; the electronic device determines a second pixel block matching the first pixel block in the twenty-first drawing result; the electronic device obtains a motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; and the electronic device determines the first motion vector of the twenty-second drawing result according to the motion vector of the first pixel block. According to the steps in this implementation manner, the electronic device can determine the motion vector of all pixel blocks in the Q pixel blocks of the twenty-second drawing result. Each pixel block includes f*f (for example, 16*16) pixel points.

[0260] In the above implementation manner, the electronic device divides the twenty-second drawing result into blocks to calculate the motion vector, without calculating the motion vector of each pixel point in the twenty-second drawing result. In this way, the calculation amount can be reduced, thereby reducing the power consumption of the electronic device.

[0261] In a possible implementation manner of the fourteenth aspect, the electronic device determines the second pixel block matched with the first pixel block in the twenty-first drawing result, specifically including: the electronic device determines a plurality of candidate pixel blocks in the twenty-first drawing result through the first pixel point in the first pixel block; the electronic device respectively calculates the difference value of the color value of the plurality of candidate pixel blocks and the first pixel block; and the electronic device determines the second pixel block matched with the first pixel block according to the difference value of the color value of the plurality of candidate pixel blocks and the first pixel block, the second pixel block being the candidate pixel block with the minimum difference value of the color value of the plurality of candidate pixel blocks and the first pixel block.

[0262] In this way, the electronic device can more accurately find the matched pixel block of each pixel block, thereby more accurately calculating the motion vector of each pixel block.

[0263] In a possible implementation manner of the fourteenth aspect, the electronic device generates the twenty-third drawing result in the twenty-third memory space according to the twenty-second drawing result and the first motion vector, specifically including: the electronic device determines the motion vector of the twenty-third drawing result according to the first motion vector, and generates the twenty-third drawing result according to the twenty-second drawing result and the motion vector of the twenty-third drawing result. The motion vector of the twenty-third drawing result is G times of the first motion vector, G is greater than 0 and less than 1.

[0264] In a possible implementation manner of the fourteenth aspect, G is equal to 0.5. In this way, the object in each image frame moves at a constant speed, which is convenient for the electronic device to calculate, and can also make the user experience better when watching the video.

[0265] In a possible implementation manner of the fourteenth aspect, the electronic device generates the twenty-third drawing result in the twenty-third memory space according to the twenty-second drawing result and the first motion vector, specifically including: the electronic device generates the twenty-third drawing result in the third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector; the size of the third drawing range is less than or equal to the size of the twenty-third memory space, and the size of the third drawing range is greater than the size of the default memory space.

[0266] In a possible implementation manner of the fourteenth aspect, the size of the third drawing range is less than or equal to the size of the twenty-third memory space, and the size of the third drawing range is greater than the size of the twenty-third memory space, specifically including: the thirteenth size of the third drawing range is K7 times of the third size of the default memory space, and the fourteenth size of the third drawing range is K8 times of the fourth size of the default memory space, K7 is greater than 1 and less than or equal to K1, and K8 is greater than 1 and less than or equal to K2.

[0267] The thirteenth size of the third drawing range can be a width of the third drawing range, and the fourteenth size of the third drawing range can be a height of the third drawing range.

[0268] With reference to the fourteenth aspect, in a possible implementation, before the drawing content of the drawing instruction of the twenty-first drawing frame is drawn into the twenty-first memory space to obtain the twenty-first drawing result, the method further includes: creating, by the electronic device, the twenty-first memory space, a twenty-second memory space, and a twenty-third memory space, the twenty-first memory space being configured to store the twenty-first drawing result of the twenty-first drawing frame, the twenty-second memory space being configured to store a twenty-second drawing result of a twenty-second drawing frame, and the twenty-third memory space being configured to store a twenty-third drawing result of a twenty-third predicted frame.

[0269] With reference to the fourteenth aspect, in a possible implementation, after the drawing content of the drawing instruction of the twenty-first drawing frame is drawn into the twenty-first memory space to obtain the twenty-first drawing result, the method further includes: cutting, by the electronic device, the twenty-first drawing result into the same size as the default memory space to obtain the twenty-first drawing frame.

[0270] With reference to the fourteenth aspect, in a possible implementation, after the drawing content of the drawing instruction of the twenty-second drawing frame is drawn into the twenty-second memory space to obtain the twenty-second drawing result, the method further includes: cutting, by the electronic device, the twenty-second drawing result into the same size as the default memory space to obtain the twenty-second drawing frame.

[0271] The fifteenth aspect provides an electronic device, including: one or more processors CPU, a graphics processing unit GPU, a memory, and a display screen; the memory is coupled with the one or more processors; the CPU is coupled with the GPU; and wherein:

[0272] The memory can be configured to store computer program code including computer instructions; and the CPU can be configured to instruct the GPU to perform drawing when drawing the twenty-first drawing frame, and instruct the GPU to perform drawing when drawing the second drawing frame.

[0273] In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be improved without increasing the rendering frame. In this way, the video interface displayed by the electronic device can be smoother while saving power consumption of the electronic device. Further, the predicted frame predicted by the electronic device can include rendering content that is not in the twenty-first rendering frame and the twenty-second rendering frame displayed by the electronic device. Thus, the rendering content in the predicted frame predicted by the electronic device is closer to the captured content in the camera field of view. Therefore, the image frame predicted by the electronic device can be more accurate.

[0274] With reference to the fifteenth aspect, in a possible implementation, the GPU can be configured to: render, when the twenty-first rendering frame is rendered, rendering content of the rendering instruction of the twenty-first rendering frame into a twenty-first memory space to obtain a twenty-first rendering result, the size of the twenty-first memory space being greater than the size of the default memory space, the default memory space being a memory space provided by the electronic device system to store the image frame displayed; render, when the twenty-second rendering frame is rendered, rendering content of the rendering instruction of the twenty-second rendering frame into a twenty-second memory space to obtain a twenty-second rendering result, the size of the twenty-second memory space being greater than the size of the default memory space; and generate, according to the twenty-first rendering result and the twenty-second rendering result, a twenty-third rendering result in a twenty-third memory space, the size of the twenty-third memory space being greater than the size of the default memory space; and cut the twenty-third rendering result into the same size as the default memory space to obtain a twenty-third predicted frame.

[0275] With reference to the fifteenth aspect, in a possible implementation, the size of the twenty-first memory space is greater than the size of the default memory space, and specifically includes: a first size of the twenty-first memory space is K1 times of a third size of the default memory space, and a second size of the twenty-first memory space is K2 times of a fourth size of the default memory space, K1 and K2 being greater than 1.

[0276] The size of the twenty-second memory space is greater than the size of the default memory space, and specifically includes: a fifth size of the twenty-second memory space is K1 times of the third size of the default memory space, and a sixth size of the twenty-second memory space is K2 times of the fourth size of the default memory space.

[0277] The size of the twenty-third memory space is greater than the size of the default memory space, and specifically includes: a seventh size of the twenty-third memory space is K1 times of the third size of the default memory space, and an eighth size of the twenty-third memory space is K2 times of the fourth size of the default memory space.

[0278] Here, the first size of the twenty-first memory space can be a width of the twenty-first memory space, and the second size of the twenty-first memory space can be a height of the twenty-first memory space. The third size of the default memory space can be a width of the default memory space, and the fourth size of the default memory space can be a height of the default memory space. The fifth size of the twenty-second memory space can be a width of the twenty-second memory space, and the sixth size of the twenty-second memory space can be a height of the twenty-second memory space. The seventh size of the twenty-third memory space can be a width of the twenty-third memory space, and the eighth size of the twenty-third memory space can be a height of the twenty-third memory space. In this way, the electronic device can enlarge the width and the height of the twenty-first memory space according to different sizes. The electronic device can enlarge the width and the height of the twenty-second memory space according to different sizes. The electronic device can enlarge the width and the height of the twenty-third memory space according to different sizes.

[0279] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be further configured to: when the twenty-first drawing frame is drawn, draw the drawing content of the drawing instruction of the twenty-first drawing frame into a first drawing range of the twenty-first memory space to obtain a twenty-first drawing result; the size of the first drawing range is less than or equal to the size of the twenty-first memory space, and the size of the first drawing range is greater than the size of the default memory space.

[0280] With reference to the fifteenth aspect, in a possible implementation manner, the size of the first drawing range is less than or equal to the size of the twenty-first memory space, and the size of the first drawing range is greater than the size of the default memory space, and specifically includes: the ninth size of the first drawing range is K3 times of the third size of the default memory space, and the tenth size of the first drawing range is K4 times of the fourth size of the default memory space, K3 is greater than 1 and less than or equal to K1, and K4 is greater than 1 and less than or equal to K2.

[0281] The ninth size of the first drawing range can be a width of the first drawing range, and the tenth size of the first drawing range can be a height of the first drawing range.

[0282] With reference to the fifteenth aspect, in a possible implementation manner, K3 is equal to K1, K4 is equal to K1, and K1, K2, K3, and K4 are fixed values of a system configuration of the electronic device. The electronic device can configure K1, K2, K3, and K4 according to experience values. Directly configuring fixed values by the electronic device can reduce the amount of calculation.

[0283] With reference to the fifteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, K3 and K4 set by the electronic device can be determined according to the drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, the magnification of the drawing range of different drawing frames can be different. In this way, the magnification of the drawing range set by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.

[0284] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can also be configured to: when drawing the twenty-second drawing frame, draw the drawing content of the drawing instruction of the twenty-second drawing frame into a second drawing range of the twenty-second memory space to obtain a twenty-second drawing result, the size of the second drawing range is less than or equal to the size of the twenty-second memory space, and the size of the second drawing range is greater than the size of the default memory space.

[0285] With reference to the fifteenth aspect, in a possible implementation manner, the size of the second drawing range is less than or equal to the size of the twenty-second memory space, and the size of the second drawing range is greater than the size of the default memory space, and specifically includes: the eleventh size of the second drawing range is K5 times the third size of the default memory space, the twelfth size of the second drawing range is K6 times the fourth size of the default memory space, K5 is greater than 1 and less than or equal to K1, and K6 is greater than 1 and less than or equal to K2.

[0286] The eleventh size of the second drawing range can be the width of the second drawing range, and the twelfth size of the second drawing range can be the height of the second drawing range.

[0287] With reference to the fifteenth aspect, in a possible implementation manner, K5 and K6 are fixed values configured by the system of the electronic device. The electronic device directly configures the fixed values can reduce the amount of calculation.

[0288] With reference to the fifteenth aspect, in a possible implementation manner, K5 and K6 are determined by the electronic device according to drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, K5 and K6 set by the electronic device can be determined according to the drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, the magnification of the drawing range of different drawing frames can be different. In this way, the magnification of the drawing range set by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.

[0289] In a possible implementation of the fifteenth aspect, the GPU can be configured to: determine, according to the twenty-first rendering result and the twenty-second rendering result, a first motion vector of the twenty-second rendering result; and generate, according to the twenty-second rendering result and the first motion vector, a twenty-third rendering result in a twenty-third memory space. In this way, the GPU can predict the twenty-third rendering result of the twenty-third predicted frame according to the twenty-first rendering frame and the twenty-second rendering frame.

[0290] In a possible implementation of the fifteenth aspect, the GPU can be configured to: divide, by the electronic device, the twenty-second rendering result into Q pixel blocks, and determine, in the twenty-first rendering result, a second pixel block that matches a first pixel block in the Q pixel blocks of the twenty-second rendering result; determine a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block; and determine a first motion vector of the twenty-second rendering result according to the motion vector of the first pixel block. According to the steps in this implementation, the GPU can determine the motion vector of each pixel block in the Q pixel blocks of the twenty-second rendering result. Each pixel block includes f*f (for example, 16*16) pixels.

[0291] In the above implementation, the GPU divides the twenty-second rendering result into blocks to calculate the motion vector, without calculating the motion vector of each pixel in the twenty-second rendering result. In this way, the amount of calculation can be reduced, thereby reducing the power consumption of the GPU in the electronic device.

[0292] In a possible implementation of the fifteenth aspect, the GPU can be configured to: determine, in the twenty-first rendering result, a plurality of candidate pixel blocks through a first pixel in the first pixel block; calculate a difference in color value between the plurality of candidate pixel blocks and the first pixel block, respectively; and determine, according to the difference in color value between the plurality of candidate pixel blocks and the first pixel block, a second pixel block that matches the first pixel block, the second pixel block being a candidate pixel block with the smallest difference in color value between the plurality of candidate pixel blocks and the first pixel block.

[0293] In this way, the GPU in the electronic device can more accurately find the matching pixel block of each pixel block, thereby being able to more accurately calculate the motion vector of each pixel block.

[0294] In a possible implementation of the fifteenth aspect, the GPU can be configured to: determine a motion vector of the twenty-third rendering result according to the first motion vector, and generate the twenty-third rendering result according to the twenty-second rendering result and the motion vector of the twenty-third rendering result. The motion vector of the twenty-third rendering result is G times the first motion vector, G being greater than 0 and less than 1.

[0295] With reference to the fifteenth aspect, in a possible implementation manner, G is equal to 0.5. In this way, the object in each image frame moves at a constant speed, which facilitates the calculation of the GPU in the electronic device, and can also make the experience of the user when watching the video better.

[0296] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be further configured to generate a twenty-third drawing result in a third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector, a size of the third drawing range is less than or equal to a size of the twenty-third memory space, and the size of the third drawing range is greater than a size of the default memory space.

[0297] With reference to the fifteenth aspect, in a possible implementation manner, the size of the third drawing range is less than or equal to the size of the twenty-third memory space, and the size of the third drawing range is greater than the size of the twenty-third memory space, and specifically includes that a thirteenth size of the third drawing range is K7 times of a third size of the default memory space, and a fourteenth size of the third drawing range is K8 times of a fourth size of the default memory space, K7 is greater than 1 and less than or equal to K1, and K8 is greater than 1 and less than or equal to K2.

[0298] The thirteenth size of the third drawing range can be a width of the third drawing range, and the fourteenth size of the third drawing range can be a height of the third drawing range.

[0299] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be configured to create the twenty-first memory space, the twenty-second memory space, and the twenty-third memory space, the twenty-first memory space can be used to store the twenty-first drawing result of the twenty-first drawing frame, the twenty-second memory space can be used to store the twenty-second drawing result of the twenty-second drawing frame, and the twenty-third memory space can be used to store the twenty-third drawing result of the twenty-third predicted frame.

[0300] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be further configured to: cut, by the electronic device, the twenty-first drawing result into the same size as the size of the default memory space to obtain the twenty-first drawing frame.

[0301] With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be further configured to: cut, by the electronic device, the twenty-second drawing result into the same size as the size of the default memory space to obtain the twenty-second drawing frame.

[0302] The sixteenth aspect provides an image frame prediction apparatus, which can include a first drawing unit, a second drawing unit, and a generating unit.

[0303] The first drawing unit can be configured to draw the drawing instruction of the twenty-first drawing frame according to a first drawing range when drawing the twenty-first drawing frame of the first application, to obtain a twenty-first drawing result, and the size of the first drawing range is greater than the size of the twenty-first drawing frame of the first application.

[0304] The second drawing unit can be configured to draw the drawing instruction of the twenty-second drawing frame according to a second drawing range when drawing the twenty-second drawing frame of the first application, to obtain a twenty-second drawing result, and the size of the twenty-second memory space is greater than the size of the twenty-second drawing frame, wherein the size of the twenty-first drawing frame is the same as the size of the twenty-second drawing frame.

[0305] The generation unit can be configured to predict and generate a twenty-third prediction frame of the first application according to the twenty-first drawing result and the twenty-second drawing result, wherein the size of the twenty-third prediction frame is the same as the size of the twenty-first drawing frame.

[0306] With reference to the sixteenth aspect, in a possible implementation manner, the first drawing unit can also be configured to draw the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space when drawing the twenty-first drawing frame, to obtain the twenty-first drawing result, and the size of the twenty-first memory space is greater than the size of the default memory space, and the default memory space is a memory space provided by an electronic device system to store an image frame for display.

[0307] With reference to the sixteenth aspect, in a possible implementation manner, the second drawing unit can also be configured to draw the drawing content of the drawing instruction of the twenty-second drawing frame into the twenty-second memory space when drawing the twenty-second drawing frame, to obtain the twenty-second drawing result, and the size of the twenty-second memory space is greater than the size of the default memory space.

[0308] With reference to the sixteenth aspect, in a possible implementation manner, the generation unit can also be configured to generate a twenty-third drawing result in a twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result, and the size of the twenty-third memory space is greater than the size of the default memory space.

[0309] With reference to the sixteenth aspect, in a possible implementation manner, the image frame prediction apparatus can further include a clipping unit configured to clip the twenty-third drawing result into the same size as the size of the default memory space, to obtain the twenty-third prediction frame.

[0310] In this way, the image frame prediction device can obtain the predicted frame. The frame rate of the image frame prediction device can be improved without increasing the drawing frame. In this way, the video interface displayed by the image frame prediction device can be smoother while saving power consumption of the image frame prediction device. Further, the predicted frame predicted by the image frame prediction device can include drawing content that is not included in the twenty-first drawing frame and the twenty-second drawing frame displayed by the image frame prediction device. Thus, the drawing content in the predicted frame predicted by the image frame prediction device is closer to the shooting content in the shooting field of view of the camera. Therefore, the image frame predicted by the image frame prediction device can be more accurate.

[0311] In a possible implementation of the sixteenth aspect, the size of the twenty-first memory space is greater than the size of the default memory space, and specifically includes that the first size of the twenty-first memory space is K1 times the third size of the default memory space, and the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, where K1 and K2 are greater than 1.

[0312] The size of the twenty-second memory space is greater than the size of the default memory space, and specifically includes that the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the sixth size of the twenty-second memory space is K2 times the fourth size of the default memory space.

[0313] The size of the twenty-third memory space is greater than the size of the default memory space, and specifically includes that the seventh size of the twenty-third memory space is K1 times the third size of the default memory space, and the eighth size of the twenty-third memory space is K2 times the fourth size of the default memory space.

[0314] Here, the first size of the twenty-first memory space can be a width of the twenty-first memory space, and the second size of the twenty-first memory space can be a height of the twenty-first memory space. The third size of the default memory space can be a width of the default memory space, and the fourth size of the default memory space can be a height of the default memory space. The fifth size of the twenty-second memory space can be a width of the twenty-second memory space, and the sixth size of the twenty-second memory space can be a height of the twenty-second memory space. The seventh size of the twenty-third memory space can be a width of the twenty-third memory space, and the eighth size of the twenty-third memory space can be a height of the twenty-third memory space. In this way, the image frame prediction device can magnify the width and the height of the twenty-first memory space according to different sizes. The image frame prediction device can magnify the width and the height of the twenty-second memory space according to different sizes. The image frame prediction device can magnify the width and the height of the twenty-third memory space according to different sizes.

[0315] With reference to the sixteenth aspect, in a possible implementation manner, the first drawing unit is further configured to: when drawing the twenty-first drawing frame, draw drawing content of the drawing instruction of the twenty-first drawing frame into a first drawing range of the twenty-first memory space to obtain a twenty-first drawing result; a size of the first drawing range is less than or equal to a size of the twenty-first memory space, and the size of the first drawing range is greater than a size of the default memory space.

[0316] With reference to the sixteenth aspect, in a possible implementation manner, the size of the first drawing range is less than or equal to the size of the twenty-first memory space, and the size of the first drawing range is greater than the size of the default memory space, and specifically includes that: a ninth size of the first drawing range is K3 times of a third size of the default memory space, and a tenth size of the first drawing range is K4 times of a fourth size of the default memory space, K3 is greater than 1 and less than or equal to K1, and K4 is greater than 1 and less than or equal to K2.

[0317] The ninth size of the first drawing range can be a width of the first drawing range, and the tenth size of the first drawing range can be a height of the first drawing range.

[0318] With reference to the sixteenth aspect, in a possible implementation manner, K3 is equal to K1, and K4 is equal to K1, and K1, K2, K3 and K4 are fixed values of a system configuration of the image frame prediction device. The image frame prediction device can configure K1, K2, K3 and K4 according to experience values. Directly configuring fixed values by the image frame prediction device can reduce a calculation amount.

[0319] With reference to the sixteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, K3 and K4 set by the image frame prediction device can be determined according to the drawing parameters contained in the drawing instruction of the twenty-first drawing frame. In this way, magnification multiples of drawing ranges of different drawing frames can be different. In this way, the magnification multiple of the drawing range by the image frame prediction device is more consistent with drawing content in the drawing instruction of the drawing frame.

[0320] With reference to the sixteenth aspect, in a possible implementation manner, the second drawing unit is further configured to: when drawing the twenty-second drawing frame, draw drawing content of the drawing instruction of the twenty-second drawing frame into a second drawing range of the twenty-second memory space to obtain a twenty-second drawing result; a size of the second drawing range is less than or equal to a size of the twenty-second memory space, and the size of the second drawing range is greater than a size of the default memory space.

[0321] In a possible implementation manner of the sixteenth aspect, the size of the second drawing range is less than or equal to the size of the twenty-second memory space, the size of the second drawing range is greater than the size of the default memory space, and specifically, the eleventh size of the second drawing range is K5 times the third size of the default memory space, the twelfth size of the second drawing range is K6 times the fourth size of the default memory space, K5 is greater than 1 and less than or equal to K1, and K6 is greater than 1 and less than or equal to K2.

[0322] The eleventh size of the second drawing range can be a width of the second drawing range, and the twelfth size of the second drawing range can be a height of the second drawing range.

[0323] In a possible implementation manner of the sixteenth aspect, K5 and K6 are fixed values of a system configuration of the image frame prediction apparatus. The image frame prediction apparatus directly configuring the fixed values can reduce the amount of calculation.

[0324] In a possible implementation manner of the sixteenth aspect, K5 and K6 are determined by the image frame prediction apparatus according to drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, K5 and K6 set by the image frame prediction apparatus can be determined according to the drawing parameters contained in the drawing instruction of the twenty-second drawing frame. In this way, the magnification of the drawing range of different drawing frames can be different. In this way, the magnification of the drawing range of the image frame prediction apparatus is more consistent with the drawing content in the drawing instruction of the drawing frame.

[0325] In a possible implementation manner of the sixteenth aspect, the generating unit can be further configured to: determine, according to the twenty-first drawing result and the twenty-second drawing result, a first motion vector of the twenty-second drawing result; and generate a twenty-third drawing result in a twenty-third memory space according to the twenty-second drawing result and the first motion vector. In this way, the generating unit in the image frame prediction apparatus can predict the twenty-third drawing result of the twenty-third prediction frame according to the twenty-first drawing frame and the twenty-second drawing frame.

[0326] In a possible implementation manner of the sixteenth aspect, the generating unit can be further configured to: divide the twenty-second drawing result into Q pixel blocks, and take out a first pixel block from the Q pixel blocks of the twenty-second drawing result; determine a second pixel block matched with the first pixel block in the twenty-first drawing result; obtain a motion vector of the first pixel block according to a displacement of the second pixel block to the first pixel block; and determine the first motion vector of the twenty-second drawing result according to the motion vector of the first pixel block. According to the steps in the implementation manner, the image frame prediction apparatus can determine the motion vectors of all the pixel blocks in the Q pixel blocks of the twenty-second drawing result. Each pixel block includes f*f (for example, 16*16) pixel points.

[0327] In the implementation manner, the image frame prediction apparatus calculates the motion vector by dividing the twenty-second drawing result into blocks, without calculating the motion vector of each pixel in the twenty-second drawing result. In this way, the calculation amount is reduced, and the power consumption of the electronic device is reduced.

[0328] With reference to the sixteenth aspect, in a possible implementation manner, the generating unit is further configured to: determine a plurality of candidate pixel blocks in the twenty-first drawing result through the first pixel in the first pixel block; calculate a difference value of the color value of the plurality of candidate pixel blocks and the first pixel block respectively; and determine the second pixel block matched with the first pixel block according to the difference value of the color value of the plurality of candidate pixel blocks and the first pixel block, the second pixel block being the candidate pixel block with the minimum difference value of the color value among the plurality of candidate pixel blocks.

[0329] In this way, the image frame prediction apparatus can more accurately find the matched pixel block of each pixel block, and thus can more accurately calculate the motion vector of each pixel block.

[0330] With reference to the sixteenth aspect, in a possible implementation manner, the generating unit is further configured to: determine the motion vector of the twenty-third drawing result according to the first motion vector, and generate the twenty-third drawing result according to the motion vector of the twenty-second drawing result and the twenty-third drawing result. The motion vector of the twenty-third drawing result is G times of the first motion vector, G being greater than 0 and less than 1.

[0331] With reference to the sixteenth aspect, in a possible implementation manner, G is equal to 0.5. In this way, the object in each image frame moves at a constant speed, which facilitates the calculation of the image frame prediction apparatus, and can also make the user experience better when watching the video.

[0332] With reference to the sixteenth aspect, in a possible implementation manner, the generating unit is further configured to: generate the twenty-third drawing result in a third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector; the size of the third drawing range is less than or equal to the size of the twenty-third memory space, and the size of the third drawing range is greater than the size of the twenty-third memory space.

[0333] With reference to the sixteenth aspect, in a possible implementation manner, the size of the third drawing range is less than or equal to the size of the twenty-third memory space, and the size of the third drawing range is greater than the size of the twenty-third memory space, and specifically includes that: the thirteenth size of the third drawing range is K7 times of the third size of the default memory space, and the fourteenth size of the third drawing range is K8 times of the fourth size of the default memory space, K7 being greater than 1 and less than or equal to K1, and K8 being greater than 1 and less than or equal to K2.

[0334] The thirteenth dimension of the third drawing range can be a width of the third drawing range, and the fourteenth dimension of the third drawing range can be a height of the third drawing range.

[0335] With reference to the sixteenth aspect, in a possible implementation manner, the image frame prediction apparatus further includes a creating unit, which is configured to: create a twenty-first memory space, a twenty-second memory space, and a twenty-third memory space, the twenty-first memory space being configured to store a twenty-first drawing result of a twenty-first drawing frame, the twenty-second memory space being configured to store a twenty-second drawing result of a twenty-second drawing frame, and the twenty-third memory space being configured to store a twenty-third drawing result of a twenty-third prediction frame.

[0336] With reference to the sixteenth aspect, in a possible implementation manner, the cutting unit is further configured to: cut the twenty-first drawing result into the same size as that of the default memory space to obtain the twenty-first drawing frame.

[0337] With reference to the sixteenth aspect, in a possible implementation manner, the cutting unit is further configured to: cut the twenty-second drawing result into the same size as that of the default memory space to obtain the twenty-second drawing frame.

[0338] The seventeenth aspect provides an electronic device, including: one or more processors; one or more memories; and one or more computer programs stored in the one or more memories, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform any one of the possible implementation manners of the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect, and the fourteenth aspect.

[0339] The eighteenth aspect provides a chip applied to an electronic device, the chip including one or more processors configured to invoke computer instructions to cause the electronic device to perform any one of the possible implementation manners of the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect, and the fourteenth aspect.

[0340] The nineteenth aspect provides a computer program product, when the computer program product is run on a computer, causing the computer to perform any one of the possible implementation manners of the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect, and the fourteenth aspect.

[0341] The twentieth aspect provides a computer-readable storage medium, including instructions, and the instructions are configured to cause an electronic device to perform any one of the possible implementation manners of the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect, and the fourteenth aspect when the instructions are run on the electronic device.

[0342] It can be understood that the electronic device provided in the seventeenth aspect, the chip provided in the eighteenth aspect, the computer program product provided in the nineteenth aspect and the computer storage medium provided in the twentieth aspect are all used to execute the method provided in the embodiments of the present application. BRIEF DESCRIPTION OF DRAWINGS

[0343] Figure 1 is a schematic diagram of a user interface 100 of a tablet computer 10 provided in the embodiments of the present application;

[0344] Figure 2 is a schematic diagram of a static object in an Nth drawing frame in the user interface 100 provided in the embodiments of the present application;

[0345] Figure 3 is a schematic diagram of a dynamic object in the Nth drawing frame in the user interface 100 provided in the embodiments of the present application;

[0346] Figure 4A is a schematic diagram of a drawing frame 300A provided in the embodiments of the present application;

[0347] Figure 4B is a schematic diagram of a predicted frame 300B provided in the embodiments of the present application;

[0348] Figure 5A is a schematic diagram of a drawing frame 500 provided in the embodiments of the present application;

[0349] Figure 5B is a schematic diagram of a partial pixel block of the drawing frame 500 provided in the embodiments of the present application;

[0350] Figure 5C is a schematic diagram of a pixel block in a predicted frame predicted according to the pixel block in the drawing frame 500 provided in the embodiments of the present application; Figure 5B

[0351] Figure 6A is a logic block diagram of a method of image frame prediction provided in the embodiments of the present application;

[0352] Figure 6B is a flowchart of a method of image frame prediction provided in the embodiments of the present application;

[0353] Figure 7A is a schematic diagram of an Nth drawing frame provided in the embodiments of the present application;

[0354] Figure 7B is a schematic diagram of a depth attachment and a color attachment of a dynamic object in the Nth drawing frame provided in the embodiments of the present application;

[0355] Figure 7C is a schematic diagram of a depth attachment and a color attachment of a static object in the Nth drawing frame provided in the embodiments of the present application;​

[0356] Figure 8A is a schematic diagram of an N+2th rendering frame provided by an embodiment of the present application;

[0357] Figure 8B is a schematic diagram of depth attachments and color attachments of dynamic objects in the N+2th rendering frame provided by an embodiment of the present application;

[0358] Figure 8C is a schematic diagram of depth attachments and color attachments of static objects in the N+2th rendering frame provided by an embodiment of the present application;

[0359] Figures 9A-9C is a schematic diagram of a process of calculating a motion vector of a pixel block 902 in the N+2th frame by a diamond search provided by an embodiment of the present application;

[0360] Figure 10A is a schematic diagram of color attachments of dynamic objects in a predicted N+3th prediction frame provided by an embodiment of the present application;

[0361] Figure 10B is a schematic diagram of color attachments of static objects in a predicted N+3th prediction frame provided by an embodiment of the present application;

[0362] Figure 10C is a schematic diagram of a predicted N+3th prediction frame provided by an embodiment of the present application;

[0363] Figure 11 is a logic block diagram of 90fps interpolation provided by an embodiment of the present application;

[0364] Figure 12 is a schematic diagram of a structure of an electronic device provided by an embodiment of the present application;

[0365] Figure 13 is a schematic diagram of a system framework of an electronic device provided by an embodiment of the present application;

[0366] Figure 14 is a schematic diagram of a user interface of a tablet computer 10 provided by an embodiment of the present application;

[0367] Figure 15 is a schematic diagram of a Wth rendering frame provided by an embodiment of the present application;

[0368] Figure 16 is a schematic diagram of a W+2th rendering frame provided by an embodiment of the present application;

[0369] Figure 17 is a schematic diagram of a method flow of image frame prediction provided by an embodiment of the present application;

[0370] Figure 18 is a schematic diagram of an electronic device acquiring object attributes provided by an embodiment of the present application;

[0371] Figure 19A is a schematic diagram of a moving object in different coordinate systems provided by an embodiment of the application;

[0372] Figure 19B is a schematic diagram of a static object in different coordinate systems provided by an embodiment of the application;

[0373] Figures 20A-20C is a schematic diagram of a GPU rendering a template image of a Wth drawing frame object provided by an embodiment of the application;

[0374] Figures 21A-21C is a schematic diagram of a GPU rendering a template image of a W+2th drawing frame object provided by an embodiment of the application;

[0375] Figures 22A-22B is a schematic diagram of a process of calculating a motion vector of a moving object provided by an embodiment of the application;

[0376] Figure 23 is a schematic diagram of a related module of image frame prediction provided by an embodiment of the application;

[0377] Figure 24 is a flowchart of a frame prediction method disclosed by an embodiment of the application;

[0378] Figure 25 is a schematic diagram of obtaining a reference frame disclosed by an embodiment of the application;

[0379] Figure 26 is another schematic diagram of obtaining a reference frame disclosed by an embodiment of the application;

[0380] Figure 27 is a schematic diagram of determining a target reference frame disclosed by an embodiment of the application;

[0381] Figure 28 is a schematic diagram of dividing a target reference frame disclosed by an embodiment of the application;

[0382] Figure 29 is a flowchart of calculating a prediction motion vector of a block disclosed by an embodiment of the application;

[0383] Figure 30 is a schematic diagram of obtaining a block from a target reference frame to a matching frame disclosed by an embodiment of the application;

[0384] Figure 31A is a schematic diagram of determining a prediction motion vector of a block disclosed by an embodiment of the application;

[0385] Figure 31B is another schematic diagram of determining a prediction motion vector of a block disclosed by an embodiment of the application;

[0386] Figure 32A A schematic diagram for determining a block around a vertex is disclosed in embodiments of the present application;

[0387] Figure 32B A schematic diagram for determining a predicted motion vector of a vertex is disclosed in embodiments of the present application;

[0388] Figure 33 A schematic diagram for determining a vertex coordinate is disclosed in embodiments of the present application;

[0389] Figure 34 A flow chart for determining a coordinate of a pixel in a block in a predicted frame is disclosed in embodiments of the present application;

[0390] Figure 35A A schematic diagram for obtaining a homography transformation formula corresponding to a block is disclosed in embodiments of the present application;

[0391] Figure 35B A schematic diagram for determining a coordinate of a pixel in a predicted frame is disclosed in embodiments of the present application;

[0392] Figure 35C A schematic diagram of a predicted frame is disclosed in embodiments of the present application;

[0393] Figure 36 A schematic diagram of another predicted frame is disclosed in embodiments of the present application;

[0394] Figure 37 A flow chart of a method for generating an image frame is provided in embodiments of the present application;

[0395] Figure 38 A schematic diagram of a position relationship is provided in embodiments of the present application;

[0396] Figure 39A A schematic diagram of an image frame is provided in embodiments of the present application;

[0397] Figure 39B A schematic diagram of dividing an image frame is provided in embodiments of the present application;

[0398] Figures 40A to 40C A schematic diagram of a group of determined matching blocks is provided in embodiments of the present application;

[0399] Figure 41A A flow chart of a method for determining a position coordinate in a predicted image frame is provided in embodiments of the present application;

[0400] Figures 41B to 41C A schematic diagram of a group of matching blocks is provided in embodiments of the present application;

[0401] Figures 41D to 41Fis a schematic diagram of a set of predicted position coordinates in a camera coordinate system provided by an embodiment of the present application;

[0402] Figure 42 is a schematic diagram of determining a vertex of a prediction block provided by an embodiment of the present application;

[0403] Figure 43 is a schematic diagram of generating a prediction block provided by an embodiment of the present application;

[0404] Figures 44A to 44B is a schematic diagram of a set of prediction blocks provided by an embodiment of the present application;

[0405] Figures 45A to 45B is a schematic diagram of a set of prediction blocks provided by an embodiment of the present application;

[0406] Figures 46A to 46I is a schematic diagram of a set of generated image frames provided by an embodiment of the present application;

[0407] Figure 47 is a schematic diagram of a software structure of an electronic device 100 provided by an embodiment of the present application;

[0408] Figure 48 is a schematic diagram of another structure of an electronic device 100 provided by an embodiment of the present application;

[0409] Figure 49A is a schematic diagram of creating a frame buffer object provided by an embodiment of the present application;

[0410] Figure 49B is a schematic diagram of drawing and displaying an original image frame provided by an embodiment of the present application;

[0411] Figure 49C is a schematic diagram of drawing and displaying a predicted image frame provided by an embodiment of the present application;

[0412] Figure 50A is a schematic diagram of a custom dynamic layer provided by an embodiment of the present application;

[0413] Figure 50B is a schematic diagram of a custom UI layer provided by an embodiment of the present application;

[0414] Figure 50C is a schematic diagram of an image frame provided by an embodiment of the present application;

[0415] Figure 50D is a schematic diagram of a drawing process provided by an embodiment of the present application;

[0416] Figure 50E is a schematic diagram of generating an image frame provided by an embodiment of the present application;

[0417] Figure 51A is a flowchart of a method for generating an image frame according to an embodiment of the present application;

[0418] Figure 51B and Figure 51C are respectively a schematic diagram of a synthesized image frame according to an embodiment of the present application;

[0419] Figure 51D and Figure 51E are respectively an effect diagram of a rendering result according to an embodiment of the present application;

[0420] Figure 51F is a schematic diagram of generating an image frame according to an embodiment of the present application;

[0421] Figure 52 is a schematic diagram of a modularized interaction according to an embodiment of the present application;

[0422] Figure 53A is a flowchart of a method for generating an image frame according to an embodiment of the present application;

[0423] Figures 53B-53D is a schematic diagram of a set of prediction processes according to an embodiment of the present application;

[0424] Figures 53E-53I is a schematic diagram of a set of rendering processes according to an embodiment of the present application;

[0425] Figures 54A-54C are respectively a set of user interface diagrams of a tablet 10 according to an embodiment of the present application;

[0426] Figure 55A is a schematic diagram of a rendering frame A, a rendering frame B, and a predicted frame obtained according to the rendering frame A and the rendering frame B according to an embodiment of the present application;

[0427] Figure 55B is a schematic diagram of a camera shooting field of view according to an embodiment of the present application;

[0428] Figure 56 is a flowchart of a method for image frame prediction according to an embodiment of the present application;

[0429] Figure 57 is a schematic diagram of a default memory space according to an embodiment of the present application;

[0430] Figure 58 is a schematic diagram of a twenty-first memory space according to an embodiment of the present application;

[0431] Figure 59 is a schematic diagram of a twenty-second memory space according to an embodiment of the present application;

[0432] Figure 60is a twenty-third memory space schematic diagram provided by an embodiment of the present application;

[0433] Figure 61 is a twenty-first memory space, a first drawing range, a twenty-first drawing result, and a Uth drawing frame schematic diagram provided by an embodiment of the present application;

[0434] Figure 62 is a twenty-second memory space, a second drawing range, a twenty-second drawing result, and a U+2th drawing frame schematic diagram provided by an embodiment of the present application;

[0435] Figures 63A-63C is a process schematic diagram for calculating a motion vector of a pixel block 6205 in the U+2th drawing frame by a diamond search provided by an embodiment of the present application;

[0436] Figure 64 is a twenty-third memory space, a third drawing range, a twenty-third drawing result, and a U+3th prediction frame schematic diagram provided by an embodiment of the present application. DETAILED DESCRIPTION

[0437] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments and are not intended to be limiting of the present application. As used in the specification and the appended claims of the present application, the singular forms “a,” “an” 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 “and / or” as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0438] Hereinafter, the terms “first” and “second” are only for the purpose of description and cannot be understood as implying or suggesting relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined with “first” and “second” can explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, the meaning of “a plurality of” is two or more, unless otherwise specified.

[0439] Since the embodiments of the present application relate to the application of an image frame prediction method, in order to facilitate understanding, the related terms and concepts involved in the embodiments of the present application will be introduced first.

[0440] (1) Image frame

[0441] In the embodiments of the present application, each frame of image displayed in the display screen by the electronic device is referred to as an image frame. In the embodiments of the present application, the image frame can be a frame of image of an application, can be a drawing result drawn by the electronic device according to the drawing instruction of the application, or can be a prediction result predicted according to the existing drawing result. For example, Figure 1As shown, the electronic device (i.e., tablet computer 10) displays a user interface 100. At time T0, the user interface 10 displays the Nth image frame. The Nth image frame is a drawing frame. Figure 1 Timing diagram 101 shows the image frames that the electronic device can display from time T0 to time Tn.

[0442] (2) Draw the frame

[0443] In this embodiment, the image frame drawn by the electronic device according to the application's drawing instructions and parameters during application runtime is called a drawing frame. The application's drawing instructions and parameters can be automatically generated by the application's graphics framework and engine, or they can be written by the application developer. The drawing parameters corresponding to the drawing frame can contain one or more objects. The electronic device can draw one or more objects as corresponding elements in the drawing frame. For example, Figure 1 The user interface 100 shown can be a single frame of drawing. Element 102 in the user interface 100 ( Figure 2 (shown in) and element 103 ( Figure 3 (As shown in the image) are all objects obtained after drawing and rendering from the drawing parameters.

[0444] It is understandable that the drawing parameters of a drawing frame contain multiple object attributes. These attributes can include one or more of the following: color value (e.g., RGB value) of each pixel, depth value of each pixel, stencil buffer, object transition matrix, etc. The CPU can send drawing instructions to the GPU based on these parameters, instructing the GPU to perform the drawing. The GPU can then draw an object based on a single drawing instruction. An object drawn by the GPU using a drawing instruction carrying a transition matrix can be called a moving object. An object drawn by the GPU using a drawing instruction without a transition matrix can be called a static object. Optionally, the drawing instruction for a static object can carry a transition matrix, which is a zero-matrix, meaning that each row and column of the matrix contains only 0 elements.

[0445] In this embodiment, taking a game application as an example, moving objects move within the game scene. The position of the first element in the user interface, drawn and rendered from the moving object, changes between adjacent image frames. The user can see that the position of this first element is moving within the user interface. Static objects are stationary in the game scene, but their positions differ between different image frames due to changes in the camera's shooting angle. The position of the second element in the user interface, drawn and rendered from the static object, can change between adjacent image frames, and the magnitude of this position change depends on the camera's shooting position and angle. For example, the first element could be... Figure 3Element 103 in FIG. 1, element 103 is a moving trolley. The second element can be Figure 2 Element 102 in FIG. 1, element 102 is a static background. The position of the static background in different image frames can change due to the shooting angle of the camera.

[0446] (3) Predicted frame

[0447] In the embodiments of the present application, the electronic device generates a new image frame according to the existing rendering frame data, which is called a predicted frame. The rendering parameters of the predicted frame are obtained according to the rendering parameters of two rendering frames. For example, the electronic device can generate a first predicted frame through a first rendering frame and a second rendering frame. The first predicted frame is the next image frame of the second rendering frame. That is, the electronic device displays the second rendering frame, and then displays the first predicted frame. The first rendering frame is an image frame before the second rendering frame (there can be image frames between the first rendering frame and the second rendering frame). It can be understood that if the Nth image frame is a rendering frame, it can be called the Nth rendering frame in the embodiments of the present application. If the Nth image frame is a predicted frame, it can be called the Nth predicted frame in the embodiments of the present application.

[0448] It can be understood that the object contained in the rendering parameters of the predicted frame is the same as the object contained in the rendering parameters of the rendering frame displayed before the predicted frame. Here, the object contained in the rendering parameters of the image frame can be simply referred to as the object contained in the image frame. For example, the object contained in the rendering parameters of the predicted frame can be simply referred to as the object contained in the predicted frame.

[0449] Here, the specific process of generating a predicted frame by the electronic device through two rendering frames can be referred to below, which will not be described here in detail.

[0450] (4) Image frame prediction

[0451] In the embodiments of the present application, the process of generating a first predicted frame by the electronic device through a first rendering frame and a second rendering frame is called image frame prediction.

[0452] (5) Color attachment

[0453] In the embodiments of the present application, the color attachment is a piece of memory space, which is used to store the color data (such as the RGB value of the pixel point) of each pixel point in the rendering result when the electronic device performs rendering according to the rendering instruction. The color attachment can be part of the FBO.

[0454] (6) Depth attachment

[0455] In the embodiments of the present application, the depth attachment is a piece of memory space for storing the depth data of each pixel in the rendering result when the electronic device renders according to the rendering instruction. The color attachment can be part of the FBO. It can be understood that the smaller the depth value of a pixel in the depth attachment, the closer the distance from the camera. When synthesizing the image frame, for two pixels with the same coordinate value in the two color attachments, the pixel with the smaller depth value can cover the other pixel with the larger depth value. That is, the color displayed by the final display pixel is the color of the pixel with the smaller depth value in the two color attachments.

[0456] In order to improve the frame rate and improve the fluency of the video, the electronic device can insert a predicted frame between the rendering frames of the application. The electronic device can obtain the predicted frame according to the image frame prediction of the rendering frame of the application. The motion speed and direction of the moving object and the static object in the image frame can be different, that is, the motion vectors are different. In the process of image frame prediction, if the moving object and the static object in the image frame are calculated together to obtain the motion vector, the calculated motion vector can be inaccurate. Thus, it can cause distortion or holes in the predicted image frame.

[0457] Figure 4A An example of a rendering frame is schematically shown. Figure 4B An example of a predicted frame obtained according to Figure 4A the rendering frame is schematically shown. As shown in Figure 4A , the rendering frame 300A can include a static object (stationary background) 301 and a moving object (moving car) 302. The electronic device can obtain the predicted frame 300B according to the rendering frame 300A and the motion vector of the rendering frame. As shown in Figure 4B the predicted frame 300B. The objects contained in the predicted frame 300B are the same as those in the rendering frame 300A. That is, the predicted frame 300B can include the static object 301 and the moving object 302. Relative to the moving object 302 in the rendering frame 300A, the moving object 301 in the predicted frame 300B moves forward, and the moving part is Figure 4B shown in the 303 part. When the moving object moves in the direction shown in the figure, the moving object 302 in the predicted frame 300B can miss the pixel information in the area 303. Since this part of the pixel is covered by the moving object 301 in the rendering frame 300A, if the electronic device predicts the predicted frame as a whole based on the rendering frame, after the moving object moves, the electronic device can not be able to obtain the pixel information of this part. Thus, it can cause the area 303 in the predicted frame 300B to miss the pixel information.

[0458] Figure 5AAn example of the rendering frame 500 is shown. The rendering frame 500 can include static background and moving car 521. The electronic device can divide the rendering frame 500 into Q pixel blocks. Figure 5A The rendering frame 400 in the example can be divided into Q pixel blocks. The size of Q is related to the resolution of the display screen and the tile in the GPU. The size of the tile is f*f. Here, an example is described with N equal to 20. The rendering frame 500 can be divided into 20 pixel blocks, pixel block 501-pixel block 520. Among them, the pixel block 513 includes both the moving car 512 and the static background. The pixel block 501-pixel block 512, the pixel block 514-pixel block 520 only include static background. The static background in the rendering frame 500 is different from the moving car in the rendering frame 500. However, when calculating the motion vector as a whole of the pixel block, the calculated motion vector of the static background in the pixel block is the same as the motion vector of the moving car. In this way, the predicted static background in the predicted frame can not be complete, and there can be a hole region (i.e., a region without pixels) in the static background. The following describes an example of the pixel block 507-pixel block 509, the pixel block 512-pixel block 514 in the rendering frame 500.

[0459] Figure 5A An example of the rendering frame 500 in the example is shown. Figure 5A The pixel block 507-pixel block 509, the pixel block 512-pixel block 514 in the rendering frame 500 in the example are shown. The pixel block 507-pixel block 509, and the pixel 512 and the pixel block 514 only include static background. The motion vector of the pixel block 507-pixel block 509, the pixel block 512, and the pixel block 514 calculated by the electronic device can be the same, that is, the motion vector of the static background. The pixel block 513 includes the moving car 521 and the static background. The motion vector of the pixel block 513 calculated by the electronic device can be the motion vector of the moving car 521. In this way, the motion vector of the pixel block 513 calculated by the electronic device is different from the motion vector of the pixel block 507-pixel block 509, and the pixel block 512 and the pixel block 514. The electronic device can predict the pixel block 507-pixel 509, and the pixel block 512-pixel block 514 in the predicted frame according to the pixel block 507-pixel 509, and the pixel block 512-pixel block 514.

[0460] Figure 5C The electronic device predicts the pixel block 507-pixel 509, and the pixel block 512-pixel block 514 in the predicted frame according to Figure 5B The pixel block 507-pixel 509, and the pixel block 512-pixel block 514 in the predicted frame predicted by the electronic device. Since Figure 5B The motion vector of the pixel block in the example is different from the motion vector of other pixel blocks, and the predicted Figure 5CThe displacement of the pixel block 513 in the image 500 is different from the displacement of other pixel blocks, so that the pixel block 513 is not connected with the pixel block 512, and a hole region 522 is formed between the pixel block 512 and the pixel block 513. The displacement of the pixel block 513 is greater than the displacement of the pixel block 514, so that the pixel block 513 covers the pixel block 514.

[0461] In order to improve the fluency of the application program video interface displayed by the electronic device and save the power consumption of the electronic device, an embodiment of the present application provides a method for predicting an image frame. The method can include the following steps. First, when a first drawing frame is drawn, the electronic device writes color data of a first drawing object into a first color attachment and writes color data of a second drawing object into a second color attachment. The drawing instruction of the first drawing object indicates that the spatial information of the first drawing object changes. The drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes. Then, when a second drawing frame is drawn, the electronic device writes color data of a third drawing object into a third color attachment and writes color data of a fourth drawing object into a fourth color attachment. The drawing instruction of the third drawing object indicates that the spatial information of the third drawing object changes. The drawing instruction of the fourth drawing object does not indicate that the spatial information of the fourth drawing object changes. Then, the electronic device predicts a fifth color attachment of a first prediction frame according to the first color attachment and the third color attachment and predicts a sixth color attachment of the first prediction frame according to the second color attachment and the fourth color attachment. Finally, the electronic device combines the fifth color attachment and the sixth color attachment into the first prediction frame.

[0462] The space information of the first drawing object indicated in the drawing instruction of the first drawing object changes, that is, the first drawing object is a moving object. The space information of the second drawing object is not indicated in the drawing instruction of the second drawing object, that is, the second drawing object is a static object. The electronic device writes the color data of the moving object in the first drawing frame into the first color attachment, and writes the color data of the static object in the first drawing frame into the second color attachment. In this way, the electronic device stores the color data of the dynamic object and the color data of the static object in the first drawing frame in different color attachments respectively. Similarly, when drawing the second drawing frame, the drawing instruction of the third drawing object in the second drawing frame indicates that the space information of the third drawing object changes, that is, the third drawing object is a moving object. The drawing instruction of the fourth drawing object does not indicate that the space information of the fourth drawing object changes, that is, the fourth drawing object is a static object. In this way, the electronic device stores the color data of the dynamic object and the color data of the static object in the second drawing frame in different color attachments respectively. Then, the moving object in the predicted frame is predicted according to the moving object in the drawing frame, the static object in the predicted frame is predicted according to the static object in the drawing frame, and the color attachment of the moving object and the color attachment of the static object are synthesized into an image frame. In this way, the predicted frame can be more accurately predicted.

[0463] A method for predicting an image frame provided by an embodiment of the present application will be described in detail below with reference to the accompanying drawings. First, Figure 6A An example of a process in which an electronic device draws an Nth drawing frame, an N+2th drawing frame, and obtains an N+3th predicted frame in a method for predicting an image frame provided by an embodiment of the present application is shown.

[0464] Figure 6A In (a) of FIG. 1, a process in which an electronic device draws an Nth drawing frame is shown. As shown in (a) of FIG. 1, the process in which the electronic device draws the Nth drawing frame can include the following steps: Figure 6A In (a) of FIG. 1, a process in which an electronic device draws an Nth drawing frame is shown. As shown in (a) of FIG. 1, the process in which the electronic device draws the Nth drawing frame can include the following steps:

[0465] 601, the electronic device obtains a drawing instruction of an Nth drawing frame, and determines whether the drawing instruction carries a transfer matrix. If yes, 602a is executed, and if no, 602b is executed.

[0466] There can be multiple draw calls in the Nth draw frame. The electronic device can draw an object according to one draw call. It can be understood that the electronic device draws another draw call of the Nth draw frame after drawing one draw call, until all draw calls in the Nth draw frame are drawn. The draw call can carry vertex coordinates, vertex IDs, depth information, color information, and the like of the object drawn according to the draw call. If the draw call carries a transformation matrix, the object drawn by the electronic device according to the draw call is a moving object. If the draw call does not carry a transformation matrix, the object drawn by the electronic device according to the draw call is a static object.

[0467] Optionally, all draw calls in the Nth draw frame can carry a transformation matrix. If the transformation matrix carried in the draw call is a full 0 matrix, the object drawn by the electronic device according to the draw call is a static object. If the values of the elements in the transformation matrix carried in the draw call are not all 0, the object drawn by the electronic device according to the draw call is a moving object. If the draw content of the draw call is a moving object, the electronic device draws the draw content of the draw call in a first memory space. The first memory space can be referred to as D1 FBO (dynamic framebuffer object).

[0468] Here, the framebuffer object FBO is a piece of memory space, which can be used to store color data, depth data, and the like of a drawn object.

[0469] In the embodiments of the present application, the electronic device can draw moving objects and static objects in a draw frame according to information carried in a draw call. In the embodiments of the present application, the draw call can be referred to as a draw call. In the embodiments of the present application, the draw call can be distinguished according to whether a transformation matrix is carried, or whether the elements in the carried transformation matrix are all 0.

[0470] If the draw call is distinguished according to whether a transformation matrix is carried, the electronic device can divide the draw call into two categories, one category being a draw call carrying a transformation matrix, and the other category being a draw call not carrying a transformation matrix. The draw content of the draw call carrying a transformation matrix is a moving object. The draw content of the draw call not carrying a transformation matrix is a static object. In the embodiments of the present application, the electronic device can draw the two categories of draw calls in different memory spaces.

[0471] If the transition matrix carried in the drawing instruction is distinguished according to whether it is a full 0 matrix, the electronic device can divide the drawing instruction into two categories: one category is a drawing instruction whose elements in the carried transition matrix are not all 0, and the other category is a drawing instruction whose elements in the carried transition matrix are all 0 (i.e., a full 0 matrix). The drawing content of the drawing instruction whose elements in the carried transition matrix are not all 0 is a moving object. The drawing content of the drawing instruction whose carried transition matrix is a full 0 matrix is a static object. In the embodiment of the present application, the electronic device can draw the two categories of drawing instructions in different memory spaces.

[0472] 602a, the electronic device writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space.

[0473] The electronic device writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space. There can be multiple drawing instructions with moving object drawing content in the Nth drawing frame, and the electronic device can draw the drawing content of the multiple drawing instructions into the color attachment A and the depth attachment A in turn. In an implementable manner, if there are L drawing instructions in the Nth drawing frame that carry a transition matrix, the drawing content of the drawing instruction is a moving object. The electronic device can draw the drawing content with color information of the L drawing instructions in the Nth drawing frame into the canvas 1 in turn, and the final drawing result with the color information of all moving objects can be referred to as the color attachment A. Specifically, the electronic device can draw the drawing content with color information of the first drawing instruction in the L drawing instructions in the Nth drawing frame onto the canvas 1 of the electronic device. Then, the electronic device draws the drawing content with color information of the second drawing instruction in the L drawing instructions in the Nth drawing frame onto the canvas 1 of the electronic device. Until the electronic device draws the drawing content with color information of the Lth drawing instruction in the L drawing instructions in the Nth drawing frame onto the canvas 1 of the electronic device, and the final drawing result with the color information of all moving objects can be referred to as the color attachment A in the embodiment of the present application.

[0474] The electronic device can draw the drawing content of the L drawing instructions in the Nth drawing frame with depth information and without color information in the canvas 2 in sequence, and the final drawing result with the depth information of all the moving objects can be referred to as a depth attachment A. Specifically, the electronic device can draw the drawing content of the first drawing instruction of the L drawing instructions with depth information and without color information on the canvas 2. Then, the electronic device can draw the drawing content of the second drawing instruction of the L drawing instructions with depth information and without color information on the canvas 2. Until the electronic device draws the drawing content of the Lth drawing instruction of the L drawing instructions with depth information and without color information on the canvas 2, the final drawing result with the depth information of all the moving objects can be referred to as the depth attachment A in the embodiment of the present application.

[0475] It can be understood that the canvas 1 and the canvas 2 in the above are both in the first memory space.

[0476] Here, the depth attachment A and the color attachment A can be referred to the description in step S105 below, which will not be described here in detail. Figure 6B

[0477] 602b, the electronic device writes the drawing content of the drawing instruction into the color attachment B and the depth attachment B in the second memory space.

[0478] Taking the drawing instruction with M drawing contents of static objects in the Nth drawing frame as an example. The electronic device can draw the drawing content of the M drawing instructions in the Nth drawing frame with color information in the canvas 3 in sequence. Specifically, the electronic device can draw the drawing content of the first drawing instruction of the M drawing instructions with color information in the canvas 3, and then draw the drawing content of the second drawing instruction of the M drawing instructions with color information in the canvas 3. Until the electronic device draws the drawing content of the Mth drawing instruction of the M drawing instructions with color information in the canvas 3, the final drawing result with the color information of all the static objects can be referred to as a color attachment B.

[0479] ​The electronic device can draw the drawing content with depth information and without color information of the M drawing instructions in the Nth drawing frame into the canvas 4 in sequence, and finally obtain the depth attachment B. Specifically, the electronic device can draw the drawing content with depth information and without color information of the first drawing instruction in the M drawing instructions into the canvas 4, and then draw the drawing content with depth information and without color information of the second drawing instruction in the M drawing instructions into the canvas 4. Until the electronic device draws the drawing content with depth information and without color information of the Mth drawing instruction in the M drawing instructions into the canvas 4, the final drawing result with the depth information of all static objects can be referred to as the depth attachment B.

[0480] It can be understood that the canvas 3 and the canvas 4 are in the second memory space.

[0481] 603、The electronic device synthesizes the color attachment A and the color attachment B into the image frame of the Nth drawing frame according to the depth attachment A and the depth attachment B.

[0482] The electronic device can synthesize the color attachment A and the color attachment B into the image frame of the Nth drawing frame in the seventh memory space. It can be understood that the color attachment A can include multiple moving objects in the Nth drawing frame, and the color attachment B can include multiple static objects in the Nth drawing frame. The electronic device can obtain the depth information of each moving object and each pixel point in the color attachment A in the depth attachment A. The electronic device can obtain the depth information of each static object and each pixel point in the color attachment B in the depth attachment B. The electronic device can synthesize the color attachment A and the color attachment B into the image frame according to the depth information of each pixel point in the color attachment A and the depth information of each pixel point in the color attachment B. The image frame can include the moving objects in the color attachment A and the static objects in the color attachment B. For example, in the image frame, if the depth value of the first pixel point in the color attachment A is less than the depth value of the first pixel point in the color attachment B, then in the image frame, the first pixel point of the color attachment A covers the first pixel point of the color attachment B. If the depth value of the first pixel point in the color attachment A is greater than the depth value of the first pixel point in the color attachment B, then in the image frame, the first pixel point of the color attachment B covers the first pixel point of the color attachment A.

[0483] 604、The electronic device displays the Nth drawing frame.

[0484] The electronic device can send the image frame of the Nth drawing frame to the display screen for display, and finally the display screen in the electronic device can display the Nth drawing frame.

[0485] Figure 6AFig. (b) in the middle illustrates an example of the process of the electronic device drawing the N+2th drawing frame. As shown in Fig. (b) in the middle, the electronic device drawing the N+2th drawing frame can include the following steps: Figure 6A Fig. (b) in the middle illustrates an example of the process of the electronic device drawing the N+2th drawing frame. As shown in Fig. (b) in the middle, the electronic device drawing the N+2th drawing frame can include the following steps:

[0486] 605. The electronic device obtains the drawing instruction of the N+2th drawing frame, and determines whether the transition matrix is carried in the drawing instruction. If yes, step 606a is performed, and if no, step 606b is performed.

[0487] The electronic device can obtain multiple drawing instructions of the N+2th drawing frame. The drawing instruction of the N+2th drawing frame can carry a transition matrix, or can not carry a transition matrix. If the drawing instruction carries a transition matrix, step 606a is performed, and if the drawing instruction does not carry a transition matrix, step 606b is performed.

[0488] Step 605 can refer to the description in step 601, which will not be repeated here.

[0489] 606a. The electronic device writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space.

[0490] If the drawing content of the drawing instruction is a moving object, the electronic device writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space. If there are K drawing instructions carrying transition matrices in the N+2th drawing frame, the drawing content of the drawing instruction is a moving object. The electronic device can draw the drawing content with color information of the K drawing instructions in the N+2th drawing frame in the canvas 5 in turn, and the final drawing result with color information of all moving objects can be referred to as the color attachment C. Specifically, the electronic device can draw the drawing content with color information of the first drawing instruction in the K drawing instructions in the N+2th drawing frame onto the canvas 5 of the electronic device. Then, the electronic device draws the drawing content with color information of the second drawing instruction in the K drawing instructions in the N+2th drawing frame onto the canvas 5 of the electronic device. Until the electronic device draws the drawing content with color information of the Kth drawing instruction in the K drawing instructions in the N+2th drawing frame onto the canvas 5 of the electronic device, and the final drawing result with color information of all moving objects can be referred to as the color attachment C in the embodiment.

[0491] The electronic device can draw the drawing content with depth information and without color information of the K drawing instructions in the N+2th drawing frame in the canvas 6 in sequence, and finally obtain the drawing result with the depth information of all the moving objects, which can be referred to as the depth attachment C. Specifically, the electronic device can draw the drawing content with depth information and without color information of the first drawing instruction of the K drawing instructions on the canvas 6. Then, the electronic device can draw the drawing content with depth information and without color information of the second drawing instruction of the K drawing instructions on the canvas 6. Until the electronic device draws the drawing content with depth information and without color information of the Kth drawing instruction of the K drawing instructions on the canvas 6, the image of the drawing result with the depth information of all the moving objects can be referred to as the depth attachment C in the embodiment of the present application.

[0492] It can be understood that the canvas 5 and the canvas 6 are in the third memory space.

[0493] Here, the depth attachment C and the color attachment C can be specifically referred to the description in step S109 of the following Figure 6B , which will not be described here in detail.

[0494] 606b, the electronic device writes the drawing content of the drawing instruction into the color attachment D and the color attachment D in the fourth memory space.

[0495] If the drawing content of the drawing instruction of the N+2th drawing frame is a static object, the electronic device writes the drawing content of the drawing instruction into the color attachment D and the depth attachment D in the fourth memory space. If there are J drawing instructions in the N+2th drawing frame without carrying the transfer matrix, the drawing content of the drawing instruction is a static object. The electronic device can draw the drawing content with color information of the J drawing instructions in the N+2th drawing frame in the canvas 7 in sequence, and finally obtain the drawing result with the color information of all the static objects, which can be referred to as the color attachment D. Specifically, the electronic device can draw the drawing content with color information of the first drawing instruction of the J drawing instructions in the N+2th drawing frame on the canvas 7 of the electronic device. Then, the electronic device draws the drawing content with color information of the second drawing instruction of the J drawing instructions in the N+2th drawing frame on the canvas 7 of the electronic device. Until the electronic device draws the drawing content with color information of the Jth drawing instruction of the J drawing instructions in the N+2th drawing frame on the canvas 7 of the electronic device, the drawing result with the color information of all the static objects can be referred to as the color attachment D in the embodiment of the present application.

[0496] The electronic device can draw the drawing content with depth information and without color information of the J drawing instructions in the N+2th drawing frame in the canvas 8 in sequence, and finally obtain the drawing result with the depth information of all the static objects, which can be referred to as a depth attachment D. Specifically, the electronic device can draw the drawing content with depth information and without color information of the first drawing instruction of the J drawing instructions on the canvas 8. Then, the electronic device can draw the drawing content with depth information and without color information of the second drawing instruction of the J drawing instructions on the canvas 8. Until the electronic device draws the drawing content with depth information and without color information of the Jth drawing instruction of the J drawing instructions on the canvas 8, the finally obtained drawing result with the depth information of all the static objects can be referred to as the depth attachment D in the embodiment of the present application.

[0497] It can be understood that the canvas 7 and the canvas 8 are in the third memory space.

[0498] Here, the depth attachment D and the color attachment D can be referred to the description in step S109 of the following Figure 6B , which will not be described here in detail.

[0499] 607、The electronic device synthesizes the color attachment C and the color attachment D into an image frame of the Nth drawing frame according to the depth attachment C and the depth attachment D.

[0500] The electronic device can synthesize the color attachment C and the color attachment D into an image frame of the N+2th drawing frame in the seventh memory space. It can be understood that the color attachment C can include a plurality of moving objects in the N+2th drawing frame, and the color attachment D can include a plurality of static objects in the N+2th drawing frame. The electronic device can obtain the depth information of each moving object and each pixel point in the color attachment C in the depth attachment C. The electronic device can obtain the depth information of each static object and each pixel point in the color attachment D in the depth attachment D. The electronic device can synthesize the color attachment C and the color attachment D into an image frame according to the depth information of each pixel point in the color attachment C and the depth information of each pixel point in the color attachment D. The image frame can include the moving objects in the color attachment C and the static objects in the color attachment D. For example, in the image frame, if the depth value of the first pixel point in the color attachment C is less than the depth value of the first pixel point in the color attachment D, then in the image frame, the first pixel point of the color attachment C will cover the first pixel point of the color attachment D. In the image frame, if the depth value of the first pixel point in the color attachment C is greater than the depth value of the first pixel point in the color attachment D, then in the image frame, the first pixel point of the color attachment D will cover the first pixel point of the color attachment C.

[0501] 608、The electronic device displays the N+2th drawing frame.

[0502] The electronic device can send the image frame of the N+2th rendering frame to the display screen for display. Eventually, the display screen in the electronic device can display the N+2th rendering frame.

[0503] Figure 6A The (c) of FIG. 1 illustrates an example of how the electronic device predicts the N+3th predicted frame. As shown in the (c) of FIG. 1, the process is as follows: Figure 6A

[0504] 1. The electronic device calculates the motion vector A according to the color attachment A and the color attachment C, and calculates the motion vector B according to the depth attachment B and the color attachment D.

[0505] As shown in the (c) of FIG. 1, the electronic device can calculate the motion vector A according to the color attachment A and the color attachment C. The electronic device calculates the motion vector B according to the depth attachment B and the color attachment D. The specific calculation process can refer to the description in step S112 of FIG. 1, which will not be described here in detail. Figure 6A Figure 6B

[0506] 2. The electronic device obtains the color attachment E according to the color attachment C and the motion vector A, and obtains the color attachment F according to the color attachment D and the motion vector B.

[0507] The electronic device can obtain the color attachment E of the N+3th predicted frame according to the color attachment of the N+2th rendering frame and the motion vector A. That is, the electronic device can predict the moving object in the N+3th frame according to the moving object of the N+2th rendering frame and the motion vector of the moving object.

[0508] The electronic device can obtain the color attachment F of the N+3th frame according to the color attachment D of the N+2th rendering frame and the motion vector B. That is, the electronic device can predict the static object in the N+3th frame according to the static object of the N+2th rendering frame and the motion vector of the static object.

[0509] Here, the specific description can refer to the description in step S114 of FIG. 1, which will not be described here in detail. Figure 6B

[0510] 3. The electronic device synthesizes the color attachment E and the color attachment F in the seventh memory space to obtain the image frame of the N+3th predicted frame.

[0511] ​​​​In the embodiment of the present application, the depth information of the pixel point at the first coordinate in the color attachment E of the N+3 predicted frame can be the same as the depth information of the pixel point at the first coordinate in the color attachment C of the N+2 rendering frame. The depth information of the pixel point at the second coordinate in the color attachment F of the N+3 predicted frame can be the same as the depth information of the pixel point at the second coordinate in the color attachment D of the N+2 rendering frame. That is, the electronic device can take the depth value of each pixel point in the depth attachment C as the depth value of each pixel point in the color attachment E. The electronic device can take the depth value of each pixel point in the depth attachment D as the depth value of each pixel point in the color attachment F. The electronic device can synthesize the color attachment E and the color attachment F into the image frame of the N+3 predicted frame according to the depth values of the pixel points taken in the depth attachment C and the depth attachment D.

[0512] 4. The electronic device displays the N+3 predicted frame.

[0513] The electronic device can send the image frame of the N+3 predicted frame to the display screen for display. Finally, the display screen in the electronic device can display the N+3 predicted frame.

[0514] Figure 6A Briefly introduce the basic steps of the image frame prediction method provided in the embodiment of the present application, Figure 6B Detailedly introduce the method flowchart of the image frame prediction provided in the embodiment of the present application, as Figure 6B shown, the method of image frame prediction provided in the embodiment of the present application can include:

[0515] S101-S102, the electronic device starts to execute the method of image frame prediction.

[0516] S101, when the target application starts to draw, the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU.

[0517] The target application is an application with animation effect in the user interface, for example, a game application. The following text takes the target application as a game application as an example for illustration. When the game application installed in the electronic device is running, the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU.

[0518] S102, the GPU of the electronic device creates a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, a sixth memory space, and a seventh memory space in the memory.

[0519] In response to instructions from the CPU to create memory spaces, the GPU can create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, a sixth memory space, and a seventh memory space. The first memory space can store the rendering results of rendering instructions carrying transition matrices in the Nth rendering frame, such as depth and color attachments. The second memory space can store the rendering results of rendering instructions without transition matrices in the Nth rendering frame. The third memory space can store the rendering results of rendering instructions carrying transition matrices in the (N+2)th rendering frame. The fourth memory space can store the rendering results of rendering instructions without transition matrices in the (N+2)th rendering frame. The GPU can predict the predicted rendering result A of the (N+3)th prediction frame using the rendering results in the first and third memory spaces in the fifth memory space. The GPU can predict the predicted rendering result B of the (N+3)th prediction frame using the rendering results in the second and fourth memory spaces in the sixth memory space. The GPU can composite image frames in the seventh memory space. For example, the GPU synthesizes the Nth rendered frame, the N+2nd rendered frame, and the N+3rd predicted frame in the seventh memory space.

[0520] S103-S106, the electronic device draws the Nth drawing frame.

[0521] S103, The CPU of the electronic device obtains the drawing parameters of the Nth drawing frame.

[0522] When a target application in an electronic device performs drawing, it can invoke drawing instructions to draw. The CPU of the electronic device 100 can obtain the drawing parameters of the Nth drawing frame from the application through an interface in a 3D image processing library. The drawing parameters of the Nth drawing frame are used to draw and render the Nth drawing frame. The drawing parameters of the Nth drawing frame can include information carried in the drawing instructions of the Nth drawing frame (e.g., draw call instructions), such as the coordinates, pixel values, depth values, etc. of each vertex in the drawing content of the draw call instructions.

[0523] S104. The CPU of the electronic device sends a drawing instruction to the GPU to instruct the GPU to draw the Nth drawing frame based on the drawing parameters of the Nth drawing frame.

[0524] The CPU of an electronic device can send drawing instructions to the GPU, instructing the GPU to draw the Nth drawing frame, based on the drawing parameters of the Nth drawing frame. It is understood that the drawing parameters of the Nth drawing frame obtained by the CPU may include information about multiple drawing instructions. Thus, the CPU can sequentially send multiple drawing instructions to the GPU, instructing the GPU to draw the Nth drawing frame. In this embodiment, the drawing instructions include a draw call execution instruction and a drawing state setting instruction.

[0525] Executing drawing instructions can trigger the GPU to draw and render data based on the current drawing state and generate drawing results, such as the glDrawElements instruction in OpenGL. OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics.

[0526] Drawing state setting instructions can be used to set the current drawing state data on which the execution of drawing instructions depends. For example, the instructions that set the state data include the vertex information cache index on which the drawing depends, such as in OpenGL's glBindBuffer. The vertex information cache index is used to indicate the vertex information data of a drawing object. Vertex information data is a set of coordinate positions, colors, and other data used in the drawing and rendering process to describe the vertices of a two-dimensional or three-dimensional vector model used for drawing.

[0527] Drawing state setting instructions can also include instructions for setting the vertex indices, texture information, and spatial position of the drawing object, such as the glActiveTexture and glBindBufferRange instructions in OpenGL. A drawing object can be an object that an electronic device can draw based on all the vertices and vertex information contained in a drawing instruction.

[0528] To illustrate this more clearly, a possible OpenGL drawing command execution order could be shown as follows:

[0529] glBindBufferRange(target = GL_UNIFORM_BUFFER, index = 1, buffer = 738, offset = 0, size = 352) / / Instructs the GPU to modify some global drawing information, such as the position of the car;

[0530] glBindBuffer(target = GL_ARRAY_BUFFER, buffer = buffer0) / / Instructs the GPU to store the index information of buffer0, which contains the vertex information of the car (such as vertex position, color, etc.), into GL_ARRAY_BUFFER;

[0531] glBindBuffer(target = GL_ELEMENT_ARRAY_BUFFER, buffer = buffer1) / / Instructs the GPU to save the index of buffer1, which stores the vertex index information of the car (such as the drawing order of the vertices), into GL_ELEMENT_ARRAY_BUFFER;

[0532] glActiveTexture(texture=GL_TEXTURE0)

[0533] glBindTexture(target = GL_TEXTURE_2D, texture = texture1) / / Instructs the GPU to save the index of texture1, which contains the texture information of the car, into GL_TEXTURE0;

[0534]

[0535] glDrawElements(GLenummode,GLsizeicount,GLenumtype,const void*indices) / / Instructs the GPU to perform the drawing of the car.

[0536] In one possible implementation, the CPU can determine whether the spatial position of the drawing object in the world coordinate system has changed relative to the previous frame based on the parameters or data of the spatial information of the drawing object in the drawing state setting instruction. This determines whether to modify the memory space (FBO, explained below) where the drawing result of the drawing instruction based on the current drawing state data is stored. The parameters or data of the spatial information of the drawing object can be the transition matrix parameters in the XXX instruction (e.g., glBindBufferRange in OpenGL). The transition matrix is ​​used to describe the mapping relationship from the local coordinate system (Local / Object Space) of the model to the world coordinate system. For example, if the coordinates of a vertex of the drawing object in the local coordinate system are U(x1,y1,z1,1) and the transition matrix is ​​S, then the relationship between the position W(x2,y2,z2,1) of this vertex in the world coordinate system and the coordinates U(x1,y1,z1,1) in the local coordinate system is: W=U*T.

[0537] One possible implementation is that if the drawing state setting instruction contains a transition matrix parameter, i.e., refreshes the transition matrix parameter of the corresponding drawing object, the electronic device determines that the spatial position of the drawing object in the world coordinate system relative to the previous frame has changed. The electronic device then modifies the memory space stored in the drawing result of the drawing instruction based on the current drawing state data to the memory space used to store moving objects (e.g., the first memory space). If the drawing state setting instruction does not contain a transition matrix parameter, i.e., the transition matrix parameter of the corresponding drawing object is not refreshed, the electronic device determines that the spatial position of the drawing object in the world coordinate system relative to the previous frame has not changed. The electronic device then modifies the memory space stored in the drawing result of the drawing instruction based on the current drawing state data to the memory space used to store static objects (e.g., the second memory space).

[0538] One possible implementation is that if the transition matrix parameter in the drawing state setting instruction differs from the transition matrix parameter of the corresponding drawing object, the electronic device determines that the spatial position of the drawing object in the world coordinate system relative to the previous frame has changed. The electronic device then modifies the memory space stored in the drawing result of the drawing instruction based on the current drawing state data to the memory space used to store moving objects (e.g., the first memory space). If the transition matrix parameter in the drawing state setting instruction is the same as the transition matrix parameter of the corresponding drawing object, the electronic device determines that the spatial position of the drawing object in the world coordinate system relative to the previous frame has not changed. The electronic device then modifies the memory space stored in the drawing result of the drawing instruction based on the current drawing state data to the memory space used to store static objects (e.g., the second memory space).

[0539] For example, in `glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)`, the parameter `target` represents the type of the binding buffer, the parameter `index` represents the index of the binding point, the parameter `buffer` represents the index of the buffer involved in the binding operation, the parameter `offset` represents the offset of the position to be bound relative to the starting position of the buffer, and the parameter `size` represents the size of the part of the buffer involved in the binding. If the parameter `size` of the `glBindBufferRange` function is 352, and the buffer ID (738) has been saved, it means that the spatial position information corresponding to this buffer has been modified by the `glBufferSubData` instruction. The electronic device then determines that the spatial position of the drawn object in the world coordinate system has changed relative to the previous frame. Otherwise, the electronic device determines that the spatial position of the drawn object in the world coordinate system has not changed relative to the previous frame. The electronic device can obtain the transition matrix parameters in the drawing frame of the program through hook functions. For example, the electronic device can obtain the transition matrix parameters through the `glBindBufferRange` function.

[0540] S105. If the drawing instruction of the Nth drawing frame carries a transfer matrix, the GPU writes the drawing content of the drawing instruction into color attachment A and depth attachment A in the first memory space; if the drawing instruction of the Nth drawing frame does not carry a transfer instruction, the GPU writes the drawing content of the drawing instruction into color attachment B and depth attachment B in the second memory space.

[0541] The drawing instructions for the Nth drawing frame can include drawing instructions carrying a transition matrix and drawing instructions without a transition matrix. For example... Figure 7A As shown, Figure 7A An example is shown of the Nth drawing frame, which may include a static background 102 and a moving vehicle 103. The drawing instructions of the Nth drawing frame may include drawing instructions for drawing the static background 102 and drawing instructions for drawing the moving vehicle 103.

[0542] If a drawing instruction in the Nth drawing frame carries a transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment A and depth attachment A in the first memory space. For example, a drawing instruction for drawing a moving car can carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the moving car 103 into the color attachment A and depth attachment A in the first memory space. Figure 7B As shown, Figure 7BThe color attachment A and depth attachment A in the first memory space are illustrated exemplarily. The color attachment A and depth attachment A contain the drawing content of the drawing instructions for the moving vehicle 103. It can be understood that the color attachment A is actually a block of memory in memory. Figure 7B To illustrate this more clearly, the color data in memory space is displayed in the form of an image scale. Similarly, depth attachment A is also actually a block of memory. Figure 7B To make it easier to understand, the depth data in the memory space is illustrated in the form of an image.

[0543] In this embodiment of the application, color attachment A can be referred to as the first color attachment, and depth attachment A can be referred to as the first depth attachment.

[0544] If a drawing instruction in the Nth drawing frame does not carry a transition matrix, the GPU writes the drawing content of that instruction into the color attachment B and the depth attachment B in the second memory space. For example, Figure 7A The static background 102 shown can be drawn without a transition matrix, as the drawing instructions for it may not include one. The GPU writes the drawing content of the static background 102 drawing instructions into the color attachment B and depth attachment B in the second memory space. Figure 7C As shown, Figure 7C The color attachment B and depth attachment B in the second memory space are illustrated exemplarily. The color attachment B and depth attachment B contain the drawing content of the static background 102 drawing instructions. It can be understood that the color attachment B is actually a block of memory in memory. Figure 7C To illustrate this more clearly, the color data in memory space is displayed in the form of an image scale. Similarly, the depth attachment B is also actually a block of memory. Figure 7C To make it easier to understand, the depth data in the memory space is illustrated in the form of an image.

[0545] In this embodiment of the application, color attachment B can be referred to as the second color attachment, and depth attachment B can be referred to as the second depth attachment.

[0546] It is understood that the Nth rendering frame can contain multiple rendering instructions carrying transition matrices and multiple rendering instructions not carrying transition matrices. The GPU renders each rendering instruction of the Nth rendering frame sequentially. When rendering each rendering instruction, the GPU can determine whether the rendering instruction carries a transition matrix. If the rendering instruction carries a transition matrix, the GPU writes the rendering content of the rendering instruction into color attachment A and depth attachment A in the first memory space. If the rendering instruction does not carry a transition matrix, the GPU writes the rendering content of the rendering instruction into color attachment B and depth attachment B in the second memory space. Finally, in this embodiment, color attachment A sequentially contains the rendering content with color information from all rendering instructions carrying transition matrices in the Nth rendering frame. Depth attachment A sequentially contains the rendering content with depth information from all rendering instructions carrying transition matrices in the Nth rendering frame. Similarly, in this embodiment, color attachment B sequentially contains the rendering content with color information from all rendering instructions not carrying transition matrices in the Nth rendering frame. Depth attachment B sequentially contains the rendering content with depth information from all rendering instructions not carrying transition matrices in the Nth rendering frame.

[0547] It is understandable that color attachment A and depth attachment A can be two separate memory spaces in the first memory space. Optionally, color attachment A and depth attachment A can also be a single memory space in the first memory space, meaning that color data and depth data can be written to this single memory space. Similarly, color attachment B and depth attachment B can be two separate memory spaces in the second memory space. Optionally, color attachment B and depth attachment B can also be a single memory space in the second memory space, meaning that color data and depth data can be written to this single memory space.

[0548] Step S105 can be referred to steps 602a and 602b above.

[0549] S106. In the seventh memory space, the GPU of the electronic device synthesizes the color attachment A and color attachment B of the Nth drawing frame according to the depth attachment A and depth attachment B.

[0550] In the seventh memory space, the GPU of the electronic device can synthesize the color attachments A and B of the Nth rendering frame based on the depth attachments A and B. For details on synthesizing color attachments A and B based on the depth attachments, please refer to the existing technology describing the synthesis of two color attachments based on depth information in depth testing; these details will not be repeated here.

[0551] S107-S110, the electronic device draws the N+2th drawing frame.

[0552] S107. The CPU of the electronic device obtains the drawing parameters of the (N+2)th drawing frame.

[0553] The CPU of the electronic device can obtain the drawing parameters of the (N+2)th drawing frame. Specifically, the CPU of the electronic device 100 can obtain the drawing parameters of the (N+2)th drawing frame of the application through an interface in the 3D image processing library. The drawing parameters of the (N+2)th drawing frame are used to draw and render the (N+2)th drawing frame. The drawing parameters of the (N+2)th drawing frame can include information carried in the drawing instructions (e.g., draw call instructions) of the (N+2)th drawing frame, such as the coordinates, pixel values, depth values, etc. of each vertex in the drawing content of the draw call instruction.

[0554] Understandably, the electronic device displays frame N+1 before drawing frame N+2. If frame N+1 is a drawing frame, the electronic device can draw frame N+1 according to the steps for drawing frame N+2 in steps S107-S110. If frame N+1 is a prediction frame, the electronic device can predict frame N+1 according to steps S111-S115.

[0555] S108. The CPU of the electronic device sends a drawing instruction to the GPU to instruct the GPU to draw the N+2th frame based on the drawing parameters of the N+2nd frame.

[0556] The CPU of the electronic device can send drawing instructions to the GPU, instructing the GPU to draw the (N+2)th drawing frame, based on the drawing parameters of the (N+2)th drawing frame. It is understood that the drawing parameters of the (N+2)th drawing frame obtained by the CPU may include information about multiple drawing instructions. In this way, the CPU can sequentially send multiple drawing instructions to the GPU, instructing the GPU to draw the (N+2)th drawing frame. For details, please refer to the description in step S104; it will not be repeated here.

[0557] S109. If the drawing instruction of the (N+2)th drawing frame carries a transition matrix, the GPU writes the drawing content of the drawing instruction of the (N+2)th frame into the color attachment C and the depth attachment C in the third memory space; if the drawing instruction of the (N+2)th drawing frame does not carry a transition matrix, the GPU writes the drawing content of the drawing instruction of the (N+2)th frame into the color attachment D and the depth attachment D in the fourth memory space.

[0558] The drawing instructions for the (N+2)th drawing frame can include drawing instructions carrying a transition matrix and drawing instructions without a transition matrix. For example... Figure 8A As shown, Figure 8AAn example is shown of the (N+2)th drawing frame, which may include a static background 102 and a moving vehicle 103. The drawing instructions for the (N+2)th drawing frame may include drawing instructions for drawing the static background 102 and drawing instructions for drawing the moving vehicle 103.

[0559] If the drawing instruction carries a transition matrix, the GPU writes the drawing content of the instruction into the color attachment C and depth attachment C in the third memory space. For example, the drawing instruction for drawing a moving car can carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the moving car 103 into the color attachment C and depth attachment C in the third memory space. Figure 8B As shown, Figure 8B The color attachment C and depth attachment C in the third memory space are illustrated exemplarily. The color attachment C and depth attachment C contain the drawing content of the drawing instructions for the moving vehicle 103. It can be understood that the color attachment C is actually a block of memory in memory. Figure 8B To illustrate this more cle...

Claims

1. A method for image frame prediction, characterized in that, include: When drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object. The electronic device writes the color data of the first drawing object into the first color attachment and writes the color data of the second drawing object into the second color attachment. When drawing the second drawing frame, the electronic device determines that the spatial information of the third drawing object has changed according to the drawing instruction of the third drawing object, and determines that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object. The electronic device writes the color data of the third drawing object into the third color attachment and writes the color data of the fourth drawing object into the fourth color attachment. The electronic device generates a fifth color attachment for the first predicted frame based on the first color attachment and the third color attachment, and generates a sixth color attachment for the first predicted frame based on the second color attachment and the fourth color attachment; The electronic device combines the fifth color attachment and the sixth color attachment into the first prediction frame.

2. The method according to claim 1, characterized in that, The electronic device generates a fifth color attachment for the first predicted frame based on the first color attachment and the third color attachment, including: The electronic device determines a first motion vector of the third color accessory based on the first color accessory and the third color accessory; The electronic device generates a fifth color attachment for the first predicted frame based on the third color attachment and the first motion vector.

3. The method according to claim 2, characterized in that, The electronic device determines a first motion vector for the third color accessory based on the first color accessory and the third color accessory; specifically including: The electronic device divides the third color accessory into Q pixel blocks, and the electronic device extracts the first pixel block from the Q pixel blocks of the third color accessory; The electronic device identifies a second pixel block in the first color accessory that matches the first pixel block; The electronic device obtains the motion vector of the first pixel block based on the displacement of the second pixel block from the first pixel block; The electronic device determines the first motion vector of the third color attachment based on the motion vector of the first pixel block.

4. The method according to claim 3, characterized in that, The electronic device determines a second pixel block that matches the first pixel block in the first color attachment, specifically including: The electronic device determines multiple candidate pixel blocks in the first color attachment based on the first pixel point in the first pixel block; The electronic device calculates the color value difference between the plurality of candidate pixel blocks and the first pixel block respectively; The electronic device determines the second pixel block that matches the first pixel block based on the difference between the color values ​​of the plurality of candidate pixel blocks and the first pixel block. The second pixel block is the candidate pixel block with the smallest difference between the color values ​​of the plurality of candidate pixel blocks and the first pixel block.

5. The method according to claim 1, characterized in that, The electronic device generates a sixth color attachment for the first predicted frame based on the second and fourth color attachments, specifically including: The electronic device determines the second motion vector of the fourth color accessory based on the second color accessory and the fourth color accessory; The electronic device generates a sixth color attachment for the first predicted frame based on the fourth color attachment and the second motion vector.

6. The method according to claim 5, characterized in that, The electronic device determines the second motion vector of the fourth color accessory based on the second color accessory and the fourth color accessory, specifically including: The electronic device divides the fourth color accessory into Q pixel blocks, and the electronic device extracts the third pixel block from the fourth color accessory; The electronic device calculates the first position of the third pixel block in the second color attachment; The electronic device determines the motion vector of the third pixel block based on the first position and the second position of the third pixel block in the fourth color attachment; The electronic device determines the second motion vector of the fourth color attachment based on the motion vector of the third pixel block.

7. The method according to claim 6, characterized in that, The electronic device calculates the first position of the third pixel block in the second color attachment, specifically including: The electronic device obtains a first matrix from the drawing instructions of the first drawing frame and a second matrix from the drawing instructions of the second drawing frame. The first matrix is ​​used to record the rotation information of the camera position in the first drawing frame, and the second matrix is ​​used to record the rotation information of the camera position in the second drawing frame. The electronic device calculates the first position of the third pixel block in the second color attachment based on the first matrix, the second matrix, and the depth value of the third pixel block.

8. The method according to claim 7, characterized in that, The drawing instructions for the first drawing object include the execution drawing instructions for the first drawing object and the drawing state device instructions for the first drawing object. The execution drawing instructions for the first drawing object are used to trigger the electronic device to perform drawing and rendering on the drawing state data of the first drawing object and generate a drawing result. The drawing state device instructions for the first drawing object are used to set the drawing state data on which the execution drawing instructions for the first drawing object depend. The drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information cache index of the first drawing object. The drawing instructions for the second drawing object include the execution drawing instructions for the second drawing object and the drawing state device instructions for the second drawing object. The execution drawing instructions for the second drawing object are used to trigger the electronic device to perform drawing and rendering on the drawing state data of the second drawing object and generate a drawing result. The drawing state device instructions for the second drawing object are used to set the drawing state data on which the execution drawing instructions for the second drawing object depend. The drawing state data of the second drawing object includes the vertex information data, vertex index, texture information, and vertex information cache index of the second drawing object. The drawing instructions for the third drawing object include the execution drawing instructions for the third drawing object and the drawing state device instructions for the third drawing object. The execution drawing instructions for the third drawing object are used to trigger the electronic device to perform drawing and rendering based on the drawing state data of the third drawing object and generate a drawing result. The drawing state device instructions for the third drawing object are used to set the drawing state data on which the execution drawing instructions for the third drawing object depend. The drawing state data of the third drawing object includes the vertex information data, vertex index, texture information, and vertex information cache index of the third drawing object. The drawing instructions for the fourth drawing object include the execution drawing instructions for the fourth drawing object and the drawing state device instructions for the fourth drawing object. The execution drawing instructions for the fourth drawing object are used to trigger the electronic device to perform drawing and rendering based on the drawing state data of the fourth drawing object and generate a drawing result. The drawing state device instructions for the fourth drawing object are used to set the drawing state data on which the execution drawing instructions for the fourth drawing object depend. The drawing state data of the fourth drawing object includes the vertex information data, vertex index, texture information, and vertex information cache index of the fourth drawing object.

9. The method according to any one of claims 1-8, characterized in that, The electronic device determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, including: the electronic device determines that there is a transfer matrix parameter in the drawing instruction of the first drawing object; the electronic device determines that the transfer matrix parameter in the drawing instruction of the first drawing object is different from the transfer matrix parameter of the corresponding first drawing object; the transfer matrix is ​​used to describe the mapping relationship from the local coordinate system to the world coordinate system of the drawing object. The electronic device determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object, including: the electronic device determines that there is no transition matrix parameter in the drawing instruction of the second drawing object, and the electronic device determines that the existing transition matrix parameter in the drawing instruction of the second drawing object is the same as the corresponding transition matrix parameter of the second drawing object; The electronic device determines that the spatial information of the first drawing object has changed according to the drawing instruction of the third drawing object, including: the electronic device determines that there is a transition matrix parameter in the drawing instruction of the third drawing object, and the electronic device determines that the transition matrix parameter in the drawing instruction of the third drawing object is different from the corresponding transition matrix parameter of the third drawing object; The electronic device determines that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, including: the electronic device determines that there is no transition matrix parameter in the drawing instruction of the second drawing object, and the electronic device determines that the existing transition matrix parameter in the drawing instruction of the second drawing object is the same as the transition matrix parameter of the corresponding second drawing object.

10. The method according to any one of claims 1-8, characterized in that, When drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object. Before the electronic device writes the color data of the first drawing object to the first color attachment and the color data of the second drawing object to the second color attachment, the method further includes: The electronic device creates a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, a sixth memory space, and a seventh memory space; wherein, the first memory space is used to store the first color attachment, the second memory space is used to store the second color attachment, the third memory space is used to store the third color attachment, the fourth memory space is used to store the fourth color attachment, the fifth memory space is used to store the fifth color attachment, the sixth memory space is used to store the sixth color attachment, and the seventh memory space is used to store the first prediction frame.

11. The method according to claim 10, characterized in that, When drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object. After the electronic device writes the color data of the first drawing object into a first color attachment and the color data of the second drawing object into a second color attachment, the method further includes: The electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.

12. The method according to claim 10, characterized in that, When drawing the second drawing frame, the electronic device determines that the spatial information of the third drawing object has changed according to the drawing instruction of the third drawing object, and determines that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object. The electronic device then writes the color data of the third drawing object into a third color attachment. After writing the color data of the fourth drawing object into a fourth color attachment, the method further includes: The electronic device combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.

13. The method according to claim 11, characterized in that, The electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space, specifically including: The electronic device combines the first color attachment and the second color attachment into the first drawing frame in the seventh memory space according to the first depth attachment and the second depth attachment. The first depth attachment is used to write the depth data of the first drawing object, and the second depth attachment is used to write the depth data of the second drawing object.

14. The method according to claim 12, characterized in that, The electronic device combines the third color attachment and the fourth color attachment into the second rendering frame in the seventh memory space, specifically including: The electronic device combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space according to the third depth attachment and the fourth depth attachment; the third depth attachment is used to write the depth data of the third drawing object, and the fourth depth attachment is used to write the depth data of the fourth drawing object.

15. The method according to claim 1, characterized in that, The method further includes: The electronic device determines the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and determines the eleventh moving object in the eleventh drawing frame according to the eleventh drawing instruction. The electronic device determines that the tenth motion object and the eleventh motion object are matched based on the attributes of the tenth motion object and the attributes of the eleventh motion object; The electronic device determines the rendering result of the twelfth motion object in the tenth prediction frame based on the tenth motion object and the eleventh motion object.

16. The method according to claim 15, characterized in that, The tenth rendering frame is displayed on the screen of the electronic device before the eleventh rendering frame, and the tenth prediction frame is displayed on the screen of the electronic device after the eleventh rendering frame.

17. The method according to any one of claim 15 or 16, characterized in that, The tenth rendering frame and the eleventh rendering frame are separated by one image frame, and the tenth prediction frame is the image frame immediately following the eleventh rendering frame.

18. The method according to claim 17, characterized in that, The electronic device determines that the tenth moving object and the eleventh moving object are matched based on the first attribute of the tenth moving object and the second attribute of the eleventh moving object, specifically including: The electronic device establishes a first index table, which is used to store the moving objects and their attributes in the tenth drawing frame. The first index table includes the tenth moving object and its attributes. The electronic device establishes a second index table, which is used to store the moving objects and their attributes in the eleventh drawing frame. The second index table includes the eleventh moving object and its attributes. The electronic device retrieves the eleventh motion object from the second index table and determines the tenth motion object that matches the eleventh motion object from the first index table.

19. The method according to claim 18, characterized in that, The matching of the tenth motion object and the eleventh motion object includes: the attributes of the tenth motion object are the same as the attributes of the eleventh motion object.

20. The method according to claim 15, characterized in that, The electronic device determines the rendering result of the twelfth moving object in the tenth prediction frame based on the tenth and eleventh moving objects, specifically including: The electronic device determines the first coordinates of the first point of the tenth moving object and the second coordinates of the second point of the eleventh moving object; The electronic device determines the tenth motion vector from the tenth moving object to the eleventh moving object based on the displacement from the first coordinate to the second coordinate. The electronic device determines the rendering result of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the eleventh moving object.

21. The method according to claim 20, characterized in that, The electronic device determines the first coordinates of the first point of the tenth moving object, specifically including: The electronic device determines the first coordinates of the first point based on the coordinates of all pixels of the tenth moving object; The electronic device determines the second coordinates of the second point of the eleventh moving object, specifically including: The electronic device determines the second coordinates of the second point based on the coordinates of all pixels of the eleventh moving object.

22. The method according to any one of claim 20 or 21, characterized in that, The first point is the geometric center point of the tenth moving object, and the second point is the geometric center point of the eleventh moving object.

23. The method according to claim 20, characterized in that, The electronic device determines the rendering result of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the eleventh moving object, specifically including: The electronic device determines the second pixel of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the first pixel of the eleventh moving object.

24. The method according to claim 23, characterized in that, The electronic device determines the second pixel of the twelfth moving object in the tenth prediction frame based on the tenth motion vector and the first pixel of the eleventh moving object, specifically including: The electronic device determines the eleventh motion vector from which the eleventh moving object moves to the twelfth moving object based on the tenth motion vector. The electronic device determines the second pixel of the twelfth moving object in the tenth prediction frame based on the eleventh motion vector and the first pixel of the eleventh moving object. The second pixel is the pixel that the first pixel moved from the eleventh drawing frame to the tenth prediction frame according to the eleventh motion vector.

25. The method according to claim 24, characterized in that, The eleventh motion vector is K times the tenth motion vector, where K is greater than 0 and less than 1.

26. The method according to claim 25, characterized in that, The value of K is 0.

5.

27. The method according to claim 1, characterized in that, The method further includes: Based on the predicted motion vectors of the blocks surrounding the first vertex from the target reference frame to the first predicted frame, the predicted motion vector of the first vertex from the target reference frame to the first predicted frame is determined. Here, the first vertex is a vertex in the first block, the first block is a block in the target reference frame, and the target reference frame is a frame determined from the first reference frame or the second reference frame based on the position of the first predicted frame relative to the first reference frame or the second reference frame. The first reference frame and the second reference frame are two adjacent frames in the video stream. The coordinates of the first vertex in the first prediction frame are determined based on the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex. The pixel block of the first block in the first prediction frame is determined based on the coordinates of the vertices of the first block in the first prediction frame and the coordinates in the target reference frame. The first predicted frame is displayed, including the pixel block.

28. The method according to claim 27, characterized in that, Determining the pixel block of the first block in the first prediction frame based on the coordinates of the vertices of the first block in the first prediction frame includes: Based on the coordinates of the vertices of the first block in the first prediction frame and the coordinates in the target reference frame, the correspondence between the coordinates of the pixels of the first block in the first prediction frame and the coordinates in the target reference frame is obtained. Based on the coordinates of the pixels in the first block in the target reference frame and the corresponding relationship, the coordinates of the pixels in the first block in the first prediction frame are determined.

29. The method according to claim 28, characterized in that, The step of obtaining the correspondence between the coordinates of the pixels of the first block in the first prediction frame and the coordinates in the target reference frame based on the coordinates of the vertices of the first block in the first prediction frame and the coordinates in the target reference frame includes: Input the coordinates of the four vertices of the first block in the first prediction frame and the coordinates in the target reference frame into the homography transformation formula to obtain a homography equation set, which includes four equations. Solve the homography equations to obtain the homography transformation matrix corresponding to the first block; Based on the homography transformation matrix corresponding to the first block, the homography transformation formula corresponding to the first block is obtained. The homography transformation formula corresponding to the first block is used to represent the correspondence between the coordinates of the pixels of the first block in the first prediction frame and the coordinates in the target reference frame.

30. The method according to claim 29, characterized in that, Determining the coordinates of pixels in the first block in the first prediction frame based on the coordinates of pixels in the first block in the target reference frame and the correspondence includes: The coordinates of the first pixel in the target reference frame are input into the homography transformation formula corresponding to the first block to obtain the coordinates of the first pixel in the first prediction frame. The first pixel is a pixel of the first block.

31. The method according to claim 30, characterized in that, The number of coordinates included in the region of the pixel block is greater than the number of coordinates of the first block in the first prediction frame. The region of the pixel block is determined by the vertices of the first block. Determining the coordinates of the pixels in the first block in the first prediction frame based on the coordinates of the pixels of the first block in the target reference frame and the correspondence further includes: The first coordinates are obtained by removing the coordinates of the first block's pixels in the first prediction frame from the coordinates of the region of the pixel block; The first coordinate is input into the homography transformation formula corresponding to the first block to obtain the pixel of the first coordinate in the target reference frame.

32. The method according to claim 31, characterized in that, Before determining the predicted motion vector of the first vertex from the target reference frame to the first predicted frame based on the predicted motion vectors of the blocks surrounding the first vertex from the target reference frame to the first predicted frame, the method further includes: Obtain the first reference frame and the second reference frame; The target reference frame is determined from the first reference frame and the second reference frame based on the position of the frame to be predicted; The target reference frame is divided into blocks according to square blocks of the first size; Calculate the motion vector of the block from the target reference frame to the first predicted frame.

33. The method according to claim 32, characterized in that, When the target reference frame is the first reference frame, calculating the motion vector of the block from the target reference frame to the first predicted frame includes: Obtain the motion vector of the first block from the first reference frame to the second reference frame; Half of the motion vector of the first block from the first reference frame to the second reference frame is determined as the predicted motion vector of the first block from the target reference frame to the first prediction frame.

34. The method according to claim 33, characterized in that, When the target reference frame is the second reference frame, calculating the motion vector of the first block from the target reference frame to the first predicted frame includes: Obtain the motion vector of the first block from the second reference frame to the first reference frame; Half of the negative value of the motion vector from the second reference frame to the first reference frame is determined as the predicted motion vector from the target reference frame to the first prediction frame.

35. The method according to claim 34, characterized in that, The step of determining the predicted motion vector of the first vertex from the target reference frame to the first predicted frame based on the predicted motion vector of the blocks surrounding the first vertex from the target reference frame to the first predicted frame includes: The average value of the predicted motion vectors of the blocks surrounding the first vertex from the target reference frame to the first prediction frame is determined as the predicted motion vector of the first vertex from the target reference frame to the first prediction frame.

36. The method according to claim 35, characterized in that, Determining the coordinates of the first vertex in the first prediction frame based on the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex includes: The coordinates of the first vertex in the target reference frame are added together with the predicted motion vector of the first vertex to obtain the coordinates of the first vertex in the first prediction frame.

37. The method according to claim 1, characterized in that, The method further includes: Based on the depth values ​​of the eleventh and twelfth blocks and their position coordinates in the image frame, determine the tenth position coordinates of the eleventh vertex of the prediction block in the prediction image frame; Wherein, the eleventh block is a block in the first image frame; the twelfth block is a block in the second image frame that matches the eleventh block according to the matching algorithm; Based on the color data of the reference block and the tenth position coordinates, a prediction block is generated, wherein the reference block is one of the eleventh or twelfth blocks; The predicted image frame is generated, and the predicted image frame includes the predicted block.

38. The method according to claim 37, characterized in that, The position coordinates in the image frame are position coordinates in a first coordinate system, which is a two-dimensional coordinate system. Determining the tenth position coordinate of the eleventh vertex of the prediction block in the predicted image frame includes: Based on the first depth value of the eleventh block and the twelfth position coordinate of the eleventh block in the first coordinate system, the thirteenth position coordinate in the second coordinate system is calculated. The second coordinate system is a three-dimensional coordinate system. Based on the second depth value of the twelfth block and the fourteenth position coordinate of the twelfth block in the first coordinate system, the fifteenth position coordinate in the second coordinate system is calculated; Based on the thirteenth and fifteenth position coordinates, the sixteenth position coordinates in the second coordinate system are calculated. Based on the sixteenth position coordinates, the tenth position coordinates in the first coordinate system are calculated.

39. The method according to claim 37 or 38, characterized in that, Before generating the prediction block, the method further includes: Based on the depth values ​​of the thirteenth and fourteenth blocks and their position coordinates in the image frame, the seventeenth position coordinates of the twelfth vertex of the prediction block in the prediction image frame are determined. Wherein, the thirteenth block is a block adjacent to the eleventh block, the fourteenth block is a block adjacent to the twelfth block, and the thirteenth block and the fourteenth block are mutually matched blocks determined according to the matching algorithm; Based on the depth values ​​of the fifteenth and sixteenth blocks and their position coordinates in the image frame, determine the eighteenth position coordinates of the thirteenth vertex of the predicted block in the predicted image frame; Wherein, the fifteenth block is a block adjacent to the thirteenth block, the sixteenth block is a block adjacent to the fourteenth block, and the fifteenth block and the sixteenth block are mutually matched blocks determined according to the matching algorithm; Based on the depth values ​​of the seventeenth and eighteenth blocks and their position coordinates in the image frame, the position coordinates of the fourteenth vertex of the predicted block in the predicted image frame are determined. Wherein, the seventeenth block is a block that is adjacent to both the eleventh block and the fifteenth block, the eighteenth block is a block that is adjacent to both the twelfth block and the sixteenth block, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.

40. The method according to claim 39, characterized in that, The position coordinates in the image frame are position coordinates in the first coordinate system. Determining the seventeenth position coordinate of the twelfth vertex of the predicted block in the predicted image frame based on the depth values ​​of the thirteenth and fourteenth blocks and their position coordinates in the image frame includes: Based on the third depth value of the thirteenth block and the twentieth position coordinate of the thirteenth block in the first coordinate system, the twenty-first position coordinate in the second coordinate system is calculated. The second coordinate system is a three-dimensional coordinate system. Based on the second depth value of the fourteenth block and the twenty-second position coordinates of the fourteenth block in the first coordinate system, the twenty-third position coordinates in the second coordinate system are calculated. Based on the 21st and 23rd position coordinates, the 24th position coordinates in the second coordinate system are calculated. The seventeenth position coordinates in the first coordinate system are calculated based on the twenty-fourth position coordinates.

41. The method according to claim 40, characterized in that, The step of generating a prediction block based on the color data of the reference block and the tenth position coordinates includes: Determine the correspondence between the tenth, seventeenth, eighteenth, and nineteenth position coordinates and the position coordinates of the four vertices in the reference block, respectively; The prediction block is generated based on the correspondence and the color data of the reference block.

42. The method according to claim 41, characterized in that, The color data includes the color data of each pixel in the reference block, and the step of generating the prediction block based on the correspondence and the color data of the reference block includes: Generate a homography transformation formula based on the aforementioned correspondence; Based on the homography transformation formula and the position coordinates of each pixel in the reference image frame, the position coordinates of each pixel in the predicted image frame are determined, and the image frame in which the reference block is located is the reference image frame; The prediction block is generated based on the color data of each pixel and the position coordinates of each pixel in the prediction image frame.

43. The method according to claim 41 or 42, characterized in that, The reference block includes: the fifteenth vertex, the sixteenth vertex, the seventeenth vertex, and the eighteenth vertex. Determining the correspondence between the tenth, seventeenth, eighteenth, and nineteenth position coordinates and the position coordinates of the four vertices in the reference block includes: The coordinates of the tenth position and the coordinates of the fifteenth vertex are determined to be a corresponding set of coordinates; The coordinates of the seventeenth position and the coordinates of the sixteenth vertex are determined to be a pair of corresponding position vertices; The coordinates of the eighteenth position and the coordinates of the seventeenth vertex are determined to be a corresponding set of coordinates; The coordinates of the nineteenth position and the coordinates of the eighteenth vertex are determined to be a corresponding set of coordinates; The reference block is a quadrilateral. The position and direction of the fifteenth vertex relative to the center point of the reference block are the same as the position and direction of the eleventh block relative to the fifteenth block; the position and direction of the sixteenth vertex relative to the center point of the reference block are the same as the position and direction of the thirteenth block relative to the seventeenth block; the position and direction of the seventeenth vertex relative to the center point of the reference block are the same as the position and direction of the fifteenth block relative to the eleventh block; and the position and direction of the eighteenth vertex relative to the center point of the reference block are the same as the position and direction of the seventeenth block relative to the thirteenth block.

44. The method according to claim 38, characterized in that, The step of calculating the sixteenth position coordinate in the second coordinate system based on the thirteenth and fifteenth position coordinates includes: Calculate the displacement vector from the thirteenth position coordinate to the fifteenth position coordinate to obtain the first displacement vector; The sixteenth position coordinate is calculated based on the thirteenth position coordinate or the fifteenth position coordinate and the first displacement vector of the first ratio.

45. The method according to claim 44, characterized in that, The first ratio is equal to the preset value.

46. ​​The method according to claim 44, characterized in that, The image frame containing the reference block is the reference image frame. The first image frame is located before the second image frame in the data stream, before the calculation of the sixteenth position coordinate. The method further includes: The first ratio is determined to be the ratio of the absolute value of the first time difference to the absolute value of the second time difference; The first time difference is equal to the difference between the time point of the predicted image frame in the data stream and the time point of the reference frame in the data stream; The second time difference is equal to the difference between the time point of the first image frame in the data stream and the time point of the second image frame in the data stream.

47. The method according to claim 46, characterized in that, The step of calculating the sixteenth position coordinate based on the thirteenth position coordinate or the fifteenth position coordinate and the first displacement vector of the first ratio includes: If the reference image frame is the first image frame, then the sixteenth position coordinate is calculated based on the thirteenth position coordinate and the first displacement vector of the first ratio; If the reference image frame is the second image frame, then the sixteenth position coordinate is calculated based on the fifteenth position coordinate and the first displacement vector of the first ratio.

48. The method according to claim 47, characterized in that, The image frame containing the reference block is the reference image frame. The first image frame is located before the second image frame in the data stream. The method for determining that the eleventh vertex of the prediction block is before the tenth position coordinate in the prediction image frame further includes: One of the first image frame and the second image frame is determined as the reference image frame; Determine another image frame, other than the reference image frame, from the first image frame and the second image frame as the matching image frame; The reference image frame is divided into blocks to obtain the reference block; According to the matching algorithm, the block in the matching image frame that matches the reference block is determined as the matching block; wherein, if the reference block is the eleventh block, then the matching block is the twelfth block; if the reference block is the twelfth block, then the matching block is the eleventh block.

49. The method according to claim 48, characterized in that, The step of determining the block in the matching image frame that matches the reference block according to the matching algorithm as the matching block includes: The block with the highest similarity to the reference block within a first region of the matching image frame is determined as the matching block; the first region is a region of a preset shape with a first area centered on the reference position coordinates in the matching image frame, and the reference position coordinates are the position coordinates of the reference block in the reference image frame.

50. The method according to claim 49, characterized in that, Before determining the block with the highest similarity to the reference block within the first region of the matching image frame as the matching block, the method further includes: The first area is calculated based on the reference depth value of the reference block, wherein the larger the reference depth value, the smaller the calculated first area.

51. The method according to claim 50, characterized in that, Before determining the block with the highest similarity to the reference block within the first region of the matching image frame as the matching block, the method further includes: If the reference depth value of the reference block is greater than or equal to the first threshold, the first area is determined to be equal to the first preset area; If the reference depth value is greater than the second threshold and less than the first threshold, the first area is calculated based on the reference depth value, wherein the larger the reference depth value, the smaller the first area; If the reference depth value is less than or equal to the second threshold, the first area is determined to be equal to the second preset area; Wherein, the first threshold is greater than the second threshold, and the second preset area is greater than the first preset area.

52. The method according to claim 1, characterized in that, The methods include: During the first drawing cycle, according to the drawing instructions of the target application, when the drawing instructions meet the first condition, the drawing result is stored in the seventh storage space as the first drawing result; when the drawing instructions meet the second condition, the drawing result is stored in the eighth storage space as the second drawing result. A seventh image frame is generated based on the first and second drawing results; During the second drawing cycle, according to the drawing instructions of the target application, when the drawing instructions meet the first condition, the drawing result is stored in the seventh storage space as the third drawing result; when the drawing instructions meet the second condition, no drawing is performed. The eighth image frame is generated based on the third drawing result and the second drawing result.

53. The method according to claim 52, characterized in that, The method further includes: During the third drawing cycle, according to the drawing instructions of the target application, when the drawing instructions meet the first condition, the drawing result is stored in the seventh storage space as the fourth drawing result, and when the drawing instructions meet the second condition, the drawing result is stored in the eighth storage space as the fifth drawing result. The third drawing cycle is located after the first drawing cycle. A ninth image frame is generated based on the fourth and fifth drawing results; During the fourth drawing cycle, a sixth drawing result is generated based on the first drawing result and the fourth drawing result; The tenth image frame is generated based on the sixth and seventh drawing results; the seventh drawing result is the drawing result obtained in the fifth drawing cycle when the drawing instructions of the target application satisfy the second condition, and the fifth drawing cycle is before the fourth drawing cycle.

54. The method according to claim 53, characterized in that, The step of generating the seventh image frame based on the first drawing result and the second drawing result includes: Store the first drawing result and the second drawing result into the ninth storage space; The seventh image frame is generated in the ninth storage space based on the first drawing result and the second drawing result.

55. The method according to claim 54, characterized in that, The step of generating the ninth image frame based on the fourth and fifth rendering results includes: The fourth and fifth drawing results are stored in the ninth storage space; The ninth image frame is generated in the ninth storage space based on the fourth drawing result and the fifth drawing result.

56. The method according to claim 54 or 55, characterized in that, The step of generating the tenth image frame based on the sixth and seventh rendering results includes: The sixth and seventh drawing results are stored in the ninth storage space; The tenth image frame is generated in the ninth storage space based on the sixth and seventh drawing results.

57. The method according to claim 56, characterized in that, The seventh storage space consists of a tenth storage space and an eleventh storage space. The first drawing result is stored in the tenth storage space, and the fourth drawing result is stored in the eleventh storage space. Generating the sixth drawing result based on the first drawing result and the fourth drawing result includes: The first drawing result is stored in the eleventh storage space; The sixth drawing result is generated in the eleventh storage space based on the first drawing result and the fourth drawing result.

58. The method according to claim 57, characterized in that, The seventh storage space comprises at least three storage spaces, including a tenth storage space, an eleventh storage space, and a twelfth storage space; the first drawing result is stored in the tenth storage space, the fourth drawing result is stored in the eleventh storage space, and the step of generating a sixth drawing result based on the first drawing result and the fourth drawing result includes: Store the first drawing result and the fourth drawing result into the twelfth storage space; The sixth drawing result is generated in the twelfth storage space based on the first drawing result and the fourth drawing result.

59. The method according to claim 58, characterized in that, The third drawing cycle is adjacent to the fourth drawing cycle; the fifth drawing cycle is the same as the third drawing cycle, and the fifth drawing result and the seventh drawing result are the same drawing result.

60. The method according to claim 59, characterized in that, The step of generating the seventh image frame based on the first drawing result and the second drawing result includes: The second drawing result is stored in the seventh storage space; The seventh image frame is generated in the seventh storage space based on the first drawing result and the second drawing result.

61. The method according to any one of claims 57-60, characterized in that, The electronic device includes a counting unit; the initial value of the counting unit is a first value, and the value of the counting unit switches between the first value and a second value every time it is updated; the counting unit is updated at the beginning of the drawing cycle. In one drawing cycle If the updated value of the counting unit is the second value, the eighth storage space is cleared at the start of the drawing cycle; and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space. If the updated value of the counting unit is the first value, the eighth storage space will not be cleared at the beginning of the drawing cycle; and drawing will not be performed when the drawing instruction meets the second condition.

62. The method according to claim 61, characterized in that, The method further includes: During the third drawing cycle, a fourth drawing result is generated based on the first drawing result and the third drawing result; A ninth image frame is generated based on the second and fourth drawing results.

63. The method according to claim 62, characterized in that, The electronic device includes a counting unit. The initial value of the counting unit is a first value. The counting unit repeatedly updates and switches between the three values ​​in the order of the first value, the second value, and the third value. The counting unit is updated at the beginning of the drawing cycle. In one drawing cycle If the updated value of the counting unit is the second value, the eighth storage space is cleared at the start of the drawing cycle; and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space. If the updated value of the counting unit is the first value or the third value, the eighth storage space will not be cleared at the beginning of the drawing cycle; and drawing will not be performed when the drawing instruction meets the second condition.

64. The method according to claim 63, characterized in that, The ninth storage space is composed of at least two storage spaces, which alternate between a first state and a second state according to the first instruction of the target application during runtime. At any given time, only one of the at least two storage spaces is in the first state, while the remaining storage spaces are in the second state. When the at least two storage spaces are in the first state, the image frames in the at least two storage spaces can be transmitted to the display device for display. When the at least two storage spaces are in the second state, the electronic device can draw in the at least two storage spaces. The two image frames generated in two adjacent drawing cycles are stored in two different storage spaces in the ninth storage space.

65. The method according to claim 64, characterized in that, The first condition is: the drawing instructions contain instructions to enable depth testing; The second condition is: the drawing instructions contain instructions to disable depth testing.

66. The method according to claim 65, characterized in that, The time points of any two adjacent drawing cycles are the time points when the target application calls the second instruction.

67. The method according to claim 1, characterized in that, The method further includes: When drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result. The size of the first drawing range is larger than the size of the twenty-first drawing frame of the first application. When drawing the twenty-second drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-second drawing frame according to the second drawing range to obtain the twenty-second drawing result. The size of the twenty-second memory space is larger than the size of the twenty-second drawing frame, wherein the size of the twenty-first drawing frame is the same as the size of the twenty-second drawing frame. The electronic device predicts and generates a 23rd prediction frame for the first application based on the 21st and 22nd drawing results, wherein the size of the 23rd prediction frame is the same as the size of the 21st drawing frame.

68. The method according to claim 67, characterized in that, The electronic device draws the drawing instructions of the 21st drawing frame according to the first drawing range to obtain the 21st drawing result, specifically including: The electronic device modifies the first parameter in the first drawing instruction of the twenty-first drawing frame issued by the first application to a first drawing range; the first parameter is used to set the drawing range size of the twenty-first drawing frame; The electronic device draws the modified drawing instructions of the twenty-first drawing frame according to the first drawing range, and obtains the twenty-first drawing result.

69. The method according to claim 68, characterized in that, The size of the first drawing area is larger than the size of the twenty-first drawing frame of the first application, specifically including: The width of the first drawing range is K3 times the width of the 21st drawing frame, and the height of the first drawing range is K4 times the height of the 21st drawing frame, where K3 is greater than 1 and K4 is greater than 1.

70. The method according to claim 69, characterized in that, K3 and K4 are fixed values ​​configured by the system of the electronic device, or are determined by the electronic device according to the drawing parameters contained in the drawing instruction of the 21st drawing frame.

71. The method according to claim 70, characterized in that, The electronic device draws the modified twenty-first drawing frame according to the first drawing range, obtaining the twenty-first drawing result, specifically including: The electronic device generates a first transformation matrix based on K3 and K4. The electronic device then adjusts the size of the drawing content in the drawing instruction of the modified twenty-first drawing frame according to the first transformation matrix and draws it into the first drawing range to obtain the twenty-first drawing result.

72. The method according to claim 67, characterized in that, The electronic device draws the drawing instructions of the 22nd drawing frame according to the second drawing range to obtain the 22nd drawing result, specifically including: The electronic device modifies the second parameter in the second drawing instruction of the twenty-second drawing frame issued by the first application to the second drawing range; the second parameter is used to set the drawing range size of the twenty-second drawing frame; The electronic device draws the modified drawing instructions of the twenty-second drawing frame according to the second drawing range, and obtains the twenty-second drawing result.

73. The method according to claim 72, characterized in that, The size of the second drawing area is larger than the size of the twenty-second drawing frame of the first application, specifically including: The width of the second drawing range is K5 times the width of the twelfth drawing frame, and the height of the second drawing range is K6 times the height of the twelfth drawing frame, where K5 is greater than 1 and K6 is greater than 1.

74. The method according to claim 73, characterized in that, K5 and K6 are fixed values ​​configured by the system of the electronic device, or are determined by the electronic device according to the drawing parameters contained in the drawing instruction of the 22nd drawing frame.

75. The method according to claim 74, characterized in that, The electronic device draws the modified drawing instructions of the twenty-second drawing frame according to the second drawing range to obtain the twenty-second drawing result, which specifically includes: The electronic device generates a second transformation matrix based on K5 and K6. The electronic device then adjusts the size of the drawing content in the drawing instruction of the modified twenty-second drawing frame according to the second transformation matrix and draws it into the second drawing range to obtain the twenty-second drawing result.

76. The method according to claim 75, characterized in that, The electronic device predicts and generates a 23rd prediction frame for the first application based on the 21st and 22nd rendering results, specifically including: The electronic device predicts and generates the 23rd prediction frame based on the 21st and 22nd drawing results; The electronic device cuts the 23rd rendering result into the 23rd prediction frame.

77. The method according to claim 76, characterized in that, The electronic device predicts and generates the 23rd prediction frame based on the 21st and 22nd rendering results, specifically including: The electronic device determines the first motion vector of the second twelfth drawing result based on the second twelfth drawing result and the second twelfth drawing result; The electronic device predicts and generates the 23rd prediction frame based on the 22nd rendering result and the first motion vector.

78. The method according to claim 77, characterized in that, The electronic device determines the first motion vector of the second twelfth rendering result based on the second twelfth rendering result and the second twelfth rendering result, specifically including: The electronic device divides the twentieth drawing result into Q pixel blocks, and the electronic device extracts the first pixel block from the Q pixel blocks of the twentieth drawing result; The electronic device determines a second pixel block that matches the first pixel block in the twenty-first drawing result; The electronic device obtains the motion vector of the first pixel block based on the displacement of the second pixel block from the first pixel block; The electronic device determines the first motion vector of the twentieth rendering result based on the motion vector of the first pixel block.

79. The method according to claim 78, characterized in that, The electronic device determines a second pixel block that matches the first pixel block in the twenty-first rendering result, specifically including: The electronic device determines multiple candidate pixel blocks in the 21st drawing result by using the first pixel point in the first pixel block; The electronic device calculates the color value difference between the plurality of candidate pixel blocks and the first pixel block respectively; The electronic device determines the second pixel block that matches the first pixel block based on the difference between the color values ​​of the plurality of candidate pixel blocks and the first pixel block. The second pixel block is the candidate pixel block with the smallest difference between the color values ​​of the plurality of candidate pixel blocks and the first pixel block.

80. The method according to claim 79, characterized in that, When drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, specifically including: When drawing the twenty-first drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-first drawing frame in the twenty-first memory space according to the first drawing range to obtain the twenty-first drawing result. The size of the twenty-first memory space is greater than or equal to the size of the first drawing range.

81. The method according to claim 80, characterized in that, When drawing the twenty-second drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-second drawing frame according to the second drawing range to obtain the twenty-second drawing result, specifically including: When drawing the twenty-second drawing frame of the first application, the electronic device draws the drawing instructions of the twenty-second drawing frame in the twenty-second memory space according to the second drawing range to obtain the twenty-second drawing result. The size of the twenty-second memory space is greater than or equal to the size of the second drawing range.

82. The method according to claim 78, characterized in that, The electronic device predicts and generates the 23rd prediction frame based on the 22nd rendering result and the first motion vector, specifically including: The electronic device generates a 23rd drawing result based on the 22nd drawing result and the first motion vector, according to a third drawing range; wherein the size of the third drawing range is larger than the size of the 23rd prediction frame.

83. The method according to any one of claims 67-82, characterized in that, When drawing the twenty-first drawing frame of the first application, after the electronic device draws the drawing instructions of the twenty-first drawing frame according to the first drawing range and obtains the twenty-first drawing result, the method further includes: The electronic device cuts the 21st drawing result into the 21st drawing frame.

84. The method according to claim 83, characterized in that, When drawing the twenty-second drawing frame of the first application, after the electronic device draws the drawing instructions of the twenty-second drawing frame according to the second drawing range and obtains the twenty-second drawing result, the method further includes: The electronic device cuts the twentieth drawing result into the twentieth drawing frame.

85. An electronic device, characterized in that, The electronic device includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, and the one or more processors calling the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 84.

86. A computer program product containing instructions, characterized in that, When the computer program product is run on an electronic device, it causes the electronic device to perform the method as described in any one of claims 1 to 84.

87. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1 to 84.

Citation Information

Patent Citations

  • Region-based motion estimation and modeling for accurate region-based motion compensation for efficient video processing or coding

    US20190045193A1

  • Systems and methods for image stitching

    US20190082103A1