WO2022068326A1 - Image frame prediction method and electronic device - Google Patents

Image frame prediction method and electronic device Download PDF

Info

Publication number
WO2022068326A1
WO2022068326A1 PCT/CN2021/106928 CN2021106928W WO2022068326A1 WO 2022068326 A1 WO2022068326 A1 WO 2022068326A1 CN 2021106928 W CN2021106928 W CN 2021106928W WO 2022068326 A1 WO2022068326 A1 WO 2022068326A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
frame
electronic device
twenty
result
Prior art date
Application number
PCT/CN2021/106928
Other languages
French (fr)
Chinese (zh)
Inventor
李煜
赵铎
胡笑鸣
黄开兴
蒋铭辉
陈健
周越海
王亮
高三山
季美辰
朱欢欢
王军
沈勇武
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202011493948.7A external-priority patent/CN114708289A/en
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN202180026284.XA priority Critical patent/CN115398907A/en
Publication of WO2022068326A1 publication Critical patent/WO2022068326A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction

Definitions

  • the present application relates to the field of electronic technology and the field of image processing, and in particular, to a method and electronic device for image frame prediction.
  • the video interface displayed by the electronic device (video playing interface such as TV series, movie, game screen, etc.) is essentially a continuous picture.
  • video playing interface such as TV series, movie, game screen, etc.
  • the higher the frame rate of the game screen the smoother the game screen displayed by the electronic device, and the better the user's visual experience.
  • the higher the frame rate the more image frames (drawing frames for short) that the electronic device needs to draw and render by applications (video applications, game applications, etc.), 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 under the condition of saving the power consumption of the electronic device is an urgent problem to be solved.
  • the present application provides an image frame prediction method and electronic device, which can improve the smoothness of the video interface displayed by the electronic device under the condition of saving the power consumption of the electronic device, which is an urgent problem to be solved.
  • the present application provides an image frame prediction method, the method may include: when drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, It is determined according to the drawing instruction of the second drawing object that the spatial information of the second drawing object has not changed, 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; when drawing the second drawing frame, 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, 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 accessory, and writes the color data of the fourth drawing object into the fourth color accessory; the electronic device generates the first prediction frame according to the first color accessory and the third color accessory The fifth color accessory of the first predicted frame is generated according to the second color accessory and the fourth color accessory; the
  • the electronic device can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, 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 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.
  • 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.
  • the electronic device may separately store the color data of the moving object and the color data of the static object in the second drawing frame.
  • the electronic device may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame.
  • the electronic device may predict the static object in the first predicted 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 utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the electronic device.
  • the electronic device generates a fifth color accessory of the first predicted frame according to the first color accessory and the third color accessory, including: the electronic device according to the first color accessory and the third color accessory, to determine the first motion vector of the third color accessory; the electronic device generates the fifth color accessory of the first predicted frame according to the second color accessory and the first motion vector.
  • 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 calculated more accurately. Moreover, the electronic device only calculates the motion vector of the moving object according to the color data of the moving object. The electronic device will not miscalculate the motion vector of a moving object as the motion vector of a static object. Therefore, the moving object in the predicted frame predicted by the electronic device is more accurate.
  • the electronic device determines the first motion vector of the third color accessory according to the first color accessory and the third color accessory; specifically, the electronic device includes: The third color accessory is divided into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks of the third color accessory; the electronic device determines the second pixel block matching the first pixel block in the first color accessory ; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first motion vector of the third color accessory according to the motion vector of the first pixel block.
  • the electronic device can determine the motion vectors of all pixel blocks in the Q pixel blocks of the third color accessory.
  • Each pixel block includes f*f (for example, 16*16) pixel points.
  • the electronic device divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
  • the electronic device determines, in the first color attachment, a second pixel block that matches the first pixel block, specifically including: the electronic device passes the first pixel block in the first pixel block The pixel points determine multiple candidate pixel blocks in the first color attachment, and the electronic device calculates the difference between the color values of the multiple candidate pixel blocks and the first pixel block; the electronic device calculates the first pixel block according to the multiple candidate pixel blocks.
  • the difference between the color values of the pixel blocks determines a second pixel block matching the first pixel block; the second pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks.
  • the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
  • the electronic device generates the fifth color attachment of the first predicted frame according to the second color attachment and the first motion vector, which specifically includes: the electronic device determines the fifth color attachment according to the first motion vector.
  • the motion vector of the color attachment, and the fifth color attachment is generated 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 the first motion vector, where K is greater than 0 and less than 1.
  • K is equal to 0.5. In this way, the objects in each image frame move 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.
  • the electronic device generates a sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory; specifically, the electronic device generates a sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory;
  • the color attachment determines the second motion vector of the fourth color attachment; the electronic device generates the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector.
  • the electronic device only uses 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 calculated more accurately. And, 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 miscalculate the motion vector of a static object as the motion vector of a moving object. Therefore, the static object in the predicted frame predicted by the electronic device is more accurate.
  • the electronic device determines the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; specifically, the electronic device divides the fourth color accessory into Q
  • the electronic device takes out the third pixel block in the fourth color attachment; the electronic device calculates the first position of the third pixel block in the second color attachment; the electronic device calculates the first position of the third pixel block according to the The second position in the color attachment determines the motion vector of the third pixel block; the electronic device determines the second motion vector of the fourth color attachment according to the motion vector of the third pixel block.
  • the electronic device can determine the motion vector of each pixel block in the Q pixel blocks of the fourth color accessory.
  • the electronic device divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
  • the electronic device calculates the first position of the third pixel block in the second color attachment, which specifically includes: the electronic device obtains the drawing of the first drawing frame The first matrix in the instruction and the second matrix of the drawing instruction in the second drawing frame, the first matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the camera position of the second drawing frame 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 the depth value of the third pixel block.
  • the electronic device generates the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector, which specifically includes: the electronic device determines the sixth color attachment according to the second motion vector.
  • the motion vector of the color attachment, and the sixth color attachment is generated according to the motion vector of the fourth color attachment and the sixth color attachment.
  • the motion vector of the sixth color attachment is K times the second motion vector, where K is greater than 0 and less than 1.
  • K is equal to 0.5. In this way, the objects in each image frame move 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.
  • the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends.
  • the drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
  • the electronic device determining that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object includes: the electronic device determining that there is a transition in the drawing instruction of the first drawing object The matrix parameter, the electronic device determines that the existing transition matrix parameter in the drawing instruction of the first drawing object is different from the transition matrix parameter of the corresponding first drawing object, and the transition matrix is used to describe the mapping of the local coordinate system of the drawing object to the world coordinate system relation.
  • the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 ;
  • the drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second 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 determining that the drawing instruction of the second drawing object does not contain any changes.
  • There is a transition matrix parameter 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, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the third drawing object depends.
  • the drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
  • the electronic device determining that the spatial information of the first drawing object has changed according to the drawing instruction of the third drawing object includes: the electronic device determining that the drawing instruction of the third drawing object is in the drawing instruction.
  • Existing transition matrix parameters the electronic device determines that the existing transition matrix parameters in the drawing instruction of the third drawing object are different from the transition matrix parameters of the corresponding third drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends.
  • the drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth 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 the drawing instruction of the fourth drawing object does not contain any changes.
  • There is a transition matrix parameter and the electronic device determines that the existing transition matrix parameter in the drawing instruction of the fourth drawing object is the same as the transition matrix parameter of the corresponding fourth drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • 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 the space of the second drawing object according to the drawing instruction of the second drawing object. The information has not changed, before the electronic device writes the color data of the first drawing object into the first color attachment, and before writing the color data of the second drawing object into the second color attachment, the method further includes: the electronic device creates the first color attachment.
  • Memory space second memory space, third memory space, fourth memory space, fifth memory space, sixth memory space, and seventh memory space; wherein, the first memory space is used to store the first color attachment, and the second memory space The 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, and the sixth memory space is used to store the fifth color attachment.
  • the seventh memory space is used for storing the first predicted frame.
  • the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, and according to the drawing of the second drawing object
  • the instruction determines that the spatial information of the second drawing object has not changed
  • the electronic device writes the color data of the first drawing object into the first color attachment
  • the method It also includes: the electronic device synthesizes the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
  • 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 according to the drawing of the fourth drawing object
  • the instruction determines that the spatial information of the fourth drawing object has not changed
  • the electronic device writes the color data of the third drawing object into the third color attachment
  • the method further includes : The electronic device synthesizes the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
  • the electronic device synthesizes the first color attachment and the second color attachment into the first drawing frame in the seventh memory space, which specifically includes: the electronic device according to the first depth attachment and The second depth attachment, the first color attachment and the second color attachment are combined into the first drawing frame in the seventh memory space, the first depth attachment is used for writing the depth data of the first drawing object, and the second depth attachment is used for Writes the second color attachment of the second drawable object.
  • the electronic device synthesizes the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space, which specifically includes: the electronic device according to the third depth attachment and The fourth depth attachment combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space; the third depth attachment is used for writing the depth data of the third drawing object, and the fourth depth attachment is used for Writes the depth data of the fourth draw object.
  • an electronic device may include: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used for storing computer program code, and the computer program code includes computer instructions , one or more processors invoke computer instructions to cause the electronic device to perform a method as in any possible manner of the first aspect.
  • an electronic device comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
  • the memory can be used to store computer program codes, and the computer program codes include computer instructions; the CPU can be used to determine that the spatial information of the first drawing object changes according to the drawing instructions of the first drawing object when drawing the first drawing frame, and according to the second drawing frame.
  • the drawing instruction of the drawing object determines that the spatial information of the second drawing object has not changed, and instructs the GPU to 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.
  • the drawing instruction of a drawing object indicates that the spatial information of the first drawing object changes, and the drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes; when drawing the second drawing frame, according to the first drawing
  • the drawing instruction of the third drawing object determines that the spatial information of the first drawing object has changed, and according to the drawing instruction of the fourth drawing object, it is determined that the spatial information of the fourth drawing object has not changed, and the GPU is instructed to write the color data of the third drawing object into the third drawing object.
  • Three-color attachment write the color data of the fourth drawing object into the fourth color attachment
  • the drawing instruction of the third drawing object indicates that the spatial information of the third drawing object changes, and the drawing instruction of the fourth drawing object does not indicate the fourth The spatial information of the drawn object changes.
  • the GPU can be used to write the color data of the first rendering object into the first color attachment, and write the color data of the second rendering object into the second color attachment; write the color data of the third rendering object into the third color attachment, and The color data of the fourth drawing object is written into the fourth color attachment; the fifth color attachment of the first predicted frame is generated according to the first color attachment and the third color attachment, and the first predicted frame is generated according to the second color attachment and the fourth color attachment.
  • the sixth color attachment of ; the fifth color attachment and the sixth color attachment are synthesized into the first prediction frame.
  • the display screen may be used to display the first drawing frame, the second drawing frame, and the first predicted frame.
  • the electronic device can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, 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 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.
  • 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.
  • the electronic device may separately store the color data of the moving object and the color data of the static object in the second drawing frame.
  • the electronic device may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame.
  • the electronic device may predict the static object in the first predicted 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 utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the electronic device.
  • the GPU may also be used to: determine the first motion vector of the third color accessory according to the first color accessory and the third color accessory; The motion vector generates the fifth color attachment of the first predicted frame.
  • 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 calculated more accurately. 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 miscalculate motion vectors for moving objects as motion vectors for static objects. Therefore, the moving object in the predicted frame predicted by the electronic device is more accurate.
  • the GPU may also be used to: divide the third color accessory into Q pixel blocks, and take out the first pixel block from the Q pixel blocks of the third color accessory; A second pixel block matching the first pixel block is determined in a color attachment; the motion vector of the first pixel block is obtained according to the displacement of the second pixel block to the first pixel block; the first pixel block is determined according to the motion vector of the first pixel block. The first motion vector of the three-color attachment.
  • the GPU divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. This reduces the amount of computation and thus reduces the power consumption of the GPU.
  • the GPU may also be used to: determine multiple candidate pixel blocks in the first color attachment by using the first pixel point in the first pixel block, and calculate multiple candidate pixel blocks respectively.
  • the difference between the color values of the candidate pixel block and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference of the color values of the first pixel block of the multiple candidate pixel blocks; the second pixel block is A candidate pixel block with the smallest difference between the color values of the first pixel block and the multiple candidate pixel blocks.
  • the GPU may also be used to: determine the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; The motion vector generates the sixth color attachment of the first predicted frame.
  • the GPU of the electronic device only uses 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 calculated more accurately. And, the GPU only calculates the motion vector of the static object based on the color data of the static object. The GPU will not miscalculate motion vectors for static objects as motion vectors for moving objects. Therefore, the static objects in the predicted frame predicted by the GPU are more accurate.
  • the GPU may also be used to: divide the fourth color attachment into Q pixel blocks, and take out the third pixel block from the fourth color attachment; calculate that the third pixel block is in The first position in the second color attachment; the motion vector of the third pixel block is determined according to the first position and the second position in the fourth color attachment of the third pixel block; the fourth pixel block is determined according to the motion vector of the third pixel block The second motion vector for the color attachment.
  • the GPU divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. This reduces the amount of computation and thus reduces the power consumption of the GPU.
  • the electronic device may also be used to: obtain the first matrix of the drawing instructions in the first drawing frame and the second matrix of the drawing instructions in the second drawing frame, and the third A matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the corner information of the camera position of the second drawing frame; according to the first matrix and the second matrix, and the depth value of the third pixel block The first position of the third pixel block in the second color attachment is calculated.
  • the GPU may also be used to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space , the seventh memory space; wherein, the first memory space is used to store the first color accessory, the second memory space is used to store the second color accessory, the third memory space is used to store the third color accessory, and the fourth memory space is used for The fourth color attachment is stored, 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.
  • the GPU may also be used to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
  • the GPU may also be used to: combine the first color attachment and the second color attachment in a seventh memory space into a first color attachment according to the first depth attachment and the second depth attachment Drawing frame; the third depth attachment is used to write the depth data of the first drawing object, and the fourth depth attachment is used to write the depth data of the second drawing object.
  • the GPU may also be used to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
  • the GPU may also be used to: combine the third color attachment and the fourth color attachment in the seventh memory space into the second depth attachment according to the third depth attachment and the fourth depth attachment Drawing frame; the third depth attachment is used to write the depth data of the third draw object, and the fourth depth attachment is used to write the depth data of the fourth draw object.
  • the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends.
  • the drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
  • the CPU determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and the CPU can also be specifically used to: determine the drawing instruction of the first drawing object.
  • Existing transition matrix parameters determining that the existing transition matrix parameters in the drawing instruction of the first drawing object are different from the transition matrix parameters of the corresponding first drawing object, and the transition matrix is used to describe the mapping of the local coordinate system of the drawing object to the world coordinate system relation.
  • the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object
  • the instruction is used to trigger the electronic device to draw and render 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
  • the drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second drawing object.
  • the CPU determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object, and the CPU can also be specifically used to: determine the drawing instruction of the second drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the second drawing object is the same as the transition matrix parameter of the corresponding second drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the third drawing object depends.
  • the drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
  • the CPU determines that the spatial information of the third drawing object has not changed according to the drawing instruction of the third drawing object, and the CPU may also be specifically used to: determine the drawing instruction of the third drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the third drawing object is the same as the transition matrix parameter of the corresponding third drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends.
  • the drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
  • the CPU determines that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, and the CPU may also be specifically used to: determine the drawing instruction of the fourth drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the fourth drawing object is the same as the transition matrix parameter of the corresponding fourth drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
  • an image frame prediction apparatus may include a drawing unit, a prediction unit, and a synthesis unit; wherein:
  • the drawing unit may be configured to, when drawing the first drawing frame, determine that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and determine that the spatial information of the second drawing object has not occurred according to the drawing instruction of the second drawing object. 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 the first color according to the drawing instruction of the third drawing object.
  • the spatial information of the drawing object changes, determine that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, 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 third color attachment. Color data is written to the fourth color attachment.
  • the prediction unit may be configured to generate a fifth color attachment of the first predicted frame according to the first color attachment and the third color attachment, and generate a sixth color attachment of the first predicted frame according to the second color attachment and the fourth color attachment.
  • the synthesis unit may be used to synthesize the fifth color attachment and the sixth color attachment into the first predicted frame.
  • the image frame prediction apparatus can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, the image frame predicting apparatus 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 rendering object is a moving object, the image frame prediction apparatus writes the color data of the rendering object into the first color attachment. If the rendering object is a static object, the image frame predicting apparatus writes the color data of the rendering object into the second color attachment.
  • the image frame prediction apparatus can separately store the color data of the moving object and the color data of the static object in the first drawing frame.
  • the image frame prediction apparatus may separately store the color data of the moving object and the color data of the static object in the second drawing frame.
  • the image frame prediction apparatus may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame.
  • the image frame predicting apparatus can predict the static object in the first predicted 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 predicting apparatus can utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the image frame predicting apparatus.
  • the prediction unit may also be used to: determine the first motion vector of the third color accessory according to the first color accessory and the third color accessory; A motion vector generates the fifth color attachment of the first predicted frame.
  • the image frame prediction apparatus 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. And, the image frame predicting apparatus calculates the motion vector of the moving object only based on the color data of the moving object. The image frame prediction apparatus does not miscalculate 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 image frame prediction device is more accurate.
  • the prediction unit may also be used to: divide the third color accessory into Q pixel blocks, and extract the first pixel block from the Q pixel blocks of the third color accessory;
  • the second pixel block matching the first pixel block is determined in the first color attachment;
  • the motion vector of the first pixel block is obtained according to the displacement of the second pixel block to the first pixel block;
  • the motion vector of the first pixel block is determined according to the motion vector of the first pixel block.
  • the first motion vector of the third color attachment may determine motion vectors of all pixel blocks in the Q pixel blocks of the third color attachment.
  • Each pixel block includes f*f (for example, 16*16) pixel points.
  • the prediction unit divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. In this way, the amount of computation can be reduced, thereby reducing the power consumption of the image frame prediction apparatus.
  • the prediction unit may also be used to: determine multiple candidate pixel blocks in the first color attachment by using the first pixel point in the first pixel block, and calculate the multiple candidate pixel blocks respectively.
  • the difference between the color values of the candidate pixel blocks and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference of the color values of the first pixel block of the multiple candidate pixel blocks; the second pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the multiple candidate pixel blocks.
  • the prediction unit can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
  • the prediction unit may also be used to: determine the motion vector of the fifth color accessory according to the first motion vector, and generate the first color accessory according to the motion vector of the second color accessory and the fifth color accessory.
  • the motion vector of the fifth color attachment is K times the first motion vector, where K is greater than 0 and less than 1.
  • K is equal to 0.5. In this way, the objects in each image frame move at a constant speed.
  • the prediction unit may be further configured to: determine the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; Two motion vectors generate the sixth color attachment of the first predicted frame.
  • the prediction unit only uses 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 calculated more accurately. And, the prediction unit calculates the motion vector of the static object only from the color data of the static object. The prediction unit does not miscalculate motion vectors of static objects as motion vectors of moving objects. Therefore, the static objects in the predicted frame predicted by the prediction unit are more accurate.
  • the prediction unit may also be used to: divide the fourth color accessory into Q pixel blocks, and take out the third pixel block from the fourth color accessory; calculate the third pixel block at the first position in the second color attachment; determine the motion vector of the third pixel block according to the first position and the second position in the fourth color attachment of the third pixel block; determine the first pixel block according to the motion vector of the third pixel block Second motion vector for four color attachments.
  • the prediction unit may determine the motion vector of each pixel block in the Q pixel blocks of the fourth color attachment.
  • the prediction unit divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. In this way, the amount of computation can be reduced, thereby reducing the power consumption of the image frame prediction apparatus.
  • the prediction unit may also be used to: obtain the first matrix in the drawing instructions of the first drawing frame and the second matrix of the drawing instructions in the second drawing frame, A matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the corner information of the camera position of the second drawing frame; according to the first matrix and the second matrix, and the depth value of the third pixel block The first position of the third pixel block in the second color attachment is calculated.
  • the prediction unit may also be used to: determine the motion vector of the sixth color accessory according to the second motion vector, and generate the sixth color accessory according to the motion vector of the fourth color accessory and the sixth color accessory.
  • the motion vector of the sixth color attachment is K times the second motion vector, where K is greater than 0 and less than 1.
  • the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends.
  • the drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
  • the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object
  • the instruction is used to trigger the electronic device to draw and render 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
  • the drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second drawing object.
  • the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 ;
  • the drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
  • the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object
  • the instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends.
  • the drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
  • the drawing unit may also be used to: determine the existence of transition matrix parameters in the drawing instruction of the first drawing object, and determine the existing transition matrix parameters in the drawing instruction of the first drawing object Different from the transition matrix parameter of the corresponding first drawing object, the transition matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.
  • the drawing unit may also be used to: determine that the transfer matrix parameter does not exist in the drawing instruction of the second drawing object, and determine the existing transition matrix in the drawing instruction of the second drawing object
  • the parameters are the same as the parameters of the transition matrix of the corresponding second drawing object, and the transition matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system.
  • the drawing unit may also be used to: determine the existence of transition matrix parameters in the drawing instruction of the third drawing object, and determine the existence of transitions in the drawing instruction of the third drawing object
  • the matrix parameter is different from the transition matrix parameter of the corresponding third drawing object, and the transition matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.
  • the drawing unit may also be used to: determine that the transfer matrix parameter does not exist in the drawing instruction of the fourth drawing object, and determine the existing transition matrix in the drawing instruction of the fourth drawing object
  • the parameters are the same as the parameters of the transition matrix of the corresponding fourth drawing object, and the transition matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system.
  • the drawing unit may also be used to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space space, the seventh memory space; wherein, the first memory space is used to store the first color accessory, the second memory space is used to store the second color accessory, the third memory space is used to store the third color accessory, and the fourth memory space is used to store the third color accessory.
  • the fifth memory space is used for storing the fifth color attachment
  • the sixth memory space is used for storing the sixth color attachment
  • the seventh memory space is used for storing the first prediction frame.
  • the synthesizing unit may be further configured to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
  • the synthesizing unit may further be configured to: combine the first color attachment and the second color attachment in the seventh memory space according to the first depth attachment and the second depth attachment A drawing frame; the third depth attachment is used for writing the depth data of the first drawing object, and the fourth depth attachment is used for writing the depth data of the second drawing object.
  • the synthesizing unit may be further configured to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
  • the synthesizing unit may be further configured to: combine the third color attachment and the fourth color attachment in the seventh memory space according to the third depth attachment and the fourth depth attachment Two drawing frames; the third depth attachment is used for writing the depth data of the third drawing object, and the fourth depth attachment is used for writing the depth data of the fourth drawing object.
  • the present application provides a method for image frame prediction, the method may include: the electronic device determines the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and draws the eleventh moving object according to the second drawing instruction The eleventh moving object is determined in the frame; the electronic device determines that the tenth moving object and the eleventh moving object match according to the attributes of the tenth moving object and the eleventh moving object; the electronic device determines that the tenth moving object and the tenth moving object match For a moving object, the drawing result of the twelfth moving object in the tenth prediction frame is determined.
  • the electronic device can draw the frame according to the two frames of the application to obtain the predicted frame. This increases the frame rate of the application's video interface. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved.
  • the tenth drawing frame is displayed on the display screen of the electronic device before the eleventh drawing frame
  • the tenth predicted frame is displayed on the display screen of the electronic device after the eleventh drawing frame. on the display. That is, the electronic device can draw frames according to the first two frames to predict the following predicted frames, thereby increasing the frame rate.
  • an image frame is separated between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is an image frame adjacent to the eleventh drawing frame.
  • the electronic device predicts the fifth prediction frame using the second rendering frame and the fourth rendering frame. In this way, the electronic device can have enough time to calculate the motion vector and draw the first predicted frame, so as to avoid the video interface being stuck after the electronic device displays the fourth drawn frame and the fifth drawn frame is not finished.
  • the electronic device determines that the tenth moving object matches the eleventh moving object according to 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, the first index table is used to save the moving objects in the tenth drawing frame and the properties of the moving objects, the first index table includes the tenth moving object and the properties of the tenth moving object; the electronic device A second index table is established, and the second index table is used to save the motion objects and the attributes of the motion objects in the eleventh drawing frame, and the second index table includes the attributes of the eleventh motion objects and the eleventh motion objects; The eleventh moving object is extracted from the second index table, and the tenth moving object matching the eleventh moving object is determined from the first index table. In this way, the electronic device can quickly find out the tenth moving object matching the eleventh moving object through the index table.
  • matching the tenth moving object with the eleventh moving object includes: the first attribute of the tenth moving object is the same as the second attribute of the eleventh moving object.
  • the electronic device determines the drawing result of the twelfth moving object in the tenth prediction frame according to the tenth moving object and the eleventh moving object, which specifically includes: the electronic device determining the first coordinate of the first point of the tenth moving object, and determining the second coordinate of the second point of the eleventh moving object; the electronic device determines the tenth moving object to the tenth moving object according to the displacement from the first coordinate to the second coordinate A tenth motion vector of a moving object; the electronic device determines a drawing result of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the eleventh moving object.
  • the electronic device can use the motion vector of one point of the object to represent the motion vector of the entire object, and does not need to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
  • the electronic device determines the first coordinates of the first point of the tenth moving object, which specifically includes: the electronic device determines the first coordinate according to the coordinates of all pixel points of the tenth moving object.
  • the first coordinates of the point; the electronic device determining the second coordinates of the second point of the eleventh moving object specifically includes: the electronic device determining the second coordinates of the second point according to the coordinates of all pixel points of the eleventh moving object.
  • the electronic device may obtain the coordinates of each pixel of the tenth moving object from the template image of the tenth moving object through the shader in the GPU.
  • the template image of the tenth moving object is drawn in the GPU.
  • the electronic device may obtain the coordinates of each pixel of the eleventh moving object from the template image of the eleventh moving object through the shader in the GPU.
  • the template image of the eleventh moving object is drawn in the GPU.
  • the first point is the geometric center point of the tenth moving object
  • the second point is the geometric center point of the eleventh moving object.
  • the center point of the moving object is more convenient to calculate, so that the calculation amount of the electronic device can be reduced, and the power consumption of the electronic device can be reduced.
  • 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, which specifically includes: the electronic device According to the tenth motion vector and the first pixel point of the eleventh moving object, the second pixel point of the twelfth moving object in the tenth prediction frame is determined.
  • the electronic device determines the second pixel point of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the first pixel point of the eleventh moving object , specifically including: the electronic device determines the eleventh motion vector of the eleventh moving object to the twelfth moving object according to the tenth motion vector; the electronic device determines the eleventh motion vector according to the eleventh motion vector and the first pixel point of the eleventh moving object , determine the second pixel of the twelfth moving object in the tenth prediction frame, and the second pixel is the pixel that the first pixel moves from the eleventh drawing frame to the tenth prediction frame according to the eleventh motion vector point.
  • the eleventh motion vector is K times the tenth motion vector, and K is greater than 0 and less than 1.
  • K is equal to 0.5. In this way, the objects in each image frame move 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.
  • an electronic device comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
  • the memory is used to store computer program code, the computer program code includes computer instructions;
  • the CPU is configured to determine the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and determine the eleventh moving object in the eleventh drawing frame according to the second drawing instruction;
  • the GPU is configured to determine that the tenth moving object and the eleventh moving object match according to the attributes of the tenth moving object and the eleventh moving object; determine the tenth prediction frame according to the tenth moving object and the eleventh moving object The drawing result of the twelfth moving object in ;
  • the display screen is used for displaying the tenth drawing frame, the eleventh drawing frame and the tenth prediction frame.
  • the electronic device provided by the embodiment of the present application can draw a frame according to two frames of an application to obtain a predicted frame. This increases the frame rate of the application's video interface. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved.
  • the tenth drawing frame is displayed on the display screen before the eleventh drawing frame
  • the tenth predicted frame is displayed on the display screen after the eleventh drawing frame. That is, the electronic device can draw frames according to the first two frames to predict the following predicted frames, thereby increasing the frame rate.
  • an image frame is separated between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is an image frame adjacent to the eleventh drawing frame.
  • the electronic device predicts the fifth prediction frame using the second rendering frame and the fourth rendering frame. In this way, the electronic device can have enough time to calculate the motion vector and draw the first predicted frame, so as to avoid the video interface being stuck after the electronic device displays the fourth drawn frame and the fifth drawn frame is not finished.
  • the CPU is specifically used to: establish a first index table, the first index table is used to save the motion object and the attributes of the motion object in the tenth drawing frame, and the first index table Including the attributes of the tenth motion object and the tenth motion object; establishing a second index table, the second index table is used to save the motion object in the eleventh drawing frame and the attributes of the motion object, and the second index table includes the eleventh motion Properties of the object and the eleventh motion object.
  • the GPU is specifically configured to: fetch the eleventh moving object from the second index table, and determine the tenth moving object matching the eleventh moving object from the first index table. In this way, the electronic device can quickly find the tenth moving object matching the eleventh moving object from the index table.
  • matching the tenth moving object with the eleventh moving object includes: the attributes of the tenth moving object are the same as the attributes of the eleventh moving object.
  • the GPU is specifically configured to: determine the first coordinate of the first point of the tenth moving object, and determine the second coordinate of the second point of the eleventh moving object; The displacement from the first coordinate to the second coordinate determines the tenth motion vector from the tenth moving object to the eleventh moving object; according to the tenth motion vector and the eleventh moving object, the twelfth motion in the tenth prediction frame is determined The result of drawing the object.
  • the electronic device can use the motion vector of one point of the object to represent the motion vector of the entire object, and does not need to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
  • the GPU is specifically used to: determine the first coordinates of the first point according to the coordinates of all the pixels of the tenth moving object; The coordinates of determine the second coordinates of the second point.
  • the first point is the geometric center point of the tenth moving object
  • the second point is the geometric center point of the eleventh moving object.
  • the GPU is specifically configured to: determine the first pixel of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the first pixel of the eleventh moving object. two pixels.
  • the GPU is specifically configured to: determine the eleventh motion vector from the eleventh moving object to the twelfth moving object according to the tenth motion vector; according to the eleventh motion vector and the first pixel of the eleventh moving object, determine the second pixel of the twelfth moving object in the tenth prediction frame, and the second pixel is the first pixel drawn according to the eleventh motion vector from the eleventh The pixel in the frame moves to the tenth predicted frame.
  • the eleventh motion vector is K times the tenth motion vector, and K is greater than 0 and less than 1.
  • K is equal to 0.5.
  • an embodiment of the present application provides a frame prediction method, wherein the method includes:
  • the electronic device determines the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, wherein 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 according to the position of the 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 predicted frame are determined according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex ;
  • According to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame determine the pixel block of the first block in the predicted frame; display the predicted frame, which includes the pixel block.
  • the electronic device first, for each vertex of the block, determines the position of the vertex in the predicted frame according to the predicted motion vector of the blocks around the vertex from the target reference frame to the predicted frame. Then, for each block, the position of each pixel of the block in the predicted frame is calculated according to the correspondence between the four vertices of the block in the reference frame and the predicted frame, and finally the entire predicted frame is obtained.
  • the vertex is determined, and then the first block is stretched according to the predicted motion vectors of the blocks around the first block, wherein the first block is a block in the reference frame, so that the adjacent prediction frames are made.
  • the vertices of the blocks are coincident, and the blocks are continuous without holes.
  • the electronic device obtains the coordinates of the pixels of the first block in the predicted frame and The corresponding relationship of the coordinates in the target reference frame, and further, according to the coordinates and the corresponding relationship of the pixels of the first block in the target reference frame, the coordinates of the pixels in the first block in the predicted frame are determined.
  • the electronic device inputs the coordinates of the four vertices of the first block in the predicted frame and the coordinates in the target reference frame into the homography transformation formula, respectively, to obtain the homography.
  • System of equations the system of homography equations consists of four equations.
  • the electronic device obtains the homography transformation matrix corresponding to the first block by solving the homography equation system, and then obtains the homography transformation formula corresponding to the first block according to the homography transformation matrix corresponding to the first block.
  • the homography transformation formula corresponding to the block is used to express the correspondence between the coordinates of the pixels of the first block in the predicted frame and the coordinates in the target reference frame.
  • 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,
  • the first pixel is one pixel of the first block.
  • 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 predicted frame, wherein the region of the pixel block is determined by the vertices of the first block .
  • the electronic device removes the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates, and then inputs the first coordinates into the homography transformation formula corresponding to the first block , get the pixel of the first coordinate in the target reference frame.
  • the electronic device executes the predicted motion vector from the target reference frame to the predicted frame according to the blocks around the first vertex, and determines the prediction of the first vertex from the target reference frame to the predicted frame. Before the motion vector, 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 square blocks of the first size, and then the motion vector of the block from the target reference frame to the predicted frame is calculated.
  • the electronic device 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 converts the first block to the second reference frame. Half of the motion vector 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 predicted frame.
  • the electronic device 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 converts the first block to the first reference frame.
  • the negative half of the motion vector from the second reference frame to the first reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
  • 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 average value of the predicted motion vectors of the first vertex from the target reference frame to the predicted frame. Predict the motion vector.
  • 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.
  • an embodiment of the present application provides an electronic device, characterized in that the electronic device includes: one or more processors, a memory, and a display screen; the memory is coupled to the one or more processors, and the memory is used to store a computer Program code, the computer program code includes computer instructions, and the one or more processors are used for invoking the computer instructions to cause the electronic device to execute: according to the predicted motion vector of the block around the first vertex from the target reference frame to the predicted frame, determine the first vertex from the predicted frame.
  • the predicted motion vector from the target reference frame to the predicted frame wherein 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 relative to the first reference frame according to the predicted frame Or the position of the second reference frame, a frame determined from 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 and the predicted motion vector of the first vertex determine the coordinates of the first vertex in the predicted frame; according to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame, determine the first block A block of pixels in a predicted frame; the predicted frame is displayed on the display screen, including the block of pixels.
  • the processor is specifically configured to: obtain the pixels of the first block in the predicted frame according to the coordinates of the vertices of the first block in the predicted frame and the coordinates in the target reference frame The corresponding relationship between the coordinates in the target reference frame and the coordinates in the target reference frame, according to the coordinates and the corresponding relationship of the pixels in the first block in the target reference frame, determine the coordinates of the pixels in the first block in the predicted frame.
  • the processor is specifically configured to: respectively input the coordinates of the four vertices of the first block in the predicted frame and the coordinates in the target reference frame into the homography transformation formula, Obtain the homography equation system, which includes four equations; solve the homography equation system to obtain the homography transformation matrix corresponding to the first block; according to the homography transformation matrix corresponding to the first block, obtain the first block.
  • a homography transformation formula corresponding to one block, and 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 predicted frame and the coordinates in the target reference frame.
  • the processor is specifically configured to: input the coordinates of the first pixel in the target reference frame into the homography transformation formula corresponding to the first block to obtain the first pixel in the predicted frame
  • the coordinates in , the first pixel is a pixel of the first block.
  • the processor is specifically configured to: remove the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates;
  • the coordinates are input into the homography transformation formula corresponding to the first block, and the pixels of the first coordinates in the target reference frame are obtained.
  • the processor is specifically configured to: acquire the first reference frame and the second reference frame; Determine the target reference frame; divide the target reference frame into blocks according to the square blocks of the first size; calculate the motion vector of the block from the target reference frame to the predicted frame.
  • the processor is specifically configured to: obtain a motion vector of the first block from the first reference frame to the second reference frame; Half of the motion vector of the reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
  • the processor is specifically configured to: obtain a motion vector of the first block from the second reference frame to the first reference frame;
  • the negative half of the motion vector of the reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
  • 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 first vertex from the target reference frame. The predicted motion vector to the predicted frame.
  • the processor is specifically configured to: add the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex to obtain the first vertex in the predicted frame coordinate of.
  • the present application provides an image frame generation method, the method may include: according to the depth values of the eleventh block and the twelfth block, the eleventh block and the twelfth block are in the image frame Position coordinates, determine the tenth position coordinates of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame; the twelfth block is the second image The block that matches the eleventh block determined according to the matching algorithm in the frame; the predicted block is generated according to the color data of the reference block and the tenth position coordinate, and the reference block is the eleventh block or the tenth position coordinate. generating the predicted image frame, the predicted image frame including the predicted block.
  • the color data may be the RGB value of each pixel included in the block.
  • the depth value is combined to predict the block, so that the generated prediction block can be scaled according to the depth value, so that the picture displayed by the predicted image frame is more consistent with the scene drawn by the electronic device according to the actual data;
  • the device inserts the predicted image frame into the original image frame drawn according to the actual data, the transition between the original image frame and the predicted image frame is more natural and smooth, which improves the user experience.
  • the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system, and the first coordinate system of the determined prediction block is
  • the tenth position coordinates of the eleven vertices in the predicted image frame include: according to the first depth value of the eleventh block and the twelfth position coordinates of the eleventh block in the first coordinate system, Calculate the thirteenth position coordinate under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the twelfth block and the first coordinate of the twelfth block
  • the fourteenth position coordinates under the system, the fifteenth position coordinates under the second coordinate system are calculated; according to the thirteenth position coordinates and the fifteenth position coordinates, the second coordinates are calculated
  • the sixteenth position coordinates under the system and the tenth position coordinates under the first coordinate system are calculated according to the sixteenth position coordinates.
  • the first coordinate system may be a screen coordinate system; the second coordinate system may be a camera coordinate system.
  • the position coordinates in the image frame in the embodiment of the present application are the coordinates in the screen coordinate system.
  • the electronic device can convert the position coordinates in the two-dimensional coordinate system into the three-dimensional space in combination with the depth value, and then realize the prediction of the position coordinates in the three-dimensional space by combining the changes of the three dimensions, and then convert the three-dimensional coordinates into the three-dimensional space.
  • the position coordinates predicted in the space are converted into two-dimensional space, and the position coordinates in the two-dimensional coordinate system are determined.
  • the prediction of position coordinates is realized by combining the data of three dimensions, and then a certain proportion of enlargement and reduction can be performed based on the reference block when generating the predicted block, so that the finally generated predicted image frame and the electronic device are drawn according to the data of the application program. results are more similar.
  • the method before the generating the prediction block, the method further includes: according to the depth values of the thirteenth block and the fourteenth block, the thirteenth block and the The position coordinates of the fourteenth block in the image frame, determine the seventeenth position coordinates of the twelfth vertex of the predicted block in the predicted image frame; wherein, the thirteenth block is the same as the eleventh block.
  • a block adjacent to a block, the fourteenth block is a block adjacent to the twelfth block, and the thirteenth block and the fourteenth block are mutually determined according to the matching algorithm.
  • the matched block according to the depth values of the fifteenth block and the sixteenth block, and the position coordinates of the fifteenth block and the sixteenth block in the image frame, it is determined that the thirteenth vertex of the prediction block is in the the eighteenth position coordinates in the predicted image frame; wherein, the fifteenth block is a block adjacent to the thirteenth block, and the sixteenth block is adjacent to the fourteenth block a block, the fifteenth block and the sixteenth block are mutually matched blocks determined according to the matching algorithm; block and the position coordinates of the eighteenth block in the image frame, determine the nineteenth position coordinates of the fourteenth vertex of the prediction block in the predicted image frame; wherein, the seventeenth block is the same as the The eleventh block and the fifteenth block are both adjacent blocks, the eighteenth block is a block adjacent to the twelfth block and the sixteenth block, and the eighteenth block is a block adjacent to both the twelfth block and the sixteenth block.
  • 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.
  • the position coordinates in the image frame are the position coordinates in the first coordinate system, and the depth values of the thirteenth and fourteenth blocks, the The position coordinates of the thirteenth block and the fourteenth block in the image frame, and determining the seventeenth position coordinate of the twelfth vertex of the predicted block in the predicted image frame, including: according to the thirteenth block The third depth value and the twentieth position coordinates of the thirteenth block under the first coordinate system are calculated to obtain the twenty-first position coordinates under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the fourteenth block and the twenty-second position coordinate of the fourteenth block in the first coordinate system, the first coordinate system under the second coordinate system is obtained by calculating Twenty-three position coordinates; according to the twenty-first position coordinates and the twenty-third position coordinates, the twenty-fourth position coordinates under the second coordinate system are calculated; according to the twenty-fourth position coordinates position coordinates, the seventeenth position coordinates, the seventeenth position coordinates, the seventeenth position
  • the predicted block is generated according to the color data of the reference block and the tenth position coordinate
  • the reference block is the eleventh block or the tenth block
  • One of the two blocks includes: determining the positions of the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate respectively and the positions of the four vertices in the reference block The corresponding relationship of coordinates; the predicted block is generated according to the corresponding relationship and the color data of the reference block.
  • the color data includes color data of each pixel in the reference block, and the color data generated according to the corresponding relationship and the color data of the reference block
  • the prediction block includes: generating a homography transformation formula according to the corresponding relationship; determining each pixel according to the homography transformation formula and the position coordinates of each pixel in the reference image frame The position coordinates of the pixels in the predicted image frame; the predicted block is generated according to the color data of each pixel and the position coordinates of each speed limit in the predicted image frame.
  • the reference block includes: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and the determining of the tenth position coordinate, The corresponding relationship between the seventeenth position coordinates, the eighteenth position coordinates and the nineteenth position coordinates respectively and the position coordinates of the four vertices in the reference block, including: determining the tenth position coordinates and the The position coordinates of the fifteenth vertex are a set of corresponding position coordinates; it is determined that the seventeenth position coordinates and the position coordinates of the sixteenth vertex are a set of corresponding position vertices; the eighteenth position coordinates and The position coordinates of the seventeenth vertex are a set of corresponding position coordinates; it is determined that the nineteenth position coordinates and the position coordinates of the eighteenth vertex are a set of corresponding position coordinates; wherein, the reference block is quadrilateral, the position of the fifteenth vertex
  • the reference block is a square
  • the fifteenth vertex is the vertex in the upper left corner of the reference block
  • the sixteenth vertex is the vertex in the upper right corner of the reference block
  • the seventeenth vertex is the vertex in the upper right corner of the reference block
  • the thirteenth block is a block adjacent to the right side of the eleventh block
  • the tenth block is a block immediately below the eleventh block
  • the fifteenth block is a block adjacent to the thirteenth block and the seventeenth block
  • the fifteenth block The vertex of the upper left corner of the block coincides with the vertex of the lower right corner of the eleventh block.
  • the sixteenth position coordinates under the second coordinate system are calculated and obtained according to the thirteenth position coordinates and the fifteenth position coordinates, Including: calculating the displacement vector from the thirteenth position coordinate to the fifteenth position coordinate to obtain a first displacement vector; according to the thirteenth position coordinate or the fifteenth position coordinate, and the first proportional The sixteenth position coordinate is obtained by calculating the first displacement vector.
  • the first ratio is equal to a preset value.
  • the electronic device can quickly determine the sixteenth position coordinates.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream
  • the method further includes: determining that the first ratio is equal to the ratio of the absolute value of the first time difference value to the absolute value of the second time difference value; the first time difference value 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 value is equal to the first image frame in the data stream The difference between the time point of and the time point of the second image frame in the data stream.
  • the electronic device can determine the first ratio according to the difference between the predicted image frame and the reference image frame, so that the scene displayed by the predicted image frame (relative to the reference image frame, the position of the block and the zoom degree) is different from the displayed predicted image.
  • the moment of the frame is more consistent with the scene constructed by the electronic device based on the actual operating data.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream
  • the calculation obtains Before the sixteenth position coordinate the method further includes: determining that the first ratio is equal to a ratio of a first value to a second value; the first value is equal to the first number plus one; the second value is equal to a second number plus one; the first number is equal to the number of image frames in the data stream that are spaced between the reference image frame and the predicted image frame; the second number is equal to the number of image frames in the data stream The number of image frames spaced between the reference image frame and the predicted image frame.
  • the electronic device can determine the first ratio according to the number of image frames separated between the predicted image frame and the reference image frame, so that in the process that the electronic device displays each image frame at a constant speed, the scene displayed by the predicted image frame (relative to The reference image frame, block position and zoom level) more closely matches the scene constructed by the electronic device based on the actual operating data at the moment when the predicted image frame is displayed.
  • the tenth position coordinate is calculated according to the thirteenth position coordinate or the fifteenth position coordinate
  • the first displacement vector of the first scale is calculated to obtain the tenth position.
  • Six position coordinates including: if the reference image frame is the first image frame, calculating the sixteenth position according to the thirteenth position coordinates and the first displacement vector of the first scale coordinates; if the reference image frame is the second image frame, the sixteenth position coordinate is obtained by calculating the fifteenth position coordinate and the first displacement vector of the first scale.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream
  • the determining prediction The eleventh vertex of the block is before the tenth position coordinate in the predicted image frame
  • the method further includes: determining one image frame in the first image frame and the second image frame as the reference image frame ; Determine that another image frame other than the reference image frame in the first image frame and the second image frame is a matching image frame; Carry out block division for the reference image frame to obtain the reference block; determine according to the matching algorithm that the block that matches the reference block in the matched image frame is a matching block; wherein, if the reference block is the eleventh block, the matching block is the first block twelve blocks; if the reference block is the twelfth block, the matching is the eleventh block.
  • the electronic device may designate the first image frame or one of the second image frames as the reference image frame, for example, the electronic device may designate the first image frame tested in the data stream as the reference image frame.
  • the electronic device may determine, based on the position of the predicted image frame relative to the first image frame and the second image frame, that one image frame in the first image frame and the second image frame is the reference image frame; specifically, if If the predicted image frame is located between the first image frame and the second image frame in the data stream, the first image frame is determined as the reference image frame; if the predicted image frame is located after the first image frame and the second image frame in the data stream , the second image frame is determined to be the reference image frame.
  • the electronic device can divide the reference image frame into blocks, and search for blocks in the matching image frame in units of blocks in the reference image frame, and then determine the blocks that match each other in the first image frame and the second image frame.
  • the determining according to the matching algorithm that the block that matches the reference block in the matching image frame is a matching block includes: determining the first block of the matching image frame.
  • the block with the highest similarity with the reference block in a region is the matching block;
  • the first region is the region of the matching image frame with the reference position coordinates as the center and the preset shape of the first area, the
  • the reference position coordinates are the position coordinates of the reference block in the reference image frame.
  • the electronic device can determine the first region in the matching image frame according to the position coordinates of the reference block, which may narrow the search range to a certain extent, thereby helping to improve the matching efficiency and matching accuracy of the block.
  • the method further includes: The first area is obtained by calculation according to the reference depth value of the reference block, wherein the larger the reference depth value is, the smaller the first area obtained by calculation is.
  • the electronic device can adjust the size of the first area according to the depth value, which is beneficial to improve the efficiency of determining 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, it is determined that the first area is equal to the first preset area; if the reference depth value is greater than the second threshold and less than the first threshold, according to the reference The depth value is calculated to obtain the first area, wherein, the larger 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, it is determined that the first area is equal to the first area. Two preset areas; wherein the first threshold is greater than the second threshold, and the second preset area is greater than the first preset area.
  • the value range of the depth value may be greater than or equal to 0 and less than or equal to 1, the first threshold may be equal to 0.8, the second threshold may be equal to 0.2, the first preset area may be twice the area of the reference block; the second preset area may be equal to The area of the reference image frame.
  • the electronic device searches for the matching block of the reference block in a small range; when the depth value is small, the electronic device can search for the matching block of the reference block in the entire image frame. It is beneficial to improve the efficiency of determining matching blocks.
  • the present application provides an electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes
  • the computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to execute: the eleventh block according to the depth values of the eleventh and twelfth blocks and the position coordinates of the twelfth block in the image frame, determine the tenth position coordinate of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame
  • the twelfth block is the block that matches the eleventh block determined according to the matching algorithm in the second image frame; According to the color data of the reference block and the tenth position coordinate, a prediction block is generated, and the The reference block is one of the eleventh block or the twelfth block; the predicted image frame is generated, and the predicted image frame includes the predicted block.
  • the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system.
  • the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: according to the first position of the eleventh block A depth value and the twelfth position coordinate of the eleventh block under the first coordinate system are calculated to obtain the thirteenth position coordinate under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; According to the second depth value of the twelfth block and the fourteenth position coordinate of the twelfth block under the first coordinate system, the fifteenth position coordinate under the second coordinate system is obtained by calculating; According to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates under the second coordinate system are calculated; according to the sixteenth position coordinates, the first position coordinates are calculated and obtained the
  • the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: according to the tenth aspect
  • the thirteenth block and the fourteenth block are mutually matched blocks determined according to the matching algorithm; according to the depth values of the fifteenth block and the sixteenth block, the fifteenth block and the sixteenth block the position coordinates of the block in the image frame, and determine the eighteenth position coordinates of the thirteenth vertex of the predicted block in the predicted image frame; wherein, the fifteenth block is 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 ; According to the depth values of the seventeenth block and the eighteenth block, the position coordinates of the seventeenth block and the eighteenth block in the image frame, determine that the fourteenth vertex of the predicted block is in the predicted image
  • the nineteenth position coordinate in the frame wherein, the seventeenth block is a block adjacent to both the eleventh block and the fifteenth block, and the eighteenth block is a block adjacent to the eighteenth block.
  • the position coordinates in the image frame are the position coordinates in the first coordinate system, and in the depth value according to the thirteenth block and the fourteenth block, the The location coordinates of the thirteenth block and the fourteenth block in the image frame, determining the seventeenth location coordinates of the twelfth vertex of the predicted block in the predicted image frame, the one or more processing a controller, specifically for invoking the computer instructions to cause the electronic device to execute: according to the third depth value of the thirteenth block and the twentieth position of the thirteenth block in the first coordinate system coordinates, the twenty-first position coordinates under the second coordinate system are calculated, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the fourteenth block and the fourteenth block in the The twenty-second position coordinate under the first coordinate system is calculated to obtain the twenty-third position coordinate under the second coordinate system; according to the twenty-first position coordinate and the twenty-third position coordinate, The twenty-fourth position coordinate under the second coordinate system is
  • the one or more processors are specifically configured to call the the computer instructions to cause the electronic device to execute: determine the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate respectively and the four vertices in the reference block The corresponding relationship of the position coordinates of the reference block; the predicted block is generated according to the corresponding relationship and the color data of the reference block.
  • the color data includes color data of each pixel in the reference block, and the color data according to the corresponding relationship and the reference block is included in the color data.
  • the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: generating a homography transformation formula according to the correspondence; generating a homography transformation formula according to the homography; The transformation formula and the position coordinates of each pixel in the reference image frame determine the position coordinates of each pixel in the predicted image frame; according to the color data of each pixel and the The predicted block is generated from the position coordinates of each rate limit in the predicted image frame.
  • the reference block includes: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and in the determining of the tenth position coordinate , the corresponding relationship between the seventeenth position coordinates, the eighteenth position coordinates and the nineteenth position coordinates respectively and the position coordinates of the four vertices in the reference block, the one or more processors, specifically For invoking the computer instruction to cause the electronic device to execute: determine that the tenth position coordinate and the position coordinate of the fifteenth vertex are a set of corresponding position coordinates; determine that the seventeenth position coordinate and all The position coordinates of the sixteenth vertex are a set of corresponding position vertices; it is determined that the eighteenth position coordinates and the position coordinates of the seventeenth vertex are a set of corresponding position coordinates; the nineteenth position coordinates are determined The position coordinates corresponding to the eighteenth vertex are a set of position coordinates
  • the position direction of a block relative to the fifteenth block is the same; the position direction of the sixteenth vertex relative to the center point of the reference block is the same as the position 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; the eighteenth vertex relative to the The position direction of the center point of the reference block is the same as the position direction of the seventeenth block relative to the thirteenth block.
  • the sixteenth position coordinates under the second coordinate system are obtained by calculation
  • the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: calculate a displacement vector from the thirteenth position coordinate to the fifteenth position coordinate, and obtain the first Displacement vector; the sixteenth position coordinate is obtained by calculating according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale.
  • the first ratio is equal to a preset value.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream.
  • the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: determining that the first ratio is equal to the absolute value of the first time difference The ratio 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 value 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.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream.
  • 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 the difference between the first value and the second value.
  • the first value is equal to the first number plus one;
  • the second value is equal to the second number plus one;
  • the first number is equal to the difference between the reference image frame and the predicted image frame in the data stream the number of image frames spaced between;
  • the second number is equal to the number of image frames spaced between the reference image frame and the predicted image frame in the data stream.
  • the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: if the reference image frame is the first image frame, according to the first image frame The thirteenth position coordinates and the first displacement vector of the first scale are calculated to obtain the sixteenth position coordinates; if the reference image frame is the second image frame, the fifteenth position coordinates are calculated according to the The sixteenth position coordinate is obtained by calculating with the first displacement vector of the first scale.
  • the image frame where the reference block is located is a reference image frame
  • the first image frame is located before the second image frame in the data stream.
  • the eleventh vertex of the predicted block is before the tenth position coordinate in the predicted image frame
  • the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: determine the first image frame and one image frame in the second image frame is the reference image frame; determine another image frame other than the reference image frame in the first image frame and the second image frame In order to match the image frame; the reference image frame is divided into blocks to obtain the reference block; according to the matching algorithm, the block that matches the reference block in the matched image frame is determined as a matching block; wherein, if the If the reference block is the eleventh block, the matching block is the twelfth block; if the reference block is the twelfth block, the matching block is the eleventh block.
  • the one or more processors which is specifically used to invoke the computer instruction to cause the electronic device to execute: determine the block with the highest similarity to the reference block in the first region of the matching image frame as the matching block; the first region is The matching image frame is a region of a preset shape with a first area centered on a reference position coordinate, where the reference position coordinate is the position coordinate of the reference block in the reference image frame.
  • the one or more a processor is further configured to invoke the computer instructions to cause the electronic device to perform: calculating and obtaining the first area according to the reference depth value of the reference block, wherein the larger the reference depth value, the greater the calculated value.
  • the first area is smaller.
  • the one or more a processor before the determining that the block with the highest similarity to the reference block in the first region of the matching image frame is the matching block, the one or more a processor, further configured to invoke the computer instructions to cause the electronic device to execute: if the reference depth value of the reference block is greater than or equal to a first threshold, determine that the first area is equal to a first preset area; The reference depth value is greater than the second threshold value and smaller than the first threshold value, and the first area is calculated according to the reference depth value, wherein the larger 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, it is determined that the first area is equal to a second preset area; wherein, the first threshold is greater than the second threshold, and the second preset area is greater than the first a preset area.
  • An eleventh aspect provides a method for generating an image frame, the method may include: in a first drawing cycle, according to a drawing instruction of a target application, when the drawing instruction satisfies a first condition, storing a drawing result in a The seventh storage space, as the first drawing result, when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space as the second drawing result; according to the first drawing result and the The second drawing result generates a seventh image frame; in the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space, as a third drawing result, when the drawing instruction satisfies the second condition, no drawing is performed; an eighth image frame is generated according to the third drawing result and the second drawing result.
  • the rendering result generated when the rendering instruction satisfies the first condition may present a dynamic interface on the display screen.
  • the effect that the drawing result generated when the drawing instruction satisfies the second condition is presented on the display screen may be a control.
  • the electronic device can store the drawing results obtained according to the drawing instructions of different conditions in different storage spaces according to the drawing instructions of the target application, so that one copy can be shared in the two drawing cycles. Drawing result; reducing the drawing time of the electronic device when the drawing instruction satisfies the second condition, and reducing the power consumption of the electronic device.
  • the method further includes: in the third drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, storing the drawing result in the into the seventh storage space, as the fourth drawing result, when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space, as the fifth drawing result, the third The drawing period is after the first drawing period; the ninth image frame is generated according to the fourth drawing result and the fifth drawing result; in the fourth drawing period, the first drawing result and the fourth drawing result are generated according to the fourth drawing period The drawing result generates the sixth drawing result; the tenth image frame is generated according to the sixth drawing result and the seventh drawing result; the seventh drawing result is that in the fifth drawing cycle, the drawing instruction of the target application satisfies all requirements.
  • the drawing result obtained under the second condition, the fifth drawing cycle is before the fourth drawing cycle.
  • this example can be used in interpolated frames.
  • the electronic device may generate a predicted sixth rendering result according to the rendering results when the two rendering instructions satisfy the first condition; and generate the predicted insertion in combination with the seventh rendering result obtained when the rendering instructions satisfy the second condition in the previous rendering cycle image frame.
  • the electronic device can reuse the seventh rendering result, which reduces the power consumption when generating the inserted image frame; and in the process of generating the inserted image frame, the seventh rendering result is There is no need to perform prediction calculation for the effect presented in the .
  • the electronic device only calculates the prediction calculation based on the rendering result when the two rendering instructions satisfy the first condition. The power consumption of the electronic device is further reduced.
  • the method includes: The drawing result and the second drawing result are stored in a ninth storage space; and the seventh image frame is generated in the ninth storage space according to the first drawing result and the second drawing result.
  • the method includes: converting the fourth rendering result and the fifth rendering result is stored in the ninth storage space; and the ninth image frame is generated in the ninth storage space according to the fourth rendering result and the fifth rendering result.
  • the method includes: combining the sixth rendering result with the all The seventh rendering result is stored in the ninth storage space; and the tenth image frame is generated in the ninth storage space according to the sixth rendering result and the seventh rendering result.
  • 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
  • the fourth drawing result is stored in the eleventh storage space
  • generating a sixth drawing result according to the first drawing result and the fourth drawing result includes: storing the first drawing result storing in the eleventh storage space; and generating the sixth drawing result in the eleventh storage space according to the first drawing result and the fourth drawing result.
  • the seventh storage space consists of at least three storage spaces, and the at least three storage spaces include a tenth storage space, an eleventh storage space and a tenth storage space Two storage spaces; the first drawing result is stored in the tenth storage space, the fourth drawing result is stored in the eleventh storage space, and the first drawing result and the fourth drawing result are stored in the eleventh storage space.
  • Aspects of generating a sixth drawing result include: storing the first drawing result and the fourth drawing result in a twelfth storage space; storing the first drawing result and the fourth drawing result in the twelfth storage space according to the The fourth rendering result generates the sixth rendering result.
  • the third drawing period is adjacent to the fourth drawing period; the fifth drawing period and the third drawing period are the same drawing period, so The fifth drawing result and the seventh drawing result are the same drawing result.
  • the electronic device can reuse the drawing result used to generate the image of the previous frame, which reduces the power consumption of the electronic device.
  • the method includes: storing the second drawing result in a In the seventh storage space; the seventh image frame is generated in the seventh storage space according to the first drawing result and the second drawing result.
  • the electronic device applying the method includes a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated at the first value every time. and the second value is switched once; the counting unit is updated at the moment when the drawing cycle starts; in a drawing cycle, if the updated value of the counting unit is the second value, then at the moment when the drawing cycle starts Empty the eighth storage space; and when the drawing instruction satisfies the second condition, store the drawing result in the eighth storage space; if the updated value of the counting unit is the first value, then draw When the cycle starts, the second storage unit is not emptied; and when the drawing instruction satisfies the second condition, the drawing is not performed.
  • the electronic device can share a drawing result obtained when the drawing instruction satisfies the second condition for every two adjacent drawing cycles, reducing the drawing result of the electronic device.
  • the amount of data processing in the process reduces the power consumption of electronic equipment.
  • the method further includes: during a third drawing cycle, generating a fourth drawing result according to the first drawing result and the third drawing result;
  • the second rendering result and the fourth rendering result generate a ninth image frame.
  • the electronic device applying the method includes a counting unit, the initialization value of the counting unit is a first value, and the counting unit is based on the first value, the second value, The sequence of the third numerical value is repeatedly updated and switched between the three numerical values, and the counting unit is updated at the moment when the drawing cycle starts.
  • the electronic device can share a drawing result obtained when the drawing instruction satisfies the second condition every three drawing cycles, which reduces the number of times in the drawing process of the electronic device. The amount of data processing, reduces the power consumption of electronic equipment.
  • the ninth storage space is composed of at least two storage spaces, and the at least two storage spaces are based on the first storage space of the target application when the target application is running.
  • An instruction alternates between a first state and a second state; 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 first state Two states; 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 a display device for display; when the at least two storage spaces are in the second state , the electronic device can perform drawing in the at least two storage spaces; two image frames generated by two adjacent drawing cycles are respectively stored in two different storage spaces in the ninth storage space. It can be seen that the electronic device can rotate the storage space in which the image frames are stored, and draw the next image frame in the process of displaying the previous image frame, which improves the efficiency of generating and displaying the image frame by the electronic device.
  • the first condition is: the drawing instruction includes an instruction to enable depth testing; the second condition is: the drawing instruction includes an instruction to disable depth testing instruction. It can be seen that by turning on or off the depth test command, the division of the drawing results is achieved, and then the layers used for the display space are reused. The amount of data processing in the process of drawing image frames is small, which reduces the power consumption of electronic devices.
  • the time nodes of any two adjacent drawing cycles are the time points at which the target application invokes the second instruction.
  • the first instruction and the second instruction may be the same instruction. That is, each time the electronic device rotates the storage space in which the image frame is stored, it 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.
  • a twelfth aspect provides an electronic device, the electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used for storing computer program codes, the memory is
  • the computer program code includes computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to execute: during the first drawing cycle, according to the drawing instructions of the target application, when the drawing instructions satisfy Under the first condition, the drawing result is stored in the seventh storage space as the first drawing result, and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space as the second drawing result;
  • a seventh image frame is generated according to the first drawing result and the second drawing result; in the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition,
  • the drawing result is stored in the seventh storage space, and as the third drawing result, when the drawing instruction satisfies the second condition, no drawing is performed; generating according to the third drawing result and the second drawing
  • the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: during the third drawing cycle, according to the target application The drawing instruction of the program, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space, as the fourth drawing result, when the drawing instruction satisfies the second condition, the drawing The result is stored in the eighth storage space, and as the fifth drawing result, the third drawing cycle is located after the first drawing cycle; the ninth image frame is generated according to the fourth drawing result and the fifth drawing result ; During the fourth drawing cycle, generate a sixth drawing result according to the first drawing result and the fourth drawing result; generate a tenth image frame according to the sixth drawing result and the seventh drawing result; the seventh drawing result The drawing result is the drawing result obtained when the drawing instruction of the target application satisfies the second condition in the fifth drawing cycle, and the fifth drawing cycle is before the fourth drawing cycle.
  • the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: store the first drawing result and the second drawing result in a ninth storage space; and store the first drawing result in the ninth storage space according to the first drawing
  • the result and the second rendering result generate the seventh image frame.
  • the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: storing the fourth drawing result and the fifth drawing result into the ninth storage space; in the ninth storage space according to the fourth The drawing result and the fifth drawing result generate the ninth image frame.
  • the one or more processors are specifically configured to call The computer instructions cause the electronic device to execute: store the sixth drawing result and the seventh drawing result in the ninth storage space; and store the sixth drawing result in the ninth storage space according to the sixth drawing result and the seventh rendering result to generate the tenth image frame.
  • 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
  • the fourth drawing result is stored in the eleventh storage space
  • the one or more processors It is specifically used to invoke the computer instruction to cause the electronic device to execute: store the first drawing result in the eleventh storage space; and store the first drawing result in the eleventh storage space according to the first drawing result and the fourth rendering result to generate the sixth rendering result.
  • the seventh storage space consists of at least three storage spaces, and the at least three storage spaces include a tenth storage space, an eleventh storage space and a tenth storage space Two storage spaces; the first drawing result is stored in the tenth storage space, the fourth drawing result is stored in the eleventh storage space, and the first drawing result and the fourth drawing result are stored in the eleventh storage space.
  • the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: storing the first drawing result and the fourth drawing result in the tenth drawing result Two storage spaces; the sixth drawing result is generated in the twelfth storage space according to the first drawing result and the fourth drawing result.
  • the third drawing period is adjacent to the fourth drawing period; the fifth drawing period and the third drawing period are the same drawing period, so The fifth drawing result and the seventh drawing result are the same drawing result.
  • the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: store the second drawing result in the seventh storage space; and store the second drawing result in the seventh storage space according to the first drawing result and the The second rendering result generates the seventh image frame.
  • the electronic device includes a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated between the first value and the first value every time. Switch between two values once; the counting unit is updated at the moment when the drawing cycle starts; in a drawing cycle, if the updated value of the counting unit is the second value, then the counting unit is cleared at the moment when the drawing cycle starts the eighth storage space; 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 drawing cycle starts The second storage unit is not emptied at the time of ; and when the drawing instruction satisfies the second condition, the drawing is not performed.
  • the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: during the third drawing cycle, according to the The first rendering result and the third rendering result generate a fourth rendering result; and a ninth image frame is generated according to the second rendering result and the fourth rendering result.
  • the electronic device includes a counting unit, the initialization value of the counting unit is a first value, and the counting unit is based on the first value, the second value, and the third value.
  • the sequence of updating and switching is repeated between three values, and the counting unit is updated at the moment when the drawing cycle starts.
  • the drawing In a drawing cycle, if the updated value of the counting unit is the second value, then the drawing The eighth storage space is emptied at the moment when the cycle starts; 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 second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed.
  • the ninth storage space is composed of at least two storage spaces, and the at least two storage spaces are based on the first storage space of the target application when the target application is running.
  • An instruction alternates between a first state and a second state; 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 first state Two states; 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 a display device for display; when the at least two storage spaces are in the second state , the electronic device can perform drawing in the at least two storage spaces; two image frames generated by two adjacent drawing cycles are respectively stored in two different storage spaces in the ninth storage space.
  • the first condition is: the drawing instruction includes an instruction to enable depth testing; and the second condition is: the drawing instruction includes an instruction to disable depth testing.
  • the time nodes of any two adjacent drawing cycles are the time points at which the target application invokes the second instruction.
  • an embodiment of the present application provides an image frame prediction method.
  • the method may include: when drawing the twenty-first drawing frame of the first application, the electronic device converts the drawing instruction of the twenty-first drawing frame to the drawing instruction of the twenty-first drawing frame. Drawing according to the first drawing range, the twenty-first drawing result is obtained, and 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 The device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range, and obtains 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 second The size of the eleventh drawing frame is the same as the size of the twenty-second drawing frame; the electronic device predicts and generates the twenty-third predicted 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 rendering frame.
  • the electronic device can obtain the predicted frame.
  • the frame rate of the electronic device can be increased without increasing the drawing frame.
  • the smoothness of the video interface displayed by the electronic device can be improved.
  • the predicted frame predicted by the electronic device there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
  • 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, which specifically includes: The first parameter in the first drawing instruction of the twenty-first drawing frame issued by the application is modified to the first drawing range; the first parameter is used to set the size of the drawing range of the twenty-first drawing frame; The drawing instruction of the twenty-first drawing frame is drawn according to the first drawing range, and the twenty-first drawing result is obtained.
  • the size of the first drawing range 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 the twenty-first drawing range The width of the frame is K3 times, the height of the first drawing range is K4 times the height of the twenty-first drawing frame, and K3 and K4 are greater than 1.
  • K3 and K4 are determined by the fixed values of the system configuration of the electronic device, or by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • the electronic device draws the drawing instruction of the modified twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, which specifically includes: the electronic device draws the drawing according to the first drawing range.
  • K3 and K4 generate a first conversion matrix, and the electronic device adjusts the size of the drawing content in the drawing instruction of the modified twenty-first drawing frame into the first drawing range according to the first conversion matrix, and obtains the twenty-first Plot the result.
  • 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, which specifically includes: The second parameter in the second drawing instruction of the twenty-second drawing frame issued by the application is modified to the second drawing range; the second parameter is used to set the size of the drawing range of the twenty-second drawing frame; The drawing instructions of the twenty-two drawing frames are drawn according to the second drawing range, and the twenty-second drawing result is obtained.
  • the size of the second drawing range is larger than the size of the twenty-second drawing frame of the first application, which specifically includes: the width of the second drawing range is the twenty-second drawing range.
  • the width of the frame is K5 times
  • 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.
  • K5 and K6 are determined by the fixed values of the system configuration of the electronic device, or by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • 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, which specifically includes: the electronic device
  • the second conversion matrix is generated according to K5 and K6, and the electronic device adjusts the size of the drawing content in the drawing instruction of the 22nd drawing frame after modification according to the second conversion matrix and draws it into the second drawing range, to obtain the twentieth drawing range. a plot result.
  • the electronic device predicts and generates the twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result, specifically including: the current device According to the twenty-first rendering result and the twenty-second rendering result, the twenty-third rendering result of the twenty-third predicted frame is predicted and generated; the electronic device cuts the twenty-third rendering result into the twenty-third predicted frame.
  • the electronic device predicts and generates the twenty-third drawing result of the twenty-third predicted frame according to the twenty-first drawing result and the twenty-second drawing result, Specifically, it includes: the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; the electronic device predicts and generates the first motion vector according to the twenty-second rendering result and the first motion vector The twenty-third rendering result of the twenty-third predicted frame.
  • the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result, which specifically includes: the electronic device Divide the twenty-second rendering result into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks in the twenty-second rendering result; the electronic device determines in the twenty-first rendering result that it is the same as the first pixel.
  • the second pixel block matched by the block; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first pixel block of the twenty-second rendering result according to the motion vector of the first pixel block. a motion vector.
  • the electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block, which specifically includes:
  • a plurality of candidate pixel blocks are determined for the first pixel point of the The difference between the color values of the first pixel block determines a second pixel block that matches the first pixel block, and the second pixel block is the candidate with the smallest difference in color value from the first pixel block among the multiple candidate pixel blocks. pixel block.
  • the electronic device 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, and obtains the first drawing range.
  • the twenty-first drawing result specifically includes: 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, The twenty-first drawing result is obtained, and the size of the twenty-first memory space is greater than or equal to the size of the first drawing range.
  • the electronic device when drawing the twenty-second drawing frame of the first application, draws the drawing instruction of the twenty-second drawing frame according to the second drawing range, and obtains the The twenty-two drawing results specifically include: 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, The twenty-second drawing result is obtained, and the size of the twenty-second memory space is greater than or equal to the size of the second drawing range.
  • the electronic device predicts and 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: an electronic device The device predicts and generates a twenty-third drawing result according to the third drawing range according to the twenty-second drawing result and the first motion vector, wherein the size of the third drawing range is larger than the size of the twenty-third predicted frame.
  • the electronic device when drawing the twenty-first drawing frame of the first application, draws the drawing instruction of the twenty-first drawing frame according to the first drawing range, and obtains the first drawing range. After the twenty-first rendering result, the method further includes: the electronic device cuts the twenty-first rendering result into a twenty-first rendering frame.
  • the electronic device 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, and obtains the After the twenty-second rendering result, the method further includes: the electronic device cuts the twenty-second rendering result into a twenty-second rendering frame.
  • the present application provides a method for predicting an image frame, the method may include: when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame to the drawing content of the drawing instruction of the twenty-first drawing frame.
  • the twenty-first drawing result is obtained, and the size of the twenty-first memory space is larger than the size of the default memory space, and the default memory space is the memory space provided by the electronic device system for storing image frames for display;
  • the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains the twenty-second drawing result, the size of the twenty-second memory space larger than the size of the default memory space;
  • the electronic device generates the twenty-third drawing result in the 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 larger than the size of the default memory space;
  • the electronic device cuts the twenty-third drawing result to be the same size as the default memory space to obtain the twenty-third predicted frame.
  • the electronic device can obtain the predicted frame.
  • the frame rate of the electronic device can be increased without increasing the drawing frame.
  • the smoothness of the video interface displayed by the electronic device can be improved.
  • the predicted frame predicted by the electronic device there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
  • the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
  • the size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
  • the size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
  • the first size of the twenty-first memory space may be the width of the twenty-first memory space
  • the second size of the twenty-first memory space may be the height of the twenty-first memory space
  • the third size of the default memory space may be the width of the default memory space
  • the fourth size of the default memory space may be the height of the default memory space
  • the fifth size of the twenty-second memory space may be the width of the twenty-second memory space
  • the sixth size of the twenty-second memory space may be the height of the twenty-second memory space.
  • the seventh size of the twenty-third memory space may be the width of the twenty-third memory space
  • the eighth size of the twenty-third memory space may be the height of the twenty-third memory space.
  • the electronic device can enlarge the width and height of the twenty-first memory space according to different sizes.
  • the electronic device may enlarge the width and height of the twenty-second memory space according to different sizes.
  • the electronic device may enlarge the width and height of the twenty-third memory space according to different sizes.
  • the electronic device when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, Obtaining the twenty-first drawing result specifically includes: when drawing the twenty-first drawing frame, 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.
  • 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, specifically including :
  • the ninth size of the first drawing range is K3 times the third size of the default memory space
  • 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
  • K4 is greater than 1, and less than or equal to K2.
  • the ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
  • K3 is equal to K1
  • K4 is equal to K1
  • K1, K2, K3, and K4 are fixed values of the system configuration of the electronic device.
  • the electronic equipment can configure K1, K2, K3, K4 according to the experience value.
  • the electronic device directly configures the fixed value to reduce the amount of calculation.
  • K3 and K4 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • K3 and K4 set by the electronic device can be determined according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • the magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the electronic device when drawing the twenty-second drawing frame, draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains:
  • the twenty-second drawing result specifically includes: when drawing the twenty-second drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame into the second drawing range of the twenty-second memory space, The twenty-second drawing result is obtained; 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.
  • the size of the second drawing range is smaller 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, specifically including:
  • 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
  • the eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
  • K5 and K6 are fixed values of the system configuration of the electronic device.
  • the electronic device directly configures the fixed value to reduce the amount of calculation.
  • K5 and K6 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • K5 and K6 set by the electronic device can be determined according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the electronic device generates the twenty-third drawing result in the twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result, and the second The size of the thirteenth memory space is larger than the size of the default memory space, which specifically includes: the electronic device determines the first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result; The twenty-two rendering results and the first motion vector generate the twenty-third rendering result in the twenty-third memory space. In this way, the electronic device 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.
  • the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result, which specifically includes: the electronic device Divide the twenty-second rendering result into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks in the twenty-second rendering result; the electronic device determines in the twenty-first rendering result that it is the same as the first pixel.
  • the second pixel block matched by the block; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first pixel block of the twenty-second rendering result according to the motion vector of the first pixel block. a motion vector.
  • the electronic device can determine the motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result.
  • Each pixel block includes f*f (for example, 16*16) pixel points.
  • the electronic device divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
  • the electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block, which specifically includes:
  • a plurality of candidate pixel blocks are determined for the first pixel point of the The difference between the color values of the first pixel block determines a second pixel block that matches the first pixel block, and the second pixel block is the candidate with the smallest difference in color value from the first pixel block among the multiple candidate pixel blocks.
  • the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
  • 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, which specifically includes: electronic The device determines the motion vector of the twenty-third rendering result according to the first motion vector, and generates 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, and G is greater than 0 and less than 1.
  • G is equal to 0.5. In this way, the objects in each image frame move 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.
  • 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, which specifically includes: electronic The device generates the twenty-third drawing result within 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 twenty-third memory space The size of the third drawing range is larger than the size of the default memory space.
  • the size of the third drawing range is smaller 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 the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
  • the thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
  • the electronic device when drawing the twenty-first drawing frame, draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, Before obtaining the twenty-first drawing result, the method may further include: the electronic device creates a twenty-first memory space, a twenty-second memory space, and a twenty-third memory space, and the twenty-first memory space can be used to store the first memory space.
  • 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-second drawing result.
  • Twenty-third rendering result of the three predicted frames are possible implementation manner, when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space.
  • the method may further include: the electronic device creates a twenty-first memory space, a twenty-second memory space, and a twenty-third memory space, and the twenty-first memory
  • the electronic device when drawing the twenty-first drawing frame, draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, After the twenty-first drawing result is obtained, the method further includes: the electronic device cuts the twenty-first drawing result into the same size as the default memory space to obtain the twenty-first drawing frame.
  • the electronic device when drawing the twenty-second drawing frame, draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains: After the twenty-second rendering result, the method may further include: cutting the twenty-second rendering result into the same size as the default memory space by the electronic device to obtain the twenty-second rendering frame.
  • a fifteenth aspect provides an electronic device, comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
  • the memory can be used to store computer program codes, and the computer program codes include computer instructions;
  • the CPU can be used to instruct the GPU to perform the drawing when drawing the twenty-first drawing frame, and to instruct the GPU to perform the drawing when drawing the second drawing;
  • the electronic device can obtain the predicted frame.
  • the frame rate of the electronic device can be increased without increasing the drawing frame.
  • the smoothness of the video interface displayed by the electronic device can be improved.
  • the predicted frame predicted by the electronic device there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
  • the GPU may be used to draw the drawing content of the drawing instruction of the twenty-first drawing frame to the twenty-first memory space when drawing the twenty-first drawing frame , obtain the twenty-first drawing result, the size of the twenty-first memory space is larger than the size of the default memory space, and the default memory space is the memory space provided by the electronic device system to store the image frames for display;
  • the drawing content of the drawing instruction of the twenty-second drawing frame is drawn to the twenty-second memory space, and the twenty-second drawing result is obtained, and the size of the twenty-second memory space is larger than the size of the default memory space;
  • the twenty-third drawing result is generated in the twenty-third memory space, and the size of the twenty-third memory space is larger than the size of the default memory space;
  • the twenty-third rendering result is cut to the same size as the default memory space, and the twenty-third predicted frame is obtained.
  • the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
  • the size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
  • the size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
  • the first size of the twenty-first memory space may be the width of the twenty-first memory space
  • the second size of the twenty-first memory space may be the height of the twenty-first memory space
  • the third size of the default memory space may be the width of the default memory space
  • the fourth size of the default memory space may be the height of the default memory space
  • the fifth size of the twenty-second memory space may be the width of the twenty-second memory space
  • the sixth size of the twenty-second memory space may be the height of the twenty-second memory space.
  • the seventh size of the twenty-third memory space may be the width of the twenty-third memory space
  • the eighth size of the twenty-third memory space may be the height of the twenty-third memory space.
  • the electronic device can enlarge the width and height of the twenty-first memory space according to different sizes.
  • the electronic device may enlarge the width and height of the twenty-second memory space according to different sizes.
  • the electronic device may enlarge the width and height of the twenty-third memory space according to different sizes.
  • the GPU may also be used to: when drawing the twenty-first drawing frame, draw the drawing content of the drawing instruction of the twenty-first drawing frame to the twenty-first drawing frame In the first drawing range of the memory space, the twenty-first drawing result is obtained; 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 larger than the size of the default memory space.
  • 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, specifically including :
  • the ninth size of the first drawing range is K3 times the third size of the default memory space
  • 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
  • K4 is greater than 1, and less than or equal to K2.
  • the ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
  • K3 is equal to K1
  • K4 is equal to K1
  • K1, K2, K3, and K4 are fixed values of the system configuration of the electronic device.
  • the electronic equipment can configure K1, K2, K3, K4 according to the experience value.
  • the electronic device directly configures the fixed value to reduce the amount of calculation.
  • K3 and K4 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • K3 and K4 set by the electronic device can be determined according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • the magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the GPU may also be used to: when drawing the twenty-second drawing frame, draw the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second drawing frame In the second drawing range of the memory space, the twenty-second drawing result is obtained; the size of the second drawing range is smaller 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.
  • 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, specifically including:
  • 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
  • the eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
  • K5 and K6 are fixed values of the system configuration of the electronic device.
  • the electronic device directly configures the fixed value to reduce the amount of calculation.
  • K5 and K6 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • K5 and K6 set by the electronic device can be determined according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • the magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the GPU may be used to: determine the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; The twenty-two rendering results and the first motion vector generate the twenty-third rendering result in the 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.
  • the GPU may be used to: the electronic device divides the twenty-second rendering result into Q pixel blocks, and extracts the 22nd rendering result from the Q pixel blocks of the twenty-second rendering result.
  • a pixel block determines a second pixel block matching the first pixel block in the twenty-first rendering result; obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; The motion vector of the block determines the first motion vector of the twenty-second rendering result.
  • the GPU may determine motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result.
  • Each pixel block includes f*f (for example, 16*16) pixel points.
  • the GPU divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation and thus reduces the power consumption of GPUs in electronic devices.
  • the GPU may be used to: determine a plurality of candidate pixel blocks in the twenty-first drawing result by using the first pixel point in the first pixel block; The difference between the color values of the multiple candidate pixel blocks and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference between the color values of the first pixel block of the multiple candidate pixel blocks, and the second pixel block The block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks.
  • the GPU in the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
  • the GPU may be used to: determine the motion vector of the twenty-third rendering result according to the first motion vector, and determine the motion vector of the twenty-third rendering result according to the twenty-second rendering result and the twenty-third rendering result The motion vector of generates the twenty-third rendering result.
  • the motion vector of the twenty-third rendering result is G times the first motion vector, and G is greater than 0 and less than 1.
  • G is equal to 0.5. In this way, the objects in each image frame move at a constant speed, which is convenient for the calculation of the GPU in the electronic device, and can also make the user experience better when watching the video.
  • the GPU may also be used to: generate the second drawing within the third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector Thirteen drawing results; 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.
  • 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 the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
  • the thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
  • the GPU can be used to: create the twenty-first memory space, the twenty-second memory space, the twenty-third memory space, and the twenty-first memory space can be used For storing 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-second drawing result of the twenty-second drawing frame.
  • the GPU may also be used for: the electronic device cuts the twenty-first drawing result to the same size as the default memory space to obtain the twenty-first drawing frame.
  • the GPU may also be used for: the electronic device cuts the twenty-second drawing result into the same size as the default memory space to obtain the twenty-second drawing frame.
  • a sixteenth aspect provides an image frame prediction apparatus, the apparatus may include a first drawing unit, a second drawing unit, and a generating unit; wherein:
  • the first drawing unit may be configured to draw the drawing instruction of the twenty-first drawing frame according to the first drawing range when drawing the twenty-first drawing frame of the first application, to obtain the twenty-first drawing result, the first The size of the drawing range is greater than the size of the twenty-first drawing frame of the first application;
  • the second drawing unit may be configured to draw the drawing instruction of the twenty-second drawing frame according to the second drawing range when drawing the twenty-second drawing frame of the first application, to obtain the twenty-second drawing result, the twenty-second drawing result.
  • the size of the 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;
  • the generating unit may be configured to predict and generate the twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result, wherein the size of the twenty-third predicted frame is the same as that of the twenty-first rendering frame. are the same size.
  • the first drawing unit may also be used to draw the drawing content of the drawing instruction of the twenty-first drawing frame to the second drawing when drawing the twenty-first drawing frame.
  • the twenty-first drawing result is obtained, and the size of the twenty-first memory space is larger than the size of the default memory space, which is the memory space provided by the electronic device system for storing image frames for display.
  • the second drawing unit may also be used to draw the drawing content of the drawing instruction of the twenty-second drawing frame to the electronic device when drawing the twenty-second drawing frame.
  • the twenty-second drawing result is obtained, and the size of the twenty-second memory space is larger than the size of the default memory space.
  • the generating unit may be further configured to generate the twentieth drawing in the twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result. Three drawing results, the size of the twenty-third memory space is larger than the size of the default memory space.
  • the image frame prediction apparatus may further include a clipping unit, and the clipping unit may be configured to clip the twenty-third rendering result to the size of the default memory space In the same way, the twenty-third predicted frame is obtained.
  • the image frame prediction apparatus can obtain the predicted frame.
  • the frame rate of the image frame prediction apparatus can be increased without increasing the number of rendering frames.
  • the smoothness of the video interface displayed by the image frame prediction apparatus can be improved.
  • the prediction frame predicted by the image frame prediction device there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering frame displayed by the image frame prediction device. Therefore, 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.
  • the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
  • the size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
  • the size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
  • the first size of the twenty-first memory space may be the width of the twenty-first memory space
  • the second size of the twenty-first memory space may be the height of the twenty-first memory space
  • the third size of the default memory space may be the width of the default memory space
  • the fourth size of the default memory space may be the height of the default memory space
  • the fifth size of the twenty-second memory space may be the width of the twenty-second memory space
  • the sixth size of the twenty-second memory space may be the height of the twenty-second memory space.
  • the seventh size of the twenty-third memory space may be the width of the twenty-third memory space
  • the eighth size of the twenty-third memory space may be the height of the twenty-third memory space.
  • the image frame prediction apparatus can enlarge the width and height of the twenty-first memory space according to different sizes.
  • the image frame prediction apparatus may enlarge the width and height of the twenty-second memory space according to different sizes.
  • the image frame prediction apparatus may enlarge the width and height of the twenty-third memory space according to different sizes.
  • the first drawing unit may be further configured to: when drawing the twenty-first drawing frame, draw the drawing content of the drawing instruction of the twenty-first drawing frame to the drawing content of the drawing instruction of the twenty-first drawing frame.
  • the twenty-first drawing result is obtained; 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 .
  • 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, specifically including :
  • the ninth size of the first drawing range is K3 times the third size of the default memory space
  • 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
  • K4 is greater than 1, and less than or equal to K2.
  • the ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
  • K3 is equal to K1
  • K4 is equal to K1
  • K1, K2, K3, and K4 are fixed values of the system configuration of the image frame prediction apparatus.
  • the image frame predicting apparatus may configure K1, K2, K3, and K4 according to empirical values. Directly configuring the fixed value in the image frame prediction apparatus can reduce the amount of calculation.
  • K3 and K4 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • K3 and K4 set by the image frame prediction apparatus can be determined according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
  • the magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the image frame prediction apparatus is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the second drawing unit may be further configured to: when drawing the twenty-second drawing frame, draw the drawing content of the drawing instruction of the twenty-second drawing frame to the drawing content of the drawing instruction of the twenty-second drawing frame.
  • the twenty-second drawing result is obtained; 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 .
  • 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, specifically including:
  • 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
  • the eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
  • K5 and K6 are fixed values of the system configuration of the image frame prediction apparatus. Directly configuring the fixed value in the image frame prediction apparatus can reduce the amount of calculation.
  • K5 and K6 are determined by the image frame prediction apparatus according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • K5 and K6 set by the image frame prediction apparatus can be determined according to the drawing parameters included in the drawing instruction of the twenty-second drawing frame.
  • the magnification of the drawing range of different drawing frames can be different.
  • the magnification of the drawing range by the image frame prediction apparatus is more consistent with the drawing content in the drawing instruction of the drawing frame.
  • the generating unit may also be configured to: determine the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; A twenty-third drawing result is generated in the twenty-third memory space according to the twenty-second drawing result and the first motion vector.
  • the generating unit in the image frame prediction apparatus 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.
  • the generating unit may also be used to: divide the twenty-second rendering result into Q pixel blocks, and extract the first pixel from the Q pixel blocks of the twenty-second rendering result. a pixel block; determine the second pixel block matching the first pixel block in the twenty-first rendering result; obtain the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; according to the first pixel block The motion vector of the pixel block determines the first motion vector of the twenty-second rendering result.
  • the image frame prediction apparatus may determine motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result.
  • Each pixel block includes f*f (for example, 16*16) pixel points.
  • the image frame prediction apparatus divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
  • the generating unit may be further configured to: determine multiple candidate pixel blocks in the twenty-first drawing result by using the first pixel point in the first pixel block; respectively; Calculate the difference between the color values of the multiple candidate pixel blocks and the first pixel block; determine the second pixel block that matches the first pixel block according to the difference between the color values of the first pixel block of the multiple candidate pixel blocks, and the first pixel block
  • the two-pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks.
  • the image frame prediction apparatus can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
  • the generating unit may be further configured to: determine the motion vector of the twenty-third rendering result according to the first motion vector, and determine the motion vector of the twenty-third rendering result according to the first motion vector, and The motion vector of the rendering result generates the twenty-third rendering result.
  • the motion vector of the twenty-third rendering result is G times the first motion vector, and G is greater than 0 and less than 1.
  • G is equal to 0.5. In this way, the objects in each image frame move at a constant speed, which is convenient for the image frame prediction device to calculate, and can also make the user experience better when watching the video.
  • the generating unit may be further configured to: generate a third drawing range within the third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector. Twenty-three drawing results; 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.
  • 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 the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
  • the thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
  • the image frame prediction apparatus may further include a creation unit, and the creation unit may be configured to: create a twenty-first memory space, a twenty-second memory space, and a second memory space. Thirteen memory spaces, the twenty-first memory space can be used to store the twenty-first drawing result of the twenty-first drawing frame, and the twenty-second memory space can be used to store the twenty-second drawing frame of the twenty-second drawing frame. For the drawing result, the twenty-third memory space can be used to store the twenty-third drawing result of the twenty-third predicted frame.
  • the clipping unit may also be used to: clip the twenty-first drawing result to be the same size as the default memory space to obtain the twenty-first drawing frame.
  • the clipping unit may also be used to: clip the twenty-second drawing result to be the same size as the default memory space to obtain the twenty-second drawing frame.
  • a seventeenth aspect provides an electronic device, comprising: one or more processors; one or more memories; the one or more memories stores one or more computer programs, and the one or more computer programs include instructions, when The instructions, when executed by one or more processors, cause the electronic device to perform any one of the first, fifth, seventh, ninth, eleventh, thirteenth, and fourteenth aspects possible implementations.
  • an embodiment of the present application provides a chip, the chip is applied to an electronic device, the chip includes one or more processors, and the processor is configured to invoke computer instructions to cause the electronic device to execute the first aspect, Any possible implementation manner of the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect and the fourteenth aspect.
  • a nineteenth aspect provides a computer product that, when the computer program product runs on a computer, causes the computer to perform the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, and the first aspect. Any possible implementation manner of the thirteenth aspect and the fourteenth aspect.
  • a computer-readable storage medium comprising instructions, characterized in that, when the above-mentioned instructions are executed on an electronic device, the electronic device executes the first aspect, the fifth aspect, the seventh aspect, the first aspect, and the third aspect. Any possible implementation manner of the ninth aspect, the eleventh aspect, the thirteenth aspect and the fourteenth aspect.
  • 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 embodiments of the present application. provided method.
  • FIG. 1 is a schematic diagram of a user interface 100 of a tablet computer 10 provided by an embodiment of the present application;
  • FIG. 2 is a schematic diagram of a static object of the Nth drawing frame in the user interface 100 provided by the embodiment of the present application;
  • FIG. 3 is a schematic diagram of a dynamic object of the Nth drawing frame in the user interface 100 provided by the embodiment of the present application;
  • FIG. 4A is a schematic diagram of a drawing frame 300A provided by an embodiment of the present application.
  • 4B is a schematic diagram of a prediction frame 300B provided by an embodiment of the present application.
  • FIG. 5A is a schematic diagram of a drawing frame 500 provided by an embodiment of the present application.
  • FIG. 5B is a schematic diagram of a partial pixel block of the drawing frame 500 provided by an embodiment of the present application.
  • 5C is a schematic diagram of a pixel block in a prediction frame predicted according to the pixel block in FIG. 5B provided by an embodiment of the present application;
  • 6A is a logical block diagram of a method for image frame prediction provided by an embodiment of the present application.
  • 6B is a flowchart of a method for predicting an image frame provided by an embodiment of the present application.
  • FIG. 7A is a schematic diagram of an Nth drawing frame provided by an embodiment of the present application.
  • FIG. 7B is a schematic diagram of depth attachment and color attachment of a dynamic object in the Nth drawing frame provided by an embodiment of the present application.
  • FIG. 7C is a schematic diagram of depth attachment and color attachment of a static object in the Nth drawing frame provided by an embodiment of the present application.
  • FIG. 8A is a schematic diagram of an N+2th drawing frame provided by an embodiment of the present application.
  • 8B is a schematic diagram of a depth attachment and a color attachment of a dynamic object in the N+2th drawing frame provided by an embodiment of the present application;
  • 8C is a schematic diagram of depth attachment and color attachment of a static object in the N+2th drawing frame provided by an embodiment of the present application;
  • 9A-9C are schematic diagrams of the process of calculating the motion vector of the pixel block 902 in the N+2th frame through a diamond search provided by an embodiment of the present application;
  • 10A is a schematic diagram of the color attachment of a dynamic object in the predicted N+3th predicted frame provided by an embodiment of the present application;
  • 10B is a schematic diagram of the color attachment of the static object in the predicted N+3th predicted frame provided by an embodiment of the present application;
  • FIG. 10C is a schematic diagram of the predicted N+3 th prediction frame provided by an embodiment of the present application.
  • FIG. 11 is a logical block diagram of 90fps frame insertion provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 13 is a schematic diagram of a system framework of an electronic device provided by an embodiment of the present application.
  • FIG. 14 is a schematic diagram of a user interface of a tablet computer 10 provided by an embodiment of the present application.
  • 16 is a schematic diagram of the W+2th drawing frame provided by an embodiment of the present application.
  • 17 is a schematic flowchart of a method for predicting an image frame provided by an embodiment of the present application.
  • 18 is a schematic diagram of an electronic device acquiring object attributes provided by an embodiment of the present application.
  • 19A is a schematic diagram of the conversion of a moving object in different coordinate systems provided by an embodiment of the present application.
  • 19B is a schematic diagram of a static object provided in an embodiment of the present application in different coordinate systems
  • 20A-20C are schematic diagrams of a template image of a GPU drawing the Wth drawing frame object provided by an embodiment of the present application;
  • 21A-21C are schematic diagrams of GPU rendering a template image of the W+2th rendering frame object provided by an embodiment of the present application.
  • 22A-22B are schematic diagrams of a process of calculating a motion vector of a moving object according to an embodiment of the present application.
  • FIG. 23 is a schematic diagram of related modules for image frame prediction provided by an embodiment of the present application.
  • FIG. 25 is a schematic diagram of obtaining a reference frame disclosed by an embodiment of the present application.
  • FIG. 26 is another schematic diagram of acquiring a reference frame disclosed by an embodiment of the present application.
  • FIG. 27 is a schematic diagram of determining a target reference frame disclosed by an embodiment of the present application.
  • FIG. 28 is a schematic diagram of dividing a target reference frame disclosed by an embodiment of the present application.
  • 29 is a schematic flowchart of calculating a predicted motion vector of a block disclosed in an embodiment of the present application.
  • FIG. 30 is a schematic diagram of an acquisition block from a target reference frame to a matching frame disclosed by an embodiment of the present application.
  • 31A is a schematic diagram of determining a predicted motion vector of a block according to an embodiment of the present application.
  • 31B is a schematic diagram of another method of determining a predicted motion vector of a block disclosed in an embodiment of the present application.
  • 32A is a schematic diagram of determining blocks around a vertex according to an embodiment of the present application.
  • 32B is a schematic diagram of determining a predicted motion vector of a vertex disclosed in an embodiment of the present application.
  • 33 is a schematic diagram of determining vertex coordinates disclosed in an embodiment of the present application.
  • 35A is a schematic diagram of a homography transformation formula corresponding to an acquisition block disclosed by an embodiment of the present application.
  • 35B is a schematic diagram of determining coordinates of pixels in a predicted frame disclosed by an embodiment of the present application.
  • 35C is a schematic diagram of a prediction frame disclosed in an embodiment of the present application.
  • FIG. 36 is a schematic diagram of another prediction frame disclosed in an embodiment of the present application.
  • 39A is a schematic diagram of an image frame provided by an embodiment of the present application.
  • 39B is a schematic diagram of dividing an image frame according to an embodiment of the present application.
  • 40A to 40C are schematic diagrams of a group of determining matching blocks provided by an embodiment of the present application.
  • 41A is a schematic flowchart of a method for determining position coordinates in a predicted image frame provided by an embodiment of the present application
  • 41B to 41C are schematic diagrams of a group of matching blocks provided by an embodiment of the present application.
  • 41D to 41F are schematic diagrams of predicted position coordinates in a set of camera coordinate systems provided by an embodiment of the present application.
  • FIG. 42 is a schematic diagram of determining a vertex of a prediction block provided by an embodiment of the present application.
  • 43 is a schematic diagram of generating a prediction block provided by an embodiment of the present application.
  • 44A to 44B are a set of schematic diagrams about prediction blocks provided by an embodiment of the present application.
  • 45A to 45B are a set of schematic diagrams about prediction blocks provided by an embodiment of the present application.
  • 46A to 46I are schematic diagrams of a group of generated image frames provided by an embodiment of the present application.
  • FIG. 47 is a software structural block diagram of a group of electronic devices 100 provided by an embodiment of the present application.
  • FIG. 48 is a schematic structural diagram of another electronic device 100 provided by an embodiment of the present application.
  • 49A is a schematic diagram of creating a frame buffer object provided by an embodiment of the present application.
  • 49B is a schematic diagram of drawing and displaying an original image frame provided by an embodiment of the present application.
  • 49C is a schematic diagram of drawing and displaying a predicted image frame provided by an embodiment of the present application.
  • 50A is a schematic diagram of a custom dynamic layer provided by an embodiment of the present application.
  • 50B is a schematic diagram of a custom UI layer provided by an embodiment of the present application.
  • 50C is a schematic diagram of an image frame provided by an embodiment of the present application.
  • 50D is a schematic diagram of a drawing process provided by an embodiment of the present application.
  • FIG. 50E is a schematic diagram of generating an image frame provided by an embodiment of the present application.
  • 51A is a schematic flowchart of a method for generating an image frame provided by an embodiment of the present application.
  • FIG. 51B and FIG. 51C are respectively schematic diagrams of a composite image frame provided by an embodiment of the present application.
  • FIG. 51D and FIG. 51E are effect diagrams that a drawing result may present according to an embodiment of the present application.
  • FIG. 51F is a schematic diagram of generating an image frame provided by an embodiment of the present application.
  • FIG. 52 is a schematic diagram of a modular interaction provided by an embodiment of the present application.
  • 53A is a schematic flowchart of a method for generating an image frame provided by an embodiment of the present application.
  • 53B-53D are schematic diagrams of a group of prediction processes provided by an embodiment of the present application.
  • 53E-53I are schematic diagrams of a group of drawing processes provided by an embodiment of the present application.
  • 54A-54C are schematic diagrams of a group of user interfaces of the tablet computer 10 provided by the embodiments of the present application.
  • 55A is a schematic diagram of a drawing frame A, a drawing frame B, and a predicted frame obtained according to the drawing frame A and the drawing frame B provided by an embodiment of the present application;
  • FIG. 55B is a schematic diagram of a camera shooting field of view provided by an embodiment of the present application.
  • 57 is a schematic diagram of a default memory space provided by an embodiment of the present application.
  • 58 is a schematic diagram of a twenty-first memory space provided by an embodiment of the present application.
  • 59 is a schematic diagram of a twenty-second memory space provided by an embodiment of the present application.
  • 60 is a schematic diagram of a twenty-third memory space provided by an embodiment of the present application.
  • 61 is a schematic diagram of the first drawing range, the twenty-first drawing result, and the U-th drawing frame in the twenty-first memory space provided by an embodiment of the present application;
  • FIG. 62 is a schematic diagram of the second drawing range, the twenty-second drawing result, and the U+2th drawing frame in the twenty-second memory space provided by an embodiment of the present application;
  • 63A-63C are schematic diagrams of the process of calculating the motion vector of the pixel block 6205 in the U+2th drawing frame by diamond search provided by an embodiment of the present application;
  • FIG. 64 is a schematic diagram of the third drawing range, the twenty-third drawing result, and the U+3-th predicted frame in the twenty-third memory space provided by the embodiment of the present application.
  • first and second are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as “first” and “second” may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the “multiple” The meaning is two or more.
  • each frame of image that the electronic device uses to display on the display screen is referred to as an image frame.
  • an image frame may be a frame of an image of an application, a drawing result drawn by an electronic device according to a drawing instruction of the application, or a prediction result predicted based on an existing drawing result.
  • an electronic device ie, tablet 10
  • the Nth image frame is displayed in the user interface 10.
  • the Nth image frame is a drawing frame.
  • the timing diagram 101 in FIG. 1 shows the image frames that the electronic device can display from time T0 to time Tn.
  • the image frame drawn by the electronic device according to the drawing instruction and drawing parameters of the application program when the application program is running is called a drawing frame.
  • the drawing instructions and drawing parameters of the application may be automatically generated by the application graphics framework or the application engine, or may be written by the application developer.
  • the drawing parameters corresponding to the drawing frame can contain one or more objects.
  • the electronic device may draw one or more objects as corresponding elements in the drawing frame.
  • the user interface 100 shown in FIG. 1 may be a frame of drawing.
  • Element 102 (shown in FIG. 2 ) and element 103 (shown in FIG. 3 ) in the user interface 100 are obtained after drawing and rendering the objects in the drawing parameters.
  • the drawing parameters of the drawing frame contain properties of multiple objects.
  • the properties of the object can include one or more of the color value (eg, RGB value) of each pixel in the object, the depth value of each pixel in the object, the stencil buffer, the object's transition matrix, etc. .
  • the CPU may send a drawing instruction to the GPU for instructing the GPU to perform drawing according to the drawing parameter.
  • the GPU can draw an object according to a drawing instruction.
  • the object drawn by the GPU according to the drawing instruction carrying the transition matrix can be called a moving object.
  • Objects drawn by the GPU according to drawing instructions that do not carry a transition matrix can be called static objects.
  • the drawing instruction corresponding to the static object may carry a transition matrix, and the transition matrix is an all-zero matrix, that is, the elements of each row and each column in the matrix are 0.
  • a moving object can move in a game scene.
  • the position of the first element in the user interface drawn and rendered by the moving object changes in two adjacent image frames.
  • the user can see in the user interface that the position of the first element is moved.
  • Static objects are static in the game scene, but the position of the static objects in different image frames will be different due to the change of the camera's shooting angle.
  • the position of the second element in the user interface drawn and rendered by the static object can be changed in two adjacent image frames, and the magnitude of the position change is related to the shooting position and shooting angle of the camera.
  • the first element may be element 103 in FIG. 3 , which is a moving cart.
  • the second element may be the element 102 in FIG. 2, and the element 102 is a static background.
  • the position of the static background in different image frames can change due to the change of the camera's shooting angle.
  • an image frame newly generated by the electronic device according to the existing drawing frame data is called a prediction frame.
  • the drawing parameters of the predicted frame are obtained from the drawing parameters of the two drawing frames.
  • the electronic device may generate the first predicted frame from the first rendering frame and the second rendering frame.
  • the first predicted frame is an image frame following the second drawing frame. That is, after the electronic device displays the second drawing frame, it displays the first predicted frame.
  • the first drawing frame is an image frame before the second drawing frame (an image frame may exist between the first drawing frame and the second drawing frame). That is, the first drawing frame is displayed on the display screen of the electronic device before the second drawing frame.
  • the Nth image frame is a drawing frame, it may be referred to as the Nth drawing frame in this embodiment of the present application.
  • the N th image frame is a predicted frame, it may be referred to as the N th predicted frame in this embodiment of the present application.
  • the objects contained in the drawing parameters of the predicted frame are the same as the objects contained in the drawing parameters of the drawing frame displayed one frame before the predicted frame.
  • the objects included in the drawing parameters of the image frame may be simply referred to as the objects included in the image frame.
  • the objects included in the drawing parameters of the predicted frame may be simply referred to as the objects included in the predicted frame.
  • the process of generating the first predicted frame by the electronic device through the first drawing frame and the second drawing frame is called image frame prediction.
  • a color attachment is a memory space used to store color data (eg, RGB values of pixels) of each pixel in the drawing result when the electronic device draws according to the drawing instruction.
  • Color attachments are available as part of the FBO.
  • a depth attachment is a memory space used to store the depth data of each pixel in the drawing result when the electronic device draws according to the drawing instruction.
  • Color attachments are available as part of the FBO. Understandably, the smaller the depth value of the pixel in the depth attachment, the closer it is to the camera.
  • a pixel with a smaller depth value can cover another pixel with a larger depth value. That is, the color displayed by the final display pixel point is the color of the pixel point with the smaller depth value in the two color attachments.
  • the electronic device can insert the predicted frame between the drawn frames of the application.
  • the electronic device may perform image frame prediction according to the drawn frame of the application to obtain the predicted frame.
  • the moving speed and moving direction of the moving object and the static object in the image frame may be different, that is, the motion vector is different.
  • the calculated motion vector will be inaccurate. This can lead to distortions or holes in the predicted image frames.
  • FIG. 4A exemplarily shows a schematic diagram of drawing a frame.
  • FIG. 4B exemplarily shows a schematic diagram of a predicted frame obtained according to the frame drawn in FIG. 4A .
  • a drawing frame 300A may include a static object (static background) 301 and a moving object (moving car) 302 .
  • the electronic device can predict the predicted frame 300B according to the rendering frame 300A and the motion vector of the rendering frame.
  • a predicted frame 300B is shown in Figure 4B.
  • the objects contained in the predicted frame 300B are the same as those in the rendering frame 300A. That is, a static object 301 and a moving object 302 may be included in the predicted frame 300B.
  • the moving object 301 in the predicted frame 300B has moved forward, and the moving part is the part 303 shown in FIG. 4B .
  • the region 303 where the moving object 302 moves in the predicted frame 300B may lack pixel information. Since this part of the pixels in the drawing frame 300A is covered by the moving object 301, if the electronic device predicts the predicted frame by taking the drawing frame as a whole, during the prediction process, after the moving object moves, the electronic device may not be able to obtain the pixel information of this part . Therefore, the region 303 in the predicted frame 300B may lack pixel information.
  • FIG. 5A exemplarily shows a drawing frame 500 .
  • the drawing frame 500 may include a static background and a moving cart 521 .
  • the electronic device may divide the drawing frame 500 into Q pixel blocks.
  • the rendering frame 400 in FIG. 5A may be divided into Q pixel blocks.
  • the size of Q is related to the resolution of the display and the tiles in the GPU. Tile size is f*f.
  • N is f*f.
  • the drawing frame 500 can be divided into a total of 20 pixel blocks from a pixel block 501 to a pixel block 520 .
  • the pixel block 513 includes both the moving car 512 and the static background.
  • Pixel block 501-pixel block 512, pixel block 514-pixel block 520 only include static background.
  • the static background in the drawing frame 500 is different from the moving car of the moving car. However, when the motion vector is calculated by taking the pixel block as a whole, 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 static background in the predicted predicted frame may not be a complete one, and there may be empty areas (ie, no pixel areas) in the static background.
  • the pixel block 507-pixel block 509 and the pixel block 512-pixel block 514 in the drawing frame 500 are taken as examples for description.
  • FIG. 5A exemplarily shows pixel block 507-pixel block 509, pixel block 512-pixel block 514 in the rendering frame 500 in FIG. 5A.
  • Pixel block 507-pixel block 509, and pixel block 512 and pixel block 514 only include a static background.
  • the motion vectors of pixel blocks such as pixel block 507-pixel block 509, pixel block 512 and pixel block 514 calculated by the electronic device may be the same, that is, the motion vector of the static background.
  • the pixel block 513 includes a moving cart 521 and a static background.
  • the motion vector of the pixel block 513 calculated by the electronic device may be the motion vector of the motion cart 521 .
  • the motion vector of the pixel block 513 calculated by the electronic device is different from the motion vector of the pixel block 507 - the pixel block 509 and the pixel block 512 and the pixel block 514 .
  • the electronic device may 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.
  • FIG. 5C shows pixel blocks 507-509 and pixel blocks 512-pixel blocks 514 in the predicted frame predicted by the electronic device according to the pixel blocks in FIG. 5B. Since the motion vector of the pixel block in FIG. 5B is different from the motion vector of other pixel blocks, the predicted displacement of the pixel block 513 in FIG. 5C is different from that of other pixel blocks, resulting in that the pixel block 513 and the pixel block 512 are not connected, A hole region 522 appears 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 , causing the pixel block 513 to cover the pixel block 514 .
  • an embodiment of the present application provides a method for image frame prediction.
  • the method may include: first, when drawing the first drawing frame, the electronic device writes the color data of the first drawing object into the first color attachment, writes the color data of the second drawing object into the second color attachment, and the first drawing
  • the drawing instruction of the 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.
  • the electronic device when drawing the second drawing frame, the electronic device writes the color data of the third drawing object into the third color attachment, writes the color data of the fourth drawing object into the fourth color attachment, and writes the color data of the fourth drawing object into the drawing instruction of the third drawing object.
  • the electronic device predicts the fifth color accessory of the first predicted frame according to the first color accessory and the third color accessory, and predicts the sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory. Finally, the electronic device synthesizes the fifth color attachment and the sixth color attachment into the first predicted frame.
  • the drawing instruction of the first drawing object indicates that the spatial information of the first drawing object changes, that is, the first drawing object is a moving object.
  • the drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes, 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.
  • the drawing instruction of the third drawing object in the second drawing frame indicates that the spatial 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 spatial information of the fourth drawing object changes, that is, the fourth drawing object is a static object.
  • 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.
  • 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
  • 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 predicted more accurately.
  • FIG. 6A exemplarily shows the process of drawing N drawing frames, N+2 drawing frames, and obtaining the N+3 th predicted frame by an electronic device in an image frame prediction method provided by an embodiment of the present application.
  • Figure (a) in FIG. 6A exemplarily shows a process in which the electronic device draws the Nth drawing frame.
  • drawing the Nth drawing frame by the electronic device may include the following steps:
  • the electronic device acquires a drawing instruction of the Nth drawing frame, and determines whether the drawing instruction carries a transition matrix. If yes, go to 602a, if not, go to 602b.
  • the electronic device can draw an object according to a drawing instruction. It can be understood that, after the electronic device draws one drawing instruction, it draws another drawing instruction of the Nth drawing frame until all drawing instructions in the Nth drawing are drawn.
  • a drawing instruction can carry information such as vertex coordinates, vertex ID, depth information, color information, etc. of the object drawn according to the draw call instruction. If the drawing instruction carries a transition matrix, the object drawn by the electronic device according to the drawing instruction is a moving object. If the drawing instruction does not carry the transition matrix, the object drawn by the electronic device according to the drawing instruction is a static object.
  • all draw instructions in the Nth draw frame may carry transition matrices. If the transition matrix carried in the drawing instruction is an all-zero matrix, the object drawn by the electronic device according to the drawing instruction is a static object. If the values of the elements in the transition matrix carried by the drawing instruction are not all 0, the object drawn by the electronic device according to the drawing instruction is a moving object. If the drawing content of the drawing instruction is a moving object, the electronic device draws the drawing content of the drawing instruction in the first memory space.
  • the first memory space may be referred to as D1FBO (dynamic framebuffer object, dynamic frame buffer object).
  • D1FBO dynamic framebuffer object, dynamic frame buffer object
  • the drawing content of the drawcall instruction is a static object, the electronic device draws the drawing content of the drawcall instruction in the second memory space.
  • the second memory space may be referred to as S1FBO (static framebuffer object, static frame buffer object).
  • the frame buffer object FBO is a memory space that can be used to store color data, depth data, etc. of the drawing object.
  • the electronic device may draw moving objects and static objects in the drawing frame according to the information carried in the drawing instruction.
  • the drawing instruction may be referred to as a draw call instruction.
  • the drawing instructions can be distinguished according to whether the transition matrix is carried, or the drawing instructions can be distinguished by whether the elements in the carried transition matrix are all 0s.
  • the electronic device can classify the drawing commands into two types, one is a drawing command with a transition matrix, and the other is a drawing command without a transition matrix.
  • the drawing content of the drawing instruction carrying the transition matrix is the moving object.
  • the drawing content of a drawing instruction that does not carry a transition matrix is a static object.
  • the electronic device may draw the two types of drawing instructions in different memory spaces.
  • the electronic device can divide the drawing instructions into two categories, one is the drawing instruction whose elements in the carried transfer matrix are not all 0s, and the other is the drawing instruction that carries A drawing instruction whose elements in the transition matrix are all 0 (that is, a matrix of all 0s).
  • 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 transfer matrix is an all-zero matrix is a static object.
  • the electronic device may draw these two types of drawing instructions in different memory spaces.
  • 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.
  • 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.
  • the Nth drawing frame there may be multiple drawing instructions whose drawing contents are moving objects, and the electronic device may draw the drawing contents of the multiple drawing instructions into the color attachment A and the depth attachment A in sequence.
  • the drawing content of the drawing instruction is a moving object.
  • the electronic device can sequentially draw the drawing contents with color information of the L drawing instructions in the Nth drawing frame on the canvas 1, and the finally obtained drawing result with color information of all moving objects can be called color attachment A.
  • the electronic device may draw the drawing content with color information of the first drawing instruction in the L drawing instructions in the Nth drawing frame on 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 on the canvas 1 of the electronic device. Until the electronic device draws the drawing content with color information of the L-th drawing instruction in the N-th drawing frame on the canvas 1 of the electronic device, the finally obtained drawing result with color information of all moving objects can be called This is the color attachment A in the examples of this application.
  • the electronic device can sequentially draw the drawing contents with depth information and without color information of the L drawing instructions in the Nth drawing frame on the canvas 2, and finally obtain a drawing result with the depth information of all moving objects, which can be called a depth attachment.
  • the electronic device may draw, on the canvas 2 , the drawing content of the first drawing instruction that has depth information but does not include color information among the L drawing instructions.
  • the electronic device may draw the drawing content of the second drawing instruction among the L drawing instructions that has depth information but does not include color information on the canvas 2 .
  • the electronic device draws the drawing content of the Lth drawing instruction in the L drawing instructions that has depth information but does not contain color information on the canvas 2, the finally obtained drawing result with the depth information of all moving objects can be referred to as the present application.
  • Depth Attachment A in Examples.
  • 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.
  • the description is given by taking as an example that the Nth drawing frame has M drawing instructions whose drawing contents are static objects.
  • the electronic device may sequentially draw the drawing contents with color information of the M drawing instructions in the Nth drawing frame on the canvas 3 . Specifically, the electronic device may draw the drawing content with color information of the first drawing instruction among the M drawing instructions on the canvas 3, and then draw the drawing content with color information of the second drawing instruction among the M drawing instructions The content is drawn in canvas 3. Until, the electronic device draws the drawing content with color information of the Mth drawing instruction among the M drawing instructions on the canvas 3, and the finally obtained drawing result with color information of all static objects can be called color attachment B.
  • the electronic device may sequentially draw the M drawing instructions in the Nth drawing frame with depth information and without color information to the canvas 4, and finally obtain the depth attachment B. Specifically, the electronic device may draw the first drawing instruction in the M drawing instructions with depth information and without color information on the canvas 4, and then draw the second drawing instruction in the M drawing instructions. Drawing content with depth information and no color information is drawn in canvas 4. Until, the electronic device draws the drawing content of the M-th drawing instruction with depth information but not including color information in the canvas 4, and the finally obtained drawing result with the depth information of all static objects can be called depth Annex B.
  • canvas 3 and canvas 4 are in the second memory space.
  • the electronic device combines the color attachment A and the color attachment B into an image frame of the Nth drawing frame according to the depth attachment A and the depth attachment B.
  • the electronic device may combine the color attachment A and the color attachment B into the image frame of the Nth drawing frame in the seventh memory space.
  • the color attachment A may include multiple moving objects in the Nth drawing frame
  • the color attachment B may include multiple static objects in the Nth drawing frame.
  • the electronic device can obtain the depth information of each moving object and each pixel in the color annex A from the depth annex A.
  • the electronic device can obtain each static object in the color annex B and the depth information of each pixel point from the depth annex B.
  • the electronic device may combine the color annex A and the color annex B into an image frame according to the depth information of each pixel in the color annex A and the depth information of each pixel in the color annex B.
  • Image frames can contain moving objects in color attachment A and static objects in color attachment B.
  • the first pixel if the depth value of the first pixel in color attachment A is smaller than the depth value of the first pixel in color attachment B, then in the image frame, the color attachment A The first pixel of color will cover the first pixel of color attachment B.
  • the first pixel in color annex B At the first pixel, if the depth value of the first pixel in color annex A is greater than the depth value of the first pixel in color annex B, then in the image frame, the first pixel in color annex B will cover the color The first pixel of Annex A.
  • the electronic device displays the Nth drawing frame.
  • the electronic device may send the image frame of the Nth drawing frame to the display screen for display, and finally, the display screen in the electronic device may display the Nth drawing frame.
  • Figure (b) in FIG. 6A exemplarily shows a process in which the electronic device draws the N+2 th drawing frame.
  • drawing the N+2 th drawing frame by the electronic device may include the following steps:
  • the electronic device acquires the drawing instruction of the N+2th drawing frame, and determines whether the drawing instruction carries a transition matrix. If yes, go to 606a, if not, go to 606b.
  • the electronic device may acquire multiple drawing instructions of the N+2th drawing frame.
  • the transition matrix may or may not be carried. If the drawing instruction carries the transition matrix, go to step 606a, and if the drawing instruction does not carry the transition matrix, go to step 606b.
  • step 605 reference may be made to the description in step 601, and details are not repeated here.
  • 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.
  • the electronic device 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 a transition matrix in the N+2th drawing frame, the drawing content of the drawing instruction is a moving object.
  • the electronic device can sequentially draw the drawing contents with color information of the K drawing instructions in the N+2th drawing frame on the canvas 5, and the finally obtained drawing result with color information of all moving objects can be called color attachment C.
  • the electronic device may draw the drawing content with color information of the first drawing instruction in the K drawing instructions in the N+2 th drawing frame on the canvas 5 of the electronic device.
  • the electronic device draws the drawing content with color information of the second drawing instruction in the K drawing instructions in the N+2 th drawing frame on the canvas 5 of the electronic device.
  • the electronic device draws the drawing content with color information of the K-th drawing instruction in the K-th drawing instruction in the N+2-th drawing frame to the canvas 5 of the electronic device, and finally obtains the drawing result with the color information of all moving objects It may be referred to as color attachment C in the embodiment of the present application.
  • the electronic device can draw the K drawing instructions with depth information and without color information in the N+2th drawing frame on the canvas 6 in turn, and finally obtain the drawing result with the depth information of all moving objects, which can be called.
  • For depth attachment C the electronic device may draw, on the canvas 6 , the drawing content of the first drawing instruction among the K drawing instructions that has depth information but does not include color information. Then, the electronic device may draw the drawing content of the second drawing instruction among the K drawing instructions with depth information but not including color information on the canvas 6 .
  • the electronic device draws the Kth drawing instruction in the K drawing instructions with depth information and does not contain the drawing content of the color information on the canvas 6, and finally the image of the drawing result with the depth information of all moving objects can be called the present application.
  • Depth Attachment C in Examples.
  • 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.
  • the electronic device 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 that do not carry a transition matrix, the drawing content of the drawing instruction is a static object.
  • the electronic device can sequentially draw the drawing contents with color information of the J drawing instructions in the N+2 th drawing frame on the canvas 7, and the finally obtained drawing result with color information of all static objects can be called color attachment D.
  • the electronic device may draw the drawing content with color information of the first drawing instruction in the J drawing instructions in the N+2 th drawing frame on the canvas 7 of the electronic device.
  • the electronic device draws the drawing content with color information of the second drawing instruction in the J drawing instructions in the N+2th drawing frame on the canvas 7 of the electronic device.
  • the electronic device draws the drawing content with color information of the J-th drawing instruction in the J-th drawing instruction in the N+2-th drawing frame to the canvas 7 of the electronic device, and finally obtains the drawing result with the color information of all static objects It can be called color accessory D in the embodiment of the present application.
  • the electronic device can sequentially draw the drawing contents with depth information and without color information of the J drawing instructions in the N+2th drawing frame on the canvas 8, and finally obtain the drawing result with the depth information of all static objects, which can be called For depth annex D.
  • the electronic device may draw, on the canvas 8, the drawing content of the first drawing instruction among the J drawing instructions that has depth information but does not include color information.
  • the electronic device may draw the drawing content of the second drawing instruction among the J drawing instructions with depth information but not including color information on the canvas 8 .
  • the electronic device draws the drawing content of the Jth drawing instruction with depth information and not including color information on the canvas 8 among the J drawing instructions, the finally obtained drawing result with the depth information of all static objects can be referred to as the present application.
  • Depth Attachment D in Examples.
  • the electronic device combines 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.
  • the electronic device may combine the color attachment C and the color attachment D into the image frame of the N+2 th drawing frame in the seventh memory space.
  • the color attachment C may include multiple moving objects in the N+2 th drawing frame
  • the color attachment D may include multiple static objects in the N+2 th drawing frame.
  • the electronic device can obtain the depth information of each moving object and each pixel in the color attachment C from the depth attachment C.
  • the electronic device can obtain the depth information of each static object in the color attachment D and the depth information of each pixel point from the depth attachment D.
  • the electronic device may combine 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.
  • Image frames can contain moving objects in color attachment C and static objects in color attachment D. For example, in the image frame, at the first pixel, if the depth value of the first pixel in color attachment C is less than the depth value of the first pixel in color attachment D, then in the image frame, the color attachment C The first pixel of color will cover the first pixel of color attachment D. In the image frame, at the first pixel, if the depth value of the first pixel in color attachment C is greater than the depth value of the first pixel in color attachment D, then in the image frame, the first pixel in color attachment D The dot will cover the first pixel of color attachment C.
  • the electronic device displays the N+2th drawing frame.
  • the electronic device can send the image frame of the N+2 th drawing frame to the display screen for display, and finally, the display screen in the electronic device can display the N+2 th drawing frame.
  • Figure (c) in FIG. 6A exemplarily shows the process of how the electronic device predicts the N+3 th predicted frame. As shown in (c) in Figure 6A, the process is as follows:
  • the electronic device calculates the motion vector A according to the color attachment A and the color attachment C, and calculates the motion vector A according to the depth attachment B and the color attachment.
  • Annex D calculates the motion vector B.
  • 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.
  • step S112 in FIG. 6B For the specific calculation process, reference may be made to the description in step S112 in FIG. 6B , which will not be repeated here.
  • the electronic device obtains color attachment E according to color attachment C and motion vector A, and obtains color attachment F according to color attachment D and motion vector B.
  • the electronic device may obtain the color attachment E of the N+3 th prediction frame according to the color attachment of the N+2 th drawing frame and the motion vector A. That is to say, the electronic device can predict the moving object in the N+3 th frame according to the moving object in the N+2 th drawing frame and the motion vector of the moving object.
  • the electronic device may obtain the color attachment F of the N+3 th frame according to the color attachment D and the motion vector B of the N+2 th frame. That is to say, the electronic device can predict the static object in the N+3 th frame according to the static object of the N+2 th drawing frame and the moving object of the static object.
  • step S114 in FIG. 6B which will not be repeated here.
  • the electronic device combines the color attachment E and the color attachment F into the image frame of the N+3 th prediction frame in the seventh memory space.
  • the depth information of the pixel at the first coordinate in the color annex E of the N+3 prediction frame may be the same as the depth information of the pixel at the first coordinate in the color annex C in the N+2 drawing frame.
  • Information is the same.
  • the depth information of the pixel at the second coordinate in the color attachment F of the N+3th prediction frame may be the same as the depth information of the pixel at the second coordinate in the color attachment D of the N+2th drawing frame. That is to say, the electronic device can use the depth value of each pixel in the depth attachment C as the depth value of each pixel in the color attachment E.
  • the electronic device may use the depth value of each pixel in the depth attachment D as the depth value of each pixel in the color attachment F.
  • the electronic device may combine the color attachment E and the color attachment F into the image frame of the N+3th predicted frame according to the depth values of the pixels extracted from the depth attachment C and the depth attachment D.
  • the electronic device displays the N+3 predicted frame.
  • the electronic device can send the image frame of the N+3 th predicted frame to the display screen for display, and finally, the display screen in the electronic device can display the N+3 th predicted frame.
  • FIG. 6A briefly introduces the basic steps of the image frame prediction method provided by the embodiment of the present application
  • FIG. 6B introduces the flowchart of the image frame prediction method provided by the embodiment of the present application in detail.
  • the embodiment of the present application provides A method of image frame prediction may include:
  • the electronic device starts to perform the method for image frame prediction.
  • the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU.
  • the target application is an application with animation effects in the user interface, such as a game application.
  • the embodiments of the present application are described below by taking the target application as a game application as an example.
  • the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU.
  • 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.
  • the GPU may create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space in the memory space and the seventh memory space.
  • the first memory space may be used to store the drawing result of the drawing instruction carrying the transition matrix in the Nth drawing frame, such as depth attachment and color attachment.
  • the second memory space may be used to store the drawing result of the drawing instruction that does not carry the transition matrix in the Nth drawing frame.
  • the third memory space may be used to store the drawing result of the drawing instruction carrying the transition matrix in the N+2th drawing frame.
  • the fourth memory space may be used to store the drawing result of the drawing instruction that does not carry the transition matrix in the N+2th drawing frame.
  • the GPU may predict the predicted rendering result A of the N+3th predicted frame according to the rendering result in the first memory space and the rendering result in the third memory space in the fifth memory space.
  • the GPU may predict the predicted rendering result B of the N+3th predicted frame in the sixth memory space according to the rendering result in the second memory space and the rendering result in the fourth memory space.
  • the GPU can synthesize image frames in the seventh memory space. For example, the GPU synthesizes the Nth drawing frame in the seventh memory space, as well as the N+2th drawing frame and the N+3th prediction frame.
  • the electronic device draws the Nth drawing frame.
  • the CPU of the electronic device acquires the drawing parameters of the Nth drawing frame.
  • the target application in the electronic device draws, the target application can call a drawing instruction to draw.
  • the CPU of the electronic device 100 may acquire the drawing parameters of the Nth drawing frame of the application program through the interface in the three-dimensional 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 may include information carried in the drawing instructions (such as the draw call instruction) of the Nth drawing frame, such as the coordinates, pixel values, depth values and other information of each vertex in the drawing content of the draw call instruction .
  • the CPU of the electronic device sends a drawing instruction for instructing the GPU to draw the Nth drawing frame to the GPU according to the drawing parameters of the Nth drawing frame.
  • the CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the Nth drawing frame to the GPU according to the drawing parameters of the Nth drawing frame.
  • the drawing parameters of the Nth drawing frame acquired by the CPU may include information of multiple drawing instructions.
  • the CPU may sequentially send a plurality of drawing instructions to the GPU for instructing the GPU to draw the Nth drawing frame.
  • the drawing instruction includes an execution drawing (draw call) instruction and a drawing state setting instruction.
  • the execution of the drawing instruction may be used to trigger the GPU to perform drawing and rendering with respect to the current drawing state data, and generate a drawing result, 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.
  • the drawing state setting instruction can be used to set the current drawing state data on which the drawing instruction is executed.
  • setting the state data includes the instruction of the vertex information buffer index that the drawing depends on, such as glBindBuffer in OpenGL, where the vertex information buffer index is used for Indicates vertex information data of a drawing object.
  • the vertex information data is a set of coordinate position, color and other data used to describe the vertices of a two-dimensional or three-dimensional vector model for drawing in the drawing and rendering process.
  • the drawing state setting instruction may further include instructions such as setting the vertex index, texture information, and spatial position of the drawing object, for example, the glActiveTexture and glBindBufferRange instructions in OpenGL.
  • a drawing object may be an object that can be drawn by an electronic device according to all vertices and vertex information contained in a drawing instruction.
  • the CPU can set the parameters or data for the spatial information of the drawing object in the drawing state setting instruction to determine that the spatial position of the drawing object in the world coordinate system relative to the previous frame occurs. to determine whether to modify the memory space (FBO, and explain below) where the drawing result of the drawing instruction based on the current drawing state data is stored, where the parameter or data of the spatial information of the drawing object can be the XXX instruction (for example, in OpenGL
  • the transfer matrix parameter in the glBindBufferRange the transfer matrix is used to describe the mapping relationship between the local coordinate system (Local/Object Space) of the model to the world coordinate system.
  • a possible embodiment is that if there is a transition matrix parameter in the drawing state setting instruction, that is, the transition matrix parameter of the corresponding drawing object is refreshed, the electronic device determines that the drawing object is in world coordinates relative to the drawing object in the previous frame. If the spatial position in the system changes, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the first memory space) for storing the moving object. If there is no transition matrix parameter in the drawing state setting instruction, that is, 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 is not change. Then, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the second memory space) for storing the static object.
  • a possible embodiment is that if there is a transition matrix parameter in the drawing state setting instruction that is different from the transition matrix parameter of the corresponding drawing object, the electronic device determines that the drawing object is in the world coordinate system relative to the drawing object in the previous frame. If the spatial position of the object changes, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the first memory space) for storing the moving object. 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. Then, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the second memory space) for storing the static object.
  • the parameter target indicates the type of the binding buffer
  • the parameter index indicates the index of the binding point
  • the parameter buffer indicates the buffer that participates in the binding operation.
  • the index of the buffer, the parameter offset indicates the offset of the position to be bound relative to the starting position of the buffer
  • the parameter size indicates the size of the part of the buffer that participates 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 location information corresponding to the buffer is the location information modified by the glBufferSubData instruction.
  • the electronic device determines that the spatial position of the drawing object in the world coordinate system has changed with respect to the previous frame. Otherwise, the electronic device determines that the spatial position of the drawing object in the world coordinate system with respect to the previous frame has not changed.
  • the electronic device can obtain the transition matrix parameters in the drawing frame of the program through the hook function. For example, the electronic device can obtain the transfer matrix parameters through the glBindBufferRange function.
  • the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space; Carrying the transfer instruction, the GPU writes the drawing content of the drawing instruction into the color attachment B and the depth attachment B in the second memory space.
  • the drawing instructions of the Nth drawing frame may include a drawing instruction that carries a transition matrix and a drawing instruction that does not carry a transition matrix.
  • FIG. 7A exemplarily shows the Nth drawing frame, and the Nth drawing frame may include a static background 102 and a moving car 103 .
  • the drawing instructions of the Nth drawing frame may include a drawing instruction for drawing the static background 102 and a drawing instruction for drawing the moving cart 103 .
  • a drawing instruction of the Nth drawing frame carries a transition matrix
  • the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space.
  • a drawing instruction to draw a moving car can carry a transition matrix.
  • the GPU writes the drawing content of the drawing instruction for drawing the moving cart 103 into the color attachment A and the depth attachment A in the first memory space.
  • FIG. 7B exemplarily shows the color attachment A and the depth attachment A of the first memory space.
  • the drawing content of the drawing instruction of the moving cart 103 is written in the color attachment A and the depth attachment A. Understandably, Color Attachment A is actually a block of memory space in memory.
  • FIG. 7B exemplarily shows the color attachment A and the depth attachment A of the first memory space.
  • Color Attachment A is actually a block of memory space in memory.
  • FIG. 7B schematically shows the color data in the memory space in the form of an image scale for visual understanding.
  • depth attachment A is actually a memory space in memory.
  • FIG. 7B schematically shows the depth data in the memory space in the form of an image scale for the purpose of visual understanding.
  • the color attachment A may be referred to as the first color attachment
  • the depth attachment A may be referred to as the first depth attachment
  • the GPU writes the drawing content of the one drawing instruction into the color attachment B and the depth attachment B in the second memory space.
  • the drawing instruction for drawing the static background 102 may not carry a transition matrix.
  • the GPU writes the drawing content of the drawing instruction for drawing the static background 102 into the color attachment B and the depth attachment B in the second memory space.
  • FIG. 7C exemplarily shows color attachment B and depth attachment B of the second memory space.
  • the rendering content of the rendering instruction of the static background 102 is written. Understandably, color attachment B is actually a block of memory space in memory.
  • FIG. 7C schematically shows the color data in the memory space in the form of an image scale for visual understanding.
  • depth attachment B is actually a memory space in memory.
  • FIG. 7C for visual understanding, the depth data in the memory space is shown schematically in the form of an image scale.
  • the color attachment B may be referred to as the second color attachment
  • the depth attachment B may be referred to as the second depth attachment
  • the GPU draws each drawing instruction of the Nth drawing frame in turn. Each time the GPU draws a drawing instruction, it can determine whether the drawing instruction carries a transition matrix. If the drawing instruction carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space. If the transfer matrix is not carried in the drawing instruction, the GPU writes the drawing content of the drawing instruction into the color attachment B and the depth attachment B in the second memory space. Finally, the color attachment A of the embodiment of the present application sequentially writes the drawing contents with color information of all the drawing instructions carrying the transition matrix in the Nth drawing frame.
  • the depth attachment A sequentially writes the drawing contents with depth information of all the drawing instructions carrying the transition matrix in the Nth drawing frame.
  • the drawing contents with color information of all the drawing instructions that do not carry the transition matrix in the Nth drawing frame are written in sequence.
  • the depth attachment B sequentially writes the drawing contents with depth information of all the drawing instructions that do not carry the transition matrix in the Nth drawing frame.
  • the color attachment A and the depth attachment A may be two separate memory spaces in the first memory space.
  • the color attachment A and the depth attachment A may also be a piece of memory space in the first memory space, that is, color data and depth data can be written in this piece of memory space.
  • color attachment B and depth attachment B may be two separate memory spaces in the second memory space.
  • the color attachment B and the depth attachment B may also be a piece of memory space in the second memory space, that is, color data and depth data can be written in this piece of memory space.
  • step S105 reference may be made to steps 602a and 602b above.
  • the GPU of the electronic device combines the color attachment A and the color attachment B of the Nth rendering frame into the Nth rendering frame according to the depth attachment A and the depth attachment B.
  • the GPU of the electronic device may combine the color attachment A and the color attachment B of the Nth drawing frame into the Nth drawing frame according to the depth attachment A and the depth attachment B.
  • synthesizing color attachment A and color attachment B according to the depth attachment reference may be made to the description of synthesizing two color attachments based on depth information in the depth test in the prior art, which will not be repeated here.
  • the electronic device draws the N+2th drawing frame.
  • the CPU of the electronic device acquires the drawing parameters of the N+2th drawing frame.
  • the CPU of the electronic device may acquire the drawing parameters of the N+2th drawing frame.
  • the CPU of the electronic device 100 can acquire the drawing parameters of the N+2 th drawing frame of the application program through the interface in the three-dimensional image processing library.
  • the drawing parameters of the N+2th drawing frame are used to draw and render the N+2th drawing frame.
  • the drawing parameters of the N+2 th drawing frame may include the information carried in the drawing instruction (eg, the draw call instruction) of the N+2 th drawing frame, such as the coordinates, pixel value, depth of each vertex in the drawing content of the draw call instruction value, etc.
  • the electronic device displays the N+1 th frame. If the N+1 th frame is a drawing frame, the electronic device may draw the N+1 th frame according to the steps of drawing the N+2 th frame in steps S107 to S110 . If the N+1 th frame is a predicted frame, the electronic device may predict the N+1 th predicted frame according to steps S111-S115.
  • the CPU of the electronic device sends a drawing instruction for instructing the GPU to draw the N+2 th drawing to the GPU according to the drawing parameters of the N+2 th drawing frame.
  • the CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the N+2 th drawing frame to the GPU according to the drawing parameters of the N+2 th drawing frame.
  • the drawing parameters of the N+2th drawing frame acquired by the CPU may include information of multiple drawing instructions.
  • the CPU may sequentially send multiple drawing instructions to the GPU for instructing the GPU to draw the N+2 th drawing frame.
  • step S104 specific reference may be made to the description in step S104, which is not repeated here.
  • the GPU writes the drawing content of the drawing instruction of the N+2th frame into the color attachment C and the depth attachment C in the third memory space; if The drawing instruction of the N+2th drawing frame does not carry the transition matrix, and the GPU writes the drawing content of the drawing instruction of the N+2th frame into the color attachment D and the depth attachment D in the fourth memory space.
  • the drawing instructions of the N+2th drawing frame may include a drawing instruction that carries a transition matrix and a drawing instruction that does not carry a transition matrix.
  • FIG. 8A exemplarily shows the N+2 th drawing frame, and the N+2 th drawing frame may include a static background 102 and a moving cart 103 .
  • the drawing instructions of the N+2th drawing frame may include a drawing instruction for drawing the static background 102 and a drawing instruction for drawing the moving cart 103 .
  • the GPU writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space.
  • a drawing instruction to draw a moving car can carry a transition matrix.
  • the GPU writes the drawing content of the drawing instruction for drawing the moving cart 103 into the color attachment C and the depth attachment C in the third memory space.
  • FIG. 8B exemplarily shows the color attachment C and the depth attachment C of the third memory space.
  • the drawing content of the drawing instruction of the moving cart 103 is written in the color attachment C and the depth attachment C.
  • Color Attachment C is actually a block of memory space in memory.
  • FIG. 8B schematically shows the color data in the memory space in the form of an image scale for visual understanding.
  • depth attachment C is actually a memory space in memory.
  • FIG. 8B schematically shows the depth data in the memory space in the form of an image scale for visual understanding.
  • the GPU writes the drawing content of the drawing instruction into the color attachment D and the depth attachment D in the fourth memory space.
  • the drawing instruction for drawing the static background 102 may not carry a transition matrix.
  • the GPU writes the drawing content of the drawing instruction for drawing the static background 102 into the color attachment D and the depth attachment D in the fourth memory space.
  • FIG. 8C exemplarily shows the color attachment D and the depth attachment D of the fourth memory space.
  • the drawing content of the drawing instruction of the static background 102 is written. Understandably, the color attachment D is actually a block of memory space in memory. In FIG.
  • the color data in the memory space is schematically displayed in the form of an image scale.
  • depth attachment D is actually a memory space in memory.
  • the depth data in the memory space is schematically displayed in the form of an image scale.
  • the color accessory C may be referred to as the third color accessory, and the color accessory D may be referred to as the fourth color accessory.
  • Depth attachment C may be referred to as the third depth attachment, and depth attachment D may be referred to as the fourth depth attachment.
  • the GPU draws each drawing instruction of the N+2th drawing frame in turn. Each time the GPU draws a drawing instruction, it can determine whether the drawing instruction carries a transition matrix. If the drawing instruction carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space. If the transfer matrix is not carried in the drawing instruction, the GPU writes the drawing content of the drawing instruction into the color attachment D and the depth attachment D in the fourth memory space.
  • the drawing contents with color information of all the drawing instructions carrying the transition matrix in the N+2 th drawing frame are written in sequence.
  • the drawing contents with depth information of all the drawing instructions carrying the transition matrix in the Nth drawing frame are written in sequence.
  • the drawing contents with color information of all the drawing instructions that do not carry the transition matrix in the N+2 th drawing frame are written in sequence.
  • the drawing contents with depth information of all drawing instructions that do not carry the transition matrix in the N+2th drawing frame are sequentially written.
  • the color attachment A and the depth attachment A may be two separate memory spaces in the first memory space.
  • the color attachment A and the depth attachment A may also be a piece of memory space in the first memory space, that is, color data and depth data can be written in this piece of memory space.
  • color attachment B and depth attachment B may be two separate memory spaces in the second memory space.
  • the color attachment B and the depth attachment B may also be a piece of memory space in the second memory space, that is, color data and depth data can be written in this piece of memory space.
  • step S109 reference may be made to steps 606a and 606b above.
  • the GPU combines the color attachment C and the color attachment D into the N+2th drawing frame according to the depth attachment C and the depth attachment D.
  • the GPU of the electronic device may combine the color attachment C and the color attachment D of the N+2 th drawing frame into the N+2 th drawing frame according to the depth attachment C and the depth attachment D.
  • the GPU of the electronic device may combine the color attachment C and the color attachment D of the N+2 th drawing frame into the N+2 th drawing frame according to the depth attachment C and the depth attachment D.
  • the GPU sends the image frame of the Nth frame in the seventh memory space for display, it can clear the image frame of the Nth frame stored in the seventh memory space. Then, the GPU can synthesize the image frame of the N+2th frame in the seventh memory space. Similarly, after the GPU sends the image frame of the N+2th frame in the seventh memory space for display, the image frame of the N+2th frame stored in the seventh memory space can be cleared.
  • the electronic device predicts the N+3 th prediction frame.
  • the CPU of the electronic device sends an instruction for instructing the GPU to calculate the motion vector to the GPU.
  • the CPU of the electronic device may send an instruction to the GPU for instructing the GPU to calculate the motion vector.
  • This instruction is used to instruct the shader in the GPU to calculate the motion vector.
  • the directive can be a dispatch directive.
  • the embodiment of the present application does not limit the specific form of the instruction for calculating the motion vector.
  • the GPU of the electronic device calculates the motion vector A of the color appendix C of the N+2th drawing frame by using the color appendix A, and uses the depth appendix B and the depth appendix D to calculate the motion vector of the color appendix D of the N+2th drawing frame B.
  • the GPU of the electronic device can separately calculate the motion vector of the moving object and the motion vector of the static object in the N+2th frame.
  • the GPU of the electronic device can calculate the motion vector of the moving object (color attachment C) in the N+2th frame, that is, the motion vector A, by using the color attachment A and the color attachment C.
  • the GPU of the electronic device may calculate, according to the depth attachment B and the depth attachment D, the motion vector of the static object (color attachment D) in the N+2th frame, that is, the motion vector B.
  • the motion vector V may be referred to as the first motion vector
  • the motion vector B may be referred to as the second motion vector
  • the GPU of the electronic device uses the color attachment A to calculate the motion vector A of the color attachment C of the N+2th drawing frame, which may specifically include the following steps:
  • the GPU may divide the color attachment C of the N+2th frame into Q pixel blocks.
  • Each pixel block may contain f*f (for example, 16*16) pixels. As shown in (b) of FIG. 9A .
  • the GPU takes the first pixel block in color attachment C (for example, pixel block 902 in (b) in FIG. 9A ), and searches for a matching pixel block matching the first pixel block in color attachment A of the Nth drawing frame , such as the pixel block 901 in (a) of FIG. 9A .
  • the candidate block with the smallest absolute difference with the RGB value of the first pixel block is referred to as a matching pixel block matching the pixel block.
  • the electronic device needs to find a matching pixel block 901 that matches the pixel block in the Nth drawing frame.
  • the GPU of the electronic device may find a matching pixel block that matches the first pixel block in the Nth drawing frame by using a diamond search algorithm. As shown in FIG. 9B , the GPU can find a matching pixel block 902 in the Nth frame of the (b) figure by a diamond search algorithm that matches the pixel block 902 in the N+2th frame of the (a) figure.
  • the electronic device can use the pixel point 9011 in the upper left corner of the pixel block 901 to perform a diamond search.
  • the electronic device may find the pixel block 901 with the pixel point 1104 as the upper left corner in the Nth drawing frame to match the pixel block 902 .
  • the diamond search algorithm For details of the diamond search algorithm, reference may be made to the description in the prior art, which will not be repeated here.
  • FIG. 9C exemplarily shows a schematic diagram of the electronic device finding a pixel block 901 that matches the pixel block 901 in the Nth drawing frame.
  • the electronic device performs a diamond search for the pixel point 9011 in the upper left corner of the pixel block 902 .
  • the electronic device first performs a diamond search with the pixel point 9012 in the Nth drawing frame as the center point.
  • the coordinates of the pixel point 9011 are the same as the coordinates of the pixel point 9012 .
  • the electronic device can calculate that the pixel block 902 is respectively in the pixel block with the upper left pixel point as the pixel point 9012, the upper left pixel point is the pixel block with the pixel point 1001, the upper left pixel point is the pixel block with the pixel point 1002, the upper left pixel point is the pixel block with the pixel point 1002, and the upper left pixel point is the pixel block with the pixel point 1002.
  • the point is the pixel block of pixel 1003, the upper left pixel is the pixel block of pixel 1004, the upper left pixel is the pixel block of pixel 1005, the upper left pixel is the pixel block of pixel 1006, and the upper left pixel is the pixel block of pixel 1006.
  • the upper left pixel point is the pixel value difference of the pixel block of pixel point 1008.
  • the electronic device can then perform a small diamond search with the upper left pixel point in the pixel block with the smallest pixel value difference as the center. For example, in the above pixel block, the pixel value difference between the pixel block whose upper left corner is the pixel point 1003 and the pixel block 902 is the smallest. Then the electronic device can perform a small diamond search with the pixel point 1003 as the center.
  • the electronic device can calculate that the pixel block 902 is respectively in the pixel block with the upper left pixel point as the pixel point 1101, the upper left pixel point is the pixel block of the pixel point 1102, the upper left pixel point is the pixel block of the pixel point 1103, and the upper left corner pixel point is the pixel block of the pixel point 1103.
  • the pixel point is the pixel block of the pixel point 1104 .
  • the electronic device can determine that the pixel value difference between the pixel block whose upper left pixel point is the pixel point 1104 (ie, the pixel block 901 shown in FIG. 9B ) and the pixel block 902 is the smallest. Then the electronic device can determine that the pixel block 901 in the Nth frame is a matching pixel block of the pixel block 902 .
  • the GPU calculates the first displacement from the matched pixel block to the first pixel block, and determines the motion vector A1 of the first pixel block according to the first displacement.
  • the matching block with the pixel block 902 in FIG. 9B is the pixel block 901 .
  • the motion vector of the pixel block 902 is the motion vector V1 illustrated in (b) of FIG. 9B .
  • the GPU can calculate the motion vector of each pixel block in the Q pixel blocks in the color annex C according to the above steps 1-3, namely V1, V2, . . . , VQ.
  • the GPU of the electronic device uses the depth attachment B and the depth attachment D to calculate the motion vector B of the color attachment D of the N+2th drawing frame, which may specifically include the following steps:
  • the GPU may divide the color attachment D of the N+2th frame into Q pixel blocks. Each small block may contain f*f (eg 16*16) pixels.
  • the GPU When the GPU draws the Nth frame, it can obtain the corner information of the camera position of the Nth frame through the hook glBufferSubData interface (saved in a 4x4 matrix), and record it as M1.
  • the GPU draws the N+2 frame, it can obtain the corner information of the camera position of the N+2 frame through the hook glBufferSubData interface (saved in a 4x4 matrix), and record it as M2.
  • the GPU and computes the transformation matrix T between M1 and M2.
  • the matrix T represents the conversion relationship between the two frames of Camera.
  • the matrix R1 represents the rotation property of the camera in the Nth drawing frame
  • the matrix T1 represents the translation property of the camera in the Nth drawing frame
  • the matrix R2 represents the rotation property of the camera in the N+2th drawing frame
  • the matrix T2 represents the translation property of the camera in the N+2th drawing frame.
  • the matrix P is the projection matrix, and the GPU can directly obtain it through the hook glBufferSubData interface.
  • the GPU obtains the second pixel block and the position 2 of the second pixel block in the N+2th frame in the color attachment D of the N+2th frame, and obtains the depth value D2 of the second pixel block in the depth attachment D .
  • the GPU may calculate the motion vectors B1, B2, . . . , BQ of each pixel block in the color attachment D according to the step of calculating the motion vector of the second pixel block.
  • Motion vector B (B1, B2, . . . , BQ) for color attachment D.
  • vector G2 (position2, D2, 1)
  • vector G1 G2*T
  • G1 is a 1*4 vector
  • G1.x is the first element of G1
  • G1.y is the second element of G1
  • G1.w is the fourth element of G1.
  • the CPU of the electronic device sends an instruction for instructing the GPU to draw the predicted frame to the GPU.
  • the CPU of the electronic device 100 may send an instruction for drawing the N+3 th predicted frame to the GPU after the GPU calculates the motion vector A of the color attachment C and the motion vector B of the color attachment D.
  • the GPU predicts the color attachment E of the N+3 th prediction frame according to the color attachment C and the motion vector A, and predicts the color attachment F of the N+3 th drawing frame according to the color attachment D and the motion vector B.
  • the GPU may draw the color attachment E written in the moving object and the color attachment F written in the static object in the N+3 th predicted frame.
  • the GPU may predict the color attachment E of the N+3 th prediction frame according to the color attachment C and the motion vector A, and predict the color attachment F of the N+3 th drawing frame according to the color attachment D and the motion vector B.
  • color attachment E may be as shown in FIG. 10A
  • color attachment F may be as shown in FIG. 10B .
  • the color attachment E may be referred to as the fifth color attachment
  • the color attachment F may be referred to as the sixth color attachment.
  • the object in the Nth drawing frame is the same as the object in the N+2th drawing frame.
  • the position of the object A in the Nth drawing frame may be different from the position of the object A in the N+2th drawing frame.
  • the objects in the N+2 th rendering frame and the N+3 th prediction frame are the same, but the positions of the objects in the N+2 th rendering frame and the N+3 th prediction frame are different.
  • the GPU can predict the N+3 prediction frame by using the object of the N+2 drawing frame and the motion vector of the object.
  • the Nth drawing frame may be referred to as the first drawing frame.
  • the N+2th drawing frame may be referred to as the second drawing frame.
  • the N+3 th prediction frame may be referred to as the first prediction frame.
  • the GPU combines the color attachment E and the color attachment F according to the depth attachment C and the depth attachment D into the image frame of the N+3 th prediction frame.
  • the GPU of the electronic device can combine the color attachment E and the color attachment F of the Nth drawing frame into the image frame of the N+3th drawing frame according to the depth attachment C and the depth attachment D.
  • the N+3 th predicted frame may be as shown in FIG. 10C .
  • synthesizing the color attachment E and the color attachment F according to the depth attachment reference may be made to the description of synthesizing two images based on the depth attachment in the depth test in the prior art, which will not be repeated here. It can be understood that, since the interval between the N+2 th rendering frame and the N+3 th prediction frame is very short, the N+3 th prediction frame can be synthesized by using the depth information in the N+2 th rendering frame.
  • the GPU can also predict the depth attachments of moving objects and the depth attachments of static objects in the N+3th frame. Then, the color attachment E and the color attachment F are synthesized using the depth attachment of the moving object and the depth attachment of the static object in the N+3 frame. This application does not limit this.
  • the main process for the electronic device to draw the drawing frame is that the GPU executes several drawcall instructions.
  • the GPU draws the contents of each drawcall instruction to the FBO one by one.
  • each drawcall instruction needs to execute the rendering pipeline process once on the GPU.
  • the process of the rendering pipeline is mainly divided into vertex shader, tessellation (not required), geometry shader (not required), primitive assembly (not required), rasterization, fragment shader, test mixing stage (not required) must). In this way, it is expensive for the GPU to draw a frame to draw a frame.
  • the vertex information and coordinate information required by the GPU to execute each drawcall instruction need to be prepared by the GPU, and these preparations are also very computationally intensive for the CPU.
  • the process of predicting an image frame has almost no computational consumption for the CPU, and only needs to send some instructions to the GPU.
  • For the GPU only the motion vector of moving objects and the motion vector of static objects need to be calculated. These calculations are all parallel and only need to be calculated once.
  • Each computing unit performs a small number of basic operations, which can reduce GPU calculations and improve performance.
  • the embodiment of the present application is not limited to the electronic device predicting the N+3 th predicted frame by using the N th drawing frame and the N+2 th drawing frame.
  • the electronic device may further predict the N+2 th frame by using the N th frame and the N+1 th frame.
  • the electronic device may also predict the N+4th frame by using the Nth frame and the N+3th frame. This embodiment of the present application does not limit this.
  • the electronic device can predict the predicted frame according to different strategies. That is, the strategy of the electronic device predicting the N+3th frame according to the Nth frame and the N+2th frame in the first time period, and the strategy of predicting the N+2th frame according to the Nth frame and the N+1th frame in the second time period.
  • the electronic device may first predict the N+3 th frame according to the N th frame and the N+2 th frame.
  • the electronic device may predict the N+2th frame according to the Nth frame and the N+1th frame. This embodiment of the present application does not limit this.
  • a frame insertion logic block diagram of 90 frames per second (90 frames per second, 90 fps) is transmitted.
  • frames 0 to 2 are drawing frames. Starting from frame 3, odd-numbered frames are predicted frames, and even-numbered frames are drawn frames. For example, odd-numbered frames such as the third frame, the fifth frame, and the seventh frame are predicted frames.
  • the 4th, 6th, 8th, etc. even-numbered frames are drawing frames.
  • Frame 3 is generated by the electronic device based on frame 0 and frame 2.
  • Frame 5 is generated by the electronic device based on frames 2 and 4.
  • the 7th frame is generated by the electronic device based on the 4th and 6th frames.
  • the 89th frame is generated by the electronic device based on the 86th and 88th frames.
  • the 0th frame may be referred to as the 0th drawing frame.
  • the third frame may be referred to as a third predicted frame.
  • FIG. 12 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
  • electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have different component configurations.
  • the various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2.
  • Mobile communication module 150 wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
  • SIM Subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 .
  • the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • graphics processor graphics processor
  • ISP image signal processor
  • controller memory
  • video codec digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • the controller may be the nerve center and command center of the electronic device 100 .
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous transceiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the SIM interface can be used to communicate with the SIM card interface 195 to realize the function of transferring data to the SIM card or reading data in the SIM card.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
  • the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
  • the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
  • WLAN wireless local area networks
  • BT Bluetooth
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared technology
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
  • the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • global positioning system global positioning system, GPS
  • global navigation satellite system global navigation satellite system, GLONASS
  • Beidou navigation satellite system beidou navigation satellite system, BDS
  • quasi-zenith satellite system quadsi -zenith satellite system, QZSS
  • SBAS satellite based augmentation systems
  • the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Display screen 194 is used to display images, videos, and the like.
  • Display screen 194 includes a display panel.
  • the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
  • LED diode AMOLED
  • flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
  • the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
  • ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
  • Video codecs are used to compress or decompress digital video.
  • the electronic device 100 may support one or more video codecs.
  • the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG Moving Picture Experts Group
  • MPEG2 moving picture experts group
  • MPEG3 MPEG4
  • MPEG4 Moving Picture Experts Group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
  • RAM random access memories
  • NVM non-volatile memories
  • Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM) and so on.
  • SRAM static random-access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR SDRAM double data rate synchronous dynamic random access memory
  • DDR5 SDRAM double data rate synchronous dynamic random access memory
  • Non-volatile memory may include magnetic disk storage devices, flash memory.
  • Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cells (single-level cells, SLC), multi-level memory cells (multi-level memory cells) according to the level of storage cell potential cell, MLC), triple-level cell (TLC), fourth-level storage unit (quad-level cell, QLC), etc., according to the storage specification can include universal flash storage (English: universal flash storage, UFS) , embedded multimedia memory card (embedded multi media Card, eMMC) and so on.
  • SLC single-level memory cells
  • multi-level memory cells multi-level memory cells
  • MLC multi-level memory cells
  • TLC triple-level cell
  • QLC fourth-level storage unit
  • UFS universal flash storage
  • eMMC embedded multimedia memory card
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • executable programs eg, machine instructions
  • the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
  • the non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
  • the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used to convert digital audio information to analog audio signal output, and also to convert analog audio input to digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
  • the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the electronic device 100 emits infrared light to the outside through the light emitting diode.
  • Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
  • the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
  • the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch panel”.
  • the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to touch operations may be provided through display screen 194 .
  • the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
  • FIG. 13 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
  • the system framework 1300 for implementing image frame prediction includes a software architecture and hardware devices.
  • the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
  • the system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, a system library, and a kernel layer.
  • the application layer can include a series of application packages.
  • the application layer may target application 1301.
  • the application layer may also include camera (not shown in FIG. 13 ), gallery (not shown in FIG. 13 ), calendar (not shown in FIG. 13 ), calls (not shown in FIG. 13 ), maps (not shown in FIG. 13 ) (not shown in FIG. 13 ), navigation (not shown in FIG. 13 ), etc. applications (which may also be referred to as applications).
  • the target application 1301 may be a game application.
  • the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
  • the application framework layer includes some predefined functions.
  • the application framework layer may include an application engine 1310 .
  • the application engine 1310 may include a rendering system (Rendering System) 1311.
  • the rendering system 1311 in the application engine 1310 corresponding to the target application 1301 can acquire the drawing parameters of the target application 1301 .
  • the rendering system 1311 can also call the interface in the three-dimensional graphics processing library 1330 according to the drawing parameters, so as to realize the rendering of the image frame of the target application 1301 .
  • the application engine 1310 may be a game engine corresponding to a game application.
  • the 3D graphics processing library 1330 may be Vulkan, OpenGL, OpenGL ES.
  • a system library can include multiple functional modules. For example: surface manager (not shown in Figure 13), Media Libraries (not shown in Figure 13), platform interface 1320, 3D graphics processing library 1330 (eg: OpenGL ES), two dimensional graphics engine (eg: SGL) (not shown in FIG. 13 ), etc.
  • the Surface Manager is used to manage the display subsystem and provides a fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 3D) layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the platform interface 1320 may be used to receive the API for configuring the cache transmitted by the 3D graphics processing library 1330 . In response to the API for configuring the cache, the platform interface 1320 can drive the motion random access memory through a driver in the driver layer. In turn, the platform interface 1320 may configure storage space in the Motion RAM for use by the target application.
  • the platform interface 1320 may be EGL.
  • EGL is the interface between the Khronos rendering API (such as OpenGL, OpenGL ES or OpenVG) and the underlying native platform windowing system. EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs".
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • the three-dimensional graphics processing library 1330 may be OpenGL ES.
  • OpenGL ES is an application programming interface/library that is a subset of the OpenGL 3D graphics API.
  • OpenGL ES includes a variety of functional functions/application programming interfaces, such as glBindFrameBuffer interface 1333', glDrawArrays interface (not shown in the figure).
  • the electronic device 100 may call OpenGL ES to implement the drawing of the image frame.
  • the hook module (HOOK System) 1331 can acquire and call the parameters of interfaces such as glBindFrameBuffer interface 1333' and glDrawArrays interface in the three-dimensional image processing library 1330 by hooking some interfaces in the three-dimensional image processing library 1330.
  • the hook module (HOOK System) 1331 hooks the glBindFrameBuffer interface 1333' in the 3D image processing library 1330 through the glBindFrameBuffer interface 1333, and can obtain the parameters for calling the glBindFrameBuffer interface 1333' in the 3D image processing library 1330.
  • the rendering system 1311 in the application engine 1310 may call the eglSwapBuffers interface 1332 and the glBindFrameBuffer interface 1333 and other interfaces in the hook module 1331 .
  • the hook module (HOOK System) 1331 can obtain and call the parameters of interfaces such as glBindFrameBuffer interface 1333' and glDrawArrays interface in the three-dimensional image processing library 1330 by hooking some interfaces in the three-dimensional image processing library 1330 to realize the insertion into the target application 1301.
  • the predicted frame is realized, and the motion vector is calculated according to the drawing frame of the target application 1301 and the predicted frame is obtained.
  • 2D graphics engine is a drawing engine for 2D drawing.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer may include drivers 1340 .
  • the driver 1340 may include a variety of drivers for implementing the driver for the hardware device.
  • the driver 1340 may include a graphics memory driver 1341, a GPU driver 1342, and the like.
  • the hardware devices may include: a display device Display1350 , a graphics processor GPU1351 , a cache 1352 and an application processor 1353 .
  • Display device 1350 may be display screen 194 shown in FIG. 12 .
  • the graphics processor GPU 1351 and the application processor 1353 may be integrated in the processor 110 shown in FIG. 12 .
  • the cache 1352 may be the internal memory 121 shown in FIG. 12 .
  • the display device 1350 may refer to the description of the display screen 194 above.
  • the graphics processor 1351 may refer to the above description of the GPU.
  • the application processor 1353 may refer to the description of FIG. 12 above.
  • the cache 1352 may refer to the description of the internal memory 121 above. It will not be repeated here.
  • a corresponding hardware interrupt is sent to the kernel layer.
  • the kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer.
  • the application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and then starts the camera driver by calling the kernel layer.
  • the camera 193 captures still images or video.
  • the color attachment C is the drawing result of the motion drawing object in the drawing instruction of the N+2th frame.
  • the motion vector calculation method of color attachment C may also refer to FIG. 17-FIG. 22B for the calculation process of calculating the motion vector of the moving object.
  • the image frame prediction performed by the electronic device may specifically include: first, the electronic device divides the first drawing frame and the second drawing frame into R*S blocks respectively. Then, the electronic device determines, in the second rendering frame, a first matching block that matches the first candidate block in the first rendering frame. Next, the electronic device calculates the motion vector E from the candidate block to the first matching block. The electronic device determines, according to the motion vector E, a motion vector F of the first matching block from the second drawing frame to the first prediction frame. The electronic device draws the first matching block in the first prediction frame according to the motion vector F and the position of the first matching block in the second rendering frame.
  • the electronic device can determine a matching block to which each candidate block in the first rendering frame matches in the second rendering frame.
  • the electronic device may finish rendering the first predicted frame.
  • the value of R*S is determined by the tile size and display screen resolution in the GPU of electronic devices (such as mobile electronic devices such as mobile phones and tablet computers).
  • the GPU can divide the display into several tiles for rendering. The size of a tile is generally 16*16 or 32*32. If the display resolution of the electronic device is U*V (eg, 1580*720), then R*S is equal to (U/16)*(V/16) or (U/32)*(V/32). For example, the Wth drawing frame is divided into (1580/16)*(720/16) tiles.
  • the process of determining the first matching block matched with the first candidate block in the first drawing frame by the electronic device in the second drawing frame can refer to the description in the Wth frame and the W+2th frame above in Figures 9A-9C. , and will not be repeated here.
  • the electronic device ie, tablet 10
  • the Wth image frame is displayed in the user interface 10.
  • the W-th image frame is a drawing frame.
  • the timing diagram 1403 in FIG. 14 shows the image frames that the electronic device can display from time T0 to time Tn.
  • FIG. 15 exemplarily shows a schematic diagram in the Wth frame divided into 16*16 blocks.
  • R*S is equal to 16*16 as an example.
  • the Wth frame in Figure 15 is divided into 16*16 small blocks.
  • Object 1501 and Object 1502 are each composed of a plurality of small blocks.
  • the electronic device needs to calculate the motion vector of each block in the object 1501 from the Wth frame to the W+2th frame. Take candidate block 1511 in object 1501 as an example.
  • the electronic device needs to determine the matching block that matches the candidate block 1511 in the W+2th frame.
  • FIG. 16 exemplarily shows a diagram in the W+2th frame divided into 16*16 blocks.
  • R*S is equal to 16*16 as an example.
  • the W+2th frame in Figure 16 is divided into 16*16 small blocks.
  • the object 301 and the object 302 are respectively composed of a plurality of small blocks.
  • the block 1611 in the object 1601 shown in FIGS. 15 and 16 matches the candidate block 1511 .
  • the electronic device needs to perform a search to find a block 1611 that matches the candidate block 1511.
  • the electronic device can use the diamond search algorithm to find the block 1611 that matches the candidate block 1511.
  • the specific process of the diamond search can refer to the description in FIG. 9B-FIG. 9C, which will not be repeated here.
  • an embodiment of the present application provides a method for predicting an image frame.
  • the method may include: first, the electronic device according to the first The drawing instruction determines the first moving object in the first drawing frame, and the second moving object is determined in the second drawing frame according to the second drawing instruction. Then, the electronic device determines that the first moving object and the second moving object match according to the attribute of the first moving object and the attribute of the second moving object. Next, the electronic device calculates the first coordinates of the center point of the first moving object and the second coordinates of the second moving object.
  • the electronic device determines a motion vector E from the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate. Finally, the electronic device determines the first pixel of the third moving object in the first predicted frame according to the motion vector E and the first pixel of the second moving object. In this way, the electronic device can insert a predicted image frame between every two drawing frames of the application program, which can improve the frame rate at which the electronic device displays the video interface of the application program. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved. Also, the electronic device can use the motion vector of the geometric center point of the object to represent the motion vector of the entire object, and it is not necessary to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
  • the attribute of the first motion object may be referred to as the first attribute
  • the attribute of the second motion object may be referred to as the second attribute
  • an image frame prediction method provided by an embodiment of the present application may include:
  • S701-S709 The electronic device draws the Wth drawing frame.
  • the target application is an application with animation effects in the user interface, such as a game application.
  • the embodiments of the present application are described below by taking the target application as a game application as an example.
  • the game application installed in the electronic device runs, the game application can call the drawing instruction to draw.
  • the CPU of the electronic device 100 can obtain the Wth drawing frame of the application program through the interface in the three-dimensional image processing library.
  • the drawing parameters of the Wth drawing frame are used to draw and render the Wth drawing frame.
  • the drawing parameters of the Wth drawing frame may include attributes of each object in the Wth drawing frame, such as the vertex buffer ID, vertex number, texture ID, shader ID, transformation matrix, stencil buffer, etc. of each object.
  • the CPU can obtain the drawing parameters of the Wth drawing frame of the application through the GL HOOK interface.
  • the GL HOOK interface can obtain the drawing parameters of each image frame of the application from the game application.
  • the CPU can obtain the texture ID from OpenGL through the HOOKG1BindTexture interface and store it in the object structure.
  • the CPU can obtain the vertex Buffer ID from OpenGL through HOOKGlBindBuffer and store it in the object structure.
  • the CPU can obtain the data for calculating the number of vertices from OpenGL through the HOOKGlBufferData interface, and store the calculated number of vertices in the object structure.
  • the CPU can obtain the transformation matrix of the object in the world coordinate system from OpenGL through the HOOKGlBufferSubData interface and store it in the global matrix variable.
  • object structure for storing object information can be defined according to the following code:
  • an object structure can be used to store the vertexBufferID, vertexNum, textureID of the object, the minimum value of the bounding box X-axis coordinate, the maximum value of the bounding box X-axis coordinate, the minimum value of the bounding box Y-axis coordinate, and the bounding box Y-axis.
  • the minimum value of the X-axis coordinate of the bounding box of the object is the minimum value of the X-axis coordinates of all the vertices of the object.
  • the maximum value of the X-axis coordinate of the bounding box of the object is the maximum value of the X-axis coordinates of all the vertices of the object.
  • the minimum value of the Y-axis coordinate of the bounding box of the object is the minimum value of the Y-axis coordinates of all the vertices of the object.
  • the maximum value of the object's bounding box Y-axis coordinate is the maximum value of the Y-axis coordinates of all vertices of the object.
  • the CPU can determine the X-axis coordinate of the center of the bounding box and the Y-axis coordinate of the center of the bounding box according to the minimum value of the X-axis coordinate of the bounding box, the maximum value of the X-axis coordinate of the bounding box, the minimum value of the Y-axis coordinate of the bounding box, and the maximum value of the Y-axis coordinate of the bounding box. It can be understood that the object structure in the embodiment of the present application is not limited to the object structure shown above, which is not limited in the embodiment of the present application.
  • the attribute of the object may include a transformation matrix, or may not include a transformation matrix. If the attribute of the object includes a transformation matrix, then the object is a moving object in this embodiment of the present application.
  • the object ie, the sphere
  • the sphere in (a) and (b) of FIG. 19A contains the transformation matrix, and the sphere is a moving object. If the attribute of the object does not include a transformation matrix, the object is a static object in this embodiment of the application.
  • the object ie, the rectangular parallelepiped
  • the cuboid in (a) and (b) of FIG. 19B does not contain a transformation matrix, and the cuboid is a static object.
  • the moving object may be set to a first identifier.
  • the static object may be set with a second identifier.
  • the CPU may set the first value in the pixel bits of the moving object's stencil buffer.
  • the CPU can set a second value in the pixel bits of the static object's stencil buffer.
  • the first value may be 1 and the second value may be 0.
  • the electronic device 100 may be a smart phone, a tablet device, a smart watch, a computer, etc., which is not limited here.
  • the CPU of the electronic device 100 sends an instruction A for applying for a memory space to the GPU.
  • the CPU of the electronic device 100 may send the instruction A for applying for memory space to the GPU. That is, when the target application starts to call the drawing instruction to draw, the CPU applies to the GPU for memory space A, and the memory space A is used to store the stencil buffer of the Wth drawing frame, that is, stencil buffer1.
  • Stencil buffer (stencil buffer) or stencil buffer is another kind of data buffer other than color buffer, pixel buffer and depth buffer, which is common in computer graphics hardware such as OpenGL three-dimensional drawing.
  • the stencil buffer is a pixel-based, integer-valued buffer, usually assigning a byte-length value to each pixel.
  • the instruction A may be the instruction glGenTextures(1,&texture) and the instruction glBindTexture(target,texture).
  • the CPU can send the instruction glGenTextures(1,&texture) and the instruction glBindTexture(target,texture) to the GPU to apply for memory space A from the GPU. It can be understood that the specific form of the instruction A is not limited in the embodiments of the present application.
  • the GPU of the electronic device 100 allocates the memory space A for the template buffer of the Wth drawing frame.
  • the GPU allocates a memory space A for the stencil buffer of the Wth drawing frame.
  • the drawing frames of the application are the Wth frame, W+2th frame, W+4th frame, W+6th frame, ..., W+nth frame.
  • Memory space A stores the stencil buffer for the Wth drawing frame.
  • the memory space A is used to store the stencil buffer of the W+4th drawing frame.
  • the memory space A is used to store the stencil buffer of the W+6 drawing frame.
  • the memory space A is used to store the stencil buffer of the W+8 drawing frame.
  • the memory space A is used to store the stencil buffer of the W+10th drawing frame.
  • the memory space A is used to store the stencil buffer of the W+4th drawing frame, which specifically includes: when the GPU sends the Wth drawing frame to the display screen.
  • the GPU clears the stencil buffer of the Wth drawing frame in the memory space A, and stores the stencil buffer of the W+4th drawing frame.
  • the memory space A may include a first template cache and a second template cache.
  • the first template buffer is used for the GPU to draw the template image corresponding to the object of the Wth drawing frame. That is, the GPU can draw objects in the first stencil buffer.
  • the second stencil buffer is used to back up the objects drawn in the first stencil buffer.
  • the stencil image corresponding to the object may refer to an image drawn by the GPU according to the stencil buffer of the object, and the image is not colored by the shader corresponding to the object coloring ID. If the pixel bit in the stencil buffer of the object is the first value (for example, 1), that is, when the object is a moving object, the GPU can draw the template image of the moving object as a template image with the first color.
  • the GPU can draw the stencil image of the still image as a stencil image with the second color.
  • the first color and the second color are different.
  • the first color is black and the second color is white.
  • the CPU of the electronic device 100 determines, according to the drawing parameters, the moving object contained in the Wth drawing frame and the attributes of the moving object.
  • the CPU of the electronic device 100 determines, according to the drawing parameters that can draw the Wth frame, the multiple objects included in the Wth drawing frame, and determines the attributes of the multiple objects. For example, if the drawing parameters of the Wth drawing frame include parameters of two objects (object A and object B), the CPU can determine the object A and the object B in the Wth drawing frame.
  • the CPU of the electronic device 100 establishes a first index table according to the motion objects included in the Wth drawing frame and the attributes of the motion objects.
  • the CPU may establish the first index table according to the multiple objects included in the Wth drawing frame and the attributes of the multiple objects.
  • the first index table only stores the index information of the moving object in the Wth drawing frame (for example, the ID of the moving object and the attribute corresponding to the moving object). If there are only two moving objects in the Wth drawing frame, moving object 1 and moving object 2. Then, the first index table of the Wth drawing frame may be as shown in Table 1.
  • the moving object 1 corresponds to the object ID 01 in Table 1, that is, it indicates that the ID of the moving object 1 is 01.
  • Object ID01 may include attributes such as vertex buffer ID01, vertex count, texture ID01, shader ID01, transformation matrix M01, stencil buffer, and so on.
  • the object ID01 is a moving object, so the attributes of the object ID01 include the transformation matrix M01.
  • the moving object 2 corresponds to the object ID 11 in Table 1, that is, it indicates that the ID of the object 2 is 11.
  • Object ID11 may include attributes such as vertex buffer ID11, vertex count, texture ID11, shader ID11, transformation matrix M11, stencil buffer, and so on.
  • the object ID11 is a moving object, so the attributes of the object ID11 include the transformation matrix M11.
  • the CPU of the electronic device 100 sends the instruction B for memory mapping to the GPU.
  • the CPU of the electronic device 100 may send the instruction B for mapping the first index table to the GPU.
  • instruction B may be glMapBufferRange().
  • the CPU can let the GPU map the first index table by sending the instruction glMapBufferRange() to the GPU.
  • the specific form of the instruction B is not limited in this embodiment of the present application.
  • the GPU of the electronic device 100 maps the first index table in the CPU.
  • the GPU of the electronic device 100 may map the first index table in the CPU.
  • the CPU can store the first index table on the hardware
  • the GPU maps the first index table in the CPU, which means that the GPU can access and read the first index table on the hardware.
  • S708 The CPU of the electronic device 100 sends a first drawing instruction for drawing the Wth drawing frame to the GPU.
  • the CPU may send a drawing instruction for drawing the Wth drawing frame to the GPU.
  • the drawing instruction for the Wth drawing frame may be glDrawArrays(). That is, the CPU may send the instruction glDrawArrays( ) to the GPU, and in response to the instruction, the GPU starts to draw the Wth drawing frame.
  • the drawing instruction of the Wth drawing frame may include a plurality of instructions for drawing objects in the Wth drawing frame.
  • the GPU may draw multiple objects in the Wth drawing frame according to multiple instructions for drawing objects.
  • the GPU of the electronic device 100 draws the object in the wth drawing frame and draws the template image of the moving object in the memory space A.
  • the GPU can draw all objects in the Wth drawing frame and render them for display.
  • the GPU can also draw a template image of the moving object in the memory space A, and the template image is used for the motion vector calculation in the subsequent steps.
  • the specific process of the motion vector calculation is described in S719-S721, which will not be repeated here.
  • the GPU may draw the template image of the object 1 of the Wth drawing frame in the first template buffer.
  • Object 1 is a moving object
  • the pixel bit of the template image of Object 1 drawn by the GPU is 1 (which can be indicated by black).
  • the initial state of the second template cache is empty. That is, in the initial state, nothing is stored in the second template cache.
  • the GPU saves the object drawn in the first stencil buffer into the second stencil buffer.
  • the GPU saves the object drawn in the first stencil buffer to the second stencil buffer.
  • the GPU may draw the template image of the object 2 of the Wth drawing frame in the first template buffer.
  • Object 2 is a static object, so the pixel bit of the template image of Object 2 drawn by the GPU is 0 (which can be indicated by white).
  • the GPU may again save the stencil image of the object 2 drawn in the first stencil buffer to the second stencil buffer.
  • the W-th drawing frame may be the W-th drawing frame shown in FIG. 15 above.
  • Object 1 may be a sphere object corresponding to element 1501 in FIG. 15 .
  • Object 2 may be a cuboid object corresponding to element 1502 .
  • the GPU may only draw the template image of the moving object of the Wth drawing frame in the first template buffer.
  • S710-S718 The electronic device draws the W+2th drawing frame.
  • the CPU of the electronic device 100 acquires the drawing parameters of the W+2 th drawing frame.
  • the CPU can obtain the drawing parameters of the W+2 drawing frame of the application through the GL HOOK interface.
  • the drawing parameters of the W+2 th drawing frame are used to draw and render the W+2 th drawing frame.
  • the drawing parameters of the W+2th drawing frame may include object attributes of each object in the W+2th drawing frame, such as the vertex buffer ID, vertex number, texture ID, shader ID, transformation matrix, stencil buffer, etc. of each object and other properties.
  • object attributes of each object in the W+2th drawing frame such as the vertex buffer ID, vertex number, texture ID, shader ID, transformation matrix, stencil buffer, etc.
  • the CPU of the electronic device 100 sends an instruction C for applying for a memory space to the GPU.
  • the CPU of the electronic device 100 may send the instruction C to apply for memory space to the GPU.
  • Instruction C can be used to request memory space B.
  • Memory space B is used to store the stencil buffer of the W+2 drawing frame, that is, stencil buffer2.
  • step S711 reference may be made to the description of step S702, which will not be repeated here.
  • the GPU of the electronic device 100 allocates a memory space B for the stencil buffer of the W+2 th drawing frame.
  • the GPU allocates a memory space B for the stencil buffer of the Wth drawing frame.
  • the drawing frames of the application are the Wth frame, W+2th frame, N+4th frame, Frame N+6, ..., frame N+n.
  • Memory space B stores the stencil buffer of the W+2 drawing frame.
  • the memory space B is used to store the stencil buffer of the N+6 drawing frame.
  • the memory space B is used to store the stencil buffer of the N+6 drawing frame, which specifically includes: after the GPU sends the Wth drawing frame to the display screen for display , the GPU clears the stencil buffer of the W+2th drawing frame in the memory space B, and stores the stencil buffer of the N+6th drawing frame.
  • the memory space B may include a third template cache and a fourth template cache.
  • the third stencil buffer is used for the GPU to draw the stencil image corresponding to the object of the W+2 th drawing frame. That is, the GPU can draw objects in the third stencil buffer.
  • the fourth stencil buffer is used to back up the objects drawn in the first stencil buffer.
  • step S712 refers to the description in step S703, and details are not repeated here.
  • the GPU may only draw the template image of the moving object of the W+2 th drawing frame in the third template buffer.
  • the CPU of the electronic device 100 determines, according to the drawing parameters, the moving objects included in the W+2 th drawing frame and the attributes of the moving objects.
  • the CPU of the electronic device may determine, according to the drawing parameters of the W+2 th drawing frame, multiple objects included in the W+2 th drawing frame, and determine the attributes of the multiple objects.
  • the CPU can determine the moving object in the W+2th drawing frame and the attributes of the moving object.
  • step 713 reference may be made to the description in step S704, which is not repeated here.
  • the CPU of the electronic device 100 establishes a second index table according to the moving objects included in the W+2 th drawing frame and the attributes of the moving objects.
  • the CPU may establish the second index table according to the multiple objects included in the W+2 th drawing frame and the attributes of the multiple objects. For example, if the W+2-th drawing frame only includes two moving objects, such as moving object 1 and moving object 2 . Then, the second index table of the Wth drawing frame may be as shown in Table 2.
  • the moving object 1 corresponds to the object ID 02 in Table 2, that is, it indicates that the ID of the moving object 1 is 02.
  • Object ID02 may include attributes such as vertex buffer ID02, vertex count, texture ID02, shader ID02, transformation matrix M02, stencil buffer, and so on.
  • the object ID02 is a moving object, so the attributes of the object ID02 include the transformation matrix M02.
  • the moving object 2 corresponds to the object ID 12 in Table 1, that is, it indicates that the ID of the object 2 is 12.
  • Object ID12 may include attributes such as vertex buffer ID12, vertex count, texture ID12, shader ID12, transformation matrix M12, stencil buffer, and so on.
  • the object ID12 is a moving object, so the attributes of the object ID12 include the transformation matrix M12.
  • the CPU of the electronic device 100 sends the instruction D for memory mapping to the GPU.
  • the CPU can also send instruction D to the GPU.
  • instruction D reference may be made to the description of the instruction B above, which will not be repeated here.
  • Instruction D is used to instruct the GPU to map the second index table in the CPU.
  • step S715 may be step S706, which will not be repeated here.
  • the GPU of the electronic device 100 maps the second index table in the CPU.
  • the GPU may map the second index table in the CPU. That is, the GPU can access and read the second index table stored by the CPU in some hardware.
  • the second index table may be the object index table shown in Table 2 above.
  • Step S716 may refer to step S707, which will not be repeated here.
  • S717 The CPU of the electronic device 100 sends a drawing instruction for drawing the W+2 th drawing frame to the GPU.
  • the CPU may send a drawing instruction to the GPU for drawing the W+2 th drawing frame.
  • the drawing instruction of the W+2 th drawing frame reference may be made to the description of the drawing instruction of the W th drawing frame.
  • the GPU starts to draw the W+2 th drawing frame.
  • the drawing instruction of the W+2 th drawing frame may include a plurality of instructions for drawing objects in the W+2 th drawing frame. That is, when there are multiple objects in the W+2 th drawing frame, the GPU may draw the multiple objects in the W+2 th drawing frame according to multiple instructions for drawing objects.
  • the GPU of the electronic device 100 draws the object in the W+2 th drawing frame and the template image of the moving object in the memory space B.
  • the GPU can draw all objects in the W+2 drawing frame and render them for display.
  • the GPU can also draw a template image of the moving object in the memory space B, and the template image is used for the motion vector calculation in the subsequent steps.
  • the moving object in step S718 refers to the moving object in the W+2 drawing frame.
  • the specific process of the motion vector calculation is described in S719-S721, which will not be repeated here.
  • the GPU may draw the template image of the object 1 of the W+2-th drawing frame in the third template buffer.
  • Object 1 is a moving object, so the pixel bit of the template image of Object 1 drawn by the GPU is 1 (it can be indicated by black).
  • the initial state of the fourth template cache is empty. That is, in the initial state, nothing is stored in the second template cache.
  • the GPU saves the object drawn in the third stencil buffer into the fourth stencil buffer.
  • the GPU saves the object drawn in the third stencil buffer into the fourth stencil buffer.
  • the GPU may draw the template image of the object 2 of the W+2 th drawing frame in the first template buffer.
  • Object 2 is a static object, so the pixel bit of the template image of Object 2 drawn by the GPU is 0 (which can be indicated by white).
  • the GPU may again save the stencil image of the object 2 drawn in the third stencil buffer to the fourth stencil buffer.
  • the W+2 th drawing frame may be the N+3 th drawing frame shown in FIG. 16 above.
  • Object 1 may be a sphere object corresponding to element 1601 in FIG. 16 .
  • Object 2 may be the cuboid object corresponding to element 1602 .
  • S719-S724 Predict the W+3 th prediction frame.
  • the CPU in the electronic device 100 sends an instruction for instructing the GPU to calculate the motion vector to the GPU.
  • the CPU in the electronic device 100 may send an instruction to the GPU for instructing the GPU to calculate the motion vector.
  • This instruction is used to instruct the shader in the GPU to calculate the motion vector.
  • the directive can be a dispatch directive.
  • the embodiment of the present application does not limit the specific form of the instruction for calculating the motion vector.
  • the CPU may cyclically send an instruction for calculating the motion vector to the GPU. After the GPU draws a frame, the CPU can send an instruction to the GPU for instructing the GPU to calculate the motion vector once. That is, after step S709, the CPU can also execute step S719.
  • the GPU in the electronic device 100 determines the first moving object in the first index table, and the first moving object matches the second moving object in the second index table.
  • the GPU can now retrieve the second moving object from the second index table, and then go to the first index table to find the first moving object that matches the second moving object.
  • the moving object is the second moving object.
  • the GPU may determine the moving object and the static object according to the identifier carried by each object in the W+2th drawing frame. That is, the object carrying the first identification is a moving object, and the object carrying the second identification is a static object. Only the moving objects in the N+2 drawing frames are stored in the second index table.
  • the second moving object may be any moving object in the second index table.
  • the W+2 th drawing frame may contain multiple objects. If there is only one moving object among the multiple objects, the moving object is the second moving object.
  • the GPU may retrieve the second moving object from the second index table in the W+2 th drawing frame. Then the GPU finds the first moving object matching the second moving object in the first index table of the Wth drawing frame.
  • the matching of the first moving object and the second moving object means that the M attributes of the first moving object are the same as the M attributes of the second moving object.
  • M is a positive integer, for example, the value of M can be 1, 2, 3 or other integers.
  • the value of M is not limited. For example, the number of vertices, texture ID, shader ID, transformation matrix, stencil buffer, etc. of the first moving object, and the number of vertices, texture ID, shader ID, transformation matrix, stencil buffer, etc. attributes of the second moving object same. It can be understood that, in the image frame sequence of the target application, the first moving object and the second moving object may be the same object.
  • the GPU may determine that the first moving object matches the second moving object according to the following code.
  • the GPU in the electronic device 100 calculates the first coordinate of the geometric center point of the first moving object in the Wth drawing frame according to the template image of the first moving object, and calculates the second moving object according to the template image of the second moving object The second coordinate of the geometric center point in the W+2th drawing frame.
  • the GPU of the electronic device 100 can obtain the coordinates of all the pixels of the first moving object by using the shader according to the template image of the first moving object. First, the GPU can determine the bounding box of the first moving object according to the minimum value X1min of the X axis, the maximum value X1max of the X axis, the minimum value Y1min of the Y axis, and the maximum value Y1max of the Y axis in the coordinates of all the pixel points of the first moving object. .
  • the coordinates of the four vertices of the bounding box of the first moving object may be respectively (X1min, Y1min), (X1max, Y1min), (X1min, Y1max), and (X1max, Y1max).
  • the GPU may determine the first coordinate of the first moving object according to the bounding box of the first moving object. The first coordinate is ((X1min+X1max)/2, (Y1min+Y1max)/2).
  • the GPU of the electronic device 100 can use the shader to obtain the coordinates of all the pixels of the first moving object according to the template image of the second moving object.
  • the GPU can determine the bounding box of the second moving object according to the minimum value X2min of the X axis, the maximum value X2max of the X axis, the minimum value Y2min of the Y axis, and the maximum value Y2max of the Y axis in the coordinates of all the pixel points of the second moving object. .
  • the coordinates of the four vertices of the bounding box of the second moving object may be respectively (X2min, Y2min), (X2max, Y2min), (X2min, Y2max), and (X2max, Y2max).
  • the GPU may determine the second coordinates of the second moving object according to the bounding box of the second moving object.
  • the second coordinate is ((X2min+X2max)/2, (Y2min+Y2max)/2).
  • the GPU in the electronic device 100 determines the motion vector E of the first moving object from the Wth drawing frame to the W+2th drawing frame according to the displacement from the first coordinate to the second coordinate, and determines the second motion according to the motion vector E The motion vector F of the object from the W+2-th drawn frame to the N+3-th predicted frame.
  • the GPU may determine the motion vector E for moving the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate. Then, the GPU determines the motion vector F of the second moving object from the W+2 th drawing frame to the N+3 th prediction frame according to the motion vector E.
  • the motion vector F is equal to K times the motion vector E. K is greater than 0 and less than 1.
  • K 0.5. That is, in the image frame sequence of the application, the movement of the same moving object is uniform. That is to say, the speed of the first moving object moving from the first frame to the second frame is the same as the speed of moving from the second frame to the third frame.
  • the first moving object may be the moving object 2201 illustrated in (a) of FIG. 22A .
  • the second moving object may be the moving object 2202 illustrated in (b) of FIG. 22A .
  • the motion vector E of the first moving object moving to the second moving object is the motion vector of moving the moving object 2201 to the moving object 2202 in (c) of FIG. 22B .
  • the geometric center point of the moving object 501 is the point 2203 .
  • the geometric center point of the moving object 2202 is point 2204 .
  • the motion vector from the moving object 2201 to the moving object 2202 is the motion vector 2205 from the point 2203 to the point 2204 .
  • Motion vector E may be motion vector 2205 in Figure 22B.
  • the motion vector F may be K times the motion vector 2205.
  • the CPU in the electronic device 100 sends an instruction E for drawing the N+3 th predicted frame to the GPU.
  • the CPU of the electronic device 100 may send an instruction E for drawing the N+3 th predicted frame to the GPU.
  • the GPU receives the instruction E, in response to the instruction E, the GPU draws the N+3 predicted frame.
  • the instruction E may include multiple instructions for drawing objects, that is, the GPU may draw multiple objects in the N+3 predicted frame according to the multiple instructions for drawing objects.
  • the GPU in the electronic device 100 draws the third moving object in the N+3 th prediction frame according to the motion vector F and the coordinates of each pixel point of the second moving object in the W+2 th drawing frame.
  • the GPU draws the N+3 predicted frame. Specifically, the GPU draws the third moving object in the N+3 prediction frame according to the motion vector F and the coordinates of each pixel of the second moving object in the W+2 drawing frame, wherein the second moving object and the second moving object Motion object matching. That is, each pixel in the second moving object is shifted by the motion vector F, that is, the pixel constituting the third motion vector.
  • the third motion vector and the motion vector F have the same number of vertices, the same shader ID, the same texture ID, and the same attributes such as transformation matrices.
  • the W+1th frame may be a drawing frame or a prediction frame. As shown in Figure 11, if the W-th drawing frame is the 0th frame, then the W+1-th frame is the first frame, then the W+1-th frame is the W+1-th drawing frame, then the electronic device can follow the steps The drawing process shown in S701-S709 draws the W+1 th drawing frame. If the W-th drawing frame is the second frame shown in FIG. 11 , then the W+1-th frame is the third frame in FIG. 11 , and at this time, the W+1-th frame is the W+1-th predicted frame. The electronic device may draw the W+1 th predicted frame according to the steps shown in steps S719 to S724.
  • the electronic device can repeatedly perform steps S719 to 722 until the motion vector of each moving object is predicted.
  • the embodiment of the present application is not limited to the electronic device predicting the W+3 th predicted frame by using the W th rendering frame and the W+2 th rendering frame.
  • the electronic device may also predict the W+2 th frame by using the W th frame and the W+1 th frame.
  • the electronic device may also predict the W+4th frame by using the Wth frame and the W+3th frame. This embodiment of the present application does not limit this.
  • the electronic device predicts the W+2th frame through the Wth frame and the W+1th frame.
  • the computing power of the GPU is required to be higher, that is, the GPU needs to calculate the motion vector and draw the W+2th frame before the W+1th frame is displayed. If the computing power of the GPU does not meet the requirements, the video interface of the electronic device will freeze after the electronic device displays the N+1th frame.
  • the electronic device can predict the predicted frame according to different strategies. That is, the strategy of the electronic device predicting the N+3th frame according to the Wth frame and the W+2th frame in the first time period, and the strategy of predicting the W+2th frame according to the Wth frame and the W+1th frame in the second time period.
  • the electronic device may first predict the W+3 th frame according to the W th frame and the W+2 th frame.
  • the electronic device may predict the W+2 th frame according to the W th frame and the W+1 th frame. This embodiment of the present application does not limit this.
  • the electronic device can determine the first moving object in the first drawing frame according to the first drawing instruction, and determine the second moving object in the second drawing frame according to the second drawing instruction moving objects. Then, the electronic device determines that the first moving object and the second moving object match according to the first attribute of the first moving object and the second attribute of the second moving object. Next, the electronic device calculates the first coordinates of the center point of the first moving object, and calculates the second coordinates of the second moving object. Then, the electronic device determines a motion vector E from the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate.
  • the electronic device determines the first pixel of the third moving object in the first predicted frame according to the motion vector E and the first pixel of the second moving object.
  • the electronic device can insert a predicted image frame between every two drawing frames of the application program, which can improve the frame rate at which the electronic device displays the video interface of the application program. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved.
  • the electronic device can use the motion vector of the geometric center point of the object to represent the motion vector of the entire object, and it is not necessary to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
  • the image frame prediction apparatus may include the following modules: HOOK system module 2300, Frame buffer Object Composition module 2310, UI Separating module 2320, Motion vector computation Module 2330 , Frame Prediction module 2340 , Debug system module 2350 , Frame Rate Control module 2360 . in:
  • the hook module HOOK system2300 is used to call the relevant interface of the 3D graphics processing library to obtain the drawing parameters of the target application.
  • the frame synthesis module 2310 is used for synthesizing the separated UI controls and the interface content of the target application into one frame of data.
  • the UI control separation module 2320 is used to separate the UI controls from the drawing parameters obtained from the target application.
  • UI controls refer to some buttons, input boxes, etc. in the user interface of the target application that can be used to receive user operations.
  • the UI control separation module 2320 may include a UI control detection (UI Detection) module 2321 and a UI frame buffer dump (UI Frame buffer Dump) module 2322.
  • the UI control detection module 2321 is used to detect UI controls.
  • the UI frame buffer dump module 2322 is used to store the UI controls detected by the UI detection module 2321 .
  • the motion vector calculation module 2330 is used to calculate the motion vector of the image frame.
  • the motion vector calculation module 2330 may include: a diamond search algorithm (Diamond Search Algorithm) module 2331, a reprojection algorithm (Reprojection Algorithm) module 2332, and an object based algorithm (Object Based Algorithm) module 2333.
  • the diamond search algorithm module 2331 is used to calculate the motion vector of each small block in the image frame through the diamond search algorithm.
  • the reprojection algorithm module 2332 is used to calculate motion vectors of static objects in the image frame.
  • the object-based algorithm module 2333 is used to calculate the motion vector of the moving object in the image frame.
  • the frame prediction module 2340 can be used to predict one image frame according to the two-frame rendering frame of the target application.
  • the predicted image frame is the predicted frame in this embodiment of the present application.
  • the system debugging module 2350 is used to output test data, dump the predicted frame, and the drawing and debugging system module 2350 may include a Debug Power Key module 2351, a Motion Vector Showing module 2352, and a UI Information (UI Information) module. ) module 2353, frame dump (FrameDump) module 2354.
  • the power button debugging module 2351 can be used to trigger the switching of the diamond search algorithm module 2331 , the reprojection algorithm module 2332 , the object-based algorithm module 2333 and other modules in the motion vector calculation module 2330 .
  • the motion vector display module 2352 can be used to draw motion vector arrows on the frame data to visualize the motion vectors.
  • the UI information module 2353 can be used to display information such as frame rate.
  • the frame dump module 2354 can be used to dump the predicted frame data into an image file for debugging.
  • the frame rate control module 2360 is used to control the frame rate of the image frame of the target application program displayed by the electronic device.
  • the existing technology can increase the frame rate of the video by inserting the predicted frame into the original frame of the video stream, and improve the smoothness of the video. , to improve the user experience.
  • the electronic device generally uses a block matching algorithm to generate the predicted frame. Specifically, after the electronic device divides the video frame into blocks, the motion vector of the block is directly applied to all pixels of the block to obtain the predicted frame. However, when the motion vectors of adjacent blocks are far apart, this method will cause holes and blurred images in the predicted frame.
  • Embodiments of the present application provide a frame prediction method, an electronic device, and a computer-readable storage medium.
  • the electronic device first, for each vertex of a block, according to the block around the vertex from the target reference frame to the prediction frame.
  • the predicted motion vector determines the position of the vertex in the predicted frame, and further, for each block, the corresponding relationship between the four vertices of the block in the reference frame and the predicted frame is used to calculate the position of each pixel of the block in the predicted frame. position, and finally get the entire predicted frame.
  • the vertex is determined, and then the first block is stretched according to the predicted motion vectors of the blocks around the first block, wherein the first block is a block in the reference frame, so that the adjacent prediction frames are made.
  • the vertices of the blocks are coincident, and the blocks are continuous without holes.
  • the video post-processing technology refers to a video processing technology that processes the collected video through a video post-processing algorithm to obtain a video effect that is improved in a certain aspect, including video stabilization technology, Video high dynamic range (HDR) processing technology and frame rate conversion technology, etc.
  • the video post-processing algorithm is used to process the collected multiple pictures or videos.
  • the video post-processing algorithm may be invoked by the image processing module provided in this embodiment of the present application to process the collected pictures or videos.
  • the frame rate is the number of frames per second in the video, that is, the number of times the video is updated per second. Due to the persistence of vision mechanism, when images are played continuously at 16 frames per second and above, the image sequence will achieve a visual effect that looks smooth and coherent. In general, normal resolution video up to 30 frames per second is considered acceptable, and video with frame rates up to 60 frames per second is considered high definition video. Generally, the higher the frame rate of the video, the better the smoothness and smoothness of the video.
  • the electronic device can use the video frame rate conversion technology to interpolate the low frame rate video into the high frame rate video. For example, the electronic device can increase the video frame rate from 30 frames per second to 60 frames per second, making the video more smooth and continuous, so as to enhance the realism and interaction of people watching videos.
  • Frame rate conversion technology is mainly divided into two categories, one is a non-motion compensation algorithm, and the other is an algorithm based on motion estimation and motion compensation.
  • non-motion compensation algorithms include simple frame repetition and frame averaging algorithms.
  • the frame repetition algorithm completes the frame interpolation by directly copying the frames in the input video sequence.
  • This method is simple and efficient, but the quality of the interpolation frames for moving objects in the video is poor, and there will be very obvious blurring and blurring.
  • Overlapping problem; the frame averaging algorithm synthesizes intermediate frames by weighting and averaging between adjacent frames in the input video sequence according to certain rules. This method has low time and space complexity, but for scenes with motion, interpolation Obvious aliasing problems with moving objects in frame images.
  • the electronic device may use an algorithm based on motion estimation and motion compensation to generate interpolated frames.
  • the main idea of the algorithm based on motion estimation and motion compensation is to capture the motion information of objects in the video frame sequence, and then fuse and synthesize the inserted frames according to the motion information and the input adjacent frames.
  • Block Matching Algorithm Algorithms based on motion estimation and motion compensation include Block Matching Algorithm (BMA).
  • BMA Block Matching Algorithm
  • the main steps of the algorithm are: firstly, the original video frame is divided into several pixel blocks, and it is assumed that all pixels in the pixel block have the same displacement, and then, according to a certain matching search principle, find the matching current pixel block in the reference frame. block, and calculate the relative displacement between the two matching blocks as the motion vector of each block between the two frames.
  • the main idea of the frame prediction method based on the block matching algorithm is that after the electronic device obtains the predicted motion vector of each block in the reference frame, for each block, the predicted motion vector of the block is directly applied to the block. On all pixels of , the corresponding block in the predicted frame is obtained, and finally the entire predicted frame is obtained, wherein the predicted motion vector is the motion vector of the block from the reference frame to the predicted frame.
  • this method will cause local discontinuity in the predicted frame, resulting in a hole effect.
  • FIG. 24 is a flowchart of a frame prediction method disclosed in an embodiment of the present application. As shown in FIG. 24 , the frame prediction method includes: Some or all of the following steps:
  • the electronic device may acquire two adjacent frames of images from a video stream, and determine the acquired two adjacent frames of images as a first reference frame and a second reference frame, wherein the video stream may be video, or It can be a game or other multimedia resources, which is not limited here.
  • FIG. 25 is a schematic diagram of obtaining a reference frame disclosed in an embodiment of the present application, wherein the horizontal axis represents the time of the video stream, and the arrows on the horizontal axis represent the video frames in the video stream.
  • the video stream is an image sequence composed of multiple video frames arranged in time sequence.
  • the video stream includes multiple frames of images such as the first frame, the second frame, the third frame, and the Nth frame.
  • the electronic device may acquire the second frame and the third frame in the video stream, determine the second frame in the video stream as the first reference frame, and determine the third frame in the video stream as the second reference frame.
  • FIG. 26 is another schematic diagram of obtaining a reference frame disclosed by an embodiment of the present application.
  • (A) in Figure 26 represents a video of a ball moving, specifically, there is a ball in the video screen, the ball moves in the direction of the virtual image, the dashed arrow represents the direction of the ball movement, and the video background is a still image with a radial pattern , the line at the top of the ball is a reference line indicating the position of the ball;
  • the images of (B) and (C) in Figure 26 are two reference frames obtained by the electronic device from the video respectively, wherein (B) in Figure 26 ) is the first reference frame, (C) in FIG.
  • 26 is the second reference frame, as shown in the figure, taking the line at the top of the ball as a reference, the ball in the first reference frame is at the eleventh position, and the second reference frame The ball in the twelfth position is in the twelfth position. It can be known from the relative position of the ball in the first reference frame and the second reference frame. The ball in the first reference frame and the second reference frame is moving relative to the background. There is a displacement from the reference frame to the second reference frame.
  • the electronic device may determine a frame of image from the first reference frame and the second reference frame as the target reference frame according to the position of the frame to be predicted.
  • the position of the frame to be predicted can be determined according to the application scenario and user requirements. For example, in order to improve the frame rate of the game, the electronic device can generate the next frame of the first two frames of images according to the first two frames of images. Too long game delay can be avoided. For another example, when processing video without real-time requirements, the electronic device can generate an intermediate image according to two adjacent video frames, and the predicted frame generated by this method is more accurate.
  • FIG. 27 is a schematic diagram of determining a target reference frame disclosed by an embodiment of the present application.
  • the electronic device may determine the second frame and the third frame in the video stream as the first reference frame and the second reference frame, and the electronic device determines the position of the frame to be predicted according to the position of the frame to be predicted.
  • the target reference frame includes two cases as shown in (B) and (C) in FIG. 27 . Wherein, as shown in (B) in FIG.
  • the electronic device when the position of the frame to be predicted is between the first reference frame and the second reference frame, the electronic device can determine that the first reference frame is the target reference frame, and accordingly, The second reference frame is a matching frame; as shown in (C) in FIG. 27 , when the position of the frame to be predicted is located between the second reference frame and the fourth frame, the electronic device can determine that the second reference frame is the target Reference frame, correspondingly, the first reference frame is a matching frame.
  • the position of the predicted frame may be located at a middle position between the two frames of images, or may be located at other positions between the two frames of images, which is not limited here.
  • the electronic device may firstly divide the target reference frame, wherein the size of the division may be 4 ⁇ 4, 8 ⁇ 8, and 16 ⁇ 16.
  • FIG. 28 is a schematic diagram of dividing a target reference frame according to an embodiment of the present application.
  • (A) in FIG. 28 is the target reference frame.
  • the divided target reference frame as shown in (B) in FIG. 28 can be obtained.
  • the area of the edge of the ball is taken to illustrate the scheme.
  • Irregular linear regions are stationary background regions.
  • S104 Calculate the motion vector of the first block from the target reference frame to the predicted frame, where the first block is a block in the target reference frame.
  • the electronic device may first obtain the motion vector of the block from the target reference frame to the matching frame, and then calculate the predicted motion vector of the block from the target reference frame to the predicted frame according to the motion vector of the block from the target reference frame to the matching frame. For example, when the target reference frame is the first reference frame, the electronic device may first obtain the motion vector of the block from the first reference frame to the second reference frame, and then calculate the motion vector of the block from the first reference frame to the second reference frame according to the motion vector of the block from the first reference frame to the second reference frame. The predicted motion vector of the block from the first reference frame to the predicted frame.
  • FIG. 29 is a schematic flowchart of calculating a predicted motion vector of a block from a target reference frame to a predicted frame disclosed in an embodiment of the present application.
  • Step S104 may include some or all of the following steps:
  • the electronic device can determine the matching block of the block in the matching frame according to the block in the target reference frame, wherein the area corresponding to the block in the target reference frame in the matching frame is the matching block, and then according to the target reference frame
  • the displacement of the block in to the matching block of the block in the matching frame determines the motion vector of the block from the target reference frame to the matching frame.
  • the electronic device may acquire the motion vector of each block in the first reference frame from the first reference frame to the second reference frame.
  • the target reference frame is the second reference frame
  • the electronic device may acquire a motion vector of each block in the second reference frame from the second reference frame to the first reference frame.
  • FIG. 30 is a schematic diagram of an acquisition block from a target reference frame to a matching frame disclosed in an embodiment of the present application.
  • (A) in FIG. 30 is the target reference frame, and according to the blocks in the target reference frame, the matching block determined in the matching frame may be as shown in (B) in FIG. 30 .
  • a motion vector as shown in (C) in FIG. 30 can be obtained, wherein the arrow indicates the displacement of the block from the target reference frame to the prediction frame.
  • the electronic device can determine the displacement of the block in the target reference frame to the matching block of the block in the matching frame as The motion vector of the block from the target reference frame to the matching frame, the motion vector of other blocks without displacement in the schematic diagram is 0.
  • the method for the electronic device to find the matching block in the matching frame according to the block in the target reference frame includes a full search method (Full Search Method, FS), a three-step method, a diamond search method, and the like.
  • the full search method calculates the absolute error sum for all reference pixel positions within the search range, and the motion vector is the offset corresponding to the absolute error and the minimum point. Since most of the best matching points appear near the center of the search area, the FS algorithm mainly adopts a spiral search sequence centered on the area, with the center point as the starting point, and spirals from the inside to the outside in the current frame. Search until all target pixels in the macroblock are traversed.
  • the blocks determined by the electronic device in the matching frame may overlap, and accordingly, there may be some regions in the matching frame that are not determined as matching blocks.
  • the electronic device may also obtain the motion vector of the block from the target reference frame to the matching frame according to the hardware device, and there may be other methods to obtain the motion vector of the block from the target reference frame to the matching frame, which is not limited here.
  • S1042. Determine the predicted motion vector of the block from the target reference frame to the predicted frame according to the motion vector of the block from the target reference frame to the matching frame.
  • the electronic device may determine the predicted motion vector of the block from the first reference frame to the predicted frame according to the motion vector of the block from the first reference frame to the second reference frame.
  • the motion between blocks may be considered as uniform motion, and it is understood that, in this case, the electronic device may determine half of the motion vector of the block from the first reference frame to the second reference frame as The predicted motion vector for this block.
  • FIG. 31A is a schematic diagram of determining a predicted motion vector of a block according to an embodiment of the present application. As shown in the figure, a block in the target reference frame is schematically drawn, wherein Mv is the motion vector of the block from the first reference frame to the second reference frame, represented by a solid arrow; Mv' is the block The predicted motion vector from the first reference frame to the predicted frame, indicated by dashed arrows.
  • the motion vector of the block from the first reference frame to the second reference frame is (3, 5), and the electronic device may determine half of the predicted motion vector of the block from the target reference frame to the predicted frame as the prediction of the block
  • the electronic device may determine the predicted motion vector of the block from the second reference frame to the predicted frame according to the motion vector of the block from the second reference frame to the first reference frame .
  • the motion between blocks is considered to be a uniform motion, and it is understood that in this case, the electronic device may convert the block from the second reference frame to the first reference frame by half the negative value of the motion vector Determined as the predicted motion vector for this block.
  • FIG. 31B is a schematic diagram of another method of determining a predicted motion vector of a block disclosed by an embodiment of the present application. As shown in the figure, a block in the target reference frame is schematically drawn, wherein Mv is the motion vector of the block from the second reference frame to the first reference frame, represented by a solid arrow; Mv' is the block The predicted motion vector from the second reference frame to the predicted frame, indicated by dashed arrows.
  • the motion vector of the block from the first reference frame to the second reference frame is (-3, -5), and the electronic device can determine the negative half of the predicted motion vector of the block from the target reference frame to the predicted frame.
  • the electronic device can also obtain the predicted motion vector of the block from the target reference frame to the predicted frame through a network model that senses video motion acceleration.
  • the network model uses the quadratic optical flow prediction method , among which, the main idea of the quadratic optical flow prediction method is that, assuming that the motion of the object in the interval is uniformly accelerated, the electronic device can calculate the object in the interval by obtaining the initial velocity of the object and the acceleration of the object in the interval. displacement at any time. With this method, the motion vector between adjacent frames can be estimated more accurately.
  • the electronic device may also obtain the predicted motion vector of the block from the target reference frame to the predicted frame by other methods, which is not limited here.
  • S105 Determine the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, where the first vertex is a vertex in the first block.
  • the electronic device can first determine the block around the vertex in the target reference frame, and then determine the predicted motion vector of the vertex according to the predicted motion vector of the block around the vertex, wherein the predicted motion vector of the block is the block from the target reference frame.
  • the motion vector from frame to predicted frame, and the predicted motion vector of the vertex is the motion vector of the vertex from the target reference frame to the predicted frame.
  • the electronic device may, for each vertex of each block in the target reference frame, determine the blocks around the vertex in the target reference frame, and then determine each vertex according to the predicted motion vector of the blocks around each vertex. The predicted motion vector for the vertex.
  • the electronic device may determine the block closest to the vertex as the block surrounding the vertex.
  • FIG. 32A is a schematic diagram of determining blocks around a vertex according to an embodiment of the present application. As shown in FIG. 32A, taking a block in the target reference frame as an example, the four blocks closest to the vertex a of block A are block A, block B, block C, and block D, respectively. The electronic device can determine these four blocks. are the four blocks around vertex a.
  • the electronic device may determine the average value of the predicted motion vectors of the blocks around the vertex as the predicted motion vector of the vertex.
  • FIG. 32B is a schematic diagram of determining a predicted motion vector of a vertex according to an embodiment of the present application.
  • the motion vector of block B is Mv'B
  • the motion vector of block C is Mv'C
  • the motion vector of block D is Mv'D
  • the electronic device determines the average value of the predicted motion vectors of the blocks around the vertex as the predicted motion vector of the vertex, and obtains the coordinates of the vertex a.
  • the electronic device may determine the predicted motion vector of the vertex on the edge of the target reference frame to be zero.
  • S106 Determine the coordinates of the first vertex in the predicted frame according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex.
  • the electronic device may add the coordinates of the vertex in the target reference frame and the predicted motion vector of the vertex to obtain the coordinates of the vertex in the predicted frame.
  • FIG. 33 is a schematic diagram of determining vertex coordinates according to an embodiment of the present application.
  • the coordinates of vertex a in the target reference frame are (x a1 , y a1 )
  • the predicted motion vector of vertex a is (1, 2)
  • the electronic device compares the coordinates of vertex a in the target reference frame with this
  • the predicted motion vectors of vertex a are added to obtain the coordinates of vertex a in the predicted frame as (x a1 +1, y a1 +2).
  • the electronic device may calculate each vertex in the target reference frame, and finally obtain the coordinates of all the vertices in the target reference frame in the predicted frame. It should be noted that, in the case where the predicted motion vectors of the vertices on the edge of the target reference frame are determined to be zero, the coordinates of the vertices in the target reference frame are equal to the coordinates of the vertices in the predicted frame.
  • S107 Determine the pixel block of the first block in the predicted frame according to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame.
  • the electronic device may first obtain the correspondence between the coordinates of the vertices of the first block in the target reference frame and the coordinates in the predicted frame according to the coordinates of the vertices of the first block in the target reference frame and the coordinates in the predicted frame , and further determine the correspondence between the coordinates of the vertex of the first block in the target reference frame and the coordinates in the predicted frame as the correspondence between the coordinates of the pixels of the first block in the target reference frame and the predicted frame, and finally, according to the The correspondence between the coordinates of the pixels in the block in the target reference frame and the coordinates in the predicted frame determines the coordinates of the pixels in the block in the predicted frame, wherein the first block is a block in the target reference frame.
  • FIG. 34 is a flowchart of determining coordinates of pixels in a block in a predicted frame disclosed in an embodiment of the present application.
  • Step S107 may include the following steps:
  • the electronic device can obtain the homography transformation formula corresponding to the block according to the four pairs of coordinates of the block, wherein the coordinates of a vertex in the target reference frame and the coordinates in the predicted frame are a pair of coordinates, and the block corresponding to The homography transformation formula is used to express the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame. It can be understood that the electronic device calculates each block in the target reference frame, and can obtain a homography transformation formula corresponding to each block.
  • FIG. 35A is a schematic diagram of a homography transformation formula corresponding to an acquisition block disclosed by an embodiment of the present application.
  • the four vertices of block A are vertex a, vertex b, vertex c and Vertex d
  • the coordinates of a vertex in the target reference frame and the predicted frame are a pair of coordinates, specifically, a pair of coordinates of vertex a are (x a , y a ) and (x a ', y a ')
  • vertex b A pair of coordinates of (x b , y b ) and (x b ', y b ')
  • a pair of coordinates of vertex c are (x c , y c ) and (x c ', y c ')
  • vertex d A pair of coordinates is (x d , y d ) and (x d ', y d ').
  • the electronic device can input the four pairs of coordinates of the block A into the homography transformation formula respectively to obtain the equation group corresponding to the block A, wherein the equation group includes four equations.
  • the homography transformation formula is as follows:
  • (x 1 , y 1 ) is the coordinates of the vertex in the target reference frame
  • (x 1 ', y 1 ') is the vertex in the target reference frame whose coordinates are (x 1 , y 1 ) in the predicted frame
  • the coordinates of , H is the unknown homography transformation matrix.
  • the homography transformation matrix is as follows:
  • the electronic device can obtain the homography matrix HA corresponding to the block A by solving the equation system corresponding to the block A , and then substitute the homography matrix HA corresponding to the block A into the homography transformation formula to obtain the block A.
  • the homography transformation formula corresponding to A, and the homography transformation formula corresponding to block A are as follows:
  • the homography transformation formula corresponding to the block A is used to represent the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame.
  • the electronic device may determine the pixel block of the first block in the predicted frame according to the homography transformation formula corresponding to the first block.
  • the electronic device may input the coordinates of the pixels in the block in the target reference frame into the homography transformation formula corresponding to the block to obtain the coordinates of the pixels in the predicted frame.
  • FIG. 35B is a schematic diagram of determining the coordinates of pixels in a predicted frame disclosed by an embodiment of the present application.
  • taking two pixels in block A as an example, one pixel in block A The coordinates of the point in the target reference frame are (x 1 , y 1 ), and by inputting (x 1 , y 1 ) into the homography transformation formula corresponding to block A, the coordinates of the pixel in the predicted frame (x 1 ',y 1 '), the coordinate of another pixel in block A in the target reference frame is (x 2 , y 2 ), input (x 2 , y 2 ) into the homography transformation formula corresponding to block A, The coordinates (x 2 ', y 2 ') of the pixel in the predicted frame can be obtained.
  • the electronic device may first determine the area of the pixel block of the first block in the predicted frame according to the four vertices of the first block, for example, determine the quadrilateral obtained by connecting the four vertices of the first block as The first block is the region of the pixel block in the predicted frame.
  • the electronic device may input the coordinates of each pixel of the first block in the target reference frame
  • the homography transformation formula corresponding to the block is used to obtain the coordinates of each pixel in the first block in the predicted frame.
  • the number of obtained coordinates of the first block in the predicted frame can be N, where N is greater than A positive integer of 0.
  • the electronic device may acquire coordinates in the area of the pixel block. For example, there are M coordinates in the area of the pixel block. In this case, it can be understood that M>N, and M is a positive integer greater than 0. Further, the electronic device may remove the coordinates of the pixels in the N first blocks in the predicted frame from the M coordinates included in the pixel block area of the predicted frame to obtain the first coordinates, where the first coordinates include at least two coordinates. , input the first coordinate into the homography transformation formula corresponding to the first block, and obtain the pixel of the first coordinate in the target reference frame.
  • the electronic device may obtain the coordinates in the area of the pixel block, and put the area of the pixel block in the area of the pixel block. Enter the homography transformation formula corresponding to the first block for each coordinate of , and obtain the coordinates of each coordinate in the area of the pixel block in the target reference frame, and then obtain the pixel block corresponding to the first block.
  • FIG. 35C is a schematic diagram of a prediction frame disclosed in an embodiment of the present application. Taking block A as an example, the electronic device obtains a pixel block corresponding to block A according to the homography transformation formula corresponding to block A, which can be as follows shown in Figure 35C.
  • the electronic device can process each block in the predicted frame through steps S101 to S107, and can obtain a pixel block of each block in the predicted frame, wherein each coordinate in the pixel block corresponds to a pixel in the target reference frame , the electronic device can display each pixel block through the display screen, and finally, the displayed predicted frame is continuous.
  • FIG. 36 is a schematic diagram of a prediction frame disclosed by an embodiment of the present application. Taking part of the prediction frame as an example in the figure, the blocks in the prediction frame finally obtained by the electronic device are in a stretched state. The blocks are continuous and there is no void area.
  • the electronic device can not only predict the color information of the predicted frame, but also can predict the depth information of the predicted frame. In this way, the electronic device can also synthesize the predicted frame according to the predicted depth information.
  • the present application provides an image frame generation method, which may include: determining, 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, determining The tenth position coordinate of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame; the twelfth block is in the second image frame according to matching The block determined by the algorithm that matches the eleventh block; the predicted block is generated according to the color data of the reference block and the tenth position coordinate, and the reference block is the eleventh block or the twelfth block one of the blocks; generating the predicted image frame, the predicted image frame including the predicted block.
  • the color data may be the RGB value of each pixel included in the block.
  • the block is predicted in combination with the depth value, so that the generated predicted block can be scaled according to the depth value, so that the picture displayed by the predicted image frame is more consistent with the scene drawn by the electronic device according to the actual data;
  • the device inserts the predicted image frame into the original image frame drawn according to the actual data, the transition between the original image frame and the predicted image frame is more natural and smooth, which improves the user experience.
  • the electronic device when the electronic device runs the application program, can generate the image frame f 3 according to the image frame f 1 and the image frame f 2 ; the image frame f 1 and the image frame f 2 are original image frames, Image frame f3 is a predicted image frame. Inserting the predicted image frame into the original image frame can achieve the purpose of increasing the frame rate.
  • the electronic device can determine blocks that match each other between the image frame f 1 and the image frame f 2 according to a block matching algorithm; each set of matched blocks includes a block B 1 and a block B 2 , and the block B 1 is located in the image frame f 1 , block B 2 is located in image frame f 2 ; for each group of matched blocks do the following: Determine the group from the coordinates of block B 1 in image frame f 1 and the coordinates of block B 2 in image frame f 2 The displacement vector corresponding to the matched block; according to the coordinates of the block B 1 or block B 2 in the image frame, and the displacement vector, determine the coordinates of the block B 1 or block B 2 in the image frame f 3 (the coordinates in the image frame f 3 A block consists of a block B 1 or a block B 2 , for example, the image frame f 3 is obtained by recombining (by performing position transformation) a plurality of blocks B 1 ).
  • Image frame f3 This embodiment generates a predicted frame, which can achieve the purpose of increasing the frame rate.
  • the display content of the image frame presents the scene in the three-dimensional space, it has the characteristics of "closer and farther small"; specifically, the display content of the image frame can be regarded as the scene in the three-dimensional space projected onto the projection plane for presentation.
  • the projection process can be regarded as the scene in the three-dimensional space projected onto the projection plane by the camera point; according to the principle of the camera shooting the object, the camera point can be regarded as the focal point.
  • the camera point can be the image The camera point in 46E.
  • the electronic device only determines the coordinates of the block in the image frame f3 according to the displacement vector.
  • the displacement vector refers to the displacement vector in the plane, it only includes two-dimensional variables in the three-dimensional space, so the other One-dimensional data, so that the final generated image frame f 3 cannot show the effect of "near big and far small”; therefore, there is a certain deviation between the display content of the image frame f 3 and the three-dimensional scene constructed by the running data of the application, which makes the electronic After the device inserts the predicted frame (f 3 in this example) in the original image frame (f 1 , f 2 in this example), the electronic device does not have a smooth transition during the display of the image frame.
  • a method of generating an image frame is provided.
  • the electronic device may generate the predicted image frame according to the three-dimensional data of the original image frame, so that the display area of the object in the predicted frame has the effect of "closer and far smaller".
  • the scene restored by the predicted frame is closer to the three-dimensional scene constructed according to the data of the application program, thereby making the difference between the original image frame and the predicted image frame. transitions are more natural and smooth.
  • the method may include:
  • the electronic device performs block division on the reference image frame to obtain a reference block.
  • the electronic device first determines one of the image frames f1 and f2 as the reference image frame according to the position of the image frame f3 to be predicted relative to the image frame f1 and the image frame f2.
  • the image frame f 1 and the image frame f 2 are image frames drawn according to the data of the application program; the image frame f 3 is the predicted image frame predicted according to the image frame f 1 and the image frame f 2 .
  • the image frame f 1 is located before the image frame f 2 in the data stream, and the electronic device can preset the image frame f 1 and one image frame in the image frame f 2 as a reference image frame; for example, the electronic device can set the data stream.
  • the image frame f 1 at the front of the middle is the reference image frame. It should be noted that the earlier the position of the image frame in the data stream is, the earlier the time point of displaying the image frame is when the electronic device displays the image frame according to the data stream.
  • the reference image frame is determined according to the position of the image frame f3 relative to the image frame f1 and the image frame f2 in the data stream. For example, it can include the following two situations: (1) Position relationship 1 as shown in FIG. 38: the image frame f 1 is located before the image frame f 2 in the data stream; if the image frame f 3 is located in the image frame f 1 and Between the image frames f 2 , the reference image frame is the image frame f 1 and the image frame f 1 in front of the image frame f 2 . (2) Positional relationship 2 shown in Fig.
  • the image frame f 1 is located before the image frame f 2 in the data stream; if the image frame f 3 is located after the image frame f 1 and the image frame f 2 , the reference image frame is Image frame f 1 and image frame f 2 following the image frame f 2 .
  • the position of the image frame f3 in the data stream can be determined according to the application scenario and user requirements. For example, in order to improve the frame rate of the game, the electronic device can predict and generate the next frame of the image according to the first two frames of images. It can avoid the game delay being too long, that is, the position relationship 2 in Figure 38; for example, when processing a video with no or low requirements for delay, the electronic device can generate an intermediate image according to two adjacent image frames. frame, the predicted frame generated by this method is more accurate, that is, the position relationship 1 in Figure 38.
  • the electronic device divides the reference image frame according to blocks of a first size, and the first size may be a preset size.
  • the electronic device may set the first size to be 1/50 of the area of the reference image frame; for another example, the electronic device may set the first size to be a size formed by nine pixels in the reference image frame.
  • the image frame f 1 and the image frame f 2 are shown in FIG. 39A . If the image frame f 1 is a reference image frame, and the image frame f 1 is divided into blocks, the effect shown in FIG. 39B can be obtained.
  • the electronic device determines a matching block in the matching image frame that matches the reference block, and obtains that the block B1 in the image frame f1 and the block B2 in the image frame f2 are mutually matched blocks.
  • the matching image frame is an image frame other than the reference image frame in the image frame f 1 and the image frame f 2 .
  • the image frame f 1 is a reference image frame
  • the image frame f 2 is a matching image frame
  • the image frame f 1 is a matching image frame
  • step S3703 specifically includes the following steps:
  • the electronic device determines the position coordinates (x c , y c ) and the depth value d c of the reference block in the reference image frame.
  • the position coordinates in the image frame specifically refer to coordinates in the screen coordinate system.
  • the screen coordinate system is a two-dimensional coordinate system.
  • the maximum value of the horizontal and vertical coordinates of the screen coordinate system is determined according to the number of pixels contained in the display area of the electronic device (image frame/display area of the screen);
  • the electronic device stores the corresponding position coordinates of each pixel in the image frame in the image frame, and the position of the block in the image frame may be obtained by averaging the position coordinates of all pixels in the block in the image frame.
  • the position of the pixel closest to the center point in the image frame is the coordinate of the block in the image frame.
  • the electronic device stores the depth value corresponding to each pixel in the image frame, and the depth value can represent the coordinates of the pixel in the Z dimension in the camera coordinate system, and the Z dimension is the dimension perpendicular to the projection plane in the camera coordinate system;
  • the electronic device constructs a three-dimensional scene in the camera coordinate system according to the data of the application program, and then projects the constructed three-dimensional scene on the projection screen, and then obtains the image frame on the projection plane.
  • the electronic device runs the Open Graphics Library (OpenGL)
  • the electronic device stores the drawing result of the drawn image frame in the frame buffer object (Frame Buffer Object, FBO), and the frame buffer object is set with a color Attachment (ColorAttachment) and depth attachment (Depth Attachment)
  • the color value information of the pixel and the position coordinates of the pixel in the image frame are stored in the color attachment; the depth value corresponding to the pixel is stored in the depth attachment.
  • the depth value of the block can be calculated according to the depth value of the pixels included in the reference block. Specifically, the depth value of the block may be obtained by averaging all pixels included in the block. Optionally, the depth value of the block may be the depth value corresponding to the specified pixel in the block, for example, setting the depth value of the pixel at the center point of the block (the pixel closest to the center point) as the depth value of the block.
  • the electronic device determines an area of a second size according to the depth value dc.
  • the electronic device may preset the mapping relationship between dc and the second size SA .
  • the area of the second size SA is S 1 ;
  • the second size S A is equal to the size S B of the block;
  • w 1 is a positive integer;
  • S 1 >S 2 >... > S H .
  • the shape of the region may be preset, for example, the shape of the region may be a square, a circle, a triangle, and the like.
  • the electronic device determines, in the area of the second size, the block with the highest similarity with the reference block as a matching block, and obtains that block B 1 and block B 2 are a set of mutually matching blocks.
  • the electronic device can calculate the distance between the Z dimension and the camera point (camera) of the coordinates represented by the depth value in the camera coordinate system according to the depth value.
  • the display content of the image frame can be regarded as the effect of projecting the scene in the camera coordinate system onto the projection plane; the intersection of the line connecting the position point in the 3D scene with the camera point (camera) and the projection plane is the projection onto the projection screen. location point.
  • the reference image frame is image frame f 1
  • the matching image frame is image frame f 2
  • the calculation is performed according to the depth value d 1
  • z 1 is calculated by design
  • z 1 represents the conversion of the depth value d 1 to the camera coordinate system
  • the search range is an area consisting of 25 blocks centered on (x 1 , y 1 ). Please refer to Fig.
  • the block I 1 ′′ obtained by projecting the quadrilateral I 1 onto the projection plane is smaller than the block I 1 '; therefore, it can be understood that the farther away from the camera point camera, the smaller the projected area of the same object on the projection plane; and the farther away from the camera point camera, the same object is displaced by the same distance in the X and Y dimensions. , the displacement projection on the projection plane is also smaller.
  • the search range is an area consisting of 9 blocks centered at (x 1 , y 1 ). It can be seen that since d 1 can indirectly represent the position coordinates and camera points corresponding to the block in the camera coordinate system Therefore, in this embodiment of the present application, the area of the second size can be directly determined according to d 1 .
  • the electronic device may move one pixel at a time to perform matching search. For example, within the search range, the electronic device first determines whether the block B S1 whose upper left corner vertex coincides with the upper left corner vertex of the search range matches the reference block; The device judges whether it matches; if it does not match, ... until the vertex in the upper right corner of block B S1 coincides with the vertex in the upper right corner of the search range; if it does not match, the electronic device moves the block down one line (one pixel), and repeats the above operations, Until the block traversal completes the entire search range.
  • the electronic device determines the position coordinates of the vertex Yp 1 of the predicted block in the predicted image frame ( x 31 , y 31 ).
  • block B 1 and block B 2 are blocks that match each other.
  • Block B 1 represents a block in image frame f 1 and block B 2 represents a block in image frame f 2 .
  • the position coordinates of a vertex in the block in the image frame are used to represent the position coordinates of the block; the electronic device can set the vertex p 1 in the block to represent the coordinates of the block, and the position of the vertex p 1 relative to the block is preset .
  • the shape of the block is a square, and the vertex located at the upper left corner of the block in the screen coordinate system is set as p 1 by the electronic device.
  • the position coordinates of the vertex B 1 p 1 in the upper left corner of the block B 1 in the image frame f 1 in the screen coordinate system represent the position coordinates of the block B 1 in the image frame f 1 ; in the screen coordinate system, the block B 2
  • the position coordinates of the upper left corner vertex B 2 p 1 in the image frame f 2 represent the position coordinates of the block B 2 in the image frame f 2 ; in the screen coordinate system, the upper left corner vertex Yp 1 of the predicted block is in the reference image frame.
  • the position represents the position coordinates of the prediction block in the reference image frame.
  • step S3703 specifically includes the following steps:
  • the electronic device calculates the position coordinates (x e1 , y e1 , z in the camera coordinate system) according to the depth value d 1 of the block B 1 and the position coordinates (x 1 , y 1 ) of the block B 1 in the image frame f 1 e1 ).
  • the position coordinates of a block are represented by the position coordinates of a vertex in the block in the image frame.
  • the position coordinates of the vertex Bp 1 of the block B 1 in the image frame f 1 may be set to represent the position coordinates of the block B 1 .
  • the shape of the block B 1 is a square, and when the block B 1 is placed in the image frame f 1 , the vertex Bp 1 is the vertex located at the upper left corner of the block B 1 in the screen coordinate system.
  • the position coordinates in the image frame specifically refer to the coordinates in the screen coordinate system; the electronic device calculates the specific position coordinates (x e1 , y e1 , z e1 ) according to the depth value d 1 and the position coordinates (x 1 , y 1 ).
  • the process includes:
  • the electronic device can obtain the corresponding position coordinates (x e1 , y e1 , z e1 , 1) of the block B 1 in the camera coordinate system according to d 1 and (x 1 , y 1 ) of the block B 1 .
  • the electronic device calculates the position coordinates (x e2 , y e2 , z e2 ) in the camera coordinate system according to the depth value d 2 of the block B 2 and the position coordinates (x 2 , y 2 ) of the block B 2 in the reference image frame ).
  • the electronic device can obtain the position coordinates (x e2 , y e2 , z e2 ) of the block B 2 in the camera coordinate system according to d 2 and (x 2 , y 2 ) of the block B 2 ,1).
  • the electronic device is based on the position coordinates (x e1 , y e1 , z e1 , 1) corresponding to the block B 1 in the camera coordinate system and the position coordinates (x e2 , y e2 , z ) corresponding to the block B 2 in the camera coordinate system e2 , 1), the position coordinates (x e3 , y e3 , z e3 , 1) in the camera coordinate system are obtained by calculation.
  • (x e3 , y e3 , z e3 , 1) are predicted; (x e1 , y e1 , z e1 , 1) represent the position coordinates of block B 1 in the camera coordinate system; (x e2 , y e2 ) , z e2 , 1) represent the position coordinates of the block B 2 in the camera coordinate system; in the embodiment of the present application, the position of a vertex of the predicted block in the predicted image frame is predicted according to the block B 1 and the block B 2 ; In this example, the electronic device first predicts the position coordinates (x e3 , y e3 , z e3 , 1) under the camera coordinate system according to the corresponding position coordinates of the block B 1 and the block B 2 under the camera coordinates; (x e3 , y e3 , z e3 , 1) in the coordinate system is converted to the screen coordinate system, and the position coordinates (x 31 ,
  • the camera coordinate system is a three-dimensional coordinate system, and the electronic device can calculate (x e3 , y e3 , z e3 ) according to (x e1 , y e1 , z e1 ) and (x e2 , y e2 , z e2 ) in the camera coordinate system , and then get (x e3 , y e3 , z e3 , 1).
  • Image frame f1 precedes image frame f2 in the data stream.
  • the position coordinates of the block B 1 in the screen coordinate system are A 1 (x e1 , y e1 , z e1 ), and the block B 2 corresponds to the position point A 2 (x e2 , y e2 , z e2 ) in the camera coordinate system.
  • the electronic device can calculate the displacement vector ⁇ 1 of A 1 to A 2 .
  • a 3 is equal to the position coordinates of the reference block in the camera coordinate system (if the reference block is block B 1 , the corresponding position coordinates of the reference block in the camera coordinate system are point A 1 ; if the reference block is block B 2 , the position coordinate corresponding to the reference block in the camera coordinate system is point A 2 ) plus the displacement vector ⁇ 1 of the first scale; the first scale is equal to: the predicted image frame is in the data stream The ratio of the time point of the reference image frame in the data stream minus the time point of the reference image frame in the data stream, and the time point of the image frame f 2 in the data stream minus the time point of the image frame f 1 in the data stream.
  • FIG. 41B illustrates a set of mutually matched blocks, block B 1 and block B 2 , in the image frame f 1 and the image frame f 2 in the embodiment of the present application.
  • FIG. 41C the block B 1 and block B 2 in FIG. 41B are placed in the screen coordinate system to obtain the schematic diagram shown in FIG. 41C .
  • FIG. 41D is a schematic diagram of a camera coordinate system provided by an embodiment of the present application.
  • Figure 41D includes the position point A 1 (x e1 , y e1 , z e1 ) corresponding to the block B 1 in the camera coordinate system, and the position point A 2 (x e2 , y e2 , y e2 ) corresponding to the block B 2 in the camera coordinate system, z e2 ).
  • the electronic device can calculate displacement vectors ⁇ 1 (x e2 -x e1 , y e2 -y e1 , z e2 -z e1 ) of A 1 to A 2 .
  • the predicted image frame as f 3 . (1) Please refer to Fig.
  • the electronic device converts (x e3 , y e3 , z e3 , 1) in the camera coordinate system to the screen coordinate system to obtain (x 31 , y 31 ).
  • step S1041 the transformation from the camera coordinate system to the screen coordinate system is the inverse transformation of the entire process in step S1041, which can be completed by the following steps:
  • the normalized coordinates are regarded as coordinates in the normalized coordinate system.
  • the screen coordinate system corresponds to (Windowspace) in the English original
  • the normalized coordinate system corresponds to (Normalizeddevicecoordinate(NDC)space) in the English original
  • the clip coordinate system corresponds to (Clip Space) in the English original
  • the camera coordinate system corresponds to (View Space) in the English original.
  • the electronic device determines the corresponding position coordinates of the vertex Yp 2 of the predicted block in the predicted image frame according to the depth values of the blocks B 3 and B 4 and the position coordinates of the block B 3 and the block B 4 in the image frame (x 32 , y 32 ).
  • step S3705 the execution process of step S3705 is the same as that of step S3704.
  • the position coordinates are respectively replaced with the depth value of the block B 4 and the position coordinates in the image frame; then the output result is the position coordinates (x 32 , y 32 ) corresponding to the vertex Yp 2 in the predicted image frame.
  • block B 3 is a block adjacent to block B 1 in image frame f 1
  • block B 4 is a block adjacent to block B 2 in image frame f 2
  • block B 3 and block B 4 are mutually Matching blocks, please refer to step S3703 for the explanation of matching between blocks;
  • the position of the vertex Yp 2 relative to the prediction block is different from the position of the vertex Yp 1 relative to the prediction block.
  • block B 1 and block B 2 are mutually matched blocks
  • block B 3 and block B 4 are mutually matched blocks
  • block B 1 and block B 3 are adjacent
  • block B 2 and block B 4 are adjacent; therefore, the block The position of B3 relative to block B1 is the same as that of block B4 relative to block B2 .
  • the vertex Yp 2 of the prediction block has a preset association relationship with the block B3 and the block B4; for example, the vertex Yp 2 is the vertex in the upper right corner of the prediction block, then the block B 3 is the right side of the block B 1 block.
  • the vertex Yp 1 of the prediction block is determined by block B 1 and block B 2 , and the color data of the prediction block is based on the color of block B 1 and/or block B 2 Therefore, the vertex Yp 1 in this example represents a vertex in the prediction block; the vertex Yp 2 of the prediction block in this example is determined according to the blocks adjacent to the block B 1 and the block B 2 , and the block is In the case of a square, Yp 2 can represent any one of the other three vertices in the prediction block other than the vertex Yp 1 ).
  • the block is a square, and the position coordinates of the upper left corner of the block in the screen coordinate system are regarded as the position coordinates of the block in the screen system.
  • FIG. 42 is a schematic diagram of determining each vertex of a prediction block provided in an embodiment of the present application.
  • the vertex Yp 1 of the prediction block represents the vertex of the upper left corner of the prediction block.
  • the corresponding position coordinates of the vertex Yp 1 in the predicted image frame f 3 are calculated according to the vertex B 1 p 1 in the upper left corner of the block B 1 and the vertex B 2 p 2 in the upper left corner of the block B 2 .
  • the vertex Yp 2 of the prediction block represents the vertex of the upper right corner of the prediction block; the corresponding position coordinates of the vertex Yp 2 in the predicted image frame f 3 are based on the vertex B 3 p 1 of the upper left corner of the block B 3 and the vertex of the upper left corner of the block B 4 B 4 p 1 is calculated; block B 3 is a block adjacent to the right of block B 1 , and block B 4 is a block adjacent to the right of block B 2 .
  • the vertex Yp 3 of the prediction block represents the vertex of the lower right corner of the prediction block; the corresponding position coordinates of the vertex Yp 3 in the predicted image frame f 3 are based on the vertex B 5 p 1 of the upper left corner of the block B 5 and the vertex of the upper left corner of the block B 6 Calculated by B 6 p 1 ; the top left vertex of block B 5 coincides with the bottom right vertex of block B 1 , and the top left vertex of block B 6 coincides with the bottom right vertex of block B 2 .
  • the vertex Yp 4 of the prediction block represents the vertex of the lower left corner of the prediction block; the position coordinates of the vertex Yp 4 in the predicted image frame f 3 are based on the vertex B 7 p 1 of the upper left corner of the block B 7 and the vertex B of the upper left corner of the block B 8 8 calculated by p 1 ; the vertex of the upper left corner of block B 7 coincides with the vertex of the lower left corner of block B 1 , and the vertex of the upper left corner of block B 8 is coincident with the vertex of the lower left corner of block B 2 .
  • the electronic device generates the predicted image frame according to the color data of the reference block and the position coordinates of the vertex Yp 1 and the vertex Yp 2 of the predicted block in the predicted image frame.
  • the electronic device first generates a prediction block according to the color data of the reference block and the vertices Yp 1 and Yp 2 of the prediction block; since the prediction image frame is composed of multiple prediction blocks, the prediction image can be generated according to the multiple prediction blocks frame.
  • the color data may specifically refer to the color value of the pixel, for example, the RGB value of the pixel.
  • Color data can be stored in the FBO's color attachment.
  • the vertices of the reference block and the predicted block correspond to each other, and the electronic device generates the predicted block according to the corresponding relationship of the vertices, the positional relationship of the pixels in the block relative to the vertices, and the color data of the reference block.
  • the vertex in the upper left corner of the reference block corresponds to the vertex in the upper left corner of the prediction block
  • the vertex in the upper right corner of the reference block corresponds to the vertex in the upper right corner of the prediction block
  • the vertex in the lower right corner of the reference block corresponds to the vertex in the lower right corner of the prediction block
  • the vertex in the lower left corner of the reference block corresponds to the vertex in the upper right corner of the prediction block.
  • the vertices correspond to the vertices in the lower left corner of the prediction block; then the display content in the reference block is placed in the area formed by the vertices of the prediction block according to the above-mentioned corresponding relationship, and the prediction block is generated; Do one or more of the following: stretch, shrink.
  • the electronic device maps the color data ( display content ) of block B1 to the In image frame f3 , a prediction block in image frame f3 is generated.

Abstract

An image frame prediction method and an electronic device. According to the method, an electronic device can draw a first moving object in a first memory space and draw a first static object in a second memory space according to a drawing instruction for an N-th drawn frame, and draw a second moving object in a third memory space and draw a second static object in a fourth memory space according to a drawing instruction for an (N+2)-th drawn frame; the electronic device predicts a moving object in an (N+3)-th predicted frame according to the first moving object and the second moving object, and predicts a static object in the (N+3)-th predicted frame according to the first static object and the second static object; finally, the electronic device synthesizes a moving object and a static object of an N-th predicted frame into the (N+3)-th predicted frame. By implementing the technical solution provided by the present application, the electronic device can predict an image frame more accurately, and improve the frame rate at which an application plays back a video by using the predicted image frame, thereby improving the fluency of a video interface.

Description

一种图像帧预测的方法及电子设备A kind of image frame prediction method and electronic device
本申请要求于2020年09月30日提交中国专利局、申请号为202011069443.8、申请名称为“一种帧预测方法、电子设备及计算机可读存储介质”的中国专利申请的优先权;以及于2020年09月30日提交中国专利局、申请号为202011063375.4、申请名称为“图像帧生成方法及电子设备”的中国专利申请的优先权;以及于2020年10月31日提交中国专利局、申请号为202011197968.X、申请名称为“一种图像帧预测的方法及电子设备”的中国专利申请的优先权;以及于2020年11月30日提交中国专利局、申请号为202011377449.1、申请名称为“一种图像帧预测的方法及电子设备”的中国专利申请的优先权;以及于2020年11月30日提交中国专利局、申请号为202011377306.0、申请名称为“图像帧生成方法及电子设备”的中国专利申请的优先权;以及于2020年12月16日提交中国专利局、申请号为202011493948.7、申请名称为“一种图像帧预测的方法及电子设备”的中国专利申请的优先权;以及于2020年12月30日提交中国专利局、申请号为202011629171.2、申请名称为“一种图像帧预测的方法及电子设备”的中国专利申请的优先权;以上专利申请的全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on September 30, 2020, with the application number of 202011069443.8 and the application title of "A Frame Prediction Method, Electronic Device and Computer-readable Storage Medium"; and filed in 2020 The priority of the Chinese patent application filed with the China Patent Office on September 30, 2020 with the application number 202011063375.4 and the application name is "Image Frame Generation Method and Electronic Device"; and filed with the China Patent Office on October 31, 2020, with the application number It is the priority of the Chinese patent application of 202011197968.X with the application title of "A method and electronic device for image frame prediction"; The priority of the Chinese patent application for a method and electronic device for image frame prediction; the priority of the Chinese patent application; and the priority of the Chinese patent application filed on December 16, 2020 with the application number 202011493948.7 and the application title "A method and electronic device for image frame prediction"; and The priority of the Chinese patent application filed on December 30, 2020 with the application number 202011629171.2 and the application title "A method and electronic device for image frame prediction"; the entire content of the above patent application is incorporated herein by reference Applying.
技术领域technical field
本申请涉及电子技术领域,以及图像处理领域,尤其涉及一种图像帧预测的方法及电子设备。The present application relates to the field of electronic technology and the field of image processing, and in particular, to a method and electronic device for image frame prediction.
背景技术Background technique
电子设备显示的视频界面(电视剧、电影等视频播放界面、游戏画面等)本质是一张张连续的图片。以游戏画面为例,游戏画面的帧率越高,电子设备显示的游戏画面越流畅,用户视觉体验越好。对于需要实时渲染游戏画面,帧率越高,电子设备的需要应用(视频应用、游戏应用等等)绘制和渲染的图像帧(简称绘制帧)越多,电子设备的功耗越大。由此,如何在节约的电子设备功耗的情况下,提高电子设备显示的视频界面流畅度是亟待解决的问题。The video interface displayed by the electronic device (video playing interface such as TV series, movie, game screen, etc.) is essentially a continuous picture. 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 user's visual experience. For games that need to be rendered in real time, the higher the frame rate, the more image frames (drawing frames for short) that the electronic device needs to draw and render by applications (video applications, game applications, etc.), 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 under the condition of saving the power consumption of the electronic device is an urgent problem to be solved.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种图像帧预测的方法及电子设备,可以在节约的电子设备功耗的情况下,提高电子设备显示的视频界面流畅度是亟待解决的问题。The present application provides an image frame prediction method and electronic device, which can improve the smoothness of the video interface displayed by the electronic device under the condition of saving the power consumption of the electronic device, which is an urgent problem to be solved.
第一方面,本申请提供了一种图像帧预测的方法,该方法可以包括:在绘制第一绘制帧时,电子设备根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,电子设备将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件;在绘制第二绘制帧时,电子设备根据第三绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,电子设备将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件;电子设备根据第一颜色附件和第三颜色附件生成第一预测帧的第五颜色附件,根据第二颜色附件和第四颜色附件生成第一预测帧的第六颜色附件;电子设备将第五颜色附件和第六颜色附件合成为第一预测帧。In a first aspect, the present application provides an image frame prediction method, the method may include: when drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, It is determined according to the drawing instruction of the second drawing object that the spatial information of the second drawing object has not changed, 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; when drawing the second drawing frame, 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, 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 accessory, and writes the color data of the fourth drawing object into the fourth color accessory; the electronic device generates the first prediction frame according to the first color accessory and the third color accessory The fifth color accessory of the first predicted frame is generated according to the second color accessory and the fourth color accessory; the electronic device combines the fifth color accessory and the sixth color accessory into the first predicted frame.
通过第一方面提供的方法,电子设备可以根据绘制对象的绘制指令中确定出该绘制对象的空间信息是否发生变化。也即是说,电子设备可以根据绘制对象的绘制指令确定出该绘制 对象是否为运动对象。若绘制对象的绘制指令指示空间信息发生变化,则该绘制对象为运动对象。若绘制对象的绘制指令未指示空间信息发生变化,则该绘制对象为静态对象。若绘制对象是运动对象,电子设备将绘制对象的颜色数据写入第一颜色附件。若绘制对象是静态对象,则电子设备将绘制对象的颜色数据写入第二颜色附件。这样,电子设备可以将第一绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。同样地,电子设备可以将第二绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。然后,电子设备可以根据第一绘制帧中的运动对象和第二绘制帧中的运动对象来预测出第一预测帧中的运动对象。电子设备可以根据第一绘制帧中静态对象和第二绘制帧中的静态对象来预测出第一预测帧中的静态对象。这样,电子设备可以利用绘制帧预测出的预测帧,可以提升帧率,从而提高电子设备显示的视频界面流畅度。With the method provided in the first aspect, the electronic device can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, 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 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. Likewise, the electronic device may 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 may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame. The electronic device may predict the static object in the first predicted 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 utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the electronic device.
结合第一方面,在一种可能的实现方式中,电子设备根据所述第一颜色附件和所述第三颜色附件生成第一预测帧的第五颜色附件,包括:电子设备根据第一颜色附件和第三颜色附件,确定第三颜色附件的第一运动向量;电子设备根据第二颜色附件和第一运动向量生成第一预测帧的第五颜色附件。With reference to the first aspect, in a possible implementation manner, the electronic device generates a fifth color accessory of the first predicted frame according to the first color accessory and the third color accessory, including: the electronic device according to the first color accessory and the third color accessory, to determine the first motion vector of the third color accessory; the electronic device generates the fifth color accessory of the first predicted frame according to the second color accessory and the first motion vector.
上述实现方式中,电子设备只用运动对象的颜色数据计算运动对象的运动向量,这样,可以更为准确地计算出运动对象的运动向量。并且,电子设备只根据运动对象的颜色数据计算运动对象的运动向量。电子设备不会把运动对象的运动向量错误计算成静态对象的运动向量。从而,电子设备预测出的预测帧中运动对象更为准确。In the above implementation manner, 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 calculated more accurately. Moreover, the electronic device only calculates the motion vector of the moving object according to the color data of the moving object. The electronic device will not miscalculate the motion vector of a moving object as the motion vector of a static object. Therefore, the moving object in the predicted frame predicted by the electronic device is more accurate.
结合第一方面,在一种可能的实现方式中,所述电子设备根据所述第一颜色附件和所述第三颜色附件,确定第三颜色附件的第一运动向量;具体包括:电子设备将第三颜色附件分成Q个像素块,电子设备在第三颜色附件的Q个像素块中取出第一像素块;电子设备在第一颜色附件中确定出与第一像素块匹配的第二像素块;电子设备根据第二像素块到第一像素块的位移得到第一像素块的运动向量;电子设备根据第一像素块的运动向量确定出第三颜色附件的第一运动向量。按照该实现方式中的步骤,电子设备可以确定第三颜色附件的Q个像素块中所有像素块的运动向量。每个像素块中包括f*f(例如,16*16)个像素点。With reference to the first aspect, in a possible implementation manner, the electronic device determines the first motion vector of the third color accessory according to the first color accessory and the third color accessory; specifically, the electronic device includes: The third color accessory is divided into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks of the third color accessory; the electronic device determines the second pixel block matching the first pixel block in the first color accessory ; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first motion vector of the third color accessory 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 vectors of all pixel blocks in the Q pixel blocks of the third color accessory. Each pixel block includes f*f (for example, 16*16) pixel points.
上述实现方式中,电子设备将运动对象的颜色附件分块来计算运动向量,不用去计算运动向量每个像素点的运动向量。这样可以减少计算量,从而降低电子设备的功耗。In the above implementation manner, the electronic device divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
结合第一方面,在一种可能的实现方式中,电子设备在第一颜色附件中确定出与第一像素块匹配的第二像素块,具体包括:电子设备通过第一像素块中的第一像素点在第一颜色附件中确定出多个候选像素块,电子设备分别计算出多个候选像素块与第一像素块的颜色值的差值;电子设备根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块;第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。这样,电子设备可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。With reference to the first aspect, in a possible implementation manner, the electronic device determines, in the first color attachment, a second pixel block that matches the first pixel block, specifically including: the electronic device passes the first pixel block in the first pixel block The pixel points determine multiple candidate pixel blocks in the first color attachment, and the electronic device calculates the difference between the color values of the multiple candidate pixel blocks and the first pixel block; the electronic device calculates the first pixel block according to the multiple candidate pixel blocks. The difference between the color values of the pixel blocks determines a second pixel block matching the first pixel block; the second pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks. In this way, the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第一方面,在一种可能的实现方式中,电子设备根据第二颜色附件和第一运动向量生成第一预测帧的第五颜色附件,具体包括:电子设备根据第一运动向量确定第五颜色附件的运动向量,根据第二颜色附件和第五颜色附件的运动向量生成第五颜色附件。第五颜色附件的运动向量为第一运动向量的K倍,K大于0小于1。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 second color attachment and the first motion vector, which specifically includes: the electronic device determines the fifth color attachment according to the first motion vector. The motion vector of the color attachment, and the fifth color attachment is generated 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 the first motion vector, where K is greater than 0 and less than 1.
结合第一方面,在一种可能的实现方式中,K等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于电子设备计算,也可以使得用户在观看视频时的体验更好。In conjunction with the first aspect, in one possible implementation, K is equal to 0.5. In this way, the objects in each image frame move 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.
结合第一方面,在一种可能的实现方式中,电子设备根据第二颜色附件和第四颜色附件生成第一预测帧的第六颜色附件;具体包括:电子设备根据第二颜色附件和第四颜色附件确定出第四颜色附件的第二运动向量;电子设备根据第四颜色附件和第二运动向量生成第一预测帧的第六颜色附件。With reference to the first aspect, in a possible implementation manner, the electronic device generates a sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory; specifically, the electronic device generates a sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory; The color attachment determines the second motion vector of the fourth color attachment; the electronic device generates the sixth color attachment of the first predicted frame according to the fourth color attachment and the second motion vector.
上述实现方式中,电子设备只用静态对象的颜色数据计算静态对象的运动向量,这样,可以更为准确地计算出静态对象的运动向量。并且,电子设备只根据静态对象的颜色数据计算静态对象的运动向量。电子设备不会把静态对象的运动向量错误计算成运动对象的运动向量。从而,电子设备预测出的预测帧中静态对象更为准确。In the above implementation manner, the electronic device only uses 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 calculated more accurately. And, 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 miscalculate the motion vector of a static object as the motion vector of a moving object. Therefore, the static object in the predicted frame predicted by the electronic device is more accurate.
结合第一方面,在一种可能的实现方式中,电子设备根据第二颜色附件和第四颜色附件确定出第四颜色附件的第二运动向量;具体包括:电子设备将第四颜色附件分成Q个像素块,电子设备在第四颜色附件中取出第三像素块;电子设备计算出第三像素块在第二颜色附件中的第一位置;电子设备根据第一位置和第三像素块第四颜色附件中的第二位置确定出第三像素块的运动向量;电子设备根据第三像素块的运动向量确定出第四颜色附件的第二运动向量。按照该实现方式中的步骤,电子设备可以确定出第四颜色附件的Q个像素块中每个像素块的运动向量。With reference to the first aspect, in a possible implementation manner, the electronic device determines the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; specifically, the electronic device divides the fourth color accessory into Q The electronic device takes out the third pixel block in the fourth color attachment; the electronic device calculates the first position of the third pixel block in the second color attachment; the electronic device calculates the first position of the third pixel block according to the The second position in the color attachment determines the motion vector of the third pixel block; 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 accessory.
上述实现方式中,电子设备将静态对象的颜色附件分块来计算运动向量,不用去计算静态向量每个像素点的运动向量。这样可以减少计算量,从而降低电子设备的功耗。In the above implementation manner, the electronic device divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
结合第一方面,在一种可能的实现方式中,电子设备计算出所述第三像素块在所述第二颜色附件中的第一位置,具体包括:电子设备获取到第一绘制帧的绘制指令中的第一矩阵和第二绘制帧中的绘制指令的第二矩阵,第一矩阵用于记录第一绘制帧的相机位置的转角信息,第二矩阵用于记录第二绘制帧的相机位置的转角信息;电子设备根据第一矩阵和第二矩阵、以及第三像素块的深度值计算出第三像素块在第二颜色附件中的第一位置。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, which specifically includes: the electronic device obtains the drawing of the first drawing frame The first matrix in the instruction and the second matrix of the drawing instruction in the second drawing frame, the first matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the camera position of the second drawing frame 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 the depth value of the third pixel block.
结合第一方面,在一种可能的实现方式中,电子设备根据第四颜色附件和第二运动向量生成第一预测帧的第六颜色附件,具体包括:电子设备根据第二运动向量确定第六颜色附件的运动向量,根据第四颜色附件和第六颜色附件的运动向量生成第六颜色附件。第六颜色附件的运动向量为第二运动向量的K倍,K大于0小于1。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, which specifically includes: the electronic device determines the sixth color attachment according to the second motion vector. The motion vector of the color attachment, and the sixth color attachment is generated according to the motion vector of the fourth color attachment and the sixth color attachment. The motion vector of the sixth color attachment is K times the second motion vector, where K is greater than 0 and less than 1.
结合第一方面,在一种可能的实现方式中,K等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于电子设备计算,也可以使得用户在观看视频时的体验更好。In conjunction with the first aspect, in one possible implementation, K is equal to 0.5. In this way, the objects in each image frame move 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.
结合第一方面,在一种可能的实现方式中,第一绘制对象的绘制指令包括第一绘制对象的执行绘制指令和第一绘制对象的绘制状态设备指令,其中,第一绘制对象的执行绘制指令用于触发电子设备针对第一绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第一绘制对象的绘制状态设备指令用于设置第一绘制对象的执行绘制指令所依赖的绘制状态数据;第一绘制对象的绘制状态数据包括第一绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the first aspect, in a possible implementation manner, the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends. ; The drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
结合第一方面,在一种可能的实现方式中,电子设备根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,包括:电子设备确定第一绘制对象的绘制指令中存在转移矩阵参数、电子设备确定第一绘制对象的绘制指令中的存在的转移矩阵参数与对应的第一绘制对象的转移矩阵参数不同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the first aspect, in a possible implementation manner, the electronic device determining that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object includes: the electronic device determining that there is a transition in the drawing instruction of the first drawing object The matrix parameter, the electronic device determines that the existing transition matrix parameter in the drawing instruction of the first drawing object is different from the transition matrix parameter of the corresponding first drawing object, and the transition matrix is used to describe the mapping of the local coordinate system of the drawing object to the world coordinate system relation.
结合第一方面,在一种可能的实现方式中,第二绘制对象的绘制指令包括第二绘制对象 的执行绘制指令和第二绘制对象的绘制状态设备指令,其中,第二绘制对象的执行绘制指令用于触发电子设备针对第二绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第二绘制对象的绘制状态设备指令用于设置第二绘制对象的执行绘制指令所依赖的绘制状态数据;第二绘制对象的绘制状态数据包括第二绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the first aspect, in a possible implementation manner, the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object The instruction is used to trigger the electronic device to draw and render 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 ; The drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second drawing object.
结合第一方面,在一种可能的实现方式中,电子设备根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,包括:电子设备确定第二绘制对象的绘制指令中不存在转移矩阵参数、电子设备确定第二绘制对象的绘制指令中的存在的转移矩阵参数与对应的第二绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the first aspect, in a possible implementation manner, 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 determining that the drawing instruction of the second drawing object does not contain any changes. There is a transition matrix parameter, 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, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
结合第一方面,在一种可能的实现方式中,第三绘制对象的绘制指令包括第三绘制对象的执行绘制指令和第三绘制对象的绘制状态设备指令,其中,第三绘制对象的执行绘制指令用于触发电子设备针对第三绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第三绘制对象的绘制状态设备指令用于设置第三绘制对象的执行绘制指令所依赖的绘制状态数据;第三绘制对象的绘制状态数据包括第三绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the first aspect, in a possible implementation manner, the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the third drawing object depends. ; The drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
结合第一方面,在一种可能的实现方式中,电子设备根据第三绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,包括:电子设备确定所述第三绘制对象的绘制指令中存在转移矩阵参数、电子设备确定第三绘制对象的绘制指令中的存在的转移矩阵参数与对应的第三绘制对象的转移矩阵参数不同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the first aspect, in a possible implementation manner, the electronic device determining that the spatial information of the first drawing object has changed according to the drawing instruction of the third drawing object includes: the electronic device determining that the drawing instruction of the third drawing object is in the drawing instruction. Existing transition matrix parameters, the electronic device determines that the existing transition matrix parameters in the drawing instruction of the third drawing object are different from the transition matrix parameters of the corresponding third drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
结合第一方面,在一种可能的实现方式中,第四绘制对象的绘制指令包括第四绘制对象的执行绘制指令和第四绘制对象的绘制状态设备指令,其中,第四绘制对象的执行绘制指令用于触发电子设备针对第四绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第四绘制对象的绘制状态设备指令用于设置第四绘制对象的执行绘制指令所依赖的绘制状态数据;第四绘制对象的绘制状态数据包括第四绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the first aspect, in a possible implementation manner, the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends. ; The drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
结合第一方面,在一种可能的实现方式中,电子设备根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,包括:电子设备确定第四绘制对象的绘制指令中不存在转移矩阵参数、电子设备确定第四绘制对象的绘制指令中的存在的转移矩阵参数与对应的第四绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the first aspect, in a possible implementation manner, 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 the drawing instruction of the fourth drawing object does not contain any changes. There is a transition matrix parameter, and the electronic device determines that the existing transition matrix parameter in the drawing instruction of the fourth drawing object is the same as the transition matrix parameter of the corresponding fourth drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
结合第一方面,在一种可能的实现方式中,电子设备根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,电子设备所述将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件之前,该方法还包括:电子设备创建第一内存空间、第二内存空间、第三内存空间、第四内存空间、第五内存空间、第六内存空间、第七内存空间;其中,第一内存空间用于存储第一颜色附件,第二内存空间用于存储第二颜色附件,第三内存空间用于存储第三颜色附件,第四内存空间用于存储第四颜色附件,第五内存空间用于存储第五颜色附件,第六内存空间用于存储第六颜色附件,第七内存空间用于存储第一预测帧。In combination with the first aspect, in a possible implementation manner, 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 the space of the second drawing object according to the drawing instruction of the second drawing object. The information has not changed, before the electronic device writes the color data of the first drawing object into the first color attachment, and before writing the color data of the second drawing object into the second color attachment, the method further includes: the electronic device creates the first color attachment. Memory space, second memory space, third memory space, fourth memory space, fifth memory space, sixth memory space, and seventh memory space; wherein, the first memory space is used to store the first color attachment, and the second memory space The 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, and the sixth memory space is used to store the fifth color attachment. For storing the sixth color attachment, the seventh memory space is used for storing the first predicted frame.
结合第一方面,在一种可能的实现方式中,在绘制第一绘制帧时,电子设备根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,电子设备所述将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件之后,该方法还包括:电子设备在第七内存空间中将第一颜色附件和第二颜色附件合成为第一绘制帧。In combination with the first aspect, in a possible implementation manner, when drawing the first drawing frame, the electronic device determines that the spatial information of the first drawing object changes according to the drawing instruction of the first drawing object, and according to the drawing of the second drawing object The instruction determines that the spatial information of the second drawing object has not changed, and the electronic device writes the color data of the first drawing object into the first color attachment, and after writing the color data of the second drawing object into the second color attachment, the method It also includes: the electronic device synthesizes the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
结合第一方面,在一种可能的实现方式中,在绘制第二绘制帧时,电子设备根据第三绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,电子设备将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件之后,该方法还包括:电子设备在第七内存空间中将第三颜色附件和第四颜色附件合成为第二绘制帧。In combination with the first aspect, in a possible implementation manner, when drawing the second drawing frame, 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 according to the drawing of the fourth drawing object The instruction determines that the spatial information of the fourth drawing object has not changed, the electronic device writes the color data of the third drawing object into the third color attachment, and after writing the color data of the fourth drawing object into the fourth color attachment, the method further includes : The electronic device synthesizes the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
结合第一方面,在一种可能的实现方式中,电子设备在第七内存空间中将第一颜色附件和第二颜色附件合成为第一绘制帧,具体包括:电子设备根据第一深度附件和第二深度附件,在第七内存空间中将第一颜色附件和第二颜色附件合成为第一绘制帧,第一深度附件用于写入第一绘制对象的深度数据,第二深度附件用于写入第二绘制对象的第二颜色附件。With reference to the first aspect, in a possible implementation manner, the electronic device synthesizes the first color attachment and the second color attachment into the first drawing frame in the seventh memory space, which specifically includes: the electronic device according to the first depth attachment and The second depth attachment, the first color attachment and the second color attachment are combined into the first drawing frame in the seventh memory space, the first depth attachment is used for writing the depth data of the first drawing object, and the second depth attachment is used for Writes the second color attachment of the second drawable object.
结合第一方面,在一种可能的实现方式中,电子设备在第七内存空间中将第三颜色附件和第四颜色附件合成为第二绘制帧,具体包括:电子设备根据第三深度附件和第四深度附件,在第七内存空间中将第三颜色附件和第四颜色附件合成为第二绘制帧;第三深度附件用于写入第三绘制对象的深度数据,第四深度附件用于写入第四绘制对象的深度数据。With reference to the first aspect, in a possible implementation manner, the electronic device synthesizes the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space, which specifically includes: the electronic device according to the third depth attachment and The fourth depth attachment combines the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space; the third depth attachment is used for writing the depth data of the third drawing object, and the fourth depth attachment is used for Writes the depth data of the fourth draw object.
第二方面,提供一种电子设备,该电子设备可以包括:一个或多个处理器和存储器;改存储器与一个或多个处理器耦合,存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器调用计算机指令以使得电子设备执行如第一方面任一种可能方式中的方法。In a second aspect, an electronic device is provided, the electronic device may include: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used for storing computer program code, and the computer program code includes computer instructions , one or more processors invoke computer instructions to cause the electronic device to perform a method as in any possible manner of the first aspect.
第三方面,提供一种电子设备,包括:一个或多个处理器CPU、图形处理器GPU、存储器和显示屏;存储器与一个或多个处理器耦合;CPU与GPU耦合;其中:In a third aspect, an electronic device is provided, comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
存储器可以用于存储计算机程序代码,计算机程序代码包括计算机指令;CPU可以用于在绘制第一绘制帧时,根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,指示GPU将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件,第一绘制对象的绘制指令中指示第一绘制对象的空间信息发生变化,第二绘制对象的绘制指令中未指示第二绘制对象的空间信息发生变化;用于在绘制第二绘制帧时,根据第三绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,指示GPU将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件,第三绘制对象的绘制指令中指示第三绘制对象的空间信息发生变化,第四绘制对象的绘制指令中未指示第四绘制对象的空间信息发生变化。The memory can be used to store computer program codes, and the computer program codes include computer instructions; the CPU can be used to determine that the spatial information of the first drawing object changes according to the drawing instructions of the first drawing object when drawing the first drawing frame, and according to the second drawing frame. The drawing instruction of the drawing object determines that the spatial information of the second drawing object has not changed, and instructs the GPU to 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. The drawing instruction of a drawing object indicates that the spatial information of the first drawing object changes, and the drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes; when drawing the second drawing frame, according to the first drawing The drawing instruction of the third drawing object determines that the spatial information of the first drawing object has changed, and according to the drawing instruction of the fourth drawing object, it is determined that the spatial information of the fourth drawing object has not changed, and the GPU is instructed to write the color data of the third drawing object into the third drawing object. Three-color attachment, write the color data of the fourth drawing object into the fourth color attachment, the drawing instruction of the third drawing object indicates that the spatial information of the third drawing object changes, and the drawing instruction of the fourth drawing object does not indicate the fourth The spatial information of the drawn object changes.
GPU可以用于将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件;将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件;根据第一颜色附件和第三颜色附件生成第一预测帧的第五颜色附件,根据第二颜色附件和第四颜色附件生成第一预测帧的第六颜色附件;将第五颜色附件和第六颜色附件合成为第一预测帧。The GPU can be used to write the color data of the first rendering object into the first color attachment, and write the color data of the second rendering object into the second color attachment; write the color data of the third rendering object into the third color attachment, and The color data of the fourth drawing object is written into the fourth color attachment; the fifth color attachment of the first predicted frame is generated according to the first color attachment and the third color attachment, and the first predicted frame is generated according to the second color attachment and the fourth color attachment The sixth color attachment of ; the fifth color attachment and the sixth color attachment are synthesized into the first prediction frame.
显示屏可以用于显示第一绘制帧、第二绘制帧、第一预测帧。The display screen may be used to display the first drawing frame, the second drawing frame, and the first predicted frame.
通过第三方面提供的电子设备,电子设备可以根据绘制对象的绘制指令中确定出该绘制对象的空间信息是否发生变化。也即是说,电子设备可以根据绘制对象的绘制指令确定出该绘制对象是否为运动对象。若绘制对象的绘制指令指示空间信息发生变化,则该绘制对象为运动对象。若绘制对象的绘制指令未指示空间信息发生变化,则该绘制对象为静态对象。若绘制对象是运动对象,电子设备将绘制对象的颜色数据写入第一颜色附件。若绘制对象是静态对象,则电子设备将绘制对象的颜色数据写入第二颜色附件。这样,电子设备可以将第一绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。同样地,电子设备可以将第二绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。然后,电子设备可以根据第一绘制帧中的运动对象和第二绘制帧中的运动对象来预测出第一预测帧中的运动对象。电子设备可以根据第一绘制帧中静态对象和第二绘制帧中的静态对象来预测出第一预测帧中的静态对象。这样,电子设备可以利用绘制帧预测出的预测帧,可以提升帧率,从而提高电子设备显示的视频界面流畅度。With the electronic device provided by the third aspect, the electronic device can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, 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 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. Likewise, the electronic device may 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 may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame. The electronic device may predict the static object in the first predicted 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 utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the electronic device.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:根据第一颜色附件和第三颜色附件,确定第三颜色附件的第一运动向量;根据第二颜色附件和第一运动向量生成第一预测帧的第五颜色附件。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: determine the first motion vector of the third color accessory according to the first color accessory and the third color accessory; The motion vector generates the fifth color attachment of the first predicted frame.
上述实现方式中,电子设备中的GPU只用运动对象的颜色数据计算运动对象的运动向量,这样,可以更为准确地计算出运动对象的运动向量。并且,GPU只根据运动对象的颜色数据计算运动对象的运动向量。GPU不会把运动对象的运动向量错误计算成静态对象的运动向量。从而,电子设备预测出的预测帧中运动对象更为准确。In the above implementation manner, 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 calculated more accurately. 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 miscalculate motion vectors for moving objects as motion vectors for static objects. Therefore, the moving object in the predicted frame predicted by the electronic device is more accurate.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:将第三颜色附件分成Q个像素块,在第三颜色附件的Q个像素块中取出第一像素块;在第一颜色附件中确定出与第一像素块匹配的第二像素块;根据第二像素块到第一像素块的位移得到第一像素块的运动向量;根据第一像素块的运动向量确定出第三颜色附件的第一运动向量。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: divide the third color accessory into Q pixel blocks, and take out the first pixel block from the Q pixel blocks of the third color accessory; A second pixel block matching the first pixel block is determined in a color attachment; the motion vector of the first pixel block is obtained according to the displacement of the second pixel block to the first pixel block; the first pixel block is determined according to the motion vector of the first pixel block. The first motion vector of the three-color attachment.
上述实现方式中,GPU将运动对象的颜色附件分块来计算运动向量,不用去计算运动向量每个像素点的运动向量。这样可以减少计算量,从而降低GPU的功耗。In the above implementation manner, the GPU divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. This reduces the amount of computation and thus reduces the power consumption of the GPU.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:通过第一像素块中的第一像素点在第一颜色附件中确定出多个候选像素块,分别计算出多个候选像素块与第一像素块的颜色值的差值;根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块;第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。这样,电子设备的GPU可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: determine multiple candidate pixel blocks in the first color attachment by using the first pixel point in the first pixel block, and calculate multiple candidate pixel blocks respectively. The difference between the color values of the candidate pixel block and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference of the color values of the first pixel block of the multiple candidate pixel blocks; the second pixel block is A candidate pixel block with the smallest difference between the color values of the first pixel block and the multiple candidate pixel blocks. In this way, the GPU of the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:根据第二颜色附件和第四颜色附件确定出第四颜色附件的第二运动向量;根据第四颜色附件和第二运动向量生成第一预测帧的第六颜色附件。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: determine the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; The motion vector generates the sixth color attachment of the first predicted frame.
上述实现方式中,电子设备的GPU只用静态对象的颜色数据计算静态对象的运动向量,这样,可以更为准确地计算出静态对象的运动向量。并且,GPU只根据静态对象的颜色数据计算静态对象的运动向量。GPU不会把静态对象的运动向量错误计算成运动对象的运动向量。从而,GPU预测出的预测帧中静态对象更为准确。In the above implementation manner, the GPU of the electronic device only uses 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 calculated more accurately. And, the GPU only calculates the motion vector of the static object based on the color data of the static object. The GPU will not miscalculate motion vectors for static objects as motion vectors for moving objects. Therefore, the static objects in the predicted frame predicted by the GPU are more accurate.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:将第四颜色附件分成Q个像素块,在第四颜色附件中取出第三像素块;计算出第三像素块在第二颜色附件中的第一位 置;根据第一位置和第三像素块第四颜色附件中的第二位置确定出第三像素块的运动向量;根据第三像素块的运动向量确定出第四颜色附件的第二运动向量。In combination with the third aspect, in a possible implementation manner, the GPU may also be used to: divide the fourth color attachment into Q pixel blocks, and take out the third pixel block from the fourth color attachment; calculate that the third pixel block is in The first position in the second color attachment; the motion vector of the third pixel block is determined according to the first position and the second position in the fourth color attachment of the third pixel block; the fourth pixel block is determined according to the motion vector of the third pixel block The second motion vector for the color attachment.
上述实现方式中,GPU将静态对象的颜色附件分块来计算运动向量,不用去计算静态向量每个像素点的运动向量。这样可以减少计算量,从而降低GPU的功耗。In the above implementation manner, the GPU divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. This reduces the amount of computation and thus reduces the power consumption of the GPU.
结合第三方面,在一种可能的实现方式中,电子设备还可以用于:获取到第一绘制帧的绘制指令中的第一矩阵和第二绘制帧中的绘制指令的第二矩阵,第一矩阵用于记录第一绘制帧的相机位置的转角信息,第二矩阵用于记录第二绘制帧的相机位置的转角信息;根据第一矩阵和第二矩阵、以及第三像素块的深度值计算出第三像素块在第二颜色附件中的第一位置。With reference to the third aspect, in a possible implementation manner, the electronic device may also be used to: obtain the first matrix of the drawing instructions in the first drawing frame and the second matrix of the drawing instructions in the second drawing frame, and the third A matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the corner information of the camera position of the second drawing frame; according to the first matrix and the second matrix, and the depth value of the third pixel block The first position of the third pixel block in the second color attachment is calculated.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:创建第一内存空间、第二内存空间、第三内存空间、第四内存空间、第五内存空间、第六内存空间、第七内存空间;其中,第一内存空间用于存储第一颜色附件,第二内存空间用于存储第二颜色附件,第三内存空间用于存储第三颜色附件,第四内存空间用于存储第四颜色附件,第五内存空间用于存储第五颜色附件,第六内存空间用于存储第六颜色附件,第七内存空间用于存储第一预测帧。In combination with the third aspect, in a possible implementation manner, the GPU may also be used to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space , the seventh memory space; wherein, the first memory space is used to store the first color accessory, the second memory space is used to store the second color accessory, the third memory space is used to store the third color accessory, and the fourth memory space is used for The fourth color attachment is stored, 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.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:在第七内存空间中将第一颜色附件和第二颜色附件合成为第一绘制帧。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:根据第一深度附件和第二深度附件,在第七内存空间中将第一颜色附件和第二颜色附件合成第一绘制帧;第三深度附件用于写入第一绘制对象的深度数据,第四深度附件用于写入第二绘制对象的深度数据。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: combine the first color attachment and the second color attachment in a seventh memory space into a first color attachment according to the first depth attachment and the second depth attachment Drawing frame; the third depth attachment is used to write the depth data of the first drawing object, and the fourth depth attachment is used to write the depth data of the second drawing object.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:在第七内存空间中将第三颜色附件和第四颜色附件合成为第二绘制帧。With reference to the third aspect, in a possible implementation manner, the GPU may also be used to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
结合第三方面,在一种可能的实现方式中,GPU还可以用于:根据第三深度附件和第四深度附件,在第七内存空间中将第三颜色附件和第四颜色附件合成第二绘制帧;第三深度附件用于写入第三绘制对象的深度数据,第四深度附件用于写入第四绘制对象的深度数据。In combination with the third aspect, in a possible implementation manner, the GPU may also be used to: combine the third color attachment and the fourth color attachment in the seventh memory space into the second depth attachment according to the third depth attachment and the fourth depth attachment Drawing frame; the third depth attachment is used to write the depth data of the third draw object, and the fourth depth attachment is used to write the depth data of the fourth draw object.
结合第三方面,在一种可能的实现方式中,第一绘制对象的绘制指令包括第一绘制对象的执行绘制指令和第一绘制对象的绘制状态设备指令,其中,第一绘制对象的执行绘制指令用于触发电子设备针对第一绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第一绘制对象的绘制状态设备指令用于设置第一绘制对象的执行绘制指令所依赖的绘制状态数据;第一绘制对象的绘制状态数据包括第一绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the third aspect, in a possible implementation manner, the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends. ; The drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
结合第三方面,在一种可能的实现方式中,CPU根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,CPU还可以具体用于:确定第一绘制对象的绘制指令中存在转移矩阵参数、确定第一绘制对象的绘制指令中的存在的转移矩阵参数与对应的第一绘制对象的转移矩阵参数不同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。结合第三方面,在一种可能的实现方式中,第二绘制对象的绘制指令包括第二绘制对象的执行绘制指令和第二绘制对象的绘制状态设备指令,其中,第二绘制对象的执行绘制指令用于触发电子设备针对第二绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第二绘制对象的绘制状态设备指令用于设置第二绘制对象的执行绘制指令所依赖的绘制状态数据;第二绘制对象的绘制状态数据包括第二绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the third aspect, in a possible implementation manner, the CPU determines that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and the CPU can also be specifically used to: determine the drawing instruction of the first drawing object. Existing transition matrix parameters, determining that the existing transition matrix parameters in the drawing instruction of the first drawing object are different from the transition matrix parameters of the corresponding first drawing object, and the transition matrix is used to describe the mapping of the local coordinate system of the drawing object to the world coordinate system relation. With reference to the third aspect, in a possible implementation manner, the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object The instruction is used to trigger the electronic device to draw and render 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 ; The drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second drawing object.
结合第三方面,在一种可能的实现方式中,CPU根据第二绘制对象的绘制指令确定第二 绘制对象的空间信息未发生变化,CPU还可以具体用于:确定第二绘制对象的绘制指令中不存在转移矩阵参数、确定第二绘制对象的绘制指令中的存在的转移矩阵参数与对应的第二绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the third aspect, in a possible implementation manner, the CPU determines that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object, and the CPU can also be specifically used to: determine the drawing instruction of the second drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the second drawing object is the same as the transition matrix parameter of the corresponding second drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
结合第三方面,在一种可能的实现方式中,第三绘制对象的绘制指令包括第三绘制对象的执行绘制指令和第三绘制对象的绘制状态设备指令,其中,第三绘制对象的执行绘制指令用于触发电子设备针对第三绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第三绘制对象的绘制状态设备指令用于设置第三绘制对象的执行绘制指令所依赖的绘制状态数据;第三绘制对象的绘制状态数据包括第三绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the third aspect, in a possible implementation manner, the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the third drawing object depends. ; The drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
结合第三方面,在一种可能的实现方式中,CPU根据第三绘制对象的绘制指令确定第三绘制对象的空间信息未发生变化,CPU还可以具体用于:确定第三绘制对象的绘制指令中不存在转移矩阵参数、确定第三绘制对象的绘制指令中的存在的转移矩阵参数与对应的第三绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。In combination with the third aspect, in a possible implementation manner, the CPU determines that the spatial information of the third drawing object has not changed according to the drawing instruction of the third drawing object, and the CPU may also be specifically used to: determine the drawing instruction of the third drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the third drawing object is the same as the transition matrix parameter of the corresponding third drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
结合第三方面,在一种可能的实现方式中,第四绘制对象的绘制指令包括第四绘制对象的执行绘制指令和第四绘制对象的绘制状态设备指令,其中,第四绘制对象的执行绘制指令用于触发电子设备针对第四绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第四绘制对象的绘制状态设备指令用于设置第四绘制对象的执行绘制指令所依赖的绘制状态数据;第四绘制对象的绘制状态数据包括第四绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the third aspect, in a possible implementation manner, the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends. ; The drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
结合第三方面,在一种可能的实现方式中,CPU根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,CPU还可以具体用于:确定第四绘制对象的绘制指令中不存在转移矩阵参数、确定第四绘制对象的绘制指令中的存在的转移矩阵参数与对应的第四绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the third aspect, in a possible implementation manner, the CPU determines that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, and the CPU may also be specifically used to: determine the drawing instruction of the fourth drawing object There is no transition matrix parameter in , and the transition matrix parameter that exists in the drawing instruction that determines the fourth drawing object is the same as the transition matrix parameter of the corresponding fourth drawing object, and the transition matrix is used to describe the local coordinate system of the drawing object to the world coordinate system. mapping relationship.
第四方面,提供一种图像帧预测装置,该装置可以包括绘制单元、预测单元、合成单元;其中:In a fourth aspect, an image frame prediction apparatus is provided, the apparatus may include a drawing unit, a prediction unit, and a synthesis unit; wherein:
绘制单元可以用于在绘制第一绘制帧时,根据第一绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定第二绘制对象的空间信息未发生变化,将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件;在绘制第二绘制帧时,根据第三绘制对象的绘制指令确定第一绘制对象的空间信息发生变化,根据第四绘制对象的绘制指令确定第四绘制对象的空间信息未发生变化,将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件。The drawing unit may be configured to, when drawing the first drawing frame, determine that the spatial information of the first drawing object has changed according to the drawing instruction of the first drawing object, and determine that the spatial information of the second drawing object has not occurred according to the drawing instruction of the second drawing object. 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 the first color according to the drawing instruction of the third drawing object. When the spatial information of the drawing object changes, determine that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, 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 third color attachment. Color data is written to the fourth color attachment.
预测单元可以用于根据第一颜色附件和第三颜色附件生成第一预测帧的第五颜色附件,根据第二颜色附件和第四颜色附件生成第一预测帧的第六颜色附件。The prediction unit may be configured to generate a fifth color attachment of the first predicted frame according to the first color attachment and the third color attachment, and generate a sixth color attachment of the first predicted frame according to the second color attachment and the fourth color attachment.
合成单元可以用于将第五颜色附件和第六颜色附件合成为第一预测帧。The synthesis unit may be used to synthesize the fifth color attachment and the sixth color attachment into the first predicted frame.
通过第四方面提供的图像帧预测装置,该图像帧预测装置可以根据绘制对象的绘制指令中确定出该绘制对象的空间信息是否发生变化。也即是说,该图像帧预测装置可以根据绘制 对象的绘制指令确定出该绘制对象是否为运动对象。若绘制对象的绘制指令指示空间信息发生变化,则该绘制对象为运动对象。若绘制对象的绘制指令未指示空间信息发生变化,则该绘制对象为静态对象。若绘制对象是运动对象,该图像帧预测装置将绘制对象的颜色数据写入第一颜色附件。若绘制对象是静态对象,则该图像帧预测装置将绘制对象的颜色数据写入第二颜色附件。这样,该图像帧预测装置可以将第一绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。同样地,该图像帧预测装置可以将第二绘制帧中的运动对象的颜色数据和静态对像的颜色数据分开存储。然后,该图像帧预测装置可以根据第一绘制帧中的运动对象和第二绘制帧中的运动对象来预测出第一预测帧中的运动对象。该图像帧预测装置可以根据第一绘制帧中静态对象和第二绘制帧中的静态对象来预测出第一预测帧中的静态对象。这样,该图像帧预测装置可以利用绘制帧预测出的预测帧,可以提升帧率,从而提高该图像帧预测装置显示的视频界面流畅度。With the image frame prediction apparatus provided in the fourth aspect, the image frame prediction apparatus can determine whether the spatial information of the drawing object has changed according to the drawing instruction of the drawing object. That is to say, the image frame predicting apparatus 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 rendering object is a moving object, the image frame prediction apparatus writes the color data of the rendering object into the first color attachment. If the rendering object is a static object, the image frame predicting apparatus writes the color data of the rendering object into the second color attachment. In this way, the image frame prediction apparatus can separately store the color data of the moving object and the color data of the static object in the first drawing frame. Likewise, the image frame prediction apparatus may 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 apparatus may predict the moving object in the first predicted frame according to the moving object in the first drawing frame and the moving object in the second drawing frame. The image frame predicting apparatus can predict the static object in the first predicted 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 predicting apparatus can utilize the predicted frame predicted by the drawing frame, which can increase the frame rate, thereby improving the smoothness of the video interface displayed by the image frame predicting apparatus.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:根据第一颜色附件和第三颜色附件,确定第三颜色附件的第一运动向量;根据第二颜色附件和第一运动向量生成第一预测帧的第五颜色附件。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: determine the first motion vector of the third color accessory according to the first color accessory and the third color accessory; A motion vector generates the fifth color attachment of the first predicted frame.
上述实现方式中,图像帧预测装置只用运动对象的颜色数据计算运动对象的运动向量,这样,可以更为准确地计算出运动对象的运动向量。并且,图像帧预测装置只根据运动对象的颜色数据计算运动对象的运动向量。图像帧预测装置不会把运动对象的运动向量错误计算成静态对象的运动向量。从而,图像帧预测装置预测出的预测帧中运动对象更为准确。In the above implementation manner, the image frame prediction apparatus 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. And, the image frame predicting apparatus calculates the motion vector of the moving object only based on the color data of the moving object. The image frame prediction apparatus does not miscalculate 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 image frame prediction device is more accurate.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:将第三颜色附件分成Q个像素块,在第三颜色附件的Q个像素块中取出第一像素块;在第一颜色附件中确定出与第一像素块匹配的第二像素块;根据第二像素块到第一像素块的位移得到第一像素块的运动向量;根据第一像素块的运动向量确定出第三颜色附件的第一运动向量。按照该实现方式中的步骤,预测单元可以确定第三颜色附件的Q个像素块中所有像素块的运动向量。每个像素块中包括f*f(例如,16*16)个像素点。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: divide the third color accessory into Q pixel blocks, and extract the first pixel block from the Q pixel blocks of the third color accessory; The second pixel block matching the first pixel block is determined in the first color attachment; the motion vector of the first pixel block is obtained according to the displacement of the second pixel block to the first pixel block; the motion vector of the first pixel block is determined according to the motion vector of the first pixel block. The first motion vector of the third color attachment. According to the steps in this implementation, the prediction unit may determine motion vectors of all pixel blocks in the Q pixel blocks of the third color attachment. Each pixel block includes f*f (for example, 16*16) pixel points.
上述实现方式中,预测单元将运动对象的颜色附件分块来计算运动向量,不用去计算运动向量每个像素点的运动向量。这样可以减少计算量,从而降低图像帧预测装置的功耗。In the above implementation manner, the prediction unit divides the color attachment of the moving object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the motion vector. In this way, the amount of computation can be reduced, thereby reducing the power consumption of the image frame prediction apparatus.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:通过第一像素块中的第一像素点在第一颜色附件中确定出多个候选像素块,分别计算出多个候选像素块与第一像素块的颜色值的差值;根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块;第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。这样,预测单元可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: determine multiple candidate pixel blocks in the first color attachment by using the first pixel point in the first pixel block, and calculate the multiple candidate pixel blocks respectively. The difference between the color values of the candidate pixel blocks and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference of the color values of the first pixel block of the multiple candidate pixel blocks; the second pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the multiple candidate pixel blocks. In this way, the prediction unit can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:根据第一运动向量确定第五颜色附件的运动向量,根据第二颜色附件和第五颜色附件的运动向量生成第五颜色附件。第五颜色附件的运动向量为第一运动向量的K倍,K大于0小于1。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: determine the motion vector of the fifth color accessory according to the first motion vector, and generate the first color accessory according to the motion vector of the second color accessory and the fifth color accessory. Five color accessories. The motion vector of the fifth color attachment is K times the first motion vector, where K is greater than 0 and less than 1.
结合第四方面,在一种可能的实现方式中,K等于0.5。这样,每一帧图像帧中的对象为匀速移动。In conjunction with the fourth aspect, in a possible implementation, K is equal to 0.5. In this way, the objects in each image frame move at a constant speed.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:根据第二颜色附件和第四颜色附件确定出第四颜色附件的第二运动向量;根据第四颜色附件和第二运动向量生成第一预测帧的第六颜色附件。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may be further configured to: determine the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory; Two motion vectors generate the sixth color attachment of the first predicted frame.
上述实现方式中,预测单元只用静态对象的颜色数据计算静态对象的运动向量,这样,可以更为准确地计算出静态对象的运动向量。并且,预测单元只根据静态对象的颜色数据计算静态对象的运动向量。预测单元不会把静态对象的运动向量错误计算成运动对象的运动向量。从而,预测单元预测出的预测帧中静态对象更为准确。In the above implementation manner, the prediction unit only uses 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 calculated more accurately. And, the prediction unit calculates the motion vector of the static object only from the color data of the static object. The prediction unit does not miscalculate motion vectors of static objects as motion vectors of moving objects. Therefore, the static objects in the predicted frame predicted by the prediction unit are more accurate.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:将第四颜色附件分成Q个像素块,在第四颜色附件中取出第三像素块;计算出第三像素块在第二颜色附件中的第一位置;根据第一位置和第三像素块第四颜色附件中的第二位置确定出第三像素块的运动向量;根据第三像素块的运动向量确定出第四颜色附件的第二运动向量。按照该实现方式中的步骤,预测单元可以确定出第四颜色附件的Q个像素块中每个像素块的运动向量。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: divide the fourth color accessory into Q pixel blocks, and take out the third pixel block from the fourth color accessory; calculate the third pixel block at the first position in the second color attachment; determine the motion vector of the third pixel block according to the first position and the second position in the fourth color attachment of the third pixel block; determine the first pixel block according to the motion vector of the third pixel block Second motion vector for four color attachments. According to the steps in this implementation, the prediction unit may determine the motion vector of each pixel block in the Q pixel blocks of the fourth color attachment.
上述实现方式中,预测单元将静态对象的颜色附件分块来计算运动向量,不用去计算静态向量每个像素点的运动向量。这样可以减少计算量,从而降低图像帧预测装置的功耗。In the above implementation manner, the prediction unit divides the color attachment of the static object into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel of the static vector. In this way, the amount of computation can be reduced, thereby reducing the power consumption of the image frame prediction apparatus.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:获取到第一绘制帧的绘制指令中的第一矩阵和第二绘制帧中的绘制指令的第二矩阵,第一矩阵用于记录第一绘制帧的相机位置的转角信息,第二矩阵用于记录第二绘制帧的相机位置的转角信息;根据第一矩阵和第二矩阵、以及第三像素块的深度值计算出第三像素块在第二颜色附件中的第一位置。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: obtain the first matrix in the drawing instructions of the first drawing frame and the second matrix of the drawing instructions in the second drawing frame, A matrix is used to record the corner information of the camera position of the first drawing frame, and the second matrix is used to record the corner information of the camera position of the second drawing frame; according to the first matrix and the second matrix, and the depth value of the third pixel block The first position of the third pixel block in the second color attachment is calculated.
结合第四方面,在一种可能的实现方式中,预测单元还可以用于:根据第二运动向量确定第六颜色附件的运动向量,根据第四颜色附件和第六颜色附件的运动向量生成第六颜色附件。第六颜色附件的运动向量为第二运动向量的K倍,K大于0小于1。With reference to the fourth aspect, in a possible implementation manner, the prediction unit may also be used to: determine the motion vector of the sixth color accessory according to the second motion vector, and generate the sixth color accessory according to the motion vector of the fourth color accessory and the sixth color accessory. Six color accessories. The motion vector of the sixth color attachment is K times the second motion vector, where K is greater than 0 and less than 1.
结合第四方面,在一种可能的实现方式中,第一绘制对象的绘制指令包括第一绘制对象的执行绘制指令和第一绘制对象的绘制状态设备指令,其中,第一绘制对象的执行绘制指令用于触发电子设备针对第一绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第一绘制对象的绘制状态设备指令用于设置第一绘制对象的执行绘制指令所依赖的绘制状态数据;第一绘制对象的绘制状态数据包括第一绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the fourth aspect, in a possible implementation manner, the drawing instruction of the first drawing object includes an execution drawing instruction of the first drawing object and a drawing state device instruction of the first drawing object, wherein the execution drawing of the first drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the first drawing object depends. ; The drawing state data of the first drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the first drawing object.
结合第四方面,在一种可能的实现方式中,第二绘制对象的绘制指令包括第二绘制对象的执行绘制指令和第二绘制对象的绘制状态设备指令,其中,第二绘制对象的执行绘制指令用于触发电子设备针对第二绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第二绘制对象的绘制状态设备指令用于设置第二绘制对象的执行绘制指令所依赖的绘制状态数据;第二绘制对象的绘制状态数据包括第二绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the fourth aspect, in a possible implementation manner, the drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the execution drawing of the second drawing object The instruction is used to trigger the electronic device to draw and render 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 ; The drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the second drawing object.
结合第四方面,在一种可能的实现方式中,第三绘制对象的绘制指令包括第三绘制对象的执行绘制指令和第三绘制对象的绘制状态设备指令,其中,第三绘制对象的执行绘制指令用于触发电子设备针对第三绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第三绘制对象的绘制状态设备指令用于设置第三绘制对象的执行绘制指令所依赖的绘制状态数据;第三绘制对象的绘制状态数据包括第三绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the fourth aspect, in a possible implementation manner, the drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the execution drawing of the third drawing object The instruction is used to trigger the electronic device to draw and render 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 ; The drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object.
结合第四方面,在一种可能的实现方式中,第四绘制对象的绘制指令包括第四绘制对象的执行绘制指令和第四绘制对象的绘制状态设备指令,其中,第四绘制对象的执行绘制指令用于触发电子设备针对第四绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果;第四绘制对象的绘制状态设备指令用于设置第四绘制对象的执行绘制指令所依赖的绘制状态数据; 第四绘制对象的绘制状态数据包括第四绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。With reference to the fourth aspect, in a possible implementation manner, the drawing instruction of the fourth drawing object includes an execution drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the execution drawing of the fourth drawing object The instruction is used to trigger the electronic device to draw and render 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 drawing instruction of the fourth drawing object depends. ; The drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
结合第四方面,在一种可能的实现方式中,绘制单元还可以用于:确定第一绘制对象的绘制指令中存在转移矩阵参数、确定第一绘制对象的绘制指令中的存在的转移矩阵参数与对应的第一绘制对象的转移矩阵参数不同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the fourth aspect, in a possible implementation manner, the drawing unit may also be used to: determine the existence of transition matrix parameters in the drawing instruction of the first drawing object, and determine the existing transition matrix parameters in the drawing instruction of the first drawing object Different from the transition matrix parameter of the corresponding first drawing object, the transition matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.
结合第四方面,在一种可能的实现方式中,绘制单元还可以用于:确定第二绘制对象的绘制指令中不存在转移矩阵参数、确定第二绘制对象的绘制指令中的存在的转移矩阵参数与对应的第二绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。结合第四方面,在一种可能的实现方式中,绘制单元还可以用于:确定所述第三绘制对象的绘制指令中存在转移矩阵参数、确定第三绘制对象的绘制指令中的存在的转移矩阵参数与对应的第三绘制对象的转移矩阵参数不同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the fourth aspect, in a possible implementation manner, the drawing unit may also be used to: determine that the transfer matrix parameter does not exist in the drawing instruction of the second drawing object, and determine the existing transition matrix in the drawing instruction of the second drawing object The parameters are the same as the parameters of the transition matrix of the corresponding second drawing object, and the transition matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system. With reference to the fourth aspect, in a possible implementation manner, the drawing unit may also be used to: determine the existence of transition matrix parameters in the drawing instruction of the third drawing object, and determine the existence of transitions in the drawing instruction of the third drawing object The matrix parameter is different from the transition matrix parameter of the corresponding third drawing object, and the transition matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system.
结合第四方面,在一种可能的实现方式中,绘制单元还可以用于:确定第四绘制对象的绘制指令中不存在转移矩阵参数、确定第四绘制对象的绘制指令中的存在的转移矩阵参数与对应的第四绘制对象的转移矩阵参数相同,转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系。With reference to the fourth aspect, in a possible implementation manner, the drawing unit may also be used to: determine that the transfer matrix parameter does not exist in the drawing instruction of the fourth drawing object, and determine the existing transition matrix in the drawing instruction of the fourth drawing object The parameters are the same as the parameters of the transition matrix of the corresponding fourth drawing object, and the transition matrix is used to describe the mapping relationship between the local coordinate system of the drawing object and the world coordinate system.
结合第四方面,在一种可能的实现方式中,绘制单元还可以用于:创建第一内存空间、第二内存空间、第三内存空间、第四内存空间、第五内存空间、第六内存空间、第七内存空间;其中,第一内存空间用于存储第一颜色附件,第二内存空间用于存储第二颜色附件,第三内存空间用于存储第三颜色附件,第四内存空间用于存储第四颜色附件,第五内存空间用于存储第五颜色附件,第六内存空间用于存储第六颜色附件,第七内存空间用于存储第一预测帧。With reference to the fourth aspect, in a possible implementation manner, the drawing unit may also be used to: create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space space, the seventh memory space; wherein, the first memory space is used to store the first color accessory, the second memory space is used to store the second color accessory, the third memory space is used to store the third color accessory, and the fourth memory space is used to store the third color accessory. For storing the fourth color attachment, the fifth memory space is used for storing the fifth color attachment, the sixth memory space is used for storing the sixth color attachment, and the seventh memory space is used for storing the first prediction frame.
结合第四方面,在一种可能的实现方式中,合成单元还可以用于:在第七内存空间中将第一颜色附件和第二颜色附件合成为第一绘制帧。With reference to the fourth aspect, in a possible implementation manner, the synthesizing unit may be further configured to: combine the first color attachment and the second color attachment into the first drawing frame in the seventh memory space.
结合第四方面,在一种可能的实现方式中,合成单元还可以用于:根据第一深度附件和第二深度附件,在第七内存空间中将第一颜色附件和第二颜色附件合成第一绘制帧;第三深度附件用于写入第一绘制对象的深度数据,第四深度附件用于写入第二绘制对象的深度数据。With reference to the fourth aspect, in a possible implementation manner, the synthesizing unit may further be configured to: combine the first color attachment and the second color attachment in the seventh memory space according to the first depth attachment and the second depth attachment A drawing frame; the third depth attachment is used for writing the depth data of the first drawing object, and the fourth depth attachment is used for writing the depth data of the second drawing object.
结合第四方面,在一种可能的实现方式中,合成单元还可以用于:在第七内存空间中将第三颜色附件和第四颜色附件合成为第二绘制帧。With reference to the fourth aspect, in a possible implementation manner, the synthesizing unit may be further configured to: combine the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space.
结合第四方面,在一种可能的实现方式中,合成单元还可以用于:根据第三深度附件和第四深度附件,在第七内存空间中将第三颜色附件和第四颜色附件合成第二绘制帧;第三深度附件用于写入第三绘制对象的深度数据,第四深度附件用于写入第四绘制对象的深度数据。With reference to the fourth aspect, in a possible implementation manner, the synthesizing unit may be further configured to: combine the third color attachment and the fourth color attachment in the seventh memory space according to the third depth attachment and the fourth depth attachment Two drawing frames; the third depth attachment is used for writing the depth data of the third drawing object, and the fourth depth attachment is used for writing the depth data of the fourth drawing object.
第五方面,本申请提供了一种图像帧预测的方法,该方法可以包括:电子设备根据第十绘制指令在第十绘制帧中确定第十运动对象,根据第二绘制指令在第十一绘制帧中确定第十一运动对象;电子设备根据第十运动对象的属性和第十一运动对象的属性确定第十运动对象和第十一运动对象相匹配;电子设备根据第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果。In a fifth aspect, the present application provides a method for image frame prediction, the method may include: the electronic device determines the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and draws the eleventh moving object according to the second drawing instruction The eleventh moving object is determined in the frame; the electronic device determines that the tenth moving object and the eleventh moving object match according to the attributes of the tenth moving object and the eleventh moving object; the electronic device determines that the tenth moving object and the tenth moving object match For a moving object, the drawing result of the twelfth moving object in the tenth prediction frame is determined.
通过本申请实施例提供的方法,电子设备可以根据应用程序的两帧绘制帧得到预测帧。 这样可以提高应用程序视频界面的帧率。从而,可以提高电子设备显示该应用程序视频界面的流畅度。With the method provided by the embodiment of the present application, the electronic device can draw the frame according to the two frames of the application to obtain the predicted frame. This increases the frame rate of the application's video interface. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved.
结合第五方面,在一种可能的实现方式中,第十绘制帧在第十一绘制帧之前显示在电子设备的显示屏中,第十预测帧在第十一绘制帧之后显示在电子设备的显示屏中。即电子设备可以根据前两帧绘制帧来预测出后面的预测帧,从而提升帧率。With reference to the fifth aspect, in a possible implementation manner, the tenth drawing frame is displayed on the display screen of the electronic device before the eleventh drawing frame, and the tenth predicted frame is displayed on the display screen of the electronic device after the eleventh drawing frame. on the display. That is, the electronic device can draw frames according to the first two frames to predict the following predicted frames, thereby increasing the frame rate.
结合第五方面,在一种可能的实现方式中,第十绘制帧和第十一绘制帧之间间隔一帧图像帧,第十预测帧为第十一绘制帧相邻的后一帧图像帧。例如,电子设备利用第2绘制帧和第4绘制帧来预测出第5预测帧。这样,电子设备可以有足够的时间计算出运动向量并绘制出第预测帧,避免电子设备显示完第4绘制帧后,第5绘制帧未绘制完,导致视频界面卡顿。With reference to the fifth aspect, in a possible implementation manner, an image frame is separated between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is an image frame adjacent to the eleventh drawing frame. . For example, the electronic device predicts the fifth prediction frame using the second rendering frame and the fourth rendering frame. In this way, the electronic device can have enough time to calculate the motion vector and draw the first predicted frame, so as to avoid the video interface being stuck after the electronic device displays the fourth drawn frame and the fifth drawn frame is not finished.
结合第五方面,在一种可能的实现方式中,电子设备根据第十运动对象的第一属性和第十一运动对象的第二属性确定第十运动对象和第十一运动对象相匹配,具体包括:电子设备建立第一索引表,第一索引表用于保存第十绘制帧中的运动对象和运动对象的属性,第一索引表包括第十运动对象和第十运动对象的属性;电子设备建立第二索引表,第二索引表用于保存第十一绘制帧中的运动对象和运动对象的属性,第二索引表包括第十一运动对象和第十一运动对象的属性;电子设备从第二索引表中取出第十一运动对象,从第一索引表中确定出与第十一运动对象相匹配的第十运动对象。这样,电子设备通过索引表能够快速地查找出与第十一运动对象匹配的第十运动对象。With reference to the fifth aspect, in a possible implementation manner, the electronic device determines that the tenth moving object matches the eleventh moving object according to 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, the first index table is used to save the moving objects in the tenth drawing frame and the properties of the moving objects, the first index table includes the tenth moving object and the properties of the tenth moving object; the electronic device A second index table is established, and the second index table is used to save the motion objects and the attributes of the motion objects in the eleventh drawing frame, and the second index table includes the attributes of the eleventh motion objects and the eleventh motion objects; The eleventh moving object is extracted from the second index table, and the tenth moving object matching the eleventh moving object is determined from the first index table. In this way, the electronic device can quickly find out the tenth moving object matching the eleventh moving object through the index table.
结合第五方面,在一种可能的实现方式中,第十运动对象和第十一运动对象相匹配包括:第十运动对象的第一属性与第十一运动对象的第二属性相同。With reference to the fifth aspect, in a possible implementation manner, matching the tenth moving object with the eleventh moving object includes: the first attribute of the tenth moving object is the same as the second attribute of the eleventh moving object.
结合第五方面,在一种可能的实现方式中,电子设备根据第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果,具体包括:电子设备确定第十运动对象的第一点的第一坐标,确定第十一运动对象的第二点的第二坐标;电子设备根据第一坐标到第二坐标的位移,确定第十运动对象到第十一运动对象的第十运动向量;电子设备根据第十运动向量和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果。这样,电子设备可以利用对象的一个点的运动向量代表整个对象的运动向量,不需要单独确定对象的每个块的运动向量。这样,可以减少电子设备的计算量,从而可以节约电子设备的功耗。With reference to the fifth aspect, in a possible implementation manner, the electronic device determines the drawing result of the twelfth moving object in the tenth prediction frame according to the tenth moving object and the eleventh moving object, which specifically includes: the electronic device determining the first coordinate of the first point of the tenth moving object, and determining the second coordinate of the second point of the eleventh moving object; the electronic device determines the tenth moving object to the tenth moving object according to the displacement from the first coordinate to the second coordinate A tenth motion vector of a moving object; the electronic device determines a drawing result of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the eleventh moving object. In this way, the electronic device can use the motion vector of one point of the object to represent the motion vector of the entire object, and does not need to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
结合第五方面,在一种可能的实现方式中,电子设备确定第十运动对象的第一点的第一坐标,具体包括:电子设备根据第十运动对象的所有像素点的坐标确定出第一点的第一坐标;电子设备确定第十一运动对象的第二点的第二坐标,具体包括:电子设备根据第十一运动对象的所有像素点的坐标确定出第二点的第二坐标。With reference to the fifth aspect, in a possible implementation manner, the electronic device determines the first coordinates of the first point of the tenth moving object, which specifically includes: the electronic device determines the first coordinate according to the coordinates of all pixel points of the tenth moving object. The first coordinates of the point; the electronic device determining the second coordinates of the second point of the eleventh moving object specifically includes: the electronic device determining the second coordinates of the second point according to the coordinates of all pixel points of the eleventh moving object.
进一步地,电子设备可以通过GPU中的着色器shader去第十运动对象的模板图像中获取第十运动对象每个像素点的坐标。GPU中绘制有第十运动对象的模板图像。电子设备可以通过GPU中的着色器shader去第十一运动对象的模板图像中获取第十一运动对象每个像素点的坐标。GPU中绘制有第十一运动对象的模板图像。Further, the electronic device may obtain the coordinates of each pixel of the tenth moving object from the template image of the tenth moving object through the shader in the GPU. The template image of the tenth moving object is drawn in the GPU. The electronic device may obtain the coordinates of each pixel of the eleventh moving object from the template image of the eleventh moving object through the shader in the GPU. The template image of the eleventh moving object is drawn in the GPU.
结合第五方面,在一种可能的实现方式中,第一点为第十运动对象的几何中心点,第二点为第十一运动对象的几何中心点。运动对象的中心点相对于运动对象的其他点更便于计算,这样,可以减少电子设备的计算量,从而可以降低电子设备的功耗。With reference to the fifth aspect, in a possible implementation manner, 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. Compared with other points of the moving object, the center point of the moving object is more convenient to calculate, so that the calculation amount of the electronic device can be reduced, and the power consumption of the electronic device can be reduced.
结合第五方面,在一种可能的实现方式中,电子设备根据第十运动向量和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果,具体包括:电子设备根据第十运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点。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 vector and the eleventh motion object, which specifically includes: the electronic device According to the tenth motion vector and the first pixel point of the eleventh moving object, the second pixel point of the twelfth moving object in the tenth prediction frame is determined.
结合第五方面,在一种可能的实现方式中,电子设备根据第十运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点,具体包括:电子设备根据第十运动向量确定第十一运动对象运动到第十二运动对象的第十一运动向量;电子设备根据第十一运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点,第二像素点为第一像素点按照第十一运动向量从第十一绘制帧中运动到第十预测帧中的像素点。With reference to the fifth aspect, in a possible implementation manner, the electronic device determines the second pixel point of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the first pixel point of the eleventh moving object , specifically including: the electronic device determines the eleventh motion vector of the eleventh moving object to the twelfth moving object according to the tenth motion vector; the electronic device determines the eleventh motion vector according to the eleventh motion vector and the first pixel point of the eleventh moving object , determine the second pixel of the twelfth moving object in the tenth prediction frame, and the second pixel is the pixel that the first pixel moves from the eleventh drawing frame to the tenth prediction frame according to the eleventh motion vector point.
结合第五方面,在一种可能的实现方式中,第十一运动向量为第十运动向量的K倍,K大于0且小于1。With reference to the fifth aspect, in a possible implementation manner, the eleventh motion vector is K times the tenth motion vector, and K is greater than 0 and less than 1.
结合第五方面,在一种可能的实现方式中,K等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于电子设备计算,也可以使得用户在观看视频时的体验更好。In conjunction with the fifth aspect, in a possible implementation, K is equal to 0.5. In this way, the objects in each image frame move 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.
第六方面,提供一种电子设备,包括:一个或多个处理器CPU、图形处理器GPU、存储器和显示屏;存储器与一个或多个处理器耦合;CPU与GPU耦合;其中:In a sixth aspect, an electronic device is provided, comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
存储器用于存储计算机程序代码,计算机程序代码包括计算机指令;The memory is used to store computer program code, the computer program code includes computer instructions;
CPU用于根据第十绘制指令在第十绘制帧中确定第十运动对象,根据第二绘制指令在第十一绘制帧中确定第十一运动对象;The CPU is configured to determine the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and determine the eleventh moving object in the eleventh drawing frame according to the second drawing instruction;
GPU用于根据第十运动对象的属性和第十一运动对象的属性确定第十运动对象和第十一运动对象相匹配;根据第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果;The GPU is configured to determine that the tenth moving object and the eleventh moving object match according to the attributes of the tenth moving object and the eleventh moving object; determine the tenth prediction frame according to the tenth moving object and the eleventh moving object The drawing result of the twelfth moving object in ;
显示屏用于显示第十绘制帧、第十一绘制帧、第十预测帧。The display screen is used for displaying the tenth drawing frame, the eleventh drawing frame and the tenth prediction frame.
本申请实施例提供的电子设备可以根据应用程序的两帧绘制帧得到预测帧。这样可以提高应用程序视频界面的帧率。从而,可以提高电子设备显示该应用程序视频界面的流畅度。The electronic device provided by the embodiment of the present application can draw a frame according to two frames of an application to obtain a predicted frame. This increases the frame rate of the application's video interface. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved.
结合第六方面,在一种可能的实现方式中,第十绘制帧在第十一绘制帧之前显示在显示屏中,第十预测帧在第十一绘制帧之后显示在显示屏中。即电子设备可以根据前两帧绘制帧来预测出后面的预测帧,从而提升帧率。With reference to the sixth aspect, in a possible implementation manner, the tenth drawing frame is displayed on the display screen before the eleventh drawing frame, and the tenth predicted frame is displayed on the display screen after the eleventh drawing frame. That is, the electronic device can draw frames according to the first two frames to predict the following predicted frames, thereby increasing the frame rate.
结合第六方面,在一种可能的实现方式中,第十绘制帧和第十一绘制帧之间间隔一帧图像帧,第十预测帧为第十一绘制帧相邻的后一帧图像帧。例如,电子设备利用第2绘制帧和第4绘制帧来预测出第5预测帧。这样,电子设备可以有足够的时间计算出运动向量并绘制出第预测帧,避免电子设备显示完第4绘制帧后,第5绘制帧未绘制完,导致视频界面卡顿。With reference to the sixth aspect, in a possible implementation manner, an image frame is separated between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is an image frame adjacent to the eleventh drawing frame. . For example, the electronic device predicts the fifth prediction frame using the second rendering frame and the fourth rendering frame. In this way, the electronic device can have enough time to calculate the motion vector and draw the first predicted frame, so as to avoid the video interface being stuck after the electronic device displays the fourth drawn frame and the fifth drawn frame is not finished.
结合第六方面,在一种可能的实现方式中,CPU具体用于:建立第一索引表,第一索引表用于保存第十绘制帧中的运动对象和运动对象的属性,第一索引表包括第十运动对象和第十运动对象的属性;建立第二索引表,第二索引表用于保存第十一绘制帧中的运动对象和运动对象的属性,第二索引表包括第十一运动对象和第十一运动对象的属性。所述GPU具体用于:从第二索引表中取出所述第十一运动对象,从所述第一索引表中确定出与所述第十一运动对象相匹配的所述第十运动对象。这样,电子设备可以快速地从索引表中找到与第十一运动对象相匹配的第十运动对象。With reference to the sixth aspect, in a possible implementation manner, the CPU is specifically used to: establish a first index table, the first index table is used to save the motion object and the attributes of the motion object in the tenth drawing frame, and the first index table Including the attributes of the tenth motion object and the tenth motion object; establishing a second index table, the second index table is used to save the motion object in the eleventh drawing frame and the attributes of the motion object, and the second index table includes the eleventh motion Properties of the object and the eleventh motion object. The GPU is specifically configured to: fetch the eleventh moving object from the second index table, and determine the tenth moving object matching the eleventh moving object from the first index table. In this way, the electronic device can quickly find the tenth moving object matching the eleventh moving object from the index table.
结合第六方面,在一种可能的实现方式中,第十运动对象和第十一运动对象相匹配包括:第十运动对象的属性与第十一运动对象的属性相同。With reference to the sixth aspect, in a possible implementation manner, matching the tenth moving object with the eleventh moving object includes: the attributes of the tenth moving object are the same as the attributes of the eleventh moving object.
结合第六方面,在一种可能的实现方式中,GPU具体用于:确定第十运动对象的第一点的第一坐标,确定第十一运动对象的第二点的第二坐标;根据第一坐标到第二坐标的位移,确定第十运动对象到第十一运动对象的第十运动向量;根据第十运动向量和第十一运动对象, 确定出第十预测帧中的第十二运动对象的绘制结果。这样,电子设备可以利用对象的一个点的运动向量代表整个对象的运动向量,不需要单独确定对象的每个块的运动向量。这样,可以减少电子设备的计算量,从而可以节约电子设备的功耗。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 moving object, and determine the second coordinate of the second point of the eleventh moving object; The displacement from the first coordinate to the second coordinate determines the tenth motion vector from the tenth moving object to the eleventh moving object; according to the tenth motion vector and the eleventh moving object, the twelfth motion in the tenth prediction frame is determined The result of drawing the object. In this way, the electronic device can use the motion vector of one point of the object to represent the motion vector of the entire object, and does not need to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
结合第六方面,在一种可能的实现方式中,GPU具体用于:根据第十运动对象的所有像素点的坐标确定出第一点的第一坐标;根据第十一运动对象的所有像素点的坐标确定出第二点的第二坐标。With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically used to: determine the first coordinates of the first point according to the coordinates of all the pixels of the tenth moving object; The coordinates of determine the second coordinates of the second point.
结合第六方面,在一种可能的实现方式中,第一点为第十运动对象的几何中心点,第二点为第十一运动对象的几何中心点。With reference to the sixth aspect, in a possible implementation manner, 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.
结合第六方面,在一种可能的实现方式中,GPU具体用于:根据第十运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点。With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine the first pixel of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the first pixel of the eleventh moving object. two pixels.
结合第六方面,在一种可能的实现方式中,GPU具体用于:根据第十运动向量确定第十一运动对象运动到第十二运动对象的第十一运动向量;根据第十一运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点,第二像素点为第一像素点按照第十一运动向量从第十一绘制帧中运动到第十预测帧中的像素点。With reference to the sixth aspect, in a possible implementation manner, the GPU is specifically configured to: determine the eleventh motion vector from the eleventh moving object to the twelfth moving object according to the tenth motion vector; according to the eleventh motion vector and the first pixel of the eleventh moving object, determine the second pixel of the twelfth moving object in the tenth prediction frame, and the second pixel is the first pixel drawn according to the eleventh motion vector from the eleventh The pixel in the frame moves to the tenth predicted frame.
结合第六方面,在一种可能的实现方式中,第十一运动向量为第十运动向量的K倍,K大于0且小于1。With reference to the sixth aspect, in a possible implementation manner, the eleventh motion vector is K times the tenth motion vector, and K is greater than 0 and less than 1.
结合第六方面,在一种可能的实现方式中,K等于0.5。In combination with the sixth aspect, in a possible implementation, K is equal to 0.5.
第七方面,本申请实施例提供了一种帧预测方法,其特征在于,所述方法包括:In a seventh aspect, an embodiment of the present application provides a frame prediction method, wherein the method includes:
电子设备根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从目标参考帧到预测帧的预测运动向量,其中,第一顶点为第一块中的一个顶点,第一块为目标参考帧中的一个块,目标参考帧为根据预测帧相对于第一参考帧或第二参考帧的位置,从第一参考帧或第二参考帧中确定的一个帧,第一参考帧和第二参考帧为视频流中相邻的两个帧;根据目标参考帧中的第一顶点的坐标和第一顶点的预测运动向量,确定第一顶点在预测帧中的坐标;根据第一块的顶点在预测帧中的坐标和在目标参考帧中的坐标,确定第一块在预测帧中的像素块;显示预测帧,其中包括像素块。The electronic device determines the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, wherein 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 according to the position of the 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 predicted frame are determined according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex ; According to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame, determine the pixel block of the first block in the predicted frame; display the predicted frame, which includes the pixel block.
通过本申请实施例第七方面提供的帧预测方法,电子设备先针对块的每一个顶点,根据该顶点四周的块的从目标参考帧到预测帧的预测运动向量确定该顶点在预测帧中的位置,进而,针对每一个块,根据块的四个顶点在参考帧和预测帧之间的对应关系来计算该块的每个像素在预测帧中的位置,最后得到整个预测帧。With the frame prediction method provided in the seventh aspect of the embodiment of the present application, the electronic device first, for each vertex of the block, determines the position of the vertex in the predicted frame according to the predicted motion vector of the blocks around the vertex from the target reference frame to the predicted frame. Then, for each block, the position of each pixel of the block in the predicted frame is calculated according to the correspondence between the four vertices of the block in the reference frame and the predicted frame, and finally the entire predicted frame is obtained.
上述的帧预测方法中通过确定顶点,再根据第一块四周的块的预测运动向量对第一块进行拉伸,其中,第一块为参考帧中的一个块,从而使预测帧中相邻的块的顶点是重合的,并且块与块之间连续,没有空洞。In the above-mentioned frame prediction method, the vertex is determined, and then the first block is stretched according to the predicted motion vectors of the blocks around the first block, wherein the first block is a block in the reference frame, so that the adjacent prediction frames are made. The vertices of the blocks are coincident, and the blocks are continuous without holes.
结合第七方面,在一种可能的实现方式中,电子设备根据第一块的顶点在预测帧中的坐标和在目标参考帧中的坐标,得到第一块的像素在预测帧中的坐标和在目标参考帧中的坐标的对应关系,进而,根据第一块的像素在目标参考帧中的坐标和对应关系,确定第一块中的像素在预测帧中的坐标。With reference to the seventh aspect, in a possible implementation manner, the electronic device obtains the coordinates of the pixels of the first block in the predicted frame and The corresponding relationship of the coordinates in the target reference frame, and further, according to the coordinates and the corresponding relationship of the pixels of the first block in the target reference frame, the coordinates of the pixels in the first block in the predicted frame are determined.
结合第七方面,在一种可能的实现方式中,电子设备将第一块的四个顶点在预测帧中的坐标和在目标参考帧中的坐标分别输入单应性变换公式,得到单应性方程组,单应性方程组包括四个方程。电子设备通过求解单应性方程组,得到第一块对应的单应性变换矩阵,进而, 根据第一块对应的单应性变换矩阵,得到第一块对应的单应性变换公式,第一块对应的单应性变换公式用于表示第一块的像素在预测帧中的坐标和在目标参考帧中的坐标的对应关系。In combination with the seventh aspect, in a possible implementation manner, the electronic device inputs the coordinates of the four vertices of the first block in the predicted frame and the coordinates in the target reference frame into the homography transformation formula, respectively, to obtain the homography. System of equations, the system of homography equations consists of four equations. The electronic device obtains the homography transformation matrix corresponding to the first block by solving the homography equation system, and then obtains the homography transformation formula corresponding to the first block according to the homography transformation matrix corresponding to the first block. The homography transformation formula corresponding to the block is used to express the correspondence between the coordinates of the pixels of the first block in the predicted frame and the coordinates in the target reference frame.
结合第七方面,在一种可能的实现方式中,电子设备将第一像素在目标参考帧中的坐标输入第一块对应的单应性变换公式,得到第一像素在预测帧中的坐标,第一像素为第一块的一个像素。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, The first pixel is one pixel of the first block.
结合第七方面,在一种可能的实现方式中,像素块的区域包括的坐标个数大于第一块的在预测帧中的坐标个数,其中,像素块的区域由第一块的顶点确定。在该情况下,电子设备在像素块的区域中的坐标中剔除第一块的像素在预测帧中的坐标,得到第一坐标,再将第一坐标输入第一块对应的单应性变换公式,得到第一坐标在目标参考帧中的像素。With reference to the seventh aspect, in a possible implementation manner, 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 predicted frame, wherein the region of the pixel block is determined by the vertices of the first block . In this case, the electronic device removes the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates, and then inputs the first coordinates into the homography transformation formula corresponding to the first block , get the pixel of the first coordinate in the target reference frame.
结合第七方面,在一种可能的实现方式中,在电子设备执行根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从目标参考帧到预测帧的预测运动向量前,电子设备获取第一参考帧和第二参考帧,再根据需预测的帧的位置,从第一参考帧和第二参考帧中确定目标参考帧。按照第一大小的方形块,将目标参考帧划分为块,进而,计算块从目标参考帧到预测帧的运动向量。In conjunction with the seventh aspect, in a possible implementation, the electronic device executes the predicted motion vector from the target reference frame to the predicted frame according to the blocks around the first vertex, and determines the prediction of the first vertex from the target reference frame to the predicted frame. Before the motion vector, 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 square blocks of the first size, and then the motion vector of the block from the target reference frame to the predicted frame is calculated.
结合第七方面,在一种可能的实现方式中,在目标参考帧为第一参考帧时,电子设备获取第一块从第一参考帧到第二参考帧的运动向量,再将第一块从第一参考帧到第二参考帧的运动向量的一半确定为第一块从目标参考帧到预测帧的预测运动向量。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 converts the first block to the second reference frame. Half of the motion vector 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 predicted frame.
结合第七方面,在一种可能的实现方式中,在目标参考帧为第一参考帧时,电子设备获取第一块从第二参考帧到第一参考帧的运动向量,再将第一块从第二参考帧到第一参考帧的运动向量的负值的一半确定为第一块从目标参考帧到预测帧的预测运动向量。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 converts the first block to the first reference frame. The negative half of the motion vector from the second reference frame to the first reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
结合第七方面,在一种可能的实现方式中,电子设备将第一顶点四周的块从目标参考帧到预测帧的预测运动向量的平均值确定为第一顶点从目标参考帧到预测帧的预测运动向量。In conjunction with 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 average value of the predicted motion vectors of the first vertex from the target reference frame to the predicted frame. Predict the motion vector.
结合第七方面,在一种可能的实现方式中,电子设备将目标参考帧中的第一顶点的坐标和第一顶点的预测运动向量相加,得到第一顶点在预测帧中的坐标。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.
第八方面,本申请实施例提供了一种电子设备,其特征在于,电子设备包括:一个或多个处理器、存储器和显示屏;存储器与一个或多个处理器耦合,存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,一个或多个处理器用于调用计算机指令以使得电子设备执行:根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从目标参考帧到预测帧的预测运动向量,其中,第一顶点为第一块中的一个顶点,第一块为目标参考帧中的一个块,目标参考帧为根据预测帧相对于第一参考帧或第二参考帧的位置,从第一参考帧或第二参考帧中确定的一个帧,第一参考帧和第二参考帧为视频流中相邻的两个帧;根据目标参考帧中的第一顶点的坐标和第一顶点的预测运动向量,确定第一顶点在预测帧中的坐标;根据第一块的顶点在预测帧中的坐标和在目标参考帧中的坐标,确定第一块在预测帧中的像素块;通过显示屏显示预测帧,其中包括像素块。In an eighth aspect, an embodiment of the present application provides an electronic device, characterized in that the electronic device includes: one or more processors, a memory, and a display screen; the memory is coupled to the one or more processors, and the memory is used to store a computer Program code, the computer program code includes computer instructions, and the one or more processors are used for invoking the computer instructions to cause the electronic device to execute: according to the predicted motion vector of the block around the first vertex from the target reference frame to the predicted frame, determine the first vertex from the predicted frame. The predicted motion vector from the target reference frame to the predicted frame, wherein 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 relative to the first reference frame according to the predicted frame Or the position of the second reference frame, a frame determined from 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 and the predicted motion vector of the first vertex determine the coordinates of the first vertex in the predicted frame; according to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame, determine the first block A block of pixels in a predicted frame; the predicted frame is displayed on the display screen, including the block of pixels.
结合第八方面,在一种可能的实现方式中,处理器具体用于:根据第一块的顶点在预测帧中的坐标和在目标参考帧中的坐标,得到第一块的像素在预测帧中的坐标和在目标参考帧中的坐标的对应关系,根据第一块的像素在目标参考帧中的坐标和对应关系,确定第一块中的像素在预测帧中的坐标。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: obtain the pixels of the first block in the predicted frame according to the coordinates of the vertices of the first block in the predicted frame and the coordinates in the target reference frame The corresponding relationship between the coordinates in the target reference frame and the coordinates in the target reference frame, according to the coordinates and the corresponding relationship of the pixels in the first block in the target reference frame, determine the coordinates of the pixels in the first block in the predicted frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:将第一块的四个顶点在预测帧中的坐标和在目标参考帧中的坐标分别输入单应性变换公式,得到单应性方程组,单应 性方程组包括四个方程;求解单应性方程组,得到第一块对应的单应性变换矩阵;根据第一块对应的单应性变换矩阵,得到第一块对应的单应性变换公式,第一块对应的单应性变换公式用于表示第一块的像素在预测帧中的坐标和在目标参考帧中的坐标的对应关系。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: respectively input the coordinates of the four vertices of the first block in the predicted frame and the coordinates in the target reference frame into the homography transformation formula, Obtain the homography equation system, which includes four equations; solve the homography equation system to obtain the homography transformation matrix corresponding to the first block; according to the homography transformation matrix corresponding to the first block, obtain the first block. A homography transformation formula corresponding to one block, and 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 predicted frame and the coordinates in the target reference frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:将第一像素在目标参考帧中的坐标输入第一块对应的单应性变换公式,得到第一像素在预测帧中的坐标,第一像素为第一块的一个像素。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: input the coordinates of the first pixel in the target reference frame into the homography transformation formula corresponding to the first block to obtain the first pixel in the predicted frame The coordinates in , the first pixel is a pixel of the first block.
结合第八方面,在一种可能的实现方式中,处理器具体用于:在像素块的区域中的坐标中剔除第一块的像素在预测帧中的坐标,得到第一坐标;将第一坐标输入第一块对应的单应性变换公式,得到第一坐标在目标参考帧中的像素。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: remove the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates; The coordinates are input into the homography transformation formula corresponding to the first block, and the pixels of the first coordinates in the target reference frame are obtained.
结合第八方面,在一种可能的实现方式中,处理器具体用于:获取第一参考帧和第二参考帧;根据需预测的帧的位置,从第一参考帧和第二参考帧中确定目标参考帧;按照第一大小的方形块,将目标参考帧划分为块;计算块从目标参考帧到预测帧的运动向量。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: acquire the first reference frame and the second reference frame; Determine the target reference frame; divide the target reference frame into blocks according to the square blocks of the first size; calculate the motion vector of the block from the target reference frame to the predicted frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:获取第一块从第一参考帧到第二参考帧的运动向量;将第一块从第一参考帧到第二参考帧的运动向量的一半确定为第一块从目标参考帧到预测帧的预测运动向量。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: obtain a motion vector of the first block from the first reference frame to the second reference frame; Half of the motion vector of the reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:获取第一块从第二参考帧到第一参考帧的运动向量;将第一块从第二参考帧到第一参考帧的运动向量的负值的一半确定为第一块从目标参考帧到预测帧的预测运动向量。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: obtain a motion vector of the first block from the second reference frame to the first reference frame; The negative half of the motion vector of the reference frame is determined as the predicted motion vector of the first block from the target reference frame to the predicted frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:将第一顶点四周的块从目标参考帧到预测帧的预测运动向量的平均值确定为第一顶点从目标参考帧到预测帧的预测运动向量。With reference to the eighth aspect, in a possible implementation manner, 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 first vertex from the target reference frame. The predicted motion vector to the predicted frame.
结合第八方面,在一种可能的实现方式中,处理器具体用于:将目标参考帧中的第一顶点的坐标和第一顶点的预测运动向量相加,得到第一顶点在预测帧中的坐标。With reference to the eighth aspect, in a possible implementation manner, the processor is specifically configured to: add the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex to obtain the first vertex in the predicted frame coordinate of.
第九方面,本申请提供一种图像帧生成方法,该方法可包括:根据第十一块和第十二块的深度值、所述第十一块和所述第十二块在图像帧中位置坐标,确定预测块的第十一顶点在预测图像帧中的第十位置坐标;其中,所述第十一块为第一图像帧中的一个块;所述第十二块为第二图像帧中根据匹配算法确定出的与所述第十一块匹配的块;根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块;生成所述预测图像帧,所述预测图像帧包括所述预测块。In a ninth aspect, the present application provides an image frame generation method, the method may include: according to the depth values of the eleventh block and the twelfth block, the eleventh block and the twelfth block are in the image frame Position coordinates, determine the tenth position coordinates of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame; the twelfth block is the second image The block that matches the eleventh block determined according to the matching algorithm in the frame; the predicted block is generated according to the color data of the reference block and the tenth position coordinate, and the reference block is the eleventh block or the tenth position coordinate. generating the predicted image frame, the predicted image frame including the predicted block.
其中,颜色数据可以是块中包括的每个像素的RGB值。Among them, the color data may be the RGB value of each pixel included in the block.
可见,本申请实施例中结合深度值针对块进行预测,使得生成的预测块可以根据深度值进行缩放,进而使得预测图像帧展示的画面与电子设备根据实际数据绘制的场景更加吻合;使得在电子设备在根据实际数据绘制的原始图像帧中插入预测图像帧时,原始图像帧与预测图像帧之间的过渡更加自然平滑,提升了用户体验。It can be seen that in the embodiment 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, so that the picture displayed by the predicted image frame is more consistent with the scene drawn by the electronic device according to the actual data; When the device inserts the predicted image frame into the original image frame drawn according to the actual data, the transition between the original image frame and the predicted image frame is more natural and smooth, which improves the user experience.
结合第九方面,在一种可能的实现方式中,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述第一坐标系是二维坐标系,所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标,包括:根据所述第十一块的第一深度值和所述第十一块在所述第一坐标系下的第十二位置坐标,计算得到第二坐标系下的第十三位置坐标,所述第二坐标系为三维坐标系;根据所述第十二块的第二深度值和所述第十二块在所述第一坐标系下的第十四位置坐标,计 算得到所述第二坐标系下的第十五位置坐标;根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标;根据所述第十六位置坐标,计算得到在所述第一坐标系下的所述第十位置坐标。With reference to the ninth aspect, in a possible implementation manner, the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system, and the first coordinate system of the determined prediction block is The tenth position coordinates of the eleven vertices in the predicted image frame include: according to the first depth value of the eleventh block and the twelfth position coordinates of the eleventh block in the first coordinate system, Calculate the thirteenth position coordinate under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the twelfth block and the first coordinate of the twelfth block The fourteenth position coordinates under the system, the fifteenth position coordinates under the second coordinate system are calculated; according to the thirteenth position coordinates and the fifteenth position coordinates, the second coordinates are calculated The sixteenth position coordinates under the system; and the tenth position coordinates under the first coordinate system are calculated according to the sixteenth position coordinates.
其中,第一坐标系可以是屏幕坐标系;第二坐标系可以是相机坐标系。具体的,本申请实施例中图像帧中的位置坐标即为在屏幕坐标系下的坐标。Wherein, the first coordinate system may be a screen coordinate system; the second coordinate system may be a camera coordinate system. Specifically, the position coordinates in the image frame in the embodiment of the present application are the coordinates in the screen coordinate system.
可见,本申请实施例中,电子设备可以结合深度值将二维坐标系中的位置坐标转换到三维空间中,进而在三维空间中结合三个维度的变化实现对位置坐标的预测,之后将三维空间中预测得到的位置坐标转换到二维空间中,确定出二维坐标系下的位置坐标。本示例中,结合三个维度的数据实现位置坐标的预测,进而在生成预测块时可以基于参考块进行一定比例的放大和缩小,使得最终生成的预测图像帧与电子设备根据应用程序的数据绘制的结果更加相近。It can be seen that in the embodiment of the present application, the electronic device can convert the position coordinates in the two-dimensional coordinate system into the three-dimensional space in combination with the depth value, and then realize the prediction of the position coordinates in the three-dimensional space by combining the changes of the three dimensions, and then convert the three-dimensional coordinates into the three-dimensional space. The position coordinates predicted in the space are converted into two-dimensional space, and the position coordinates in the two-dimensional coordinate system are determined. In this example, the prediction of position coordinates is realized by combining the data of three dimensions, and then a certain proportion of enlargement and reduction can be performed based on the reference block when generating the predicted block, so that the finally generated predicted image frame and the electronic device are drawn according to the data of the application program. results are more similar.
结合第九方面,在一种可能的实现方式中,所述生成预测块之前,所述方法还包括:根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标;其中,所述第十三块是与所述第十一块相邻的一个块,所述第十四块是与所述第十二块相邻的一个块,所述第十三块和所述第十四块是根据所述匹配算法确定出的相互匹配的块;根据第十五块和第十六块的深度值、所述第十五块和所述第十六块在图像帧中位置坐标,确定所述预测块的第十三顶点在所述预测图像帧中的第十八位置坐标;其中,所述第十五块是与所述第十三块相邻的一个块,所述第十六块是与所述第十四块相邻的一个块,所述第十五块和所述第十六块是根据所述匹配算法确定出的相互匹配的块;根据第十七块和第十八块的深度值、所述第十七块和所述第十八块在图像帧中位置坐标,确定所述预测块的第十四顶点在所述预测图像帧中的第十九位置坐标;其中,所述第十七块是与所述第十一块和所述第十五块均相邻的一个块,所述第十八块是与所述第十二块和所述第十六块均相邻的一个块,所述第十七块和所述第十八块是根据所述匹配算法确定出的相互匹配的块。With reference to the ninth aspect, in a possible implementation manner, before the generating the prediction block, the method further includes: according to the depth values of the thirteenth block and the fourteenth block, the thirteenth block and the The position coordinates of the fourteenth block in the image frame, determine the seventeenth position coordinates of the twelfth vertex of the predicted block in the predicted image frame; wherein, the thirteenth block is the same as the eleventh block. A block adjacent to a block, the fourteenth block is a block adjacent to the twelfth block, and the thirteenth block and the fourteenth block are mutually determined according to the matching algorithm. The matched block; according to the depth values of the fifteenth block and the sixteenth block, and the position coordinates of the fifteenth block and the sixteenth block in the image frame, it is determined that the thirteenth vertex of the prediction block is in the the eighteenth position coordinates in the predicted image frame; wherein, the fifteenth block is a block adjacent to the thirteenth block, and the sixteenth block is adjacent to the fourteenth block a block, the fifteenth block and the sixteenth block are mutually matched blocks determined according to the matching algorithm; block and the position coordinates of the eighteenth block in the image frame, determine the nineteenth position coordinates of the fourteenth vertex of the prediction block in the predicted image frame; wherein, the seventeenth block is the same as the The eleventh block and the fifteenth block are both adjacent blocks, the eighteenth block is a block adjacent to the twelfth block and the sixteenth block, and the eighteenth block is a block adjacent to both the twelfth block and the sixteenth block. The seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.
可见,电子设备可以根据相邻的块确定出预测块其余顶点的位置坐标,使得最终生成的预测图像帧中不存在重叠或空隙的情况,有利于提升图像帧的画面显示效果。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.
结合第九方面,在一种可能的实现方式中,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标,包括:根据所述第十三块的第三深度值和所述第十三块在所述第一坐标系下的第二十位置坐标,计算得到第二坐标系下的第二十一位置坐标,所述第二坐标系为三维坐标系;根据所述第十四块的第二深度值和所述第十四块在所述第一坐标系下的第第二十二位置坐标,计算得到所述第二坐标系下的第二十三位置坐标;根据所述第二十一位置坐标和所述第二十三位置坐标,计算得到在所述第二坐标系下的第二十四位置坐标;根据所述第二十四位置坐标,计算得到在所述第一坐标系下的所述第十七位置坐标。With reference to the ninth aspect, in a possible implementation manner, the position coordinates in the image frame are the position coordinates in the first coordinate system, and the depth values of the thirteenth and fourteenth blocks, the The position coordinates of the thirteenth block and the fourteenth block in the image frame, and determining the seventeenth position coordinate of the twelfth vertex of the predicted block in the predicted image frame, including: according to the thirteenth block The third depth value and the twentieth position coordinates of the thirteenth block under the first coordinate system are calculated to obtain the twenty-first position coordinates under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the fourteenth block and the twenty-second position coordinate of the fourteenth block in the first coordinate system, the first coordinate system under the second coordinate system is obtained by calculating Twenty-three position coordinates; according to the twenty-first position coordinates and the twenty-third position coordinates, the twenty-fourth position coordinates under the second coordinate system are calculated; according to the twenty-fourth position coordinates position coordinates, the seventeenth position coordinates under the first coordinate system are obtained by calculation.
结合第九方面,在一种可能的实现方式中,所述根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块,包括:确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系;根据所述对应关系和所述参考块的所述颜色数据生成所述预测块。With reference to the ninth aspect, in a possible implementation manner, the predicted block is generated according to the color data of the reference block and the tenth position coordinate, and the reference block is the eleventh block or the tenth block One of the two blocks includes: determining the positions of the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate respectively and the positions of the four vertices in the reference block The corresponding relationship of coordinates; the predicted block is generated according to the corresponding relationship and the color data of the reference block.
结合第九方面,在一种可能的实现方式中,所述颜色数据中包括所述参考块中每个像素的颜色数据,所述根据所述对应关系和所述参考块的所述颜色数据生成所述预测块,包括:根据所述对应关系生成单应性变换公式;根据所述单应性变换公式和所述每个像素在所述参考图像帧中的位置坐标,确定出所述每个像素在所述预测图像帧中的位置坐标;根据所述每个像素的颜色数据和所述每个限速在所述预测图像帧中的位置坐标生成所述预测块。With reference to the ninth aspect, in a possible implementation manner, the color data includes color data of each pixel in the reference block, and the color data generated according to the corresponding relationship and the color data of the reference block The prediction block includes: generating a homography transformation formula according to the corresponding relationship; determining each pixel according to the homography transformation formula and the position coordinates of each pixel in the reference image frame The position coordinates of the pixels in the predicted image frame; the predicted block is generated according to the color data of each pixel and the position coordinates of each speed limit in the predicted image frame.
结合第九方面,在一种可能的实现方式中,所述参考块包括:第十五顶点,第十六顶点,第十七顶点和第十八顶点,所述确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系,包括:确定所述第十位置坐标与所述第十五顶点的位置坐标为一组对应的位置坐标;确定所述第十七位置坐标与所述第十六顶点的位置坐标为一组对应的位置顶点;确定所述第十八位置坐标与所述第十七顶点的位置坐标为一组对应的位置坐标;确定所述第十九位置坐标与所述第十八顶点的位置坐标为一组对应的位置坐标;其中,所述参考块为四边形,所述第十五顶点相对于所述参考块的中心点的位置与所述第十一块相对于所述第十五块的位置相同;所述第十六顶点相对于所述参考块的中心点的位置与所述第十三块相对于所述第十七块的位置相同;所述第十七顶点相对于所述参考块的中心点的位置与所述第十五块相对于所述第十一块的位置相同;所述第十八顶点相对于所述参考块的中心点的位置与所述第十七块相对于所述第十三块的位置相同。With reference to the ninth aspect, in a possible implementation manner, the reference block includes: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and the determining of the tenth position coordinate, The corresponding relationship between the seventeenth position coordinates, the eighteenth position coordinates and the nineteenth position coordinates respectively and the position coordinates of the four vertices in the reference block, including: determining the tenth position coordinates and the The position coordinates of the fifteenth vertex are a set of corresponding position coordinates; it is determined that the seventeenth position coordinates and the position coordinates of the sixteenth vertex are a set of corresponding position vertices; the eighteenth position coordinates and The position coordinates of the seventeenth vertex are a set of corresponding position coordinates; it is determined that the nineteenth position coordinates and the position coordinates of the eighteenth vertex are a set of corresponding position coordinates; wherein, the reference block is quadrilateral, the position of the fifteenth vertex relative to the center point of the reference block is the same as the position of the eleventh block relative to the fifteenth block; the sixteenth vertex relative to the reference block The position of the center point is the same as the position of the thirteenth block relative to the seventeenth block; the position of the seventeenth vertex relative to the center point of the reference block is the same as that of the fifteenth block relative to the The position of the eleventh block is the same; the position of the eighteenth vertex relative to the center point of the reference block is the same as the position of the seventeenth block relative to the thirteenth block.
举例来说,参考块为正方形,所述第十五顶点是所述参考块左上角的顶点,所述第十六顶点是所述参考块右上角的顶点,所述第十七顶点是所述参考块左上角的顶点,所述第十八顶点是所述参考块右上角的顶点;则所述第十三块是所述第十一块正右侧相邻的一个块,所述第十七块是所述第十一块正下方相邻的一个块,所述第十五块是与所述第十三块和所述第十七块相邻的一个块,且所述第十五块的左上角的顶点与所述第十一块右下角的顶点重合。For example, the reference block is a square, the fifteenth vertex is the vertex in the upper left corner of the reference block, the sixteenth vertex is the vertex in the upper right corner of the reference block, and the seventeenth vertex is the vertex in the upper right corner of the reference block The vertex in the upper left corner of the reference block, the eighteenth vertex is the vertex in the upper right corner of the reference block; then the thirteenth block is a block adjacent to the right side of the eleventh block, and the tenth block The seventh block is a block immediately below the eleventh block, the fifteenth block is a block adjacent to the thirteenth block and the seventeenth block, and the fifteenth block The vertex of the upper left corner of the block coincides with the vertex of the lower right corner of the eleventh block.
结合第九方面,在一种可能的实现方式中,所述根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标,包括:计算所述第十三位置坐标至所述第十五位置坐标的位移向量,得到第一位移向量;根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标。With reference to the ninth aspect, in a possible implementation manner, the sixteenth position coordinates under the second coordinate system are calculated and obtained according to the thirteenth position coordinates and the fifteenth position coordinates, Including: calculating the displacement vector from the thirteenth position coordinate to the fifteenth position coordinate to obtain a first displacement vector; according to the thirteenth position coordinate or the fifteenth position coordinate, and the first proportional The sixteenth position coordinate is obtained by calculating the first displacement vector.
结合第九方面,在一种可能的实现方式中,所述第一比例等于预设置的数值。With reference to the ninth aspect, in a possible implementation manner, the first ratio is equal to a preset value.
可见,在第一比例等于预设置的数值的情况下,电子设备可以快速的确定出第十六位置坐标。It can be seen that in the case that the first ratio is equal to the preset value, the electronic device can quickly determine the sixteenth position coordinates.
结合第九方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述计算得到所述第十六位置坐标之前,所述方法还包括:确定所述第一比例等于第一时间差值的绝对值与第二时间差值的绝对值的比值;所述第一时间差值等于所述预测图像帧在数据流中的时间点与参考帧在所述数据流中的时间点之间的差值;所述第二时间差值等于所述第一图像帧在所述数据流中的时间点与所述第二图像帧在所述数据流中的时间点之间的差值。With reference to the ninth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, the first image frame is located before the second image frame in the data stream, and the calculation obtains Before the sixteenth position coordinate, the method further includes: determining that the first ratio is equal to the ratio of the absolute value of the first time difference value to the absolute value of the second time difference value; the first time difference value 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 value is equal to the first image frame in the data stream The difference between the time point of and the time point of the second image frame in the data stream.
可见,电子设备可以根据预测图像帧和参考图像帧之间的差值确定出第一比例,进而使得预测图像帧展示的场景(相对于参考图像帧,块的位置和缩放程度)与显示预测图像帧的时刻电子设备根据实际运行数据构建的场景更加吻合。It can be seen that the electronic device can determine the first ratio according to the difference between the predicted image frame and the reference image frame, so that the scene displayed by the predicted image frame (relative to the reference image frame, the position of the block and the zoom degree) is different from the displayed predicted image. The moment of the frame is more consistent with the scene constructed by the electronic device based on the actual operating data.
结合第九方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述计算得到所述第十六位置坐标之前, 所述方法还包括:确定所述第一比例等于第一数值与第二数值的比值;所述第一数值等于第一数量加一;所述第二数值等于第二数量加一;所述第一数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量;所述第二数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量。With reference to the ninth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, the first image frame is located before the second image frame in the data stream, and the calculation obtains Before the sixteenth position coordinate, the method further includes: determining that the first ratio is equal to a ratio of a first value to a second value; the first value is equal to the first number plus one; the second value is equal to a second number plus one; the first number is equal to the number of image frames in the data stream that are spaced between the reference image frame and the predicted image frame; the second number is equal to the number of image frames in the data stream The number of image frames spaced between the reference image frame and the predicted image frame.
可见,电子设备可以根据预测图像帧和参考图像帧之间相隔的图像帧的数量确定出第一比例,使得电子设备匀速显示每一帧图像帧的过程中,预测图像帧展示的场景(相对于参考图像帧,块的位置和缩放程度)与显示预测图像帧的时刻电子设备根据实际运行数据构建的场景更加吻合。It can be seen that the electronic device can determine the first ratio according to the number of image frames separated between the predicted image frame and the reference image frame, so that in the process that the electronic device displays each image frame at a constant speed, the scene displayed by the predicted image frame (relative to The reference image frame, block position and zoom level) more closely matches the scene constructed by the electronic device based on the actual operating data at the moment when the predicted image frame is displayed.
结合第九方面,在一种可能的实现方式中,所述根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标,包括:若所述参考图像帧为所述第一图像帧,则根据所述第十三位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标;若所述参考图像帧为所述第二图像帧,则根据所述第十五位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标。With reference to the ninth aspect, in a possible implementation manner, the tenth position coordinate is calculated according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale is calculated to obtain the tenth position. Six position coordinates, including: if the reference image frame is the first image frame, calculating the sixteenth position according to the thirteenth position coordinates and the first displacement vector of the first scale coordinates; if the reference image frame is the second image frame, the sixteenth position coordinate is obtained by calculating the fifteenth position coordinate and the first displacement vector of the first scale.
结合第九方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标之前,所述方法还包括:确定所述第一图像帧和所述第二图像帧中的一帧图像帧为所述参考图像帧;确定所述第一图像帧和所述第二图像帧中除所述参考图像帧之外的另一帧图像帧为匹配图像帧;针对所述参考图像帧进行块的划分,得到所述参考块;根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块;其中,若所述参考块为所述第十一块,则所述匹配块为所述第十二块;若所述参考块为所述第十二块,则所述匹配为所述第十一块。With reference to the ninth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, the first image frame is located before the second image frame in the data stream, and the determining prediction The eleventh vertex of the block is before the tenth position coordinate in the predicted image frame, and the method further includes: determining one image frame in the first image frame and the second image frame as the reference image frame ; Determine that another image frame other than the reference image frame in the first image frame and the second image frame is a matching image frame; Carry out block division for the reference image frame to obtain the reference block; determine according to the matching algorithm that the block that matches the reference block in the matched image frame is a matching block; wherein, if the reference block is the eleventh block, the matching block is the first block twelve blocks; if the reference block is the twelfth block, the matching is the eleventh block.
其中,电子设备可以指定第一图像帧或第二图像帧中的一帧图像帧为参考图像帧,例如电子设备可以指定在数据流中考前的第一图像帧为参考图像帧。可选的,电子设备可以基于预测图像帧相对于第一图像帧和第二图像帧的位置确定出第一图像帧和第二图像帧中的一帧图像帧为参考图像帧;具体的,若预测图像帧在数据流中位于第一图像帧和第二图像帧之间,则确定第一图像帧为参考图像帧;若预测图像帧在数据流中位于第一图像帧和第二图像帧之后,则确定第二图像帧为参考图像帧。The electronic device may designate the first image frame or one of the second image frames as the reference image frame, for example, the electronic device may designate the first image frame tested in the data stream as the reference image frame. Optionally, the electronic device may determine, based on the position of the predicted image frame relative to the first image frame and the second image frame, that one image frame in the first image frame and the second image frame is the reference image frame; specifically, if If the predicted image frame is located between the first image frame and the second image frame in the data stream, the first image frame is determined as the reference image frame; if the predicted image frame is located after the first image frame and the second image frame in the data stream , the second image frame is determined to be the reference image frame.
可见,电子设备可以对参考图像帧进行块划分,并以参考图像帧中的块为单位搜寻匹配图像帧中的块,进而确定出第一图像帧和第二图像帧中相互匹配的块。It can be seen that the electronic device can divide the reference image frame into blocks, and search for blocks in the matching image frame in units of blocks in the reference image frame, and then determine the blocks that match each other in the first image frame and the second image frame.
结合第九方面,在一种可能的实现方式中,所述根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块,包括:确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块;所述第一区域是所述匹配图像帧中以参考位置坐标为中心,第一面积的预设形状的区域,所述参考位置坐标是所述参考块在所述参考图像帧中的位置坐标。With reference to the ninth aspect, in a possible implementation manner, the determining according to the matching algorithm that the block that matches the reference block in the matching image frame is a matching block includes: determining the first block of the matching image frame. The block with the highest similarity with the reference block in a region is the matching block; the first region is the region of the matching image frame with the reference position coordinates as the center and the preset shape of the first area, the The reference position coordinates are the position coordinates of the reference block in the reference image frame.
可见,电子设备可以根据参考块的位置坐标确定出匹配图像帧中的第一区域,可能在一定程度上缩小了搜索范围,进而有利于提升块的匹配效率和匹配的准确性。It can be seen that the electronic device can determine the first region in the matching image frame according to the position coordinates of the reference block, which may narrow the search range to a certain extent, thereby helping to improve the matching efficiency and matching accuracy of the block.
结合第九方面,在一种可能的实现方式中,所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述方法还包括:根据所述参考块的参考深度值计算得到所述第一面积,其中,所述参考深度值越大,计算得到的所述第一面积越小。With reference to the ninth aspect, in a possible implementation manner, before the block with the highest similarity to the reference block in the first region of the matched image frame is determined as the matched block, the method further includes: The first area is obtained by calculation according to the reference depth value of the reference block, wherein the larger the reference depth value is, the smaller the first area obtained by calculation is.
可见,电子设备可以根据深度值的大小调整第一面积的大小,有利于提升确定匹配块的 效率。It can be seen that the electronic device can adjust the size of the first area according to the depth value, which is beneficial to improve the efficiency of determining the matching block.
结合第九方面,在一种可能的实现方式中,所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述方法还包括:若所述参考块的参考深度值大于等于第一阈值,确定所述第一面积等于第一预设面积;若所述参考深度值大于第二阈值且小于所述第一阈值,根据所述参考深度值计算得到所述第一面积,其中,所述参考深度值越大,所述第一面积越小;若所述参考深度值小于等于所述第二阈值,确定所述第一面积等于第二预设面积;其中,所述第一阈值大于所述第二阈值,所述第二预设面积大于所述第一预设面积。With reference to the ninth aspect, in a possible implementation manner, before the block with the highest similarity to the reference block in the first region of the matched image frame is determined as the matched block, the method further includes: If the reference depth value of the reference block is greater than or equal to the first threshold, it is determined that the first area is equal to the first preset area; if the reference depth value is greater than the second threshold and less than the first threshold, according to the reference The depth value is calculated to obtain the first area, wherein, the larger 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, it is determined that the first area is equal to the first area. Two preset areas; wherein the first threshold is greater than the second threshold, and the second preset area is greater than the first preset area.
例如,深度值的取值范围可以大于等于0小于等于1,第一阈值等于0.8,第二阈值等于0.2,第一预设面积可以是参考块的面积的两倍;第二预设面积可以等于参考图像帧的面积。For example, the value range of the depth value may be greater than or equal to 0 and less than or equal to 1, the first threshold may be equal to 0.8, the second threshold may be equal to 0.2, the first preset area may be twice the area of the reference block; the second preset area may be equal to The area of the reference image frame.
可见,在深度值较大时,电子设备在一个小范围内搜寻参考块的匹配块;在深度值较小时,电子设备可以在整个图像帧内搜寻参考块的匹配块。有利于提升确定匹配块的效率。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; when the depth value is small, the electronic device can search for the matching block of the reference block in the entire image frame. It is beneficial to improve the efficiency of determining matching blocks.
第十方面,本申请提供一种电子设备,该电子设备包括:一个或多个处理器和存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:根据第十一块和第十二块的深度值、所述第十一块和所述第十二块在图像帧中位置坐标,确定预测块的第十一顶点在预测图像帧中的第十位置坐标;其中,所述第十一块为第一图像帧中的一个块;所述第十二块为第二图像帧中根据匹配算法确定出的与所述第十一块匹配的块;根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块;生成所述预测图像帧,所述预测图像帧包括所述预测块。In a tenth aspect, the present application provides an electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, and the memory is used to store computer program codes, The computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to execute: the eleventh block according to the depth values of the eleventh and twelfth blocks and the position coordinates of the twelfth block in the image frame, determine the tenth position coordinate of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame The twelfth block is the block that matches the eleventh block determined according to the matching algorithm in the second image frame; According to the color data of the reference block and the tenth position coordinate, a prediction block is generated, and the The reference block is one of the eleventh block or the twelfth block; the predicted image frame is generated, and the predicted image frame includes the predicted block.
结合第十方面,在一种可能的实现方式中,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述第一坐标系是二维坐标系,在所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:根据所述第十一块的第一深度值和所述第十一块在所述第一坐标系下的第十二位置坐标,计算得到第二坐标系下的第十三位置坐标,所述第二坐标系为三维坐标系;根据所述第十二块的第二深度值和所述第十二块在所述第一坐标系下的第十四位置坐标,计算得到所述第二坐标系下的第十五位置坐标;根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标;根据所述第十六位置坐标,计算得到在所述第一坐标系下的所述第十位置坐标。With reference to the tenth aspect, in a possible implementation manner, the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system. In terms of predicting the tenth position coordinate of the eleventh vertex in the image frame, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: according to the first position of the eleventh block A depth value and the twelfth position coordinate of the eleventh block under the first coordinate system are calculated to obtain the thirteenth position coordinate under the second coordinate system, and the second coordinate system is a three-dimensional coordinate system; According to the second depth value of the twelfth block and the fourteenth position coordinate of the twelfth block under the first coordinate system, the fifteenth position coordinate under the second coordinate system is obtained by calculating; According to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates under the second coordinate system are calculated; according to the sixteenth position coordinates, the first position coordinates are calculated and obtained the tenth position coordinate in the coordinate system.
结合第十方面,在一种可能的实现方式中,在所述生成预测块之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标;其中,所述第十三块是与所述第十一块相邻的一个块,所述第十四块是与所述第十二块相邻的一个块,所述第十三块和所述第十四块是根据所述匹配算法确定出的相互匹配的块;根据第十五块和第十六块的深度值、所述第十五块和所述第十六块在图像帧中位置坐标,确定所述预测块的第十三顶点在所述预测图像帧中的第十八位置坐标;其中,所述第十五块是与所述第十三块相邻的一个块,所述第十六块是与所述第十四块相邻的一个块,所述第十五块和所述第十六块是根据所述匹配算法确定出的相互匹配的块;根据第十七块和第十八块的深度值、所述第十七块和所述第十八块在图像帧中位置坐标, 确定所述预测块的第十四顶点在所述预测图像帧中的第十九位置坐标;其中,所述第十七块是与所述第十一块和所述第十五块均相邻的一个块,所述第十八块是与所述第十二块和所述第十六块均相邻的一个块,所述第十七块和所述第十八块是根据所述匹配算法确定出的相互匹配的块。With reference to the tenth aspect, in a possible implementation manner, before generating the prediction block, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: according to the tenth aspect The depth values of the third block and the fourteenth block, and the position coordinates of the thirteenth block and the fourteenth block in the image frame, determine the twelfth vertex of the prediction block in the prediction image frame. seventeen position coordinates; 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 is a block adjacent to the twelfth block. The thirteenth block and the fourteenth block are mutually matched blocks determined according to the matching algorithm; according to the depth values of the fifteenth block and the sixteenth block, the fifteenth block and the sixteenth block the position coordinates of the block in the image frame, and determine the eighteenth position coordinates of the thirteenth vertex of the predicted block in the predicted image frame; wherein, the fifteenth block is 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 ; According to the depth values of the seventeenth block and the eighteenth block, the position coordinates of the seventeenth block and the eighteenth block in the image frame, determine that the fourteenth vertex of the predicted block is in the predicted image The nineteenth position coordinate in the frame; wherein, the seventeenth block is a block adjacent to both the eleventh block and the fifteenth block, and the eighteenth block is a block adjacent to the eighteenth block. The twelve blocks and the sixteenth block are both adjacent blocks, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.
结合第十方面,在一种可能的实现方式中,图像帧中的位置坐标为在第一坐标系下的位置坐标,在所述根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:根据所述第十三块的第三深度值和所述第十三块在所述第一坐标系下的第二十位置坐标,计算得到第二坐标系下的第二十一位置坐标,所述第二坐标系为三维坐标系;根据所述第十四块的第二深度值和所述第十四块在所述第一坐标系下的第第二十二位置坐标,计算得到所述第二坐标系下的第二十三位置坐标;根据所述第二十一位置坐标和所述第二十三位置坐标,计算得到在所述第二坐标系下的第二十四位置坐标;根据所述第二十四位置坐标,计算得到在所述第一坐标系下的所述第十七位置坐标。With reference to the tenth aspect, in a possible implementation manner, the position coordinates in the image frame are the position coordinates in the first coordinate system, and in the depth value according to the thirteenth block and the fourteenth block, the The location coordinates of the thirteenth block and the fourteenth block in the image frame, determining the seventeenth location coordinates of the twelfth vertex of the predicted block in the predicted image frame, the one or more processing a controller, specifically for invoking the computer instructions to cause the electronic device to execute: according to the third depth value of the thirteenth block and the twentieth position of the thirteenth block in the first coordinate system coordinates, the twenty-first position coordinates under the second coordinate system are calculated, and the second coordinate system is a three-dimensional coordinate system; according to the second depth value of the fourteenth block and the fourteenth block in the The twenty-second position coordinate under the first coordinate system is calculated to obtain the twenty-third position coordinate under the second coordinate system; according to the twenty-first position coordinate and the twenty-third position coordinate, The twenty-fourth position coordinate under the second coordinate system is obtained by calculation; according to the twenty-fourth position coordinate, the seventeenth position coordinate under the first coordinate system is calculated and obtained.
结合第十方面,在一种可能的实现方式中,在所述根据参考块的颜色数据和所述第十位置坐标,生成预测块方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系;根据所述对应关系和所述参考块的所述颜色数据生成所述预测块。With reference to the tenth aspect, in a possible implementation manner, 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 call the the computer instructions to cause the electronic device to execute: determine the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate respectively and the four vertices in the reference block The corresponding relationship of the position coordinates of the reference block; the predicted block is generated according to the corresponding relationship and the color data of the reference block.
结合第十方面,在一种可能的实现方式中,在所述颜色数据中包括所述参考块中每个像素的颜色数据,所述根据所述对应关系和所述参考块的所述颜色数据生成所述预测块方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:根据所述对应关系生成单应性变换公式;根据所述单应性变换公式和所述每个像素在所述参考图像帧中的位置坐标,确定出所述每个像素在所述预测图像帧中的位置坐标;根据所述每个像素的颜色数据和所述每个限速在所述预测图像帧中的位置坐标生成所述预测块。With reference to the tenth aspect, in a possible implementation manner, the color data includes color data of each pixel in the reference block, and the color data according to the corresponding relationship and the reference block is included in the color data. In terms of generating the prediction block, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to perform: generating a homography transformation formula according to the correspondence; generating a homography transformation formula according to the homography; The transformation formula and the position coordinates of each pixel in the reference image frame determine the position coordinates of each pixel in the predicted image frame; according to the color data of each pixel and the The predicted block is generated from the position coordinates of each rate limit in the predicted image frame.
结合第十方面,在一种可能的实现方式中,所述参考块包括:第十五顶点,第十六顶点,第十七顶点和第十八顶点,在所述确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:确定所述第十位置坐标与所述第十五顶点的位置坐标为一组对应的位置坐标;确定所述第十七位置坐标与所述第十六顶点的位置坐标为一组对应的位置顶点;确定所述第十八位置坐标与所述第十七顶点的位置坐标为一组对应的位置坐标;确定所述第十九位置坐标与所述第十八顶点的位置坐标为一组对应的位置坐标;其中,所述参考块为四边形,所述第十五顶点相对于所述参考块的中心点的位置方向与所述第十一块相对于所述第十五块的位置方向相同;所述第十六顶点相对于所述参考块的中心点的位置方向与所述第十三块相对于所述第十七块的位置方向相同;所述第十七顶点相对于所述参考块的中心点的位置方向与所述第十五块相对于所述第十一块的位置方向相同;所述第十八顶点相对于所述参考块的中心点的位置方向与所述第十七块相对于所述第十三块的位置方向相同。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, and in the determining of the tenth position coordinate , the corresponding relationship between the seventeenth position coordinates, the eighteenth position coordinates and the nineteenth position coordinates respectively and the position coordinates of the four vertices in the reference block, the one or more processors, specifically For invoking the computer instruction to cause the electronic device to execute: determine that the tenth position coordinate and the position coordinate of the fifteenth vertex are a set of corresponding position coordinates; determine that the seventeenth position coordinate and all The position coordinates of the sixteenth vertex are a set of corresponding position vertices; it is determined that the eighteenth position coordinates and the position coordinates of the seventeenth vertex are a set of corresponding position coordinates; the nineteenth position coordinates are determined The position coordinates corresponding to the eighteenth vertex are a set of position coordinates; wherein the reference block is a quadrilateral, and the position direction of the fifteenth vertex relative to the center point of the reference block is the same as that of the tenth vertex. The position direction of a block relative to the fifteenth block is the same; the position direction of the sixteenth vertex relative to the center point of the reference block is the same as the position 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; the eighteenth vertex relative to the The position direction of the center point of the reference block is the same as the position direction of the seventeenth block relative to the thirteenth block.
结合第十方面,在一种可能的实现方式中,在所述根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标方面,所述一个或多个处理器, 具体用于调用所述计算机指令以使得所述电子设备执行:计算所述第十三位置坐标至所述第十五位置坐标的位移向量,得到第一位移向量;根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标。With reference to the tenth aspect, in a possible implementation manner, in the calculation according to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates under the second coordinate system are obtained by calculation In an aspect, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: calculate a displacement vector from the thirteenth position coordinate to the fifteenth position coordinate, and obtain the first Displacement vector; the sixteenth position coordinate is obtained by calculating according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale.
结合第十方面,在一种可能的实现方式中,所述第一比例等于预设置的数值。With reference to the tenth aspect, in a possible implementation manner, the first ratio is equal to a preset value.
结合第十方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,在所述计算得到所述第十六位置坐标之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:确定所述第一比例等于第一时间差值的绝对值与第二时间差值的绝对值的比值;所述第一时间差值等于所述预测图像帧在数据流中的时间点与参考帧在所述数据流中的时间点之间的差值;所述第二时间差值等于所述第一图像帧在所述数据流中的时间点与所述第二图像帧在所述数据流中的时间点之间的差值。With reference to the tenth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, and the first image frame is located before the second image frame in the data stream. Before obtaining the sixteenth position coordinates, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: determining that the first ratio is equal to the absolute value of the first time difference The ratio 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 value 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.
结合第十方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,在所述计算得到所述第十六位置坐标之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:确定所述第一比例等于第一数值与第二数值的比值;所述第一数值等于第一数量加一;所述第二数值等于第二数量加一;所述第一数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量;所述第二数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量。With reference to the tenth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, and the first image frame is located before the second image frame in the data stream. Before obtaining the sixteenth position coordinates, 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 the difference between the first value and the second value. the first value is equal to the first number plus one; the second value is equal to the second number plus one; the first number is equal to the difference between the reference image frame and the predicted image frame in the data stream the number of image frames spaced between; the second number is equal to the number of image frames spaced between the reference image frame and the predicted image frame in the data stream.
结合第十方面,在一种可能的实现方式中,在所述根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:若所述参考图像帧为所述第一图像帧,则根据所述第十三位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标;若所述参考图像帧为所述第二图像帧,则根据所述第十五位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标。With reference to the tenth aspect, in a possible implementation manner, in the calculation according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale, the In terms of position coordinates, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: if the reference image frame is the first image frame, according to the first image frame The thirteenth position coordinates and the first displacement vector of the first scale are calculated to obtain the sixteenth position coordinates; if the reference image frame is the second image frame, the fifteenth position coordinates are calculated according to the The sixteenth position coordinate is obtained by calculating with the first displacement vector of the first scale.
结合第十方面,在一种可能的实现方式中,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,在所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:确定所述第一图像帧和所述第二图像帧中的一帧图像帧为所述参考图像帧;确定所述第一图像帧和所述第二图像帧中除所述参考图像帧之外的另一帧图像帧为匹配图像帧;针对所述参考图像帧进行块的划分,得到所述参考块;根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块;其中,若所述参考块为所述第十一块,则所述匹配块为所述第十二块;若所述参考块为所述第十二块,则所述匹配为所述第十一块。With reference to the tenth aspect, in a possible implementation manner, the image frame where the reference block is located is a reference image frame, and the first image frame is located before the second image frame in the data stream. The eleventh vertex of the predicted block is before the tenth position coordinate in the predicted image frame, and the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute: determine the first image frame and one image frame in the second image frame is the reference image frame; determine another image frame other than the reference image frame in the first image frame and the second image frame In order to match the image frame; the reference image frame is divided into blocks to obtain the reference block; according to the matching algorithm, the block that matches the reference block in the matched image frame is determined as a matching block; wherein, if the If the reference block is the eleventh block, the matching block is the twelfth block; if the reference block is the twelfth block, the matching block is the eleventh block.
结合第十方面,在一种可能的实现方式中,在所述根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块;所述第一区域是所述匹配图像帧中以参考位置坐标为中心,第一面积的预设形状的区域,所述参考位置坐标是所述参考块在所述参考图像帧中的位置坐标。With reference to the tenth aspect, in a possible implementation manner, in the aspect of determining, according to the matching algorithm, that the block that matches the reference block in the matched image frame is a matching block, the one or more processors , which is specifically used to invoke the computer instruction to cause the electronic device to execute: determine the block with the highest similarity to the reference block in the first region of the matching image frame as the matching block; the first region is The matching image frame is a region of a preset shape with a first area centered on a reference position coordinate, where the reference position coordinate is the position coordinate of the reference block in the reference image frame.
结合第十方面,在一种可能的实现方式中,在所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述一个或多个处理器,还用于调用所述计 算机指令以使得所述电子设备执行:根据所述参考块的参考深度值计算得到所述第一面积,其中,所述参考深度值越大,计算得到的所述第一面积越小。With reference to the tenth aspect, in a possible implementation manner, before the determining that the block with the highest similarity to the reference block in the first region of the matching image frame is the matching block, the one or more a processor is further configured to invoke the computer instructions to cause the electronic device to perform: calculating and obtaining the first area according to the reference depth value of the reference block, wherein the larger the reference depth value, the greater the calculated value. The first area is smaller.
结合第十方面,在一种可能的实现方式中,在所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:若所述参考块的参考深度值大于等于第一阈值,确定所述第一面积等于第一预设面积;若所述参考深度值大于第二阈值且小于所述第一阈值,根据所述参考深度值计算得到所述第一面积,其中,所述参考深度值越大,所述第一面积越小;若所述参考深度值小于等于所述第二阈值,确定所述第一面积等于第二预设面积;其中,所述第一阈值大于所述第二阈值,所述第二预设面积大于所述第一预设面积。With reference to the tenth aspect, in a possible implementation manner, before the determining that the block with the highest similarity to the reference block in the first region of the matching image frame is the matching block, the one or more a processor, further configured to invoke the computer instructions to cause the electronic device to execute: if the reference depth value of the reference block is greater than or equal to a first threshold, determine that the first area is equal to a first preset area; The reference depth value is greater than the second threshold value and smaller than the first threshold value, and the first area is calculated according to the reference depth value, wherein the larger 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, it is determined that the first area is equal to a second preset area; wherein, the first threshold is greater than the second threshold, and the second preset area is greater than the first a preset area.
第十一方面,提供一种图像帧的生成方法,该方法可包括:在第一绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入第八存储空间,作为第二绘制结果;根据所述第一绘制结果和所述第二绘制结果生成第七图像帧;在第二绘制周期时,根据所述目标应用程序的绘制指令,当所述绘制指令满足所述第一条件时,将绘制结果存入所述第七存储空间,作为第三绘制结果,当所述绘制指令满足所述第二条件时,不进行绘制;根据所述第三绘制结果和所述第二绘制结果生成第八图像帧。其中,绘制指令满足第一条件时生成的绘制结果在显示屏上呈现的效果可以是动态的界面。绘制指令满足第二条件时生成的绘制结果在显示屏上呈现的效果可以是控件。这样,实施第一方面的方法,电子设备可根据目标应用程序的绘制指令,将根据不同条件的绘制指令得到的绘制结果存入不同的存储空间中,使得在两个绘制周期中可共用一份绘制结果;减小了绘制指令满足第二条件时电子设备的绘制时长,降低了电子设备的功耗。An eleventh aspect provides a method for generating an image frame, the method may include: in a first drawing cycle, according to a drawing instruction of a target application, when the drawing instruction satisfies a first condition, storing a drawing result in a The seventh storage space, as the first drawing result, when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space as the second drawing result; according to the first drawing result and the The second drawing result generates a seventh image frame; in the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space, as a third drawing result, when the drawing instruction satisfies the second condition, no drawing is performed; an eighth image frame is generated according to the third drawing result and the second drawing result. Wherein, the rendering result generated when the rendering instruction satisfies the first condition may present a dynamic interface on the display screen. The effect that the drawing result generated when the drawing instruction satisfies the second condition is presented on the display screen may 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 of different conditions in different storage spaces according to the drawing instructions of the target application, so that one copy can be shared in the two drawing cycles. Drawing result; reducing the drawing time of the electronic device when the drawing instruction satisfies the second condition, and reducing the power consumption of the electronic device.
结合第十一方面,在一种可能的实现方式中,该方法还包括:在第三绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入所述第七存储空间中,作为第四绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入所述第八存储空间,作为第五绘制结果,所述第三绘制周期位于所述第一绘制周期之后;根据所述第四绘制结果和所述第五绘制结果生成第九图像帧;在第四绘制周期时,根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果;根据第六绘制结果和所述第七绘制结果生成第十图像帧;所述第七绘制结果为在第五绘制周期中,所述目标应用程序的绘制指令满足所述第二条件时得到的绘制结果,所述第五绘制周期在所述第四绘制周期之前。其中,本示例可用于插帧场景中。电子设备可根据两个绘制指令满足第一条件时的绘制结果生成一个预测的第六绘制结果;并结合之前的绘制周期中在绘制指令满足第二条件时得到的第七绘制结果生成预测的插入图像帧。由于在生成预测的插入图像帧的过程中,电子设备可以复用第七绘制结果,降低了生成插入图像帧时的功耗;且在生成插入图像帧的过程中由于第七绘制结果在图像帧中呈现的效果无需进行预测计算,电子设备只计算根据两个绘制指令满足第一条件时的绘制结果进行预测计算,相较于通用的插帧方法,无需根据整帧图像帧的数据进行计算,进一步降低了电子设备的功耗。With reference to the eleventh aspect, in a possible implementation manner, the method further includes: in the third drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, storing the drawing result in the into the seventh storage space, as the fourth drawing result, when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space, as the fifth drawing result, the third The drawing period is after the first drawing period; the ninth image frame is generated according to the fourth drawing result and the fifth drawing result; in the fourth drawing period, the first drawing result and the fourth drawing result are generated according to the fourth drawing period The drawing result generates the sixth drawing result; the tenth image frame is generated according to the sixth drawing result and the seventh drawing result; the seventh drawing result is that in the fifth drawing cycle, the drawing instruction of the target application satisfies all requirements. The drawing result obtained under the second condition, the fifth drawing cycle is before the fourth drawing cycle. Among them, this example can be used in interpolated frames. The electronic device may generate a predicted sixth rendering result according to the rendering results when the two rendering instructions satisfy the first condition; and generate the predicted insertion in combination with the seventh rendering result obtained when the rendering instructions satisfy the second condition in the previous rendering cycle image frame. In the process of generating the predicted inserted image frame, the electronic device can reuse the seventh rendering result, which reduces the power consumption when generating the inserted image frame; and in the process of generating the inserted image frame, the seventh rendering result is There is no need to perform prediction calculation for the effect presented in the . The electronic device only calculates the prediction calculation based on the rendering result when the two rendering instructions satisfy the first condition. The power consumption of the electronic device is further reduced.
结合第十一方面,在一种可能的实现方式中,在所述电子设备根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,该方法包括:将所述第一绘制结果和所述第二绘制结果存入第九存储空间中;在所述第九存储空间中根据所述第一绘制结果和所述第二绘制结 果生成所述第七图像帧。With reference to the eleventh aspect, in a possible implementation manner, in that the electronic device generates a seventh image frame according to the first drawing result and the second drawing result, the method includes: The drawing result and the second drawing result are stored in a ninth storage space; and the seventh image frame is generated in the ninth storage space according to the first drawing result and the second drawing result.
结合第十一方面,在一种可能的实现方式中,在所述根据所述第四绘制结果和所述第五绘制结果生成第九图像帧方面,该方法包括:将所述第四绘制结果和所述第五绘制结果存入所述第九存储空间;在所述第九存储空间中根据所述第四绘制结果和所述第五绘制结果生成所述第九图像帧。With reference to the eleventh aspect, in a possible implementation manner, in the aspect of generating a ninth image frame according to the fourth rendering result and the fifth rendering result, the method includes: converting the fourth rendering result and the fifth rendering result is stored in the ninth storage space; and the ninth image frame is generated in the ninth storage space according to the fourth rendering result and the fifth rendering result.
结合第十一方面,在一种可能的实现方式中,在所述根据第六绘制结果和所述第七绘制结果生成第十图像帧方面,该方法包括:将所述第六绘制结果和所述第七绘制结果存入所述第九存储空间;在所述第九存储空间中根据所述第六绘制结果和所述第七绘制结果生成所述第十图像帧。With reference to the eleventh aspect, in a possible implementation manner, in the aspect of generating the tenth image frame according to the sixth rendering result and the seventh rendering result, the method includes: combining the sixth rendering result with the all The seventh rendering result is stored in the ninth storage space; and the tenth image frame is generated in the ninth storage space according to the sixth rendering result and the seventh rendering result.
结合第十一方面,在一种可能的实现方式中,所述第七存储空间由第十存储空间和第十一存储空间构成,所述第一绘制结果存储在所述第十存储空间中,所述第四绘制结果存储在所述第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,包括:将所述第一绘制结果存入所述第十一存储空间中;在所述第十一存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。With reference to the eleventh aspect, in a possible implementation manner, the seventh storage space consists of a tenth storage space and an eleventh storage space, and the first drawing result is stored in the tenth storage space, The fourth drawing result is stored in the eleventh storage space, and generating a sixth drawing result according to the first drawing result and the fourth drawing result includes: storing the first drawing result storing in the eleventh storage space; and generating the sixth drawing result in the eleventh storage space according to the first drawing result and the fourth drawing result.
结合第十一方面,在一种可能的实现方式中,所述第七存储空间由至少三个存储空间构成,所述至少三个存储空间包括第十存储空间,第十一存储空间和第十二存储空间;所述第一绘制结果存储在第十存储空间中,所述第四绘制结果存储在第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,包括:将所述第一绘制结果和所述第四绘制结果存入第十二存储空间;在所述第十二存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。With reference to the eleventh aspect, in a possible implementation manner, the seventh storage space consists of at least three storage spaces, and the at least three storage spaces include a tenth storage space, an eleventh storage space and a tenth storage space Two storage spaces; the first drawing result is stored in the tenth storage space, the fourth drawing result is stored in the eleventh storage space, and the first drawing result and the fourth drawing result are stored in the eleventh storage space. Aspects of generating a sixth drawing result include: storing the first drawing result and the fourth drawing result in a twelfth storage space; storing the first drawing result and the fourth drawing result in the twelfth storage space according to the The fourth rendering result generates the sixth rendering result.
结合第十一方面,在一种可能的实现方式中,所述第三绘制周期与所述第四绘制周期相邻;所述第五绘制周期与所述第三绘制周期为同一绘制周期,所述第五绘制结果和所述第七绘制结果为同一绘制结果。在生成插入图像帧时,电子设备可复用用于生成前一帧图像的绘制结果,降低了电子设备的功耗。With reference to the eleventh aspect, in a possible implementation manner, the third drawing period is adjacent to the fourth drawing period; the fifth drawing period and the third drawing period are the same drawing period, so The fifth drawing result and the seventh drawing result are the same drawing result. When generating the inserted image frame, the electronic device can reuse the drawing result used to generate the image of the previous frame, which reduces the power consumption of the electronic device.
结合第十一方面,在一种可能的实现方式中,在所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,包括:将所述第二绘制结果存入所述第七存储空间中;在所述第七存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。With reference to the eleventh aspect, in a possible implementation manner, in the aspect of generating a seventh image frame according to the first drawing result and the second drawing result, the method includes: storing the second drawing result in a In the seventh storage space; the seventh image frame is generated in the seventh storage space according to the first drawing result and the second drawing result.
结合第十一方面,在一种可能的实现方式中,应用该方法的电子设备包括计数单元;所述计数单元的初始化数值为第一数值,所述计数单元的数值每更新一次在第一数值和第二数值之间切换一次;所述计数单元在绘制周期开始的时刻进行更新;在一个绘制周期中,若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;若更新后的所述计数单元的数值为第一数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。可见,通过设置计数单元,可以使电子设备在根据目标应用程序的绘制指令绘制的过程中,每两个相邻绘制周期共用一个绘制指令满足第二条件时得到的绘制结果,减少了电子设备绘制过程中的数据处理量,降低了电子设备的功耗。In conjunction with the eleventh aspect, in a possible implementation manner, the electronic device applying the method includes a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated at the first value every time. and the second value is switched once; the counting unit is updated at the moment when the drawing cycle starts; in a drawing cycle, if the updated value of the counting unit is the second value, then at the moment when the drawing cycle starts Empty the eighth storage space; and when the drawing instruction satisfies the second condition, store the drawing result in the eighth storage space; if the updated value of the counting unit is the first value, then draw When the cycle starts, the second storage unit is not emptied; and when the drawing instruction satisfies the second condition, the drawing is not performed. It can be seen that by setting the counting unit, in the process of drawing according to the drawing instruction of the target application program, the electronic device can share a drawing result obtained when the drawing instruction satisfies the second condition for every two adjacent drawing cycles, reducing the drawing result of the electronic device. The amount of data processing in the process reduces the power consumption of electronic equipment.
结合第十一方面,在一种可能的实现方式中,所述方法还包括:在第三绘制周期时,根据所述第一绘制结果和所述第三绘制结果生成第四绘制结果;根据所述第二绘制结果和所述第四绘制结果生成第九图像帧。With reference to the eleventh aspect, in a possible implementation manner, the method further includes: during a third drawing cycle, generating a fourth drawing result according to the first drawing result and the third drawing result; The second rendering result and the fourth rendering result generate a ninth image frame.
结合第十一方面,在一种可能的实现方式中,应用该方法的电子设备包括计数单元,所 述计数单元的初始化数值为第一数值,所述计数单元按照第一数值,第二数值,第三数值的顺序在三个数值间进行重复的更新切换,所述计数单元在绘制周期开始的时刻进行更新,在一个绘制周期中,若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;若更新后的所述计数单元的数值为第一数值或第三数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。可见,通过设置计数单元,可以使电子设备在根据目标应用程序的绘制指令绘制的过程中,每三个绘制周期共用一个绘制指令满足第二条件时得到的绘制结果,减少了电子设备绘制过程中的数据处理量,降低了电子设备的功耗。With reference to the eleventh aspect, in a possible implementation manner, the electronic device applying the method includes a counting unit, the initialization value of the counting unit is a first value, and the counting unit is based on the first value, the second value, The sequence of the third numerical value is repeatedly updated and switched between the three numerical values, and the counting unit is updated at the moment when the drawing cycle starts. In one drawing cycle, if the updated value of the counting unit is the second numerical value, Then clear the eighth storage space at the moment when the drawing cycle starts; and when the drawing instruction satisfies the second condition, store the drawing result into the eighth storage space; if the updated value of the counting unit is If the first value or the third value is used, the second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed. It can be seen that by setting the counting unit, in the process of drawing according to the drawing instruction of the target application, the electronic device can share a drawing result obtained when the drawing instruction satisfies the second condition every three drawing cycles, which reduces the number of times in the drawing process of the electronic device. The amount of data processing, reduces the power consumption of electronic equipment.
结合第十一方面,在一种可能的实现方式中,所述第九存储空间由至少两个存储空间构成,所述至少两个存储空间在目标应用程序运行时根据所述目标应用程序的第一指令在第一状态和第二状态之间进行轮换;在同一时间点,所述至少两个存储空间中仅有一个存储空间处于所述第一状态,其余的所述存储空间处于所述第二状态;所述至少两个存储空间处于所述第一状态时,所述至少两个存储空间中的图像帧可传输至显示设备显示;所述至少两个存储空间处于所述第二状态时,所述电子设备可在所述至少两个存储空间中进行绘制;相邻的两个绘制周期生成的两帧图像帧分别存储在所述第九存储空间中的两个不同的存储空间中。可见,电子设备可以将存储有图像帧的存储空间进行轮换,在显示前一帧图像帧的过程中绘制下一帧图像帧,提高了电子设备生成和显示图像帧的效率。With reference to the eleventh 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 based on the first storage space of the target application when the target application is running. An instruction alternates between a first state and a second state; 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 first state Two states; 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 a display device for display; when the at least two storage spaces are in the second state , the electronic device can perform drawing in the at least two storage spaces; two image frames generated by two adjacent drawing cycles are respectively stored in two different storage spaces in the ninth storage space. It can be seen that the electronic device can rotate the storage space in which the image frames are stored, and draw the next image frame in the process of displaying the previous image frame, which improves the efficiency of generating and displaying the image frame by the electronic device.
结合第十一方面,在一种可能的实现方式中,其特征在于,所述第一条件为:绘制指令中包含启用深度测试的指令;所述第二条件为:绘制指令中包含关闭深度测试的指令。可见,通过开启或关闭深度测试的指令,实现对于绘制结果的划分,进而达到复用用于显示空间的图层,在影响根据图像帧的显示效果较小甚至不影响显示效果的条件下,减小绘制图像帧过程中的数据处理量,降低了电子设备的功耗。With reference to the eleventh aspect, in a possible implementation manner, the first condition is: the drawing instruction includes an instruction to enable depth testing; the second condition is: the drawing instruction includes an instruction to disable depth testing instruction. It can be seen that by turning on or off the depth test command, the division of the drawing results is achieved, and then the layers used for the display space are reused. The amount of data processing in the process of drawing image frames is small, which reduces the power consumption of electronic devices.
结合第十一方面,在一种可能的实现方式中,任意两个相邻的绘制周期的时间节点为所述目标应用程序调用第二指令的时间点。其中,第一指令和第二指令可以为同一指令。即电子设备每轮换一次存储有图像帧的存储空间时,可视为相邻两个绘制周期中前一个绘制周期的结束和后一个绘制周期的开始。With reference to the eleventh aspect, in a possible implementation manner, the time nodes of any two adjacent drawing cycles are the time points at which the target application invokes the second instruction. Wherein, the first instruction and the second instruction may be the same instruction. That is, each time the electronic device rotates the storage space in which the image frame is stored, it 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.
第十二方面,提供一种电子设备,该电子设备包括:一个或多个处理器和存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:在第一绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入第八存储空间,作为第二绘制结果;根据所述第一绘制结果和所述第二绘制结果生成第七图像帧;在第二绘制周期时,根据所述目标应用程序的绘制指令,当所述绘制指令满足所述第一条件时,将绘制结果存入所述第七存储空间,作为第三绘制结果,当所述绘制指令满足所述第二条件时,不进行绘制;根据所述第三绘制结果和所述第二绘制结果生成第八图像帧。A twelfth aspect provides an electronic device, the electronic device comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used for storing computer program codes, the memory is The computer program code includes computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to execute: during the first drawing cycle, according to the drawing instructions of the target application, when the drawing instructions satisfy Under the first condition, the drawing result is stored in the seventh storage space as the first drawing result, and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space as the second drawing result; A seventh image frame is generated according to the first drawing result and the second drawing result; in the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, The drawing result is stored in the seventh storage space, and as the third drawing result, when the drawing instruction satisfies the second condition, no drawing is performed; generating according to the third drawing result and the second drawing result Eighth image frame.
结合第十二方面,在一种可能的实现方式中,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:在第三绘制周期时,根据目标应用程序的绘制指令, 当所述绘制指令满足第一条件时,将绘制结果存入所述第七存储空间中,作为第四绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入所述第八存储空间,作为第五绘制结果,所述第三绘制周期位于所述第一绘制周期之后;根据所述第四绘制结果和所述第五绘制结果生成第九图像帧;在第四绘制周期时,根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果;根据第六绘制结果和所述第七绘制结果生成第十图像帧;所述第七绘制结果为在第五绘制周期中,所述目标应用程序的绘制指令满足所述第二条件时得到的绘制结果,所述第五绘制周期在所述第四绘制周期之前。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 execute: during the third drawing cycle, according to the target application The drawing instruction of the program, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space, as the fourth drawing result, when the drawing instruction satisfies the second condition, the drawing The result is stored in the eighth storage space, and as the fifth drawing result, the third drawing cycle is located after the first drawing cycle; the ninth image frame is generated according to the fourth drawing result and the fifth drawing result ; During the fourth drawing cycle, generate a sixth drawing result according to the first drawing result and the fourth drawing result; generate a tenth image frame according to the sixth drawing result and the seventh drawing result; the seventh drawing result The drawing result is the drawing result obtained when the drawing instruction of the target application satisfies the second condition in the fifth drawing cycle, and the fifth drawing cycle is before the fourth drawing cycle.
结合第十二方面,在一种可能的实现方式中,在所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第一绘制结果和所述第二绘制结果存入第九存储空间中;在所述第九存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the seventh image frame according to the first rendering result and the second rendering result, the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: store the first drawing result and the second drawing result in a ninth storage space; and store the first drawing result in the ninth storage space according to the first drawing The result and the second rendering result generate the seventh image frame.
结合第十二方面,在一种可能的实现方式中,在所述根据所述第四绘制结果和所述第五绘制结果生成第九图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第四绘制结果和所述第五绘制结果存入所述第九存储空间;在所述第九存储空间中根据所述第四绘制结果和所述第五绘制结果生成所述第九图像帧。With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the ninth image frame according to the fourth rendering result and the fifth rendering result, the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: storing the fourth drawing result and the fifth drawing result into the ninth storage space; in the ninth storage space according to the fourth The drawing result and the fifth drawing result generate the ninth image frame.
结合第十二方面,在一种可能的实现方式中,在所述根据第六绘制结果和所述第七绘制结果生成第十图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第六绘制结果和所述第七绘制结果存入所述第九存储空间;在所述第九存储空间中根据所述第六绘制结果和所述第七绘制结果生成所述第十图像帧。With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the tenth image frame according to the sixth rendering result and the seventh rendering result, the one or more processors are specifically configured to call The computer instructions cause the electronic device to execute: store the sixth drawing result and the seventh drawing result in the ninth storage space; and store the sixth drawing result in the ninth storage space according to the sixth drawing result and the seventh rendering result to generate the tenth image frame.
结合第十二方面,在一种可能的实现方式中,所述第七存储空间由第十存储空间和第十一存储空间构成,所述第一绘制结果存储在所述第十存储空间中,所述第四绘制结果存储在所述第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第一绘制结果存入所述第十一存储空间中;在所述第十一存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。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, and the first drawing result is stored in the tenth storage space, The fourth drawing result is stored in the eleventh storage space, and 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, It is specifically used to invoke the computer instruction to cause the electronic device to execute: store the first drawing result in the eleventh storage space; and store the first drawing result in the eleventh storage space according to the first drawing result and the fourth rendering result to generate the sixth rendering result.
结合第十二方面,在一种可能的实现方式中,所述第七存储空间由至少三个存储空间构成,所述至少三个存储空间包括第十存储空间,第十一存储空间和第十二存储空间;所述第一绘制结果存储在第十存储空间中,所述第四绘制结果存储在第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第一绘制结果和所述第四绘制结果存入第十二存储空间;在所述第十二存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。With reference to the twelfth aspect, in a possible implementation manner, the seventh storage space consists of at least three storage spaces, and the at least three storage spaces include a tenth storage space, an eleventh storage space and a tenth storage space Two storage spaces; the first drawing result is stored in the tenth storage space, the fourth drawing result is stored in the eleventh storage space, and the first drawing result and the fourth drawing result are stored in the eleventh storage space. In the aspect of generating the sixth drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute: storing the first drawing result and the fourth drawing result in the tenth drawing result Two storage spaces; the sixth drawing result is generated in the twelfth storage space according to the first drawing result and the fourth drawing result.
结合第十二方面,在一种可能的实现方式中,所述第三绘制周期与所述第四绘制周期相邻;所述第五绘制周期与所述第三绘制周期为同一绘制周期,所述第五绘制结果和所述第七绘制结果为同一绘制结果。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 and the third drawing period are the same drawing period, so The fifth drawing result and the seventh drawing result are the same drawing result.
结合第十二方面,在一种可能的实现方式中,在所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:将所述第二绘制结果存入所述第七存储空间中;在所述第七存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。With reference to the twelfth aspect, in a possible implementation manner, in the aspect of generating the seventh image frame according to the first rendering result and the second rendering result, the one or more processors specifically use invoking the computer instructions to cause the electronic device to execute: store the second drawing result in the seventh storage space; and store the second drawing result in the seventh storage space according to the first drawing result and the The second rendering result generates the seventh image frame.
结合第十二方面,在一种可能的实现方式中,所述电子设备包括计数单元;所述计数单 元的初始化数值为第一数值,所述计数单元的数值每更新一次在第一数值和第二数值之间切换一次;所述计数单元在绘制周期开始的时刻进行更新;在一个绘制周期中,若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;若更新后的所述计数单元的数值为第一数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。With reference to the twelfth aspect, in a possible implementation manner, the electronic device includes a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated between the first value and the first value every time. Switch between two values once; the counting unit is updated at the moment when the drawing cycle starts; in a drawing cycle, if the updated value of the counting unit is the second value, then the counting unit is cleared at the moment when the drawing cycle starts the eighth storage space; 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 drawing cycle starts The second storage unit is not emptied at the time of ; and when the drawing instruction satisfies the second condition, the drawing is not performed.
结合第十二方面,在一种可能的实现方式中,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:在第三绘制周期时,根据所述第一绘制结果和所述第三绘制结果生成第四绘制结果;根据所述第二绘制结果和所述第四绘制结果生成第九图像帧。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 execute: during the third drawing cycle, according to the The first rendering result and the third rendering result generate a fourth rendering result; and a ninth image frame is generated according to the second rendering result and the fourth rendering result.
结合第十二方面,在一种可能的实现方式中,该电子设备包括计数单元,所述计数单元的初始化数值为第一数值,所述计数单元按照第一数值,第二数值,第三数值的顺序在三个数值间进行重复的更新切换,所述计数单元在绘制周期开始的时刻进行更新,在一个绘制周期中,若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;若更新后的所述计数单元的数值为第一数值或第三数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。With reference to the twelfth aspect, in a possible implementation manner, the electronic device includes a counting unit, the initialization value of the counting unit is a first value, and the counting unit is based on the first value, the second value, and the third value. The sequence of updating and switching is repeated between three values, and the counting unit is updated at the moment when the drawing cycle starts. In a drawing cycle, if the updated value of the counting unit is the second value, then the drawing The eighth storage space is emptied at the moment when the cycle starts; 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 second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed.
结合第十二方面,在一种可能的实现方式中,所述第九存储空间由至少两个存储空间构成,所述至少两个存储空间在目标应用程序运行时根据所述目标应用程序的第一指令在第一状态和第二状态之间进行轮换;在同一时间点,所述至少两个存储空间中仅有一个存储空间处于所述第一状态,其余的所述存储空间处于所述第二状态;所述至少两个存储空间处于所述第一状态时,所述至少两个存储空间中的图像帧可传输至显示设备显示;所述至少两个存储空间处于所述第二状态时,所述电子设备可在所述至少两个存储空间中进行绘制;相邻的两个绘制周期生成的两帧图像帧分别存储在所述第九存储空间中的两个不同的存储空间中。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 based on the first storage space of the target application when the target application is running. An instruction alternates between a first state and a second state; 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 first state Two states; 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 a display device for display; when the at least two storage spaces are in the second state , the electronic device can perform drawing in the at least two storage spaces; two image frames generated by two adjacent drawing cycles are respectively stored in two different storage spaces in the ninth storage space.
结合第十二方面,在一种可能的实现方式中,所述第一条件为:绘制指令中包含启用深度测试的指令;所述第二条件为:绘制指令中包含关闭深度测试的指令。With reference to the twelfth aspect, in a possible implementation manner, the first condition is: the drawing instruction includes an instruction to enable depth testing; and the second condition is: the drawing instruction includes an instruction to disable depth testing.
结合第十二方面,在一种可能的实现方式中,任意两个相邻的绘制周期的时间节点为所述目标应用程序调用第二指令的时间点。With reference to the twelfth aspect, in a possible implementation manner, the time nodes of any two adjacent drawing cycles are the time points at which the target application invokes the second instruction.
第十三方面,本申请实施例提供了一种图像帧预测的方法,该方法可以包括:在绘制第一应用的第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,第一绘制范围的尺寸大于第一应用的第二十一绘制帧的尺寸;在绘制第一应用的第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,第二十二内存空间的尺寸大于所述第二十二绘制帧的尺寸,其中,第二十一绘制帧的尺寸与第二十二绘制帧的尺寸相同;电子设备根据第二十一绘制结果和所述第二十二绘制结果,预测生成第一应用的第二十三预测帧,其中,第二十三预测帧的尺寸与第二十一绘制帧的尺寸相同。In a thirteenth aspect, an embodiment of the present application provides an image frame prediction method. The method may include: when drawing the twenty-first drawing frame of the first application, the electronic device converts the drawing instruction of the twenty-first drawing frame to the drawing instruction of the twenty-first drawing frame. Drawing according to the first drawing range, the twenty-first drawing result is obtained, and 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 The device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range, and obtains 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 second The size of the eleventh drawing frame is the same as the size of the twenty-second drawing frame; the electronic device predicts and generates the twenty-third predicted 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 rendering frame.
这样,电子设备可以得到预测帧。在不增加绘制帧的情况下,可以提高电子设备的帧率。这样,在节约电子设备功耗的情况下,可以提高电子设备显示的视频界面流畅度。进一步地,电子设备预测出的预测帧中可以存在电子设备显示的第二十一绘制帧和第二十二绘制帧中没有的绘制内容。从而,电子设备预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄 内容。因而,电子设备预测出的图像帧可以更为准确。In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be increased without increasing the drawing frame. In this way, while saving the power consumption of the electronic device, the smoothness of the video interface displayed by the electronic device can be improved. Further, in the predicted frame predicted by the electronic device, there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
结合第十三方面,在一种可能的实现方式中,电子设备将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:电子设备将第一应用下发的第二十一绘制帧的第一绘制指令中第一参数修改为第一绘制范围;第一参数用于设置第二十一绘制帧的绘制范围尺寸;电子设备将修改后的第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果。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, which specifically includes: The first parameter in the first drawing instruction of the twenty-first drawing frame issued by the application is modified to the first drawing range; the first parameter is used to set the size of the drawing range of the twenty-first drawing frame; The drawing instruction of the twenty-first drawing frame is drawn according to the first drawing range, and the twenty-first drawing result is obtained.
结合第十三方面,在一种可能的实现方式中,第一绘制范围的尺寸大于第一应用的第二十一绘制帧的尺寸,具体包括:第一绘制范围的宽度为第二十一绘制帧的宽度的K3倍,第一绘制范围的高度为第二十一绘制帧的高度的K4倍,K3、K4大于1。With reference to the thirteenth aspect, in a possible implementation manner, the size of the first drawing range 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 the twenty-first drawing range The width of the frame is K3 times, the height of the first drawing range is K4 times the height of the twenty-first drawing frame, and K3 and K4 are greater than 1.
结合第十三方面,在一种可能的实现方式中,K3、K4由电子设备的系统配置的固定值,或由电子设备根据第二十一绘制帧的绘制指令中包含的绘制参数确定。With reference to the thirteenth aspect, in a possible implementation manner, K3 and K4 are determined by the fixed values of the system configuration of the electronic device, or by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
结合第十三方面,在一种可能的实现方式中,电子设备将修改后第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:电子设备根据K3、K4生成第一转换矩阵,电子设备将修改后的第二十一绘制帧的绘制指令中的绘制内容的大小根据第一转换矩阵调整后绘制到第一绘制范围中,得到第二十一绘制结果。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device draws the drawing instruction of the modified twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, which specifically includes: the electronic device draws the drawing according to the first drawing range. K3 and K4 generate a first conversion matrix, and the electronic device adjusts the size of the drawing content in the drawing instruction of the modified twenty-first drawing frame into the first drawing range according to the first conversion matrix, and obtains the twenty-first Plot the result.
结合第十三方面,在一种可能的实现方式中,电子设备将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十一绘制结果,具体包括:电子设备将第一应用下发的第二十二绘制帧的第二绘制指令中第二参数修改为第二绘制范围;第二参数用于设置第二十二绘制帧的绘制范围尺寸;电子设备将修改后的第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果。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, which specifically includes: The second parameter in the second drawing instruction of the twenty-second drawing frame issued by the application is modified to the second drawing range; the second parameter is used to set the size of the drawing range of the twenty-second drawing frame; The drawing instructions of the twenty-two drawing frames are drawn according to the second drawing range, and the twenty-second drawing result is obtained.
结合第十三方面,在一种可能的实现方式中,第二绘制范围的尺寸大于第一应用的第二十二绘制帧的尺寸,具体包括:第二绘制范围的宽度为第二十二绘制帧的宽度的K5倍,第二绘制范围的高度为第二十二绘制帧的高度的K6倍,K5、K6大于1。With reference to the thirteenth aspect, in a possible implementation manner, the size of the second drawing range is larger than the size of the twenty-second drawing frame of the first application, which specifically includes: the width of the second drawing range is the twenty-second drawing range. The width of the frame is K5 times, the height of the second drawing range is K6 times the height of the twenty-second drawing frame, and K5 and K6 are greater than 1.
结合第十三方面,在一种可能的实现方式中,K5、K6由电子设备的系统配置的固定值,或由电子设备根据第二十一绘制帧的绘制指令中包含的绘制参数确定。With reference to the thirteenth aspect, in a possible implementation manner, K5 and K6 are determined by the fixed values of the system configuration of the electronic device, or by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame.
结合第十三方面,在一种可能的实现方式中,电子设备将修改后的第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,具体包括:电子设备根据K5、K6生成第二转换矩阵,电子设备将修改后的第二十二绘制帧的绘制指令中的绘制内容的大小根据第二转换矩阵调整后绘制到第二绘制范围中,得到第二十一绘制结果。With reference to the thirteenth aspect, in a possible implementation manner, 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, which specifically includes: the electronic device The second conversion matrix is generated according to K5 and K6, and the electronic device adjusts the size of the drawing content in the drawing instruction of the 22nd drawing frame after modification according to the second conversion matrix and draws it into the second drawing range, to obtain the twentieth drawing range. a plot result.
结合第十三方面,在一种可能的实现方式中,电子设备根据第二十一绘制结果和第二十二绘制结果,预测生成第一应用的第二十三预测帧,具体包括:现在设备根据第二十一绘制结果和第二十二绘制结果,预测生成第二十三预测帧的第二十三绘制结果;电子设备将第二十三绘制结果剪切为第二十三预测帧。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device predicts and generates the twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result, specifically including: the current device According to the twenty-first rendering result and the twenty-second rendering result, the twenty-third rendering result of the twenty-third predicted frame is predicted and generated; the electronic device cuts the twenty-third rendering result into the twenty-third predicted frame.
结合第十三方面,在一种可能的实现方式中,电子设备根据第二十一绘制结果和第二十二绘制结果,预测生成所述第二十三预测帧的第二十三绘制结果,具体包括:电子设备根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量;电子设备根据第二十二绘制结果和第一运动向量,预测生成第二十三预测帧的第二十三绘制结果。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device predicts and generates the twenty-third drawing result of the twenty-third predicted frame according to the twenty-first drawing result and the twenty-second drawing result, Specifically, it includes: the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; the electronic device predicts and generates the first motion vector according to the twenty-second rendering result and the first motion vector The twenty-third rendering result of the twenty-third predicted frame.
结合第十三方面,在一种可能的实现方式中,电子设备根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量,具体包括:电子设备将第二十二绘制结果分成Q个像素块,电子设备在第二十二绘制结果的Q个像素块中取出第一像素块;电子 设备在第二十一绘制结果中确定出与第一像素块匹配的第二像素块;电子设备根据第二像素块到第一像素块的位移得到第一像素块的运动向量;电子设备根据第一像素块的运动向量确定第二十二绘制结果的第一运动向量。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result, which specifically includes: the electronic device Divide the twenty-second rendering result into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks in the twenty-second rendering result; the electronic device determines in the twenty-first rendering result that it is the same as the first pixel. The second pixel block matched by the block; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first pixel block of the twenty-second rendering result according to the motion vector of the first pixel block. a motion vector.
结合第十三方面,在一种可能的实现方式中,电子设备在第二十一绘制结果中确定出与第一像素块匹配的第二像素块,具体包括:电子设备通过第一像素块中的第一像素点在第二十一绘制结果中确定出多个候选像素块;电子设备分别计算出多个候选像素块与第一像素块的颜色值的差值;电子设备根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块,第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block, which specifically includes: In the twenty-first drawing result, a plurality of candidate pixel blocks are determined for the first pixel point of the The difference between the color values of the first pixel block determines a second pixel block that matches the first pixel block, and the second pixel block is the candidate with the smallest difference in color value from the first pixel block among the multiple candidate pixel blocks. pixel block.
结合第十三方面,在一种可能的实现方式中,在绘制第一应用的第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:在绘制第一应用的第二十一绘制帧时,电子设备在第二十一内存空间中将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,第二十一内存空间的尺寸大于或等于第一绘制范围的尺寸。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, and obtains the first drawing range. The twenty-first drawing result specifically includes: 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, The twenty-first drawing result is obtained, and the size of the twenty-first memory space is greater than or equal to the size of the first drawing range.
结合第十三方面,在一种可能的实现方式中,在绘制第一应用的第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,具体包括:在绘制第一应用的第二十二绘制帧时,电子设备在第二十二内存空间中将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,第二十二内存空间的尺寸大于或等于第二绘制范围的尺寸。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, and obtains the The twenty-two drawing results specifically include: 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, The twenty-second drawing result is obtained, and the size of the twenty-second memory space is greater than or equal to the size of the second drawing range.
结合第十三方面,在一种可能的实现方式中,电子设备根据第二十二绘制结果和第一运动向量,预测生成第二十三预测帧的第二十三绘制结果,具体包括:电子设备根据第二十二绘制结果和第一运动向量,按照第三绘制范围预测生成第二十三绘制结果;其中,第三绘制范围的尺寸大于第二十三预测帧的尺寸。With reference to the thirteenth aspect, in a possible implementation manner, the electronic device predicts and 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: an electronic device The device predicts and generates a twenty-third drawing result according to the third drawing range according to the twenty-second drawing result and the first motion vector, wherein the size of the third drawing range is larger than the size of the twenty-third predicted frame.
结合第十三方面,在一种可能的实现方式中,在绘制第一应用的第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果之后,方法还包括:电子设备将第二十一绘制结果剪切成第二十一绘制帧。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, and obtains the first drawing range. After the twenty-first rendering result, the method further includes: the electronic device cuts the twenty-first rendering result into a twenty-first rendering frame.
结合第十三方面,在一种可能的实现方式中,在绘制第一应用的第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果之后,方法还包括:电子设备将第二十二绘制结果剪切成第二十二绘制帧。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, and obtains the After the twenty-second rendering result, the method further includes: the electronic device cuts the twenty-second rendering result into a twenty-second rendering frame.
第十四方面,本申请提供了一种图像帧预测的方法,该方法可以包括:在绘制第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果,第二十一内存空间的尺寸大于默认内存空间的尺寸,默认内存空间为电子设备系统提供的存储用于显示的图像帧的内存空间;在绘制第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得到第二十二绘制结果,第二十二内存空间的尺寸大于默认内存空间的尺寸;电子设备根据第二十一绘制结果和所述第二十二绘制结果,在第二十三内存空间中生成第二十三绘制结果,第二十三内存空间的尺寸大于默认内存空间的尺寸;电子设备将第二十三绘制结果剪切成与默认内存空间的尺寸相同,得到第二十三预测帧。In a fourteenth aspect, the present application provides a method for predicting an image frame, the method may include: when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame to the drawing content of the drawing instruction of the twenty-first drawing frame. In the twenty-one memory space, the twenty-first drawing result is obtained, and the size of the twenty-first memory space is larger than the size of the default memory space, and the default memory space is the memory space provided by the electronic device system for storing image frames for display; When drawing the twenty-second drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains the twenty-second drawing result, the size of the twenty-second memory space larger than the size of the default memory space; the electronic device generates the twenty-third drawing result in the 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 larger than the size of the default memory space; the electronic device cuts the twenty-third drawing result to be the same size as the default memory space to obtain the twenty-third predicted frame.
这样,电子设备可以得到预测帧。在不增加绘制帧的情况下,可以提高电子设备的帧率。 这样,在节约电子设备功耗的情况下,可以提高电子设备显示的视频界面流畅度。进一步地,电子设备预测出的预测帧中可以存在电子设备显示的第二十一绘制帧和第二十二绘制帧中没有的绘制内容。从而,电子设备预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄内容。因而,电子设备预测出的图像帧可以更为准确。In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be increased without increasing the drawing frame. In this way, while saving the power consumption of the electronic device, the smoothness of the video interface displayed by the electronic device can be improved. Further, in the predicted frame predicted by the electronic device, there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
结合第十四方面,在一种可能的实现方式中,第二十一内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十一内存空间的第一尺寸是默认内存空间的第三尺寸的K1倍,第二十一内存空间的第二尺寸是默认内存空间的第四尺寸的K2倍,K1、K2大于1。With reference to the fourteenth aspect, in a possible implementation manner, the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
第二十二内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十二内存空间的第五尺寸是默认内存空间的第三尺寸的K1倍,第二十二内存空间的第五尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
第二十三内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十三内存空间的第七尺寸是默认内存空间的第三尺寸的K1倍,第二十三内存空间的第八尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
这里,第二十一内存空间的第一尺寸可以是第二十一内存空间的宽度,第二十一内存空间的第二尺寸可以是第二十一内存空间的高度。默认内存空间的第三尺寸可以是默认内存空间的宽度,默认内存空间的第四尺寸可以是默认内存空间的高度。第二十二内存空间的第五尺寸可以是第二十二内存空间的宽度,第二十二内存空间的第六尺寸可以是第二十二内存空间的高度。第二十三内存空间的第七尺寸可以是第二十三内存空间的宽度,第二十三内存空间的第八尺寸可以是第二十三内存空间的高度。这样,电子设备可以按照不同的尺寸来放大第二十一内存空间的宽度和高度。电子设备可以按照不同的尺寸来放大第二十二内存空间的宽度和高度。电子设备可以按照不同的尺寸来放大第二十三内存空间的宽度和高度。Here, the first size of the twenty-first memory space may be the width of the twenty-first memory space, and the second size of the twenty-first memory space may be the height of the twenty-first memory space. The third size of the default memory space may be the width of the default memory space, and the fourth size of the default memory space may be the height of the default memory space. The fifth size of the twenty-second memory space may be the width of the twenty-second memory space, and the sixth size of the twenty-second memory space may be the height of the twenty-second memory space. The seventh size of the twenty-third memory space may be the width of the twenty-third memory space, and the eighth size of the twenty-third memory space may be the height of the twenty-third memory space. In this way, the electronic device can enlarge the width and height of the twenty-first memory space according to different sizes. The electronic device may enlarge the width and height of the twenty-second memory space according to different sizes. The electronic device may enlarge the width and height of the twenty-third memory space according to different sizes.
结合第十四方面,在一种可能的实现方式中,在绘制第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果,具体包括:在绘制第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间的第一绘制范围中,得到第二十一绘制结果;第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fourteenth aspect, in a possible implementation manner, when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, Obtaining the twenty-first drawing result specifically includes: when drawing the twenty-first drawing frame, 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.
结合第十四方面,在一种可能的实现方式中,第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于所述默认内存空间的尺寸,具体包括:第一绘制范围的第九尺寸是默认内存空间的第三尺寸的K3倍,第一绘制范围的第十尺寸是默认内存空间的第四尺寸的K4倍,K3大于1,且小于或等于K1,K4大于1,且小于或等于K2。With reference to 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, specifically including : The ninth size of the first drawing range is K3 times the third size of the default memory space, 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 , K4 is greater than 1, and less than or equal to K2.
第一绘制范围的第九尺寸可以是第一绘制范围的宽度,第一绘制范围的第十尺寸可以第一绘制范围的高度。The ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
结合第十四方面,在一种可能的实现方式中,K3等于K1,K4等于K1,K1、K2、K3、K4为电子设备的系统配置的固定值。电子设备可以根据经验值配置K1、K2、K3、K4。电子设备直接配置固定值可以减小计算量。With reference to the fourteenth 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 the system configuration of the electronic device. The electronic equipment can configure K1, K2, K3, K4 according to the experience value. The electronic device directly configures the fixed value to reduce the amount of calculation.
结合第十四方面,在一种可能的实现方式中,K3和K4由电子设备根据第二十一绘制帧的绘制指令中包含的绘制参数确定。这样,电子设备设置的K3和K4可以根据第二十一绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,电子设备对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the fourteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to the drawing parameters included 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 included 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 by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十四方面,在一种可能的实现方式中,在绘制第二十二绘制帧时,电子设备将第 二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得到第二十二绘制结果,具体包括:在绘制第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间的第二绘制范围中,得到第二十二绘制结果;第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fourteenth aspect, in a possible implementation manner, when drawing the twenty-second drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains: The twenty-second drawing result specifically includes: when drawing the twenty-second drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame into the second drawing range of the twenty-second memory space, The twenty-second drawing result is obtained; 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.
结合第十四方面,在一种可能的实现方式中,第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸,具体包括:第二绘制范围的第十一尺寸是默认内存空间的第三尺寸的K5倍,第二绘制范围的第十二尺寸是默认内存空间的第四尺寸的K6倍,K5大于1,且小于或等于K1,K6大于1,且小于或等于K2。With reference to the fourteenth aspect, in a possible implementation manner, the size of the second drawing range is smaller 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, specifically including: 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
第二绘制范围的第十一尺寸可以是第二绘制范围的宽度,第二绘制范围的第十二尺寸可以是第二绘制范围的高度。The eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
结合第十四方面,在一种可能的实现方式中,K5和K6为电子设备的系统配置的固定值。电子设备直接配置固定值可以减小计算量。With reference to the fourteenth aspect, in a possible implementation manner, K5 and K6 are fixed values of the system configuration of the electronic device. The electronic device directly configures the fixed value to reduce the amount of calculation.
结合第十四方面,在一种可能的实现方式中,K5和K6由电子设备根据第二十二绘制帧的绘制指令中包含的绘制参数确定。这样,电子设备设置的K5和K6可以根据第二十二绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,电子设备对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the fourteenth aspect, in a possible implementation manner, K5 and K6 are determined by the electronic device according to the drawing parameters included 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 included 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 by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十四方面,在一种可能的实现方式中,电子设备根据第二十一绘制结果和第二十二绘制结果,在第二十三内存空间中生成第二十三绘制结果,第二十三内存空间的尺寸大于默认内存空间的尺寸,具体包括:电子设备根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量;电子设备根据第二十二绘制结果和第一运动向量,在第二十三内存空间中生成第二十三绘制结果。这样,电子设备可以根据第二十一绘制帧和第二十二绘制帧预测出第二十三预测帧的第二十三绘制结果。With reference to the fourteenth aspect, in a possible implementation manner, the electronic device generates the twenty-third drawing result in the twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result, and the second The size of the thirteenth memory space is larger than the size of the default memory space, which specifically includes: the electronic device determines the first motion vector of the twenty-second drawing result according to the twenty-first drawing result and the twenty-second drawing result; The twenty-two rendering results and the first motion vector generate the twenty-third rendering result in the twenty-third memory space. In this way, the electronic device 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.
结合第十四方面,在一种可能的实现方式中,电子设备根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量,具体包括:电子设备将第二十二绘制结果分成Q个像素块,电子设备在第二十二绘制结果的Q个像素块中取出第一像素块;电子设备在第二十一绘制结果中确定出与第一像素块匹配的第二像素块;电子设备根据第二像素块到第一像素块的位移得到第一像素块的运动向量;电子设备根据第一像素块的运动向量确定第二十二绘制结果的第一运动向量。按照该实现方式中的步骤,电子设备可以确定第二十二绘制结果的Q个像素块中所有像素块的运动向量。每个像素块中包括f*f(例如,16*16)个像素点。With reference to the fourteenth aspect, in a possible implementation manner, the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result, which specifically includes: the electronic device Divide the twenty-second rendering result into Q pixel blocks, and the electronic device takes out the first pixel block from the Q pixel blocks in the twenty-second rendering result; the electronic device determines in the twenty-first rendering result that it is the same as the first pixel. The second pixel block matched by the block; the electronic device obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; the electronic device determines the first pixel block of the twenty-second rendering result according to the motion vector of the first pixel block. a motion vector. According to the steps in this implementation manner, the electronic device can determine the motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result. Each pixel block includes f*f (for example, 16*16) pixel points.
上述实现方式中,电子设备将第二十二绘制结果分块来计算运动向量,不用去计算第二十二绘制结果中每个像素点的运动向量。这样可以减少计算量,从而降低电子设备的功耗。In the above implementation manner, the electronic device divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
结合第十四方面,在一种可能的实现方式中,电子设备在第二十一绘制结果中确定出与第一像素块匹配的第二像素块,具体包括:电子设备通过第一像素块中的第一像素点在第二十一绘制结果中确定出多个候选像素块;电子设备分别计算出多个候选像素块与第一像素块的颜色值的差值;电子设备根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块,第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。With reference to the fourteenth aspect, in a possible implementation manner, the electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block, which specifically includes: In the twenty-first drawing result, a plurality of candidate pixel blocks are determined for the first pixel point of the The difference between the color values of the first pixel block determines a second pixel block that matches the first pixel block, and the second pixel block is the candidate with the smallest difference in color value from the first pixel block among the multiple candidate pixel blocks. pixel block.
这样,电子设备可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。In this way, the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第十四方面,在一种可能的实现方式中,电子设备根据第二十二绘制结果和第一运动向量,在第二十三内存空间中生成第二十三绘制结果,具体包括:电子设备根据第一运动向量确定第二十三绘制结果的运动向量,根据第二十二绘制结果和第二十三绘制结果的运动向量生成第二十三绘制结果。第二十三绘制结果的运动向量为第一运动向量的G倍,G大于0小于1。With reference to the fourteenth aspect, in a possible implementation manner, 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, which specifically includes: electronic The device determines the motion vector of the twenty-third rendering result according to the first motion vector, and generates 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, and G is greater than 0 and less than 1.
结合第十四方面,在一种可能的实现方式中,G等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于电子设备计算,也可以使得用户在观看视频时的体验更好。With reference to the fourteenth aspect, in a possible implementation, G is equal to 0.5. In this way, the objects in each image frame move 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.
结合第十四方面,在一种可能的实现方式中,电子设备根据第二十二绘制结果和第一运动向量,在第二十三内存空间中生成第二十三绘制结果,具体包括:电子设备根据第二十二绘制结果和第一运动向量,在第二十三内存空间的第三绘制范围内生成第二十三绘制结果;第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fourteenth aspect, in a possible implementation manner, 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, which specifically includes: electronic The device generates the twenty-third drawing result within 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 twenty-third memory space The size of the third drawing range is larger than the size of the default memory space.
结合第十四方面,在一种可能的实现方式中,第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于第二十三内存空间的尺寸,具体包括:第三绘制范围的第十三尺寸是默认内存空间的第三尺寸的K7倍,第三绘制范围的第十四尺寸是默认内存空间的第四尺寸的K8倍,K7大于1,且小于或等于K1,K8大于1,且小于或等于K2。With reference to the fourteenth aspect, in a possible implementation manner, the size of the third drawing range is smaller 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 the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
第三绘制范围的第十三尺寸可以是第三绘制范围的宽度,第三绘制范围的第十四尺寸可以是第三绘制范围的高度。The thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
结合第十四方面,在一种可能的实现方式中,在绘制第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果之前,该方法还可以包括:电子设备创建第二十一内存空间,第二十二内存空间,第二十三内存空间,第二十一内存空间可以用于存储第二十一绘制帧的第二十一绘制结果,第二十二内存空间可以用于存储第二十二绘制帧的第二十二绘制结果,第二十三内存空间可以用于存储第二十三预测帧的第二十三绘制结果。With reference to the fourteenth aspect, in a possible implementation manner, when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, Before obtaining the twenty-first drawing result, the method may further include: the electronic device creates a twenty-first memory space, a twenty-second memory space, and a twenty-third memory space, and the twenty-first memory space can be used to store the first memory space. 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-second drawing result. Twenty-third rendering result of the three predicted frames.
结合第十四方面,在一种可能的实现方式中,在绘制第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果之后,方法还包括:电子设备将第二十一绘制结果剪切成与默认内存空间的尺寸相同,得到第二十一绘制帧。With reference to the fourteenth aspect, in a possible implementation manner, when drawing the twenty-first drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-first drawing frame into the twenty-first memory space, After the twenty-first drawing result is obtained, the method further includes: the electronic device cuts the twenty-first drawing result into the same size as the default memory space to obtain the twenty-first drawing frame.
结合第十四方面,在一种可能的实现方式中,在绘制第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得到第二十二绘制结果之后,方法还可以包括:电子设备将第二十二绘制结果剪切成与默认内存空间的尺寸相同,得到第二十二绘制帧。With reference to the fourteenth aspect, in a possible implementation manner, when drawing the twenty-second drawing frame, the electronic device draws the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second memory space, and obtains: After the twenty-second rendering result, the method may further include: cutting the twenty-second rendering result into the same size as the default memory space by the electronic device to obtain the twenty-second rendering frame.
第十五方面,提供一种电子设备,包括:一个或多个处理器CPU、图形处理器GPU、存储器和显示屏;存储器与一个或多个处理器耦合;CPU与GPU耦合;其中:A fifteenth aspect provides an electronic device, comprising: one or more processors, a CPU, a graphics processor GPU, a memory, and a display screen; the memory is coupled to the one or more processors; the CPU is coupled to the GPU; wherein:
存储器可以用于存储计算机程序代码,计算机程序代码包括计算机指令;CPU可以用于在绘制第二十一绘制帧时,指示GPU执行绘制,在绘制第二绘制时,指示GPU执行绘制;The memory can be used to store computer program codes, and the computer program codes include computer instructions; the CPU can be used to instruct the GPU to perform the drawing when drawing the twenty-first drawing frame, and to instruct the GPU to perform the drawing when drawing the second drawing;
这样,电子设备可以得到预测帧。在不增加绘制帧的情况下,可以提高电子设备的帧率。这样,在节约电子设备功耗的情况下,可以提高电子设备显示的视频界面流畅度。进一步地, 电子设备预测出的预测帧中可以存在电子设备显示的第二十一绘制帧和第二十二绘制帧中没有的绘制内容。从而,电子设备预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄内容。因而,电子设备预测出的图像帧可以更为准确。In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be increased without increasing the drawing frame. In this way, while saving the power consumption of the electronic device, the smoothness of the video interface displayed by the electronic device can be improved. Further, in the predicted frame predicted by the electronic device, there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
结合第十五方面,在一种可能的实现方式中,GPU可以用于在绘制第二十一绘制帧时,将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果,第二十一内存空间的尺寸大于默认内存空间的尺寸,默认内存空间为电子设备系统提供的存储用于显示的图像帧的内存空间;在绘制第二十二绘制帧时,将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得到第二十二绘制结果,第二十二内存空间的尺寸大于默认内存空间的尺寸;根据第二十一绘制结果和所述第二十二绘制结果,在第二十三内存空间中生成第二十三绘制结果,第二十三内存空间的尺寸大于默认内存空间的尺寸;将第二十三绘制结果剪切成与默认内存空间的尺寸相同,得到第二十三预测帧。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may be used to draw the drawing content of the drawing instruction of the twenty-first drawing frame to the twenty-first memory space when drawing the twenty-first drawing frame , obtain the twenty-first drawing result, the size of the twenty-first memory space is larger than the size of the default memory space, and the default memory space is the memory space provided by the electronic device system to store the image frames for display; When the second frame is drawn, the drawing content of the drawing instruction of the twenty-second drawing frame is drawn to the twenty-second memory space, and the twenty-second drawing result is obtained, and the size of the twenty-second memory space is larger than the size of the default memory space; According to the twenty-first drawing result and the twenty-second drawing result, the twenty-third drawing result is generated in the twenty-third memory space, and the size of the twenty-third memory space is larger than the size of the default memory space; The twenty-third rendering result is cut to the same size as the default memory space, and the twenty-third predicted frame is obtained.
结合第十五方面,在一种可能的实现方式中,第二十一内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十一内存空间的第一尺寸是默认内存空间的第三尺寸的K1倍,第二十一内存空间的第二尺寸是默认内存空间的第四尺寸的K2倍,K1、K2大于1。With reference to the fifteenth aspect, in a possible implementation manner, the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
第二十二内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十二内存空间的第五尺寸是默认内存空间的第三尺寸的K1倍,第二十二内存空间的第五尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
第二十三内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十三内存空间的第七尺寸是默认内存空间的第三尺寸的K1倍,第二十三内存空间的第八尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
这里,第二十一内存空间的第一尺寸可以是第二十一内存空间的宽度,第二十一内存空间的第二尺寸可以是第二十一内存空间的高度。默认内存空间的第三尺寸可以是默认内存空间的宽度,默认内存空间的第四尺寸可以是默认内存空间的高度。第二十二内存空间的第五尺寸可以是第二十二内存空间的宽度,第二十二内存空间的第六尺寸可以是第二十二内存空间的高度。第二十三内存空间的第七尺寸可以是第二十三内存空间的宽度,第二十三内存空间的第八尺寸可以是第二十三内存空间的高度。这样,电子设备可以按照不同的尺寸来放大第二十一内存空间的宽度和高度。电子设备可以按照不同的尺寸来放大第二十二内存空间的宽度和高度。电子设备可以按照不同的尺寸来放大第二十三内存空间的宽度和高度。Here, the first size of the twenty-first memory space may be the width of the twenty-first memory space, and the second size of the twenty-first memory space may be the height of the twenty-first memory space. The third size of the default memory space may be the width of the default memory space, and the fourth size of the default memory space may be the height of the default memory space. The fifth size of the twenty-second memory space may be the width of the twenty-second memory space, and the sixth size of the twenty-second memory space may be the height of the twenty-second memory space. The seventh size of the twenty-third memory space may be the width of the twenty-third memory space, and the eighth size of the twenty-third memory space may be the height of the twenty-third memory space. In this way, the electronic device can enlarge the width and height of the twenty-first memory space according to different sizes. The electronic device may enlarge the width and height of the twenty-second memory space according to different sizes. The electronic device may enlarge the width and height of the twenty-third memory space according to different sizes.
结合第十五方面,在一种可能的实现方式中,GPU还可以用于:在绘制第二十一绘制帧时,将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间的第一绘制范围中,得到第二十一绘制结果;第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may also be used to: when drawing the twenty-first drawing frame, draw the drawing content of the drawing instruction of the twenty-first drawing frame to the twenty-first drawing frame In the first drawing range of the memory space, the twenty-first drawing result is obtained; 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 larger than the size of the default memory space.
结合第十五方面,在一种可能的实现方式中,第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于所述默认内存空间的尺寸,具体包括:第一绘制范围的第九尺寸是默认内存空间的第三尺寸的K3倍,第一绘制范围的第十尺寸是默认内存空间的第四尺寸的K4倍,K3大于1,且小于或等于K1,K4大于1,且小于或等于K2。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, specifically including : The ninth size of the first drawing range is K3 times the third size of the default memory space, 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 , K4 is greater than 1, and less than or equal to K2.
第一绘制范围的第九尺寸可以是第一绘制范围的宽度,第一绘制范围的第十尺寸可以第一绘制范围的高度。The ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
结合第十五方面,在一种可能的实现方式中,K3等于K1,K4等于K1,K1、K2、K3、K4为电子设备的系统配置的固定值。电子设备可以根据经验值配置K1、K2、K3、K4。 电子设备直接配置固定值可以减小计算量。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 the system configuration of the electronic device. The electronic equipment can configure K1, K2, K3, K4 according to the experience value. The electronic device directly configures the fixed value to reduce the amount of calculation.
结合第十五方面,在一种可能的实现方式中,K3和K4由电子设备根据第二十一绘制帧的绘制指令中包含的绘制参数确定。这样,电子设备设置的K3和K4可以根据第二十一绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,电子设备对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the fifteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to the drawing parameters included 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 included 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 by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十五方面,在一种可能的实现方式中,GPU还可以用于:在绘制第二十二绘制帧时,将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间的第二绘制范围中,得到第二十二绘制结果;第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may also be used to: when drawing the twenty-second drawing frame, draw the drawing content of the drawing instruction of the twenty-second drawing frame to the twenty-second drawing frame In the second drawing range of the memory space, the twenty-second drawing result is obtained; the size of the second drawing range is smaller 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.
结合第十五方面,在一种可能的实现方式中,第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸,具体包括:第二绘制范围的第十一尺寸是默认内存空间的第三尺寸的K5倍,第二绘制范围的第十二尺寸是默认内存空间的第四尺寸的K6倍,K5大于1,且小于或等于K1,K6大于1,且小于或等于K2。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, specifically including: 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
第二绘制范围的第十一尺寸可以是第二绘制范围的宽度,第二绘制范围的第十二尺寸可以是第二绘制范围的高度。The eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
结合第十五方面,在一种可能的实现方式中,K5和K6为电子设备的系统配置的固定值。电子设备直接配置固定值可以减小计算量。With reference to the fifteenth aspect, in a possible implementation manner, K5 and K6 are fixed values of the system configuration of the electronic device. The electronic device directly configures the fixed value to reduce the amount of calculation.
结合第十五方面,在一种可能的实现方式中,K5和K6由电子设备根据第二十二绘制帧的绘制指令中包含的绘制参数确定。这样,电子设备设置的K5和K6可以根据第二十二绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,电子设备对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the fifteenth aspect, in a possible implementation manner, K5 and K6 are determined by the electronic device according to the drawing parameters included 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 included 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 by the electronic device is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十五方面,在一种可能的实现方式中,GPU可以用于:根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量;根据第二十二绘制结果和第一运动向量,在第二十三内存空间中生成第二十三绘制结果。这样,GPU可以根据第二十一绘制帧和第二十二绘制帧预测出第二十三预测帧的第二十三绘制结果。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may be used to: determine the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; The twenty-two rendering results and the first motion vector generate the twenty-third rendering result in the 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.
结合第十五方面,在一种可能的实现方式中,GPU可以用于:电子设备将第二十二绘制结果分成Q个像素块,在第二十二绘制结果的Q个像素块中取出第一像素块在第二十一绘制结果中确定出与第一像素块匹配的第二像素块;根据第二像素块到第一像素块的位移得到第一像素块的运动向量;根据第一像素块的运动向量确定第二十二绘制结果的第一运动向量。按照该实现方式中的步骤,GPU可以确定第二十二绘制结果的Q个像素块中所有像素块的运动向量。每个像素块中包括f*f(例如,16*16)个像素点。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may be used to: the electronic device divides the twenty-second rendering result into Q pixel blocks, and extracts the 22nd rendering result from the Q pixel blocks of the twenty-second rendering result. A pixel block determines a second pixel block matching the first pixel block in the twenty-first rendering result; obtains the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; The motion vector of the block determines the first motion vector of the twenty-second rendering result. According to the steps in this implementation manner, the GPU may determine motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result. Each pixel block includes f*f (for example, 16*16) pixel points.
上述实现方式中,GPU将第二十二绘制结果分块来计算运动向量,不用去计算第二十二绘制结果中每个像素点的运动向量。这样可以减少计算量,从而降低电子设备中GPU的功耗。In the above implementation manner, the GPU divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation and thus reduces the power consumption of GPUs in electronic devices.
结合第十五方面,在一种可能的实现方式中,GPU可以用于:通过第一像素块中的第一像素点在第二十一绘制结果中确定出多个候选像素块;分别计算出多个候选像素块与第一像素块的颜色值的差值;根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块,第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may be used to: determine a plurality of candidate pixel blocks in the twenty-first drawing result by using the first pixel point in the first pixel block; The difference between the color values of the multiple candidate pixel blocks and the first pixel block; the second pixel block matching the first pixel block is determined according to the difference between the color values of the first pixel block of the multiple candidate pixel blocks, and the second pixel block The block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks.
这样,电子设备中的GPU可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。In this way, the GPU in the electronic device can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第十五方面,在一种可能的实现方式中,GPU可以用于:根据第一运动向量确定第二十三绘制结果的运动向量,根据第二十二绘制结果和第二十三绘制结果的运动向量生成第二十三绘制结果。第二十三绘制结果的运动向量为第一运动向量的G倍,G大于0小于1。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may be used to: determine the motion vector of the twenty-third rendering result according to the first motion vector, and determine the motion vector of the twenty-third rendering result according to the twenty-second rendering result and the twenty-third rendering result The motion vector of generates the twenty-third rendering result. The motion vector of the twenty-third rendering result is G times the first motion vector, and G is greater than 0 and less than 1.
结合第十五方面,在一种可能的实现方式中,G等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于电子设备中GPU的计算,也可以使得用户在观看视频时的体验更好。In conjunction with the fifteenth aspect, in a possible implementation, G is equal to 0.5. In this way, the objects in each image frame move at a constant speed, which is convenient for the calculation of the GPU in the electronic device, and can also make the user experience better when watching the video.
结合第十五方面,在一种可能的实现方式中,GPU还可以用于:根据第二十二绘制结果和第一运动向量,在第二十三内存空间的第三绘制范围内生成第二十三绘制结果;第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于默认内存空间的尺寸。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may also be used to: generate the second drawing within the third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector Thirteen drawing results; 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.
结合第十五方面,在一种可能的实现方式中,第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于第二十三内存空间的尺寸,具体包括:第三绘制范围的第十三尺寸是默认内存空间的第三尺寸的K7倍,第三绘制范围的第十四尺寸是默认内存空间的第四尺寸的K8倍,K7大于1,且小于或等于K1,K8大于1,且小于或等于K2。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, specifically Including: the thirteenth size of the third drawing range is K7 times the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
第三绘制范围的第十三尺寸可以是第三绘制范围的宽度,第三绘制范围的第十四尺寸可以是第三绘制范围的高度。The thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
结合第十五方面,在一种可能的实现方式中,GPU可以用于:创建第二十一内存空间,第二十二内存空间,第二十三内存空间,第二十一内存空间可以用于存储第二十一绘制帧的第二十一绘制结果,第二十二内存空间可以用于存储第二十二绘制帧的第二十二绘制结果,第二十三内存空间可以用于存储第二十三预测帧的第二十三绘制结果。With reference to the fifteenth aspect, in a possible implementation manner, the GPU can be used to: create the twenty-first memory space, the twenty-second memory space, the twenty-third memory space, and the twenty-first memory space can be used For storing 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-second drawing result of the twenty-second drawing frame. The twenty-third rendering result of the twenty-third predicted frame.
结合第十五方面,在一种可能的实现方式中,GPU还可以用于:电子设备将第二十一绘制结果剪切成与默认内存空间的尺寸相同,得到第二十一绘制帧。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may also be used for: the electronic device cuts the twenty-first drawing result to the same size as the default memory space to obtain the twenty-first drawing frame.
结合第十五方面,在一种可能的实现方式中,GPU还可以用于:电子设备将第二十二绘制结果剪切成与默认内存空间的尺寸相同,得到第二十二绘制帧。With reference to the fifteenth aspect, in a possible implementation manner, the GPU may also be used for: the electronic device cuts the twenty-second drawing result into the same size as the default memory space to obtain the twenty-second drawing frame.
第十六方面,提供一种图像帧预测装置,该装置可以包括第一绘制单元、第二绘制单元、生成单元;其中:A sixteenth aspect provides an image frame prediction apparatus, the apparatus may include a first drawing unit, a second drawing unit, and a generating unit; wherein:
第一绘制单元可以用于在绘制第一应用的第二十一绘制帧时,将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,第一绘制范围的尺寸大于第一应用的第二十一绘制帧的尺寸;The first drawing unit may be configured to draw the drawing instruction of the twenty-first drawing frame according to the first drawing range when drawing the twenty-first drawing frame of the first application, to obtain the twenty-first drawing result, the first The size of the drawing range is greater than the size of the twenty-first drawing frame of the first application;
第二绘制单元可以用于在绘制第一应用的第二十二绘制帧时,将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,第二十二内存空间的尺寸大于第二十二绘制帧的尺寸,其中,第二十一绘制帧的尺寸与第二十二绘制帧的尺寸相同;The second drawing unit may be configured to draw the drawing instruction of the twenty-second drawing frame according to the second drawing range when drawing the twenty-second drawing frame of the first application, to obtain the twenty-second drawing result, the twenty-second drawing result. The size of the 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;
生成单元可以用于根据第二十一绘制结果和第二十二绘制结果,预测生成第一应用的第二十三预测帧,其中,第二十三预测帧的尺寸与第二十一绘制帧的尺寸相同。The generating unit may be configured to predict and generate the twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result, wherein the size of the twenty-third predicted frame is the same as that of the twenty-first rendering frame. are the same size.
结合第十六方面,在一种可能的实现方式中,第一绘制单元还可以用于在绘制第二十一绘制帧时,将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果,第二十一内存空间的尺寸大于默认内存空间的尺寸,默认内存空间为电子设备系统提供的存储用于显示的图像帧的内存空间。With reference to the sixteenth aspect, in a possible implementation manner, the first drawing unit may also be used to draw the drawing content of the drawing instruction of the twenty-first drawing frame to the second drawing when drawing the twenty-first drawing frame. In the eleventh memory space, the twenty-first drawing result is obtained, and the size of the twenty-first memory space is larger than the size of the default memory space, which is the memory space provided by the electronic device system for storing image frames for display.
结合第十六方面,在一种可能的实现方式中,第二绘制单元还可以用于在绘制第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得 到第二十二绘制结果,第二十二内存空间的尺寸大于默认内存空间的尺寸。With reference to the sixteenth aspect, in a possible implementation manner, the second drawing unit may also be used to draw the drawing content of the drawing instruction of the twenty-second drawing frame to the electronic device when drawing the twenty-second drawing frame. For the twenty-second memory space, the twenty-second drawing result is obtained, and the size of the twenty-second memory space is larger than the size of the default memory space.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于根据第二十一绘制结果和所述第二十二绘制结果,在第二十三内存空间中生成第二十三绘制结果,第二十三内存空间的尺寸大于默认内存空间的尺寸。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may be further configured to generate the twentieth drawing in the twenty-third memory space according to the twenty-first drawing result and the twenty-second drawing result. Three drawing results, the size of the twenty-third memory space is larger than the size of the default memory space.
结合第十六方面,在一种可能的实现方式中,该图像帧预测装置还可以包括剪切单元,该剪切单元可以用于将第二十三绘制结果剪切成与默认内存空间的尺寸相同,得到第二十三预测帧。With reference to the sixteenth aspect, in a possible implementation manner, the image frame prediction apparatus may further include a clipping unit, and the clipping unit may be configured to clip the twenty-third rendering result to the size of the default memory space In the same way, the twenty-third predicted frame is obtained.
这样,图像帧预测装置可以得到预测帧。在不增加绘制帧的情况下,可以提高图像帧预测装置的帧率。这样,在节约图像帧预测装置功耗的情况下,可以提高图像帧预测装置显示的视频界面流畅度。进一步地,图像帧预测装置预测出的预测帧中可以存在图像帧预测装置显示的第二十一绘制帧和第二十二绘制帧中没有的绘制内容。从而,图像帧预测装置预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄内容。因而,图像帧预测装置预测出的图像帧可以更为准确。In this way, the image frame prediction apparatus can obtain the predicted frame. The frame rate of the image frame prediction apparatus can be increased without increasing the number of rendering frames. In this way, while saving the power consumption of the image frame prediction apparatus, the smoothness of the video interface displayed by the image frame prediction apparatus can be improved. Further, in the prediction frame predicted by the image frame prediction device, there may be rendering content that is not in the twenty-first rendering frame and the twenty-second rendering frame displayed by the image frame prediction device. Therefore, 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.
结合第十六方面,在一种可能的实现方式中,第二十一内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十一内存空间的第一尺寸是默认内存空间的第三尺寸的K1倍,第二十一内存空间的第二尺寸是默认内存空间的第四尺寸的K2倍,K1、K2大于1。With reference to the sixteenth aspect, in a possible implementation manner, the size of the twenty-first memory space is larger than the size of the default memory space, specifically including: the first size of the twenty-first memory space is the third size of the default memory space K1 times the size, the second size of the twenty-first memory space is K2 times the fourth size of the default memory space, and K1 and K2 are greater than 1.
第二十二内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十二内存空间的第五尺寸是默认内存空间的第三尺寸的K1倍,第二十二内存空间的第五尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-second memory space is larger than the size of the default memory space, specifically including: the fifth size of the twenty-second memory space is K1 times the third size of the default memory space, and the fifth size of the twenty-second memory space is K2 times the fourth dimension of the default memory space.
第二十三内存空间的尺寸大于默认内存空间的尺寸,具体包括:第二十三内存空间的第七尺寸是默认内存空间的第三尺寸的K1倍,第二十三内存空间的第八尺寸是默认内存空间的第四尺寸的K2倍。The size of the twenty-third memory space is larger than the size of the default memory space, specifically including: 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 dimension of the default memory space.
这里,第二十一内存空间的第一尺寸可以是第二十一内存空间的宽度,第二十一内存空间的第二尺寸可以是第二十一内存空间的高度。默认内存空间的第三尺寸可以是默认内存空间的宽度,默认内存空间的第四尺寸可以是默认内存空间的高度。第二十二内存空间的第五尺寸可以是第二十二内存空间的宽度,第二十二内存空间的第六尺寸可以是第二十二内存空间的高度。第二十三内存空间的第七尺寸可以是第二十三内存空间的宽度,第二十三内存空间的第八尺寸可以是第二十三内存空间的高度。这样,图像帧预测装置可以按照不同的尺寸来放大第二十一内存空间的宽度和高度。图像帧预测装置可以按照不同的尺寸来放大第二十二内存空间的宽度和高度。图像帧预测装置可以按照不同的尺寸来放大第二十三内存空间的宽度和高度。Here, the first size of the twenty-first memory space may be the width of the twenty-first memory space, and the second size of the twenty-first memory space may be the height of the twenty-first memory space. The third size of the default memory space may be the width of the default memory space, and the fourth size of the default memory space may be the height of the default memory space. The fifth size of the twenty-second memory space may be the width of the twenty-second memory space, and the sixth size of the twenty-second memory space may be the height of the twenty-second memory space. The seventh size of the twenty-third memory space may be the width of the twenty-third memory space, and the eighth size of the twenty-third memory space may be the height of the twenty-third memory space. In this way, the image frame prediction apparatus can enlarge the width and height of the twenty-first memory space according to different sizes. The image frame prediction apparatus may enlarge the width and height of the twenty-second memory space according to different sizes. The image frame prediction apparatus may enlarge the width and height of the twenty-third memory space according to different sizes.
结合第十六方面,在一种可能的实现方式中,第一绘制单元还可以用于:在绘制第二十一绘制帧时,将第二十一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间的第一绘制范围中,得到第二十一绘制结果;第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于默认内存空间的尺寸。With reference to the sixteenth aspect, in a possible implementation manner, the first drawing unit may be further configured to: when drawing the twenty-first drawing frame, draw the drawing content of the drawing instruction of the twenty-first drawing frame to the drawing content of the drawing instruction of the twenty-first drawing frame. In the first drawing range of the twenty-first memory space, the twenty-first drawing result is obtained; 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 .
结合第十六方面,在一种可能的实现方式中,第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,第一绘制范围的尺寸大于所述默认内存空间的尺寸,具体包括:第一绘制范围的第九尺寸是默认内存空间的第三尺寸的K3倍,第一绘制范围的第十尺寸是默认内存空间的第四尺寸的K4倍,K3大于1,且小于或等于K1,K4大于1,且小于或等于K2。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, specifically including : The ninth size of the first drawing range is K3 times the third size of the default memory space, 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 , K4 is greater than 1, and less than or equal to K2.
第一绘制范围的第九尺寸可以是第一绘制范围的宽度,第一绘制范围的第十尺寸可以第 一绘制范围的高度。The ninth size of the first drawing range may be the width of the first drawing range, and the tenth size of the first drawing range may be the height of the first drawing range.
结合第十六方面,在一种可能的实现方式中,K3等于K1,K4等于K1,K1、K2、K3、K4为图像帧预测装置的系统配置的固定值。图像帧预测装置可以根据经验值配置K1、K2、K3、K4。图像帧预测装置直接配置固定值可以减小计算量。With reference to the sixteenth 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 the system configuration of the image frame prediction apparatus. The image frame predicting apparatus may configure K1, K2, K3, and K4 according to empirical values. Directly configuring the fixed value in the image frame prediction apparatus can reduce the amount of calculation.
结合第十六方面,在一种可能的实现方式中,K3和K4由电子设备根据第二十一绘制帧的绘制指令中包含的绘制参数确定。这样,图像帧预测装置设置的K3和K4可以根据第二十一绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,图像帧预测装置对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the sixteenth aspect, in a possible implementation manner, K3 and K4 are determined by the electronic device according to the drawing parameters included in the drawing instruction of the twenty-first drawing frame. In this way, K3 and K4 set by the image frame prediction apparatus can be determined according to the drawing parameters included 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 by the image frame prediction apparatus is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十六方面,在一种可能的实现方式中,第二绘制单元还可以用于:在绘制第二十二绘制帧时,将第二十二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间的第二绘制范围中,得到第二十二绘制结果;第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸。With reference to the sixteenth aspect, in a possible implementation manner, the second drawing unit may be further configured to: when drawing the twenty-second drawing frame, draw the drawing content of the drawing instruction of the twenty-second drawing frame to the drawing content of the drawing instruction of the twenty-second drawing frame. In the second drawing range of the twenty-two memory space, the twenty-second drawing result is obtained; 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 .
结合第十六方面,在一种可能的实现方式中,第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,第二绘制范围的尺寸大于默认内存空间的尺寸,具体包括:第二绘制范围的第十一尺寸是默认内存空间的第三尺寸的K5倍,第二绘制范围的第十二尺寸是默认内存空间的第四尺寸的K6倍,K5大于1,且小于或等于K1,K6大于1,且小于或等于K2。With reference to the sixteenth 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, specifically including: 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, and K5 is greater than 1 and less than or equal to K1 , K6 is greater than 1, and less than or equal to K2.
第二绘制范围的第十一尺寸可以是第二绘制范围的宽度,第二绘制范围的第十二尺寸可以是第二绘制范围的高度。The eleventh size of the second drawing range may be the width of the second drawing range, and the twelfth size of the second drawing range may be the height of the second drawing range.
结合第十六方面,在一种可能的实现方式中,K5和K6为图像帧预测装置的系统配置的固定值。图像帧预测装置直接配置固定值可以减小计算量。With reference to the sixteenth aspect, in a possible implementation manner, K5 and K6 are fixed values of the system configuration of the image frame prediction apparatus. Directly configuring the fixed value in the image frame prediction apparatus can reduce the amount of calculation.
结合第十六方面,在一种可能的实现方式中,K5和K6由图像帧预测装置根据第二十二绘制帧的绘制指令中包含的绘制参数确定。这样,图像帧预测装置设置的K5和K6可以根据第二十二绘制帧的绘制指令中包含的绘制参数决定。这样,不同的绘制帧的绘制范围的放大倍数可以不同。这样,图像帧预测装置对绘制范围的放大倍数与绘制帧的绘制指令中的绘制内容更相符。With reference to the sixteenth aspect, in a possible implementation manner, K5 and K6 are determined by the image frame prediction apparatus according to the drawing parameters included 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 included 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 by the image frame prediction apparatus is more consistent with the drawing content in the drawing instruction of the drawing frame.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于:根据第二十一绘制结果和第二十二绘制结果,确定第二十二绘制结果的第一运动向量;根据第二十二绘制结果和第一运动向量,在第二十三内存空间中生成第二十三绘制结果。这样,图像帧预测装置中的生成单元可以根据第二十一绘制帧和第二十二绘制帧预测出第二十三预测帧的第二十三绘制结果。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may also be configured to: determine the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result; A twenty-third drawing result is generated in the 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 rendering result of the twenty-third predicted frame according to the twenty-first rendering frame and the twenty-second rendering frame.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于:将第二十二绘制结果分成Q个像素块,在第二十二绘制结果的Q个像素块中取出第一像素块;在第二十一绘制结果中确定出与第一像素块匹配的第二像素块;根据第二像素块到第一像素块的位移得到第一像素块的运动向量;根据第一像素块的运动向量确定第二十二绘制结果的第一运动向量。按照该实现方式中的步骤,图像帧预测装置可以确定第二十二绘制结果的Q个像素块中所有像素块的运动向量。每个像素块中包括f*f(例如,16*16)个像素点。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may also be used to: divide the twenty-second rendering result into Q pixel blocks, and extract the first pixel from the Q pixel blocks of the twenty-second rendering result. a pixel block; determine the second pixel block matching the first pixel block in the twenty-first rendering result; obtain the motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block; according to the first pixel block The motion vector of the pixel block determines the first motion vector of the twenty-second rendering result. According to the steps in this implementation manner, the image frame prediction apparatus may determine motion vectors of all pixel blocks in the Q pixel blocks of the twenty-second rendering result. Each pixel block includes f*f (for example, 16*16) pixel points.
上述实现方式中,图像帧预测装置将第二十二绘制结果分块来计算运动向量,不用去计算第二十二绘制结果中每个像素点的运动向量。这样可以减少计算量,从而降低电子设备的功耗。In the above implementation manner, the image frame prediction apparatus divides the twenty-second rendering result into blocks to calculate the motion vector, and does not need to calculate the motion vector of each pixel in the twenty-second rendering result. This reduces the amount of computation, which in turn reduces the power consumption of electronic devices.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于:通过第一像素块中的第一像素点在第二十一绘制结果中确定出多个候选像素块;分别计算出多个候选像素块与第一像素块的颜色值的差值;根据多个候选像素块第一像素块的颜色值的差值确定出与第一像素块匹配的第二像素块,第二像素块为多个候选像素块中与第一像素块的颜色值的差值最小的候选像素块。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may be further configured to: determine multiple candidate pixel blocks in the twenty-first drawing result by using the first pixel point in the first pixel block; respectively; Calculate the difference between the color values of the multiple candidate pixel blocks and the first pixel block; determine the second pixel block that matches the first pixel block according to the difference between the color values of the first pixel block of the multiple candidate pixel blocks, and the first pixel block The two-pixel block is a candidate pixel block with the smallest difference between the color values of the first pixel block and the plurality of candidate pixel blocks.
这样,图像帧预测装置可以更为准确地找到每个像素块的匹配像素块,从而能够更准确地计算出每个像素块的运动向量。In this way, the image frame prediction apparatus can more accurately find the matching pixel block of each pixel block, so that the motion vector of each pixel block can be calculated more accurately.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于:根据第一运动向量确定第二十三绘制结果的运动向量,根据第二十二绘制结果和第二十三绘制结果的运动向量生成第二十三绘制结果。第二十三绘制结果的运动向量为第一运动向量的G倍,G大于0小于1。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may be further configured to: determine the motion vector of the twenty-third rendering result according to the first motion vector, and determine the motion vector of the twenty-third rendering result according to the first motion vector, and The motion vector of the rendering result generates the twenty-third rendering result. The motion vector of the twenty-third rendering result is G times the first motion vector, and G is greater than 0 and less than 1.
结合第十六方面,在一种可能的实现方式中,G等于0.5。这样,每一帧图像帧中的对象为匀速移动,便于图像帧预测装置计算,也可以使得用户在观看视频时的体验更好。In conjunction with the sixteenth aspect, in a possible implementation, G is equal to 0.5. In this way, the objects in each image frame move at a constant speed, which is convenient for the image frame prediction device to calculate, and can also make the user experience better when watching the video.
结合第十六方面,在一种可能的实现方式中,生成单元还可以用于:根据第二十二绘制结果和第一运动向量,在第二十三内存空间的第三绘制范围内生成第二十三绘制结果;第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于第二十三内存空间的尺寸。With reference to the sixteenth aspect, in a possible implementation manner, the generating unit may be further configured to: generate a third drawing range within the third drawing range of the twenty-third memory space according to the twenty-second drawing result and the first motion vector. Twenty-three drawing results; 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.
结合第十六方面,在一种可能的实现方式中,第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,第三绘制范围的尺寸大于第二十三内存空间的尺寸,具体包括:第三绘制范围的第十三尺寸是默认内存空间的第三尺寸的K7倍,第三绘制范围的第十四尺寸是默认内存空间的第四尺寸的K8倍,K7大于1,且小于或等于K1,K8大于1,且小于或等于K2。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, specifically Including: the thirteenth size of the third drawing range is K7 times the third size of the default memory space, the fourteenth size of the third drawing range is K8 times the fourth size of the default memory space, and K7 is greater than 1 and less than or equal to K1, K8 is greater than 1, and less than or equal to K2.
第三绘制范围的第十三尺寸可以是第三绘制范围的宽度,第三绘制范围的第十四尺寸可以是第三绘制范围的高度。The thirteenth size of the third drawing range may be the width of the third drawing range, and the fourteenth size of the third drawing range may be the height of the third drawing range.
结合第十六方面,在一种可能的实现方式中,该图像帧预测装置还可以包括创建单元,该创建单元可以用于:创建第二十一内存空间,第二十二内存空间,第二十三内存空间,第二十一内存空间可以用于存储第二十一绘制帧的第二十一绘制结果,第二十二内存空间可以用于存储第二十二绘制帧的第二十二绘制结果,第二十三内存空间可以用于存储第二十三预测帧的第二十三绘制结果。With reference to the sixteenth aspect, in a possible implementation manner, the image frame prediction apparatus may further include a creation unit, and the creation unit may be configured to: create a twenty-first memory space, a twenty-second memory space, and a second memory space. Thirteen memory spaces, the twenty-first memory space can be used to store the twenty-first drawing result of the twenty-first drawing frame, and the twenty-second memory space can be used to store the twenty-second drawing frame of the twenty-second drawing frame. For the drawing result, the twenty-third memory space can be used to store the twenty-third drawing result of the twenty-third predicted frame.
结合第十六方面,在一种可能的实现方式中,剪切单元还可以用于:将第二十一绘制结果剪切成与默认内存空间的尺寸相同,得到第二十一绘制帧。With reference to the sixteenth aspect, in a possible implementation manner, the clipping unit may also be used to: clip the twenty-first drawing result to be the same size as the default memory space to obtain the twenty-first drawing frame.
结合第十六方面,在一种可能的实现方式中,剪切单元还可以用于:将第二十二绘制结果剪切成与默认内存空间的尺寸相同,得到第二十二绘制帧。With reference to the sixteenth aspect, in a possible implementation manner, the clipping unit may also be used to: clip the twenty-second drawing result to be the same size as the default memory space to obtain the twenty-second drawing frame.
第十七方面,提供一种电子设备,包括:一个或多个处理器;一个或多个存储器;一个或多个存储器存储有一个或多个计算机程序,一个或多个计算机程序包括指令,当指令被一个或多个处理器执行时,使得电子设备执行如第一方面、第五方面、第七方面、第九方面、第十一方面、第十三方面以及第十四方面中任一种可能的实现方式。A seventeenth aspect provides an electronic device, comprising: one or more processors; one or more memories; the one or more memories stores one or more computer programs, and the one or more computer programs include instructions, when The instructions, when executed by one or more processors, cause the electronic device to perform any one of the first, fifth, seventh, ninth, eleventh, thirteenth, and fourteenth aspects possible implementations.
第十八方面,本申请实施例提供了一种芯片,该芯片应用于电子设备,该芯片包括一个或多个处理器,该处理器用于调用计算机指令以使得该电子设备执行如第一方面、第五方面、 第七方面、第九方面、第十一方面、第十三方面以及第十四方面中任一种可能的实现方式。In an eighteenth aspect, an embodiment of the present application provides a chip, the chip is applied to an electronic device, the chip includes one or more processors, and the processor is configured to invoke computer instructions to cause the electronic device to execute the first aspect, Any possible implementation manner of the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, the thirteenth aspect and the fourteenth aspect.
第十九方面,提供一种计算机产品当所述计算机程序产品在计算机上运行时,使得所述计算机执行如第一方面、第五方面、第七方面、第九方面、第十一方面、第十三方面以及第十四方面中任一种可能的实现方式。A nineteenth aspect provides a computer product that, when the computer program product runs on a computer, causes the computer to perform the first aspect, the fifth aspect, the seventh aspect, the ninth aspect, the eleventh aspect, and the first aspect. Any possible implementation manner of the thirteenth aspect and the fourteenth aspect.
第二十方面,提供一种计算机可读存储介质,包括指令,其特征在于,当上述指令在电子设备上运行时,以使得电子设备执行如第一方面、第五方面、第七方面、第九方面、第十一方面、第十三方面以及第十四方面中任一种可能的实现方式。In a twentieth aspect, a computer-readable storage medium is provided, comprising instructions, characterized in that, when the above-mentioned instructions are executed on an electronic device, the electronic device executes the first aspect, the fifth aspect, the seventh aspect, the first aspect, and the third aspect. Any possible implementation manner of the ninth aspect, the eleventh aspect, the thirteenth aspect and the fourteenth aspect.
可以理解地,上述第十七方面提供的电子设备、第十八方面提供的芯片、第十九方面提供的计算机程序产品和第二十方面提供的计算机存储介质均用于执行本申请实施例所提供的方法。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 embodiments of the present application. provided method.
附图说明Description of drawings
图1是本申请实施例提供的平板电脑10的用户界面100示意图;FIG. 1 is a schematic diagram of a user interface 100 of a tablet computer 10 provided by an embodiment of the present application;
图2是本申请实施例提供的用户界面100中第N绘制帧的静态对象示意图;FIG. 2 is a schematic diagram of a static object of the Nth drawing frame in the user interface 100 provided by the embodiment of the present application;
图3是本申请实施例提供的用户界面100中第N绘制帧的动态对象示意图;3 is a schematic diagram of a dynamic object of the Nth drawing frame in the user interface 100 provided by the embodiment of the present application;
图4A是本申请实施例提供的绘制帧300A的示意图;4A is a schematic diagram of a drawing frame 300A provided by an embodiment of the present application;
图4B是本申请实施例提供的预测帧300B的示意图;4B is a schematic diagram of a prediction frame 300B provided by an embodiment of the present application;
图5A是本申请实施例提供的绘制帧500的示意图;FIG. 5A is a schematic diagram of a drawing frame 500 provided by an embodiment of the present application;
图5B是本申请实施例提供的绘制帧500的部分像素块示意图;FIG. 5B is a schematic diagram of a partial pixel block of the drawing frame 500 provided by an embodiment of the present application;
图5C是本申请实施例提供的根据图5B中像素块预测出的预测帧中的像素块示意图;5C is a schematic diagram of a pixel block in a prediction frame predicted according to the pixel block in FIG. 5B provided by an embodiment of the present application;
图6A是本申请实施例提供的一种图像帧预测的方法的逻辑框图;6A is a logical block diagram of a method for image frame prediction provided by an embodiment of the present application;
图6B是本申请实施例提供的一种图像帧预测的方法流程图;6B is a flowchart of a method for predicting an image frame provided by an embodiment of the present application;
图7A是本申请实施例提供的第N绘制帧示意图;7A is a schematic diagram of an Nth drawing frame provided by an embodiment of the present application;
图7B是本申请实施例提供的第N绘制帧中动态对象的深度附件和颜色附件示意图;7B is a schematic diagram of depth attachment and color attachment of a dynamic object in the Nth drawing frame provided by an embodiment of the present application;
图7C是本申请实施例提供的第N绘制帧中静态对象的深度附件和颜色附件示意图;7C is a schematic diagram of depth attachment and color attachment of a static object in the Nth drawing frame provided by an embodiment of the present application;
图8A是本申请实施例提供的第N+2绘制帧示意图;8A is a schematic diagram of an N+2th drawing frame provided by an embodiment of the present application;
图8B是本申请实施例提供的第N+2绘制帧中动态对象的深度附件和颜色附件示意图;8B is a schematic diagram of a depth attachment and a color attachment of a dynamic object in the N+2th drawing frame provided by an embodiment of the present application;
图8C是本申请实施例提供的第N+2绘制帧中静态对象的深度附件和颜色附件示意图;8C is a schematic diagram of depth attachment and color attachment of a static object in the N+2th drawing frame provided by an embodiment of the present application;
图9A-图9C是本申请实施例提供的通过菱形搜索计算第N+2帧中像素块902的运动向量的过程示意图;9A-9C are schematic diagrams of the process of calculating the motion vector of the pixel block 902 in the N+2th frame through a diamond search provided by an embodiment of the present application;
图10A是本申请实施例提供的预测出的第N+3预测帧中动态对象的颜色附件示意图;10A is a schematic diagram of the color attachment of a dynamic object in the predicted N+3th predicted frame provided by an embodiment of the present application;
图10B是本申请实施例提供的预测出的第N+3预测帧中静态对象的颜色附件示意图;10B is a schematic diagram of the color attachment of the static object in the predicted N+3th predicted frame provided by an embodiment of the present application;
图10C是本申请实施例提供的预测出的第N+3预测帧示意图;FIG. 10C is a schematic diagram of the predicted N+3 th prediction frame provided by an embodiment of the present application;
图11是本申请实施例提供的90fps插帧逻辑框图;11 is a logical block diagram of 90fps frame insertion provided by an embodiment of the present application;
图12是本申请实施例提供的电子设备的结构示意图;12 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
图13是本申请实施例提供的电子设备的系统框架示意图;13 is a schematic diagram of a system framework of an electronic device provided by an embodiment of the present application;
图14是本申请实施例提供的平板电脑10的用户界面示意图;FIG. 14 is a schematic diagram of a user interface of a tablet computer 10 provided by an embodiment of the present application;
图15是本申请实施例提供的第W绘制帧示意图;15 is a schematic diagram of the Wth drawing frame provided by an embodiment of the present application;
图16是本申请实施例提供的第W+2绘制帧示意图;16 is a schematic diagram of the W+2th drawing frame provided by an embodiment of the present application;
图17是本申请实施例提供的一种图像帧预测的方法流程示意图;17 is a schematic flowchart of a method for predicting an image frame provided by an embodiment of the present application;
图18是本申请实施例提供的电子设备获取对象属性的示意图;18 is a schematic diagram of an electronic device acquiring object attributes provided by an embodiment of the present application;
图19A是本申请实施例提供的运动对象在不同坐标系转换示意图;19A is a schematic diagram of the conversion of a moving object in different coordinate systems provided by an embodiment of the present application;
图19B是本申请实施例提供的静态对象在不同坐标系示意图;19B is a schematic diagram of a static object provided in an embodiment of the present application in different coordinate systems;
图20A-图20C是本申请实施例提供的GPU绘制第W绘制帧对象的模板图像的示意图;20A-20C are schematic diagrams of a template image of a GPU drawing the Wth drawing frame object provided by an embodiment of the present application;
图21A-图21C是本申请实施例提供的GPU绘制第W+2绘制帧对象的模板图像的示意图;21A-21C are schematic diagrams of GPU rendering a template image of the W+2th rendering frame object provided by an embodiment of the present application;
图22A-图22B是本申请实施例提供的计算运动对象的运动向量过程示意图;22A-22B are schematic diagrams of a process of calculating a motion vector of a moving object according to an embodiment of the present application;
图23是本申请实施例提供的图像帧预测的相关模块示意图;FIG. 23 is a schematic diagram of related modules for image frame prediction provided by an embodiment of the present application;
图24为本申请实施例公开的一种帧预测方法的流程图;24 is a flowchart of a frame prediction method disclosed in an embodiment of the present application;
图25为本申请实施例公开的一种获取参考帧的示意图;FIG. 25 is a schematic diagram of obtaining a reference frame disclosed by an embodiment of the present application;
图26为本申请实施例公开的另一种获取参考帧的示意图;FIG. 26 is another schematic diagram of acquiring a reference frame disclosed by an embodiment of the present application;
图27为本申请实施例公开的一种确定目标参考帧的示意图;FIG. 27 is a schematic diagram of determining a target reference frame disclosed by an embodiment of the present application;
图28为本申请实施例公开的一种划分目标参考帧的示意图;FIG. 28 is a schematic diagram of dividing a target reference frame disclosed by an embodiment of the present application;
图29为本申请实施例公开的一种计算块的预测运动向量的流程示意图;29 is a schematic flowchart of calculating a predicted motion vector of a block disclosed in an embodiment of the present application;
图30为本申请实施例公开的一种获取块从目标参考帧到匹配帧的示意图;30 is a schematic diagram of an acquisition block from a target reference frame to a matching frame disclosed by an embodiment of the present application;
图31A为本申请实施例公开的一种确定块的预测运动向量的示意图;31A is a schematic diagram of determining a predicted motion vector of a block according to an embodiment of the present application;
图31B为本申请实施例公开的另一种确定块的预测运动向量的示意图;31B is a schematic diagram of another method of determining a predicted motion vector of a block disclosed in an embodiment of the present application;
图32A为本申请实施例公开的一种确定顶点四周的块的示意图;32A is a schematic diagram of determining blocks around a vertex according to an embodiment of the present application;
图32B为本申请实施例公开的一种确定顶点的预测运动向量的示意图;32B is a schematic diagram of determining a predicted motion vector of a vertex disclosed in an embodiment of the present application;
图33为本申请实施例公开的一种确定顶点坐标的示意图;33 is a schematic diagram of determining vertex coordinates disclosed in an embodiment of the present application;
图34为本申请实施例公开的一种确定块中的像素在预测帧中的坐标的流程图;34 is a flowchart of determining coordinates of pixels in a block in a predicted frame disclosed in an embodiment of the present application;
图35A为本申请实施例公开的一种获取块对应的单应性变换公式的示意图;35A is a schematic diagram of a homography transformation formula corresponding to an acquisition block disclosed by an embodiment of the present application;
图35B为本申请实施例公开的一种确定像素在预测帧中的坐标的示意图;35B is a schematic diagram of determining coordinates of pixels in a predicted frame disclosed by an embodiment of the present application;
图35C为本申请实施例公开的一种预测帧的示意图;35C is a schematic diagram of a prediction frame disclosed in an embodiment of the present application;
图36为本申请实施例公开的另一种预测帧的示意图;FIG. 36 is a schematic diagram of another prediction frame disclosed in an embodiment of the present application;
图37是本申请实施例提供的一种图像帧生成方法的流程示意图;37 is a schematic flowchart of a method for generating an image frame provided by an embodiment of the present application;
图38是本申请实施例提供的一种位置关系的示意图;38 is a schematic diagram of a positional relationship provided by an embodiment of the present application;
图39A是本申请实施例提供的一种图像帧的示意图;39A is a schematic diagram of an image frame provided by an embodiment of the present application;
图39B是本申请实施例提供的一种划分图像帧的示意图;39B is a schematic diagram of dividing an image frame according to an embodiment of the present application;
图40A至图40C是本申请实施例提供的一组确定匹配块的示意图;40A to 40C are schematic diagrams of a group of determining matching blocks provided by an embodiment of the present application;
图41A是本申请实施例提供的一种确定预测图像帧中位置坐标的方法的流程示意图;41A is a schematic flowchart of a method for determining position coordinates in a predicted image frame provided by an embodiment of the present application;
图41B至图41C是本申请实施例提供的一组匹配块的示意图;41B to 41C are schematic diagrams of a group of matching blocks provided by an embodiment of the present application;
图41D至图41F是本申请实施例提供的一组相机坐标系下预测位置坐标的示意图;41D to 41F are schematic diagrams of predicted position coordinates in a set of camera coordinate systems provided by an embodiment of the present application;
图42是本申请实施例提供的一种确定预测块的顶点的示意图;42 is a schematic diagram of determining a vertex of a prediction block provided by an embodiment of the present application;
图43是本申请实施例提供的一种生成预测块的示意图;43 is a schematic diagram of generating a prediction block provided by an embodiment of the present application;
图44A至图44B是本申请实施例提供的一组关于预测块的示意图;44A to 44B are a set of schematic diagrams about prediction blocks provided by an embodiment of the present application;
图45A至图45B是本申请实施例提供的一组关于预测块的示意图;45A to 45B are a set of schematic diagrams about prediction blocks provided by an embodiment of the present application;
图46A至图46I是本申请实施例提供的一组生成图像帧的示意图;46A to 46I are schematic diagrams of a group of generated image frames provided by an embodiment of the present application;
图47是本申请实施例提供的一组电子设备100的软件结构框图;FIG. 47 is a software structural block diagram of a group of electronic devices 100 provided by an embodiment of the present application;
图48是本申请实施例提供的另一种电子设备100的结构示意图;FIG. 48 is a schematic structural diagram of another electronic device 100 provided by an embodiment of the present application;
图49A是本申请实施例提供的一种创建帧缓存对象示意图;49A is a schematic diagram of creating a frame buffer object provided by an embodiment of the present application;
图49B是本申请实施例提供的一种绘制和显示原始图像帧的示意图;49B is a schematic diagram of drawing and displaying an original image frame provided by an embodiment of the present application;
图49C是本申请实施例提供的一种绘制和显示预测图像帧的示意图;49C is a schematic diagram of drawing and displaying a predicted image frame provided by an embodiment of the present application;
图50A是本申请实施例提供的一种自定义的动态图层的示意图;50A is a schematic diagram of a custom dynamic layer provided by an embodiment of the present application;
图50B是本申请实施例提供的一种自定义的UI图层的示意图;50B is a schematic diagram of a custom UI layer provided by an embodiment of the present application;
图50C是本申请实施例提供的一种图像帧的示意图;50C is a schematic diagram of an image frame provided by an embodiment of the present application;
图50D是本申请实施例提供的一种绘制过程的示意图;50D is a schematic diagram of a drawing process provided by an embodiment of the present application;
图50E是本申请实施例提供的一种生成图像帧的示意图;FIG. 50E is a schematic diagram of generating an image frame provided by an embodiment of the present application;
图51A是本申请实施例提供的一种图像帧的生成方法的流程示意图;51A is a schematic flowchart of a method for generating an image frame provided by an embodiment of the present application;
图51B和图51C分别是本申请实施例提供的一种合成图像帧的示意图;FIG. 51B and FIG. 51C are respectively schematic diagrams of a composite image frame provided by an embodiment of the present application;
图51D和图51E是本申请实施例提供的一种绘制结果可能呈现的效果图;FIG. 51D and FIG. 51E are effect diagrams that a drawing result may present according to an embodiment of the present application;
图51F是本申请实施例提供的一种生成图像帧的示意图;FIG. 51F is a schematic diagram of generating an image frame provided by an embodiment of the present application;
图52是本申请实施例提供的一种模块化的交互示意图;52 is a schematic diagram of a modular interaction provided by an embodiment of the present application;
图53A是本申请实施例提供的一种图像帧的生成方法的流程示意图;53A is a schematic flowchart of a method for generating an image frame provided by an embodiment of the present application;
图53B-图53D是本申请实施例提供的一组预测过程的示意图;53B-53D are schematic diagrams of a group of prediction processes provided by an embodiment of the present application;
图53E-图53I是本申请实施例提供的一组绘制过程的示意图;53E-53I are schematic diagrams of a group of drawing processes provided by an embodiment of the present application;
图54A-图54C是本申请实施例提供的平板电脑10的一组用户界面示意图;54A-54C are schematic diagrams of a group of user interfaces of the tablet computer 10 provided by the embodiments of the present application;
图55A是本申请实施例提供的绘制帧A、绘制帧B以及根据绘制帧A和绘制帧B得到的预测帧的示意图;55A is a schematic diagram of a drawing frame A, a drawing frame B, and a predicted frame obtained according to the drawing frame A and the drawing frame B provided by an embodiment of the present application;
图55B是本申请实施例提供的相机拍摄视野示意图;FIG. 55B is a schematic diagram of a camera shooting field of view provided by an embodiment of the present application;
图56是本申请实施例提供的一种图像帧预测的方法流程图;56 is a flowchart of a method for predicting an image frame provided by an embodiment of the present application;
图57是本申请实施例提供的默认内存空间示意图;57 is a schematic diagram of a default memory space provided by an embodiment of the present application;
图58是本申请实施例提供的第二十一内存空间示意图;58 is a schematic diagram of a twenty-first memory space provided by an embodiment of the present application;
图59是本申请实施例提供的第二十二内存空间示意图;59 is a schematic diagram of a twenty-second memory space provided by an embodiment of the present application;
图60是本申请实施例提供的第二十三内存空间示意图;60 is a schematic diagram of a twenty-third memory space provided by an embodiment of the present application;
图61是本申请实施例提供的第二十一内存空间中的第一绘制范围、第二十一绘制结果以及第U绘制帧示意图;61 is a schematic diagram of the first drawing range, the twenty-first drawing result, and the U-th drawing frame in the twenty-first memory space provided by an embodiment of the present application;
图62是本申请实施例提供的第二十二内存空间中的第二绘制范围、第二十二绘制结果、第U+2绘制帧示意图;62 is a schematic diagram of the second drawing range, the twenty-second drawing result, and the U+2th drawing frame in the twenty-second memory space provided by an embodiment of the present application;
图63A-图63C是本申请实施例提供的通过菱形搜索计算第U+2绘制帧中像素块6205的运动向量的过程示意图;63A-63C are schematic diagrams of the process of calculating the motion vector of the pixel block 6205 in the U+2th drawing frame by diamond search provided by an embodiment of the present application;
图64是本申请实施例提供的第二十三内存空间中的第三绘制范围、第二十三绘制结果、第U+3预测帧示意图。FIG. 64 is a schematic diagram of the third drawing range, the twenty-third drawing result, and the U+3-th predicted frame in the twenty-third memory space provided by the embodiment of the present application.
具体实施方式Detailed ways
本申请以下实施例中所使用的术语只是为了描述特定实施例的目的,而并非旨在作为对本申请的限制。如在本申请的说明书和所附权利要求书中所使用的那样,单数表达形式“一个”、“一种”、“所述”、“上述”、“该”和“这一”旨在也包括复数表达形式,除非其上下文中明确地有相反指示。还应当理解,本申请中使用的术语“和/或”是指并包含一个或多个所列出项目的任何或所有可能组合。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 used as limitations of the present application. As used in the specification of this application and the appended claims, the singular expressions "a," "an," "the," "above," "the," and "the" are intended to also Plural expressions are included unless the context clearly dictates otherwise. It will also be understood that, as used in this application, the term "and/or" refers to and includes any and all possible combinations of one or more of the listed items.
以下,术语“第一”、“第二”仅用于描述目的,而不能理解为暗示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征,在本申请实施例的描述中,除非另有说明,“多个”的含义是两个或两个以上。Hereinafter, the terms "first" and "second" are only used for descriptive purposes, and should not be construed as implying or implying relative importance or implying the number of indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, unless otherwise specified, the "multiple" The meaning is two or more.
由于本申请实施例涉及一种图像帧预测方法的应用,为了便于理解,下面先对本申请实施例涉及的相关术语及概念进行介绍。Since the embodiments of the present application relate to the application of an image frame prediction method, for ease of understanding, related terms and concepts involved in the embodiments of the present application are first introduced below.
(1)图像帧(1) Image frame
在本申请实施例中,电子设备用于显示在显示屏中的每一帧图像称为图像帧。在本申请实施例中,图像帧可以是某一应用的一帧图像,可以是电子设备根据该应用的绘制指令绘制出的绘制结果,也可以是根据已有绘制结果预测出来的预测结果。如图1所示,电子设备(即平板电脑10)显示了用户界面100。在T0时刻,用户界面10中显示了第N帧图像帧。第N帧图像帧为绘制帧。图1中时序图101示出了从T0时刻到Tn时刻电子设备可以显示的图像帧。In this embodiment of the present application, each frame of image that the electronic device uses to display on the display screen is referred to as an image frame. In this embodiment of the present application, an image frame may be a frame of an image of an application, a drawing result drawn by an electronic device according to a drawing instruction of the application, or a prediction result predicted based on an existing drawing result. As shown in FIG. 1 , an electronic device (ie, tablet 10 ) displays a user interface 100 . At time T0, the Nth image frame is displayed in the user interface 10. The Nth image frame is a drawing frame. The timing diagram 101 in FIG. 1 shows the image frames that the electronic device can display from time T0 to time Tn.
(2)绘制帧(2) Drawing frame
在本申请实施例中,电子设备在应用程序运行时,根据应用程序的绘制指令和绘制参数绘制出的图像帧称为绘制帧。应用程序的绘制指令和绘制参数可以是应用图形框架、应用引擎自动生成的,也可以是应用开发者编写的。绘制帧对应的绘制参数中可以包含一个或多个对象。电子设备可以将一个或多个对象绘制成绘制帧中对应的元素。例如,图1示出的用户界面100可以是一帧绘制帧。用户界面100中的元素102(图2中示出)和元素103(图3中示出)均为绘制参数中的对象经过绘制和渲染后得到。In the embodiment of the present application, the image frame drawn by the electronic device according to the drawing instruction and drawing parameters of the application program when the application program is running is called a drawing frame. The drawing instructions and drawing parameters of the application may be automatically generated by the application graphics framework or the application engine, or may be written by the application developer. The drawing parameters corresponding to the drawing frame can contain one or more objects. The electronic device may draw one or more objects as corresponding elements in the drawing frame. For example, the user interface 100 shown in FIG. 1 may be a frame of drawing. Element 102 (shown in FIG. 2 ) and element 103 (shown in FIG. 3 ) in the user interface 100 are obtained after drawing and rendering the objects in the drawing parameters.
可以理解的是,绘制帧的绘制参数中包含多个对象的属性。对象的属性可以包括对象中每个像素点的颜色值(例如RGB值)、对象中每个像素点的深度值,模板缓存(stencil buffer)、对象的转移矩阵等等中的一项或多项。CPU可以根据绘制参数向GPU发送用于指示GPU执行绘制的绘制指令。GPU可以根据一个绘制指令绘制出一个对象。GPU根据携带了转移矩阵的绘制指令绘制出的对象可以称为运动对象。GPU根据未携带转移矩阵的绘制指令绘制出的对象可以称为静态对象。可选地,静态对象对应的绘制指令可以携带转移矩阵,该转移矩阵为全0矩阵,即矩阵中每行每列的元素均为0。It is understandable that the drawing parameters of the drawing frame contain properties of multiple objects. The properties of the object can include one or more of the color value (eg, RGB value) of each pixel in the object, the depth value of each pixel in the object, the stencil buffer, the object's transition matrix, etc. . The CPU may send a drawing instruction to the GPU for instructing the GPU to perform drawing according to the drawing parameter. The GPU can draw an object according to a drawing instruction. The object drawn by the GPU according to the drawing instruction carrying the transition matrix can be called a moving object. Objects drawn by the GPU according to drawing instructions that do not carry a transition matrix can be called static objects. Optionally, the drawing instruction corresponding to the static object may carry a transition matrix, and the transition matrix is an all-zero matrix, that is, the elements of each row and each column in the matrix are 0.
在本申请实施例中,以游戏应用为例,运动对象在游戏场景中是会运动的。由运动对象绘制和渲染得到的用户界面中的第一元素,在相邻的两帧图像帧中的位置是变化的。用户可以在用户界面中看到该第一元素的位置是移动的。静态对象在游戏场景中是静止的,但是会因为相机的拍摄角度的变化导致静态对象在不同图像帧中的位置不同。由静态对象绘制和渲染得到的用户界面中的第二元素,在相邻的两帧图像帧中的位置可以变化,位置变化的大小与相机拍摄位置以及拍摄角度有关。例如,第一元素可以是图3中元素103,元素103为一个运动的小车。第二元素可以是图2中的元素102,元素102为一个静态的背景。静态的背景在不同图像帧中的位置可以由于相机的拍摄角度发生变化而改变。In the embodiment of the present application, taking a game application as an example, a moving object can move in a game scene. The position of the first element in the user interface drawn and rendered by the moving object changes in two adjacent image frames. The user can see in the user interface that the position of the first element is moved. Static objects are static in the game scene, but the position of the static objects in different image frames will be different due to the change of the camera's shooting angle. The position of the second element in the user interface drawn and rendered by the static object can be changed in two adjacent image frames, and the magnitude of the position change is related to the shooting position and shooting angle of the camera. For example, the first element may be element 103 in FIG. 3 , which is a moving cart. The second element may be the element 102 in FIG. 2, and the element 102 is a static background. The position of the static background in different image frames can change due to the change of the camera's shooting angle.
(3)预测帧(3) Predicted frame
在本申请实施例中,电子设备根据已有的绘制帧数据,新生成的图像帧,称为预测帧。预测帧的绘制参数根据两帧绘制帧的绘制参数得到。举例来说,电子设备可以通过第一绘制 帧和第二绘制帧生成第一预测帧。第一预测帧为第二绘制帧的后一帧图像帧。即,电子设备显示第二绘制帧后,显示第一预测帧。第一绘制帧为第二绘制帧之前的图像帧(第一绘制帧和第二绘制帧之间可以存在图像帧)。即第一绘制帧在第二绘制帧之前显示在电子设备的显示屏中。可以理解的是,若第N帧图像帧是绘制帧,那么在本申请实施例中就可以称为第N绘制帧。若第N帧图像帧是预测帧,那么在本申请实施例中就可以称为第N预测帧。In this embodiment of the present application, an image frame newly generated by the electronic device according to the existing drawing frame data is called a prediction frame. The drawing parameters of the predicted frame are obtained from the drawing parameters of the two drawing frames. For example, the electronic device may generate the first predicted frame from the first rendering frame and the second rendering frame. The first predicted frame is an image frame following the second drawing frame. That is, after the electronic device displays the second drawing frame, it displays the first predicted frame. The first drawing frame is an image frame before the second drawing frame (an image frame may exist between the first drawing frame and the second drawing frame). That is, the first drawing frame is displayed on the display screen of the electronic device before the second drawing frame. It can be understood that, if the Nth image frame is a drawing frame, it may be referred to as the Nth drawing frame in this embodiment of the present application. If the N th image frame is a predicted frame, it may be referred to as the N th predicted frame in this embodiment of the present application.
可以理解的是,预测帧的绘制参数中包含的对象与在预测帧前一帧显示的绘制帧的绘制参数中包含的对象相同。这里图像帧的绘制参数中包含的对象可以简称为图像帧包含的对象。例如,预测帧的绘制参数中包含的对象可以简称为预测帧包含的对象。It can be understood that the objects contained in the drawing parameters of the predicted frame are the same as the objects contained in the drawing parameters of the drawing frame displayed one frame before the predicted frame. Here, the objects included in the drawing parameters of the image frame may be simply referred to as the objects included in the image frame. For example, the objects included in the drawing parameters of the predicted frame may be simply referred to as the objects included in the predicted frame.
这里,电子设备通过两帧绘制帧生成预测帧的具体过程可以参考下文,此处先不赘述。Here, for the specific process of generating the predicted frame by the electronic device by drawing two frames, reference may be made to the following, which will not be repeated here.
(4)图像帧预测(4) Image frame prediction
在本申请实施例中,电子设备通过第一绘制帧和第二绘制帧生成第一预测帧的过程,称为图像帧预测。In this embodiment of the present application, the process of generating the first predicted frame by the electronic device through the first drawing frame and the second drawing frame is called image frame prediction.
(5)颜色附件(color attachment)(5) Color attachment
在本申请实施例中,颜色附件(color attachment)是一块内存空间,用于在电子设备根据绘制指令进行绘制时,存储绘制结果中的各像素点颜色数据(例如像素点的RGB值)。颜色附件可以作为FBO的一部分。In this embodiment of the present application, a color attachment is a memory space used to store color data (eg, RGB values of pixels) of each pixel in the drawing result when the electronic device draws according to the drawing instruction. Color attachments are available as part of the FBO.
(6)深度附件(6) Depth attachment
在本申请实施例中,深度附件(depth attachment)是一块内存空间,用于在电子设备根据绘制指令进行绘制时,存储绘制结果中各像素点深度数据。颜色附件可以作为FBO的一部分。可以理解的,深度附件中深度值越小的像素点,离相机的距离越近。在合成图像帧时,对于两个颜色附件中坐标值相等的两个像素点,深度值小的一个像素点可以覆盖深度值大的另一个像素点。即最终显示屏像素点显示的颜色为两个颜色附件中深度值小的像素点的颜色。In this embodiment of the present application, a depth attachment is a memory space used to store the depth data of each pixel in the drawing result when the electronic device draws according to the drawing instruction. Color attachments are available as part of the FBO. Understandably, the smaller the depth value of the pixel in the depth attachment, the closer it is to the camera. When synthesizing an image frame, for two pixels with equal coordinate values in two color attachments, a pixel with a smaller depth value can cover another pixel with a larger depth value. That is, the color displayed by the final display pixel point is the color of the pixel point with the smaller depth value in the two color attachments.
为了提升帧率,提高视频的流畅性,电子设备可以在应用的绘制帧之间插入预测帧。电子设备可以根据应用的绘制帧进行图像帧预测得到预测帧。图像帧中的运动对象和静态对象的运动速度和运动方向可能不一样,即运动向量不一样。在进行图像帧预测的过程中,若将图像帧中的运动对象和静态对象一起计算运动向量,会导致计算出来的运动向量不准确。这样,会导致预测出的图像帧中出现扭曲或者空洞。In order to increase the frame rate and improve the smoothness of the video, the electronic device can insert the predicted frame between the drawn frames of the application. The electronic device may perform image frame prediction according to the drawn frame of the application to obtain the predicted frame. The moving speed and moving direction of the moving object and the static object in the image frame may be different, that is, the motion vector is different. In the process of image frame prediction, if a motion vector is calculated together with a moving object and a static object in the image frame, the calculated motion vector will be inaccurate. This can lead to distortions or holes in the predicted image frames.
图4A示例性地示出了绘制帧的示意图。图4B示例性地示出根据图4A中绘制帧得到的预测帧示意图。如图4A所示,绘制帧300A可以包括静态对象(静止的背景)301和运动对象(运动的小车)302。电子设备可以根据绘制帧300A以及绘制帧的运动向量预测得到预测帧300B。如图4B示出的预测帧300B。该预测帧300B中包含的对象与绘制帧300A中相同。即预测帧300B中可以包含静态对象301和运动对象302。相对于绘制帧300A中的运动对象302,预测帧300B中的运动对象301向前移动了,移动部分为图4B中示出的303部分。当运动对象如图中示意的运动方向移动后,预测帧300B中运动对象302移动的区域303可能会缺失像素信息。由于在绘制帧300A中这一部分像素被运动对象301覆盖,若电子设备以绘制帧为整体来预测得到预测帧,在预测过程中,运动对象移动后,电子设备可能无法获取 到这一部分的像素信息。从而,导致预测帧300B中区域303可能会缺失像素信息。FIG. 4A exemplarily shows a schematic diagram of drawing a frame. FIG. 4B exemplarily shows a schematic diagram of a predicted frame obtained according to the frame drawn in FIG. 4A . As shown in FIG. 4A , a drawing frame 300A may include a static object (static background) 301 and a moving object (moving car) 302 . The electronic device can predict the predicted frame 300B according to the rendering frame 300A and the motion vector of the rendering frame. A predicted frame 300B is shown in Figure 4B. The objects contained in the predicted frame 300B are the same as those in the rendering frame 300A. That is, a static object 301 and a moving object 302 may be included in the predicted frame 300B. Relative to the moving object 302 in the drawing frame 300A, the moving object 301 in the predicted frame 300B has moved forward, and the moving part is the part 303 shown in FIG. 4B . When the moving object moves in the moving direction shown in the figure, the region 303 where the moving object 302 moves in the predicted frame 300B may lack pixel information. Since this part of the pixels in the drawing frame 300A is covered by the moving object 301, if the electronic device predicts the predicted frame by taking the drawing frame as a whole, during the prediction process, after the moving object moves, the electronic device may not be able to obtain the pixel information of this part . Therefore, the region 303 in the predicted frame 300B may lack pixel information.
图5A示例性地示出了绘制帧500。该绘制帧500中可以包括静态的背景以及运动的小车521。电子设备可以将绘制帧500划分为Q个像素块。图5A中的绘制帧400可以被划分为Q个像素块。Q的大小与显示屏的分辨率和GPU中的tile有关。Tile的大小为f*f。这里,以N等于20为例进行阐述。绘制帧500可以划分为像素块501-像素块520共20个像素块。其中,像素块513中既包括运动小车512又包括静态的背景。像素块501-像素块512,像素块514-像素块520中仅包括静态的背景。绘制帧500中的静态的背景和运动小车的运动小车不同。但是以像素块为整体计算运动向量时,会导致计算出的像素块中的静态的背景的运动向量与运动小车的运动向量相同。这样,预测出的预测帧中静态的背景可能不是一个完整的,静态的背景中可能有空洞区域(即没有像素区域)。下面以绘制帧500中像素块507-像素块509,像素块512-像素块514为例进行说明。FIG. 5A exemplarily shows a drawing frame 500 . The drawing frame 500 may include a static background and a moving cart 521 . The electronic device may divide the drawing frame 500 into Q pixel blocks. The rendering frame 400 in FIG. 5A may be divided into Q pixel blocks. The size of Q is related to the resolution of the display and the tiles in the GPU. Tile size is f*f. Here, the description is made by taking N equal to 20 as an example. The drawing frame 500 can be divided into a total of 20 pixel blocks from a pixel block 501 to a pixel block 520 . The pixel block 513 includes both the moving car 512 and the static background. Pixel block 501-pixel block 512, pixel block 514-pixel block 520 only include static background. The static background in the drawing frame 500 is different from the moving car of the moving car. However, when the motion vector is calculated by taking the pixel block as a whole, 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 static background in the predicted predicted frame may not be a complete one, and there may be empty areas (ie, no pixel areas) in the static background. In the following, the pixel block 507-pixel block 509 and the pixel block 512-pixel block 514 in the drawing frame 500 are taken as examples for description.
图5A示例性地示出了图5A中绘制帧500中的像素块507-像素块509,像素块512-像素块514。像素块507-像素块509,以及像素512和像素块514中仅包括静态的背景。电子设备计算出的像素块507-像素块509,像素块512和像素块514等像素块的运动向量可以是相同的,即为静态的背景的运动向量。像素块513中包括运动的小车521和静态的背景。电子设备计算出的像素块513的运动向量可以是运动小车521的运动向量。这样,电子设备计算出来的像素块513的运动向量与像素块507-像素块509以及像素块512和像素块514的运动向量不相同。电子设备可以根据像素块507-像素509,以及像素块512-像素块514预测出的预测帧中的像素块507-像素509,以及像素块512-像素块514。FIG. 5A exemplarily shows pixel block 507-pixel block 509, pixel block 512-pixel block 514 in the rendering frame 500 in FIG. 5A. Pixel block 507-pixel block 509, and pixel block 512 and pixel block 514 only include a static background. The motion vectors of pixel blocks such as pixel block 507-pixel block 509, pixel block 512 and pixel block 514 calculated by the electronic device may be the same, that is, the motion vector of the static background. The pixel block 513 includes a moving cart 521 and a static background. The motion vector of the pixel block 513 calculated by the electronic device may be the motion vector of the motion cart 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 - the pixel block 509 and the pixel block 512 and the pixel block 514 . The electronic device may 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.
图5C示出了电子设备根据图5B中像素块预测出的预测帧中的像素块507-像素509,以及像素块512-像素块514。由于图5B中的像素块的运动向量与其他像素块的运动向量不同,预测出的图5C中的像素块513与其他像素块移动的位移不一样,导致像素块513和像素块512不连接,像素块512和像素块513之间出现空洞区域522。像素块513的位移大于像素块514的位移,导致像素块513覆盖住像素块514。FIG. 5C shows pixel blocks 507-509 and pixel blocks 512-pixel blocks 514 in the predicted frame predicted by the electronic device according to the pixel blocks in FIG. 5B. Since the motion vector of the pixel block in FIG. 5B is different from the motion vector of other pixel blocks, the predicted displacement of the pixel block 513 in FIG. 5C is different from that of other pixel blocks, resulting in that the pixel block 513 and the pixel block 512 are not connected, A hole region 522 appears 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 , causing the pixel block 513 to cover the pixel block 514 .
为了在提高电子设备显示的应用程序视频界面的流畅度的同时,节约电子设备的功耗,本申请实施例提供了一种图像帧预测的方法。该方法可以包括:首先,在绘制第一绘制帧时,电子设备将第一绘制对象的颜色数据写入第一颜色附件,将第二绘制对象的颜色数据写入第二颜色附件,第一绘制对象的绘制指令中指示第一绘制对象的空间信息发生变化,第二绘制对象的绘制指令中未指示第二绘制对象的空间信息发生变化。然后,在绘制第二绘制帧时,电子设备将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件,第三绘制对象的绘制指令中指示第三绘制对象的空间信息发生变化,第四绘制对象的绘制指令中未指示第四绘制对象的空间信息发生变化。然后,电子设备根据第一颜色附件和第三颜色附件预测出第一预测帧的第五颜色附件,根据第二颜色附件和第四颜色附件预测出第一预测帧的第六颜色附件。最后,电子设备将第五颜色附件和第六颜色附件合成为第一预测帧。In order to save the power consumption of the electronic device while improving the fluency of the application video interface displayed by the electronic device, an embodiment of the present application provides a method for image frame prediction. The method may include: first, when drawing the first drawing frame, the electronic device writes the color data of the first drawing object into the first color attachment, writes the color data of the second drawing object into the second color attachment, and the first drawing The drawing instruction of the object indicates that the spatial information of the first drawing object changes, and the drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes. Then, when drawing the second drawing frame, the electronic device writes the color data of the third drawing object into the third color attachment, writes the color data of the fourth drawing object into the fourth color attachment, and writes the color data of the fourth drawing object into the drawing instruction of the third drawing object. Indicates that the spatial information of the third drawing object changes, and 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 the fifth color accessory of the first predicted frame according to the first color accessory and the third color accessory, and predicts the sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory. Finally, the electronic device synthesizes the fifth color attachment and the sixth color attachment into the first predicted frame.
第一绘制对象的绘制指令中指示第一绘制对象的空间信息发生变化,即第一绘制对象为运动对象。第二绘制对象的绘制指令中未指示第二绘制对象的空间信息发生变化,即第二绘制对象为静态对象。电子设备将第一绘制帧中的运动对象的颜色数据写入第一颜色附件,将第一绘制帧中的静态对象的颜色数据写入第二颜色附件。这样,电子设备将第一绘制帧中的 动态对象的颜色数据和静态对象的颜色数据分别存储在不同颜色附件中。同样地,当绘制第二绘制帧时,第二绘制帧中的第三绘制对象的绘制指令中指示第三绘制对象的空间信息发生变化,即第三绘制对象为运动对象。第四绘制对象的绘制指令中未指示第四绘制对象的空间信息发生变化,即第四绘制对象为静态对象。这样,电子设备将第二绘制帧中的动态对象的颜色数据和静态对像的颜色数据分别存储在不同的颜色附件中。然后根据绘制帧中的运动对象预测出预测帧中的运动对象,根据绘制帧中的静态对象预测出预测帧中的静态对象,再将运动对象的颜色附件和静态对象的颜色附件合成图像帧。这样,可以更为准确的预测出预测帧。The drawing instruction of the first drawing object indicates that the spatial information of the first drawing object changes, that is, the first drawing object is a moving object. The drawing instruction of the second drawing object does not indicate that the spatial information of the second drawing object changes, 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 the second drawing frame is drawn, the drawing instruction of the third drawing object in the second drawing frame indicates that the spatial 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 spatial 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 predicted more accurately.
下面将结合附图详细介绍本申请实施例提供的一种图像帧预测的方法。首先,图6A示例性地示出了本申请实施例提供的一种图像帧预测的方法中电子设备绘制地N绘制帧、第N+2绘制帧,以及得到第N+3预测帧的过程。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, FIG. 6A exemplarily shows the process of drawing N drawing frames, N+2 drawing frames, and obtaining the N+3 th predicted frame by an electronic device in an image frame prediction method provided by an embodiment of the present application.
图6A中(a)图示例性示出了电子设备绘制第N绘制帧的过程。如图6A中的(a)图所示,电子设备绘制第N绘制帧可以包括如下步骤:Figure (a) in FIG. 6A exemplarily shows a process in which the electronic device draws the Nth drawing frame. As shown in (a) of FIG. 6A , drawing the Nth drawing frame by the electronic device may include the following steps:
601、电子设备获取第N绘制帧的绘制指令,并判断该绘制指令中是否携带转移矩阵。若是,则执行602a,若否,则执行602b。601. The electronic device acquires a drawing instruction of the Nth drawing frame, and determines whether the drawing instruction carries a transition matrix. If yes, go to 602a, if not, go to 602b.
第N绘制帧中可以有多个绘制指令。电子设备可以根据一个绘制指令绘制出一个对象。可以理解是,电子设备绘制完一个绘制指令后,绘制第N绘制帧的另一个绘制指令,直至绘制完第N绘制中的所有绘制指令。一个绘制指令中可以携带根据该draw call指令绘制出的对象的顶点坐标、顶点ID、深度信息、颜色信息等等信息。若绘制指令中携带转移矩阵,则电子设备根据该绘制指令绘制出的对象是运动对象。若绘制指令中未携带转移矩阵,则电子设备根据绘制指令绘制出的对象是静态的对象。There can be multiple drawing instructions in the Nth drawing frame. The electronic device can draw an object according to a drawing instruction. It can be understood that, after the electronic device draws one drawing instruction, it draws another drawing instruction of the Nth drawing frame until all drawing instructions in the Nth drawing are drawn. A drawing instruction can carry information such as vertex coordinates, vertex ID, depth information, color information, etc. of the object drawn according to the draw call instruction. If the drawing instruction carries a transition matrix, the object drawn by the electronic device according to the drawing instruction is a moving object. If the drawing instruction does not carry the transition matrix, the object drawn by the electronic device according to the drawing instruction is a static object.
可选地,第N绘制帧中的所有绘制指令可以携带转移矩阵。若绘制指令中携带的转移矩阵为全0矩阵,则电子设备根据该绘制指令绘制出的对象为静态对象。若绘制指令携带的转移矩阵中的元素的数值不是全为0,则电子设备根据该绘制指令绘制出的对象为运动对象。若绘制指令的绘制内容为运动对象,则电子设备在第一内存空间中绘制出该绘制指令的绘制内容。第一内存空间可以简称为D1FBO(dynamicframebufferobject,动态帧缓冲区对象)。若drawcall指令的绘制内容为静态对象,则电子设备在第二内存空间中绘制出该drawcall指令的绘制内容。第二内存空间可以简称为S1FBO(staticframebufferobject,静态帧缓冲区对象)。Optionally, all draw instructions in the Nth draw frame may carry transition matrices. If the transition matrix carried in the drawing instruction is an all-zero matrix, the object drawn by the electronic device according to the drawing instruction is a static object. If the values of the elements in the transition matrix carried by the drawing instruction are not all 0, the object drawn by the electronic device according to the drawing instruction is a moving object. If the drawing content of the drawing instruction is a moving object, the electronic device draws the drawing content of the drawing instruction in the first memory space. The first memory space may be referred to as D1FBO (dynamic framebuffer object, dynamic frame buffer object). If the drawing content of the drawcall instruction is a static object, the electronic device draws the drawing content of the drawcall instruction in the second memory space. The second memory space may be referred to as S1FBO (static framebuffer object, static frame buffer object).
这里,帧缓冲区对象FBO是一块内存空间,可以用于存储绘制对象的颜色数据、深度数据等等。Here, the frame buffer object FBO is a memory space that can be used to store color data, depth data, etc. of the drawing object.
在本申请实施例中,电子设备可以根据绘制指令中携带的信息绘制出绘制帧中的运动对象和静态对象。在本申请实施例里,绘制指令可以称为draw call指令。本申请实施例中可以根据是否携带转移矩阵来对绘制指令进行区分,或以携带的转移矩阵中元素是否为全0来对绘制指令进行区分。In this embodiment of the present application, the electronic device may draw moving objects and static objects in the drawing frame according to the information carried in the drawing instruction. In this embodiment of the present application, the drawing instruction may be referred to as a draw call instruction. In this embodiment of the present application, the drawing instructions can be distinguished according to whether the transition matrix is carried, or the drawing instructions can be distinguished by whether the elements in the carried transition matrix are all 0s.
若按照绘制指令是否携带转移矩阵来对绘制指令进行区分,那么电子设备可以将绘制指令分为两类,一类为携带转移矩阵的绘制指令,另一类为未携带转移矩阵的绘制指令。携带转移矩阵的绘制指令的绘制内容为运动对象。未携带转移矩阵的绘制指令的绘制内容为静态对象。在本申请实施例中,电子设备可以在不同的内存空间绘制这两类绘制指令。If the drawing commands are distinguished according to whether the drawing commands carry a transition matrix, the electronic device can classify the drawing commands into two types, one is a drawing command with a transition matrix, and the other is a drawing command without a transition matrix. The drawing content of the drawing instruction carrying the transition matrix is the moving object. The drawing content of a drawing instruction that does not carry a transition matrix is a static object. In this embodiment of the present application, the electronic device may draw the two types of drawing instructions in different memory spaces.
若按照绘制指令中携带的转移矩阵是否为全0矩阵进行区分,那么电子设备可以将绘制指令分为两类,一类为携带的转移矩阵中元素不全为0的绘制指令,另一类为携带的转移矩阵中元素全为0(即全0矩阵)的绘制指令。携带的转移矩阵中元素不全为0的绘制指令的绘制内容为运动对象。携带的转移矩阵为全0矩阵的绘制指令的绘制内容为静态对象。在本申请实施例中,电子设备可以在不同内存空间中绘制这两类绘制指令。If it is distinguished according to whether the transfer matrix carried in the drawing instruction is an all-zero matrix, the electronic device can divide the drawing instructions into two categories, one is the drawing instruction whose elements in the carried transfer matrix are not all 0s, and the other is the drawing instruction that carries A drawing instruction whose elements in the transition matrix are all 0 (that is, a matrix of all 0s). 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 transfer matrix is an all-zero matrix is a static object. In this embodiment of the present application, the electronic device may draw these two types of drawing instructions in different memory spaces.
602a、电子设备在第一内存空间中将绘制指令的绘制内容写入到颜色附件A和深度附件A中。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.
电子设备在第一内存空间中将绘制指令的绘制内容写入到颜色附件A和深度附件A中。第N绘制帧中可以有多个绘制内容为运动对象的绘制指令,电子设备可以依次将多个绘制指令的绘制内容绘制到颜色附件A和深度附件A中。在一种可实现的方式中,若第N绘制帧中有L个绘制指令携带了转移矩阵,该绘制指令的绘制内容为运动对象。电子设备可以将第N绘制帧中L个绘制指令的具有颜色信息的绘制内容依次地绘制在画布1中,最终得到的具有所有运动对象的颜色信息的绘制结果可以称为颜色附件A。具体地,电子设备可以将第N绘制帧中L个绘制指令中第一个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布1上。然后,电子设备再将第N绘制帧中L个绘制指令中第二个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布1上。直至电子设备将第N绘制帧中L个绘制指令中第L个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布1上,最后得到的具有所有运动对象的颜色信息的绘制结果可以称为本申请实施例中颜色附件A。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. In the Nth drawing frame, there may be multiple drawing instructions whose drawing contents are moving objects, and the electronic device may draw the drawing contents of the multiple drawing instructions into the color attachment A and the depth attachment A in sequence. In an achievable 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 sequentially draw the drawing contents with color information of the L drawing instructions in the Nth drawing frame on the canvas 1, and the finally obtained drawing result with color information of all moving objects can be called color attachment A. Specifically, the electronic device may draw the drawing content with color information of the first drawing instruction in the L drawing instructions in the Nth drawing frame on 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 on the canvas 1 of the electronic device. Until the electronic device draws the drawing content with color information of the L-th drawing instruction in the N-th drawing frame on the canvas 1 of the electronic device, the finally obtained drawing result with color information of all moving objects can be called This is the color attachment A in the examples of this application.
电子设备可以将第N绘制帧中L个绘制指令的具有深度信息,不具有颜色信息的绘制内容依次地绘制在画布2中,最终得到具有所有运动对象的深度信息的绘制结果可以称为深度附件A。具体地,电子设备可以将L个绘制指令中第一个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布2上。然后,电子设备可以将L个绘制指令中第二个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布2上。直至电子设备将L个绘制指令中第L个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布2上,最后得到的具有所有运动对象的深度信息的绘制结果可以称为本申请实施例中的深度附件A。The electronic device can sequentially draw the drawing contents with depth information and without color information of the L drawing instructions in the Nth drawing frame on the canvas 2, and finally obtain a drawing result with the depth information of all moving objects, which can be called a depth attachment. A. Specifically, the electronic device may draw, on the canvas 2 , the drawing content of the first drawing instruction that has depth information but does not include color information among the L drawing instructions. Then, the electronic device may draw the drawing content of the second drawing instruction among the L drawing instructions that has depth information but does not include color information on the canvas 2 . Until the electronic device draws the drawing content of the Lth drawing instruction in the L drawing instructions that has depth information but does not contain color information on the canvas 2, the finally obtained drawing result with the depth information of all moving objects can be referred to as the present application. Depth Attachment A in Examples.
可以理解的是,上述中的画布1和画布2均在第一内存空间中。It can be understood that both the canvas 1 and the canvas 2 in the above are in the first memory space.
这里关于深度附件A、颜色附件A可以参考下文图6B的步骤S105中的描述,此处先不赘述。For the depth attachment A and the color attachment A, reference may be made to the description in step S105 of FIG. 6B below, which will not be repeated here.
602b、电子设备在第二内存空间中将绘制指令的绘制内容写入到颜色附件B和深度附件B中。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.
以第N绘制帧有M个绘制内容为静态对象的绘制指令为例进行说明。电子设备可以将第N绘制帧中M个绘制指令的具有颜色信息的绘制内容依次地绘制在画布3中。具体地,电子设备可以将M个绘制指令中的第一个绘制指令的具有颜色信息的绘制内容绘制在画布3中,然后将M个绘制指令中的第二个绘制指令的具有颜色信息的绘制内容绘制在画布3中。直至,电子设备将M个绘制指令中第M个绘制指令的具有颜色信息的绘制内容绘制在画布3中,最后得到的具有所有静态对象的颜色信息的绘制结果可以称为颜色附件B。The description is given by taking as an example that the Nth drawing frame has M drawing instructions whose drawing contents are static objects. The electronic device may sequentially draw the drawing contents with color information of the M drawing instructions in the Nth drawing frame on the canvas 3 . Specifically, the electronic device may draw the drawing content with color information of the first drawing instruction among the M drawing instructions on the canvas 3, and then draw the drawing content with color information of the second drawing instruction among the M drawing instructions The content is drawn in canvas 3. Until, the electronic device draws the drawing content with color information of the Mth drawing instruction among the M drawing instructions on the canvas 3, and the finally obtained drawing result with color information of all static objects can be called color attachment B.
电子设备可以将第N绘制帧中M个绘制指令的具有深度信息,不包含颜色信息的绘制内容依次地绘制到画布4中,最终得到深度附件B。具体地,电子设备可以将M个绘制指令中的第一个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制在画布4中,然后将M 个绘制指令中的第二个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制在画布4中。直至,电子设备将M个绘制指令中第M个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制在画布4中,最后得到的具有所有静态对象的深度信息的绘制结果可以称为深度附件B。The electronic device may sequentially draw the M drawing instructions in the Nth drawing frame with depth information and without color information to the canvas 4, and finally obtain the depth attachment B. Specifically, the electronic device may draw the first drawing instruction in the M drawing instructions with depth information and without color information on the canvas 4, and then draw the second drawing instruction in the M drawing instructions. Drawing content with depth information and no color information is drawn in canvas 4. Until, the electronic device draws the drawing content of the M-th drawing instruction with depth information but not including color information in the canvas 4, and the finally obtained drawing result with the depth information of all static objects can be called depth Annex B.
可以理解的是,画布3和画布4在第二内存空间中。It can be understood that canvas 3 and canvas 4 are in the second memory space.
603、电子设备根据深度附件A和深度附件B将颜色附件A和颜色附件B合成第N绘制帧的图像帧。603. The electronic device combines the color attachment A and the color attachment B into an image frame of the Nth drawing frame according to the depth attachment A and the depth attachment B.
电子设备可以在第七内存空间中将颜色附件A和颜色附件B合成第N绘制帧的图像帧。可以理解的是,颜色附件A中可以包含第N绘制帧中的多个运动对象,颜色附件B中可以包括第N绘制帧中的多个静态对象。电子设备可以在深度附件A中获取到颜色附件A中每个运动对象、以及每个像素点的深度信息。电子设备可以深度附件B中获取到颜色附件B中每个静态对象,以及每个像素点的深度信息。电子设备可以按照颜色附件A中每个像素点的深度信息,以及颜色附件B中每个像素点的深度信息将颜色附件A和颜色附件B合成图像帧。图像帧中可以包含颜色附件A中的运动对象和颜色附件B中的静态对象。举例来说,在图像帧中,在第一像素点处,若颜色附件A中第一像素点的深度值小于颜色附件B中第一像素点的深度值,那么在图像帧中,颜色附件A的第一像素点会覆盖住颜色附件B的第一像素点。在第一像素点处,若颜色附件A中第一像素点的深度值大于颜色附件B中第一像素点的深度值,那么在图像帧中,颜色附件B的第一像素点会覆盖住颜色附件A的第一像素点。The electronic device may combine 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 may include multiple moving objects in the Nth drawing frame, and the color attachment B may include multiple static objects in the Nth drawing frame. The electronic device can obtain the depth information of each moving object and each pixel in the color annex A from the depth annex A. The electronic device can obtain each static object in the color annex B and the depth information of each pixel point from the depth annex B. The electronic device may combine the color annex A and the color annex B into an image frame according to the depth information of each pixel in the color annex A and the depth information of each pixel in the color annex B. Image frames can contain moving objects in color attachment A and static objects in color attachment B. For example, in the image frame, at the first pixel, if the depth value of the first pixel in color attachment A is smaller than the depth value of the first pixel in color attachment B, then in the image frame, the color attachment A The first pixel of color will cover the first pixel of color attachment B. At the first pixel, if the depth value of the first pixel in color annex A is greater than the depth value of the first pixel in color annex B, then in the image frame, the first pixel in color annex B will cover the color The first pixel of Annex A.
604、电子设备显示第N绘制帧。604. The electronic device displays the Nth drawing frame.
电子设备可以将第N绘制帧的图像帧送到显示屏进行显示,最终,电子设备中的显示屏可以显示第N绘制帧。The electronic device may send the image frame of the Nth drawing frame to the display screen for display, and finally, the display screen in the electronic device may display the Nth drawing frame.
图6A中(b)图示例性示出了电子设备绘制第N+2绘制帧的过程。如图6A中的(b)图所示,电子设备绘制第N+2绘制帧可以包括如下步骤:Figure (b) in FIG. 6A exemplarily shows a process in which the electronic device draws the N+2 th drawing frame. As shown in (b) of FIG. 6A , drawing the N+2 th drawing frame by the electronic device may include the following steps:
605、电子设备获取第N+2绘制帧的绘制指令,并判断该绘制指令中是否携带转移矩阵。若是,则执行606a,若否,则执行606b。605. The electronic device acquires the drawing instruction of the N+2th drawing frame, and determines whether the drawing instruction carries a transition matrix. If yes, go to 606a, if not, go to 606b.
电子设备可以获取到第N+2绘制帧的多个绘制指令。第N+2绘制帧的绘制指令中,可以携带转移矩阵,也可以未携带转移矩阵。若绘制指令携带转移矩阵,就执行步骤606a,若绘制指令未携带转移矩阵,就执行步骤606b。The electronic device may acquire multiple drawing instructions of the N+2th drawing frame. In the drawing instruction of the N+2th drawing frame, the transition matrix may or may not be carried. If the drawing instruction carries the transition matrix, go to step 606a, and if the drawing instruction does not carry the transition matrix, go to step 606b.
步骤605可以参考步骤601中的描述,此处不再赘述。For step 605, reference may be made to the description in step 601, and details are not repeated here.
606a、电子设备在第三内存空间中将绘制指令的绘制内容写入到颜色附件C和深度附件C中。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.
若绘制指令的绘制内容为运动对象,则电子设备在第三内存空间中将绘制指令的绘制内容写入到颜色附件C和深度附件C中。若第N+2绘制帧中有K个绘制指令携带了转移矩阵,该绘制指令的绘制内容为运动对象。电子设备可以将第N+2绘制帧中K个绘制指令的具有颜色信息的绘制内容依次地绘制在画布5中,最终得到的具有所有运动对象的颜色信息的绘制结果可以称为颜色附件C。具体地,电子设备可以将第N+2绘制帧中K个绘制指令中第一个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布5上。然后,电子设备再将第N+2绘制帧中K个绘制指令中第二个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布5上。直至电子设备将第N+2绘制帧中K个绘制指令中第K个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布5上,最后得到的具有所有运动对象的颜色信息的绘制结果可 以称为本申请实施例中颜色附件C。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 a transition matrix in the N+2th drawing frame, the drawing content of the drawing instruction is a moving object. The electronic device can sequentially draw the drawing contents with color information of the K drawing instructions in the N+2th drawing frame on the canvas 5, and the finally obtained drawing result with color information of all moving objects can be called color attachment C. Specifically, the electronic device may draw the drawing content with color information of the first drawing instruction in the K drawing instructions in the N+2 th drawing frame on 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+2 th drawing frame on the canvas 5 of the electronic device. Until the electronic device draws the drawing content with color information of the K-th drawing instruction in the K-th drawing instruction in the N+2-th drawing frame to the canvas 5 of the electronic device, and finally obtains the drawing result with the color information of all moving objects It may be referred to as color attachment C in the embodiment of the present application.
电子设备可以将第N+2绘制帧中K个绘制指令的具有深度信息,不具有颜色信息的绘制内容依次地绘制在画布6中,最终得到具有所有运动对象的深度信息的绘制结果即可以称为深度附件C。具体地,电子设备可以将K个绘制指令中第一个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布6上。然后,电子设备可以将K个绘制指令中第二个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布6上。直至电子设备将K个绘制指令中第K个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布6上,最后具有所有运动对象的深度信息的绘制结果的图像可以称为本申请实施例中的深度附件C。The electronic device can draw the K drawing instructions with depth information and without color information in the N+2th drawing frame on the canvas 6 in turn, and finally obtain the drawing result with the depth information of all moving objects, which can be called. For depth attachment C. Specifically, the electronic device may draw, on the canvas 6 , the drawing content of the first drawing instruction among the K drawing instructions that has depth information but does not include color information. Then, the electronic device may draw the drawing content of the second drawing instruction among the K drawing instructions with depth information but not including color information on the canvas 6 . Until the electronic device draws the Kth drawing instruction in the K drawing instructions with depth information and does not contain the drawing content of the color information on the canvas 6, and finally the image of the drawing result with the depth information of all moving objects can be called the present application. Depth Attachment C in Examples.
可以理解的是,画布5和画布6均在第三内存空间中。It can be understood that both canvas 5 and canvas 6 are in the third memory space.
这里关于深度附件C、颜色附件C具体可以参考下文图6B的步骤S109中的描述,此处先不赘述。For details about the depth attachment C and the color attachment C, reference may be made to the description in step S109 of FIG. 6B below, which will not be repeated here.
606b、电子设备在第四内存空间中将绘制指令的绘制内容写入到颜色附件D和颜色附件D中。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.
若第N+2绘制帧的绘制指令的绘制内容为静态对象,则电子设备在第四内存空间中将该绘制指令的绘制内容写入到颜色附件D和深度附件D中。若第N+2绘制帧中有J个绘制指令未携带转移矩阵,该绘制指令的绘制内容为静态对象。电子设备可以将第N+2绘制帧中J个绘制指令的具有颜色信息的绘制内容依次地绘制在画布7中,最终得到的具有所有静态对象的颜色信息的绘制结果可以称为颜色附件D。具体地,电子设备可以将第N+2绘制帧中J个绘制指令中第一个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布7上。然后,电子设备再将第N+2绘制帧中J个绘制指令中第二个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布7上。直至电子设备将第N+2绘制帧中J个绘制指令中第J个绘制指令的具有颜色信息的绘制内容绘制到电子设备的画布7上,最后得到的具有所有静态对象的颜色信息的绘制结果可以称为本申请实施例中颜色附件D。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 that do not carry a transition matrix, the drawing content of the drawing instruction is a static object. The electronic device can sequentially draw the drawing contents with color information of the J drawing instructions in the N+2 th drawing frame on the canvas 7, and the finally obtained drawing result with color information of all static objects can be called color attachment D. Specifically, the electronic device may draw the drawing content with color information of the first drawing instruction in the J drawing instructions in the N+2 th 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 in 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 J-th drawing instruction in the J-th drawing instruction in the N+2-th drawing frame to the canvas 7 of the electronic device, and finally obtains the drawing result with the color information of all static objects It can be called color accessory D in the embodiment of the present application.
电子设备可以将第N+2绘制帧中J个绘制指令的具有深度信息,不具有颜色信息的绘制内容依次地绘制在画布8中,最终得到具有所有静态对象的深度信息的绘制结果即可以称为深度附件D。具体地,电子设备可以将J个绘制指令中第一个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布8上。然后,电子设备可以将J个绘制指令中第二个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布8上。直至电子设备将J个绘制指令中第J个绘制指令的具有深度信息,不包含颜色信息的绘制内容绘制到画布8上,最后得到的具有所有静态对象的深度信息的绘制结果可以称为本申请实施例中的深度附件D。The electronic device can sequentially draw the drawing contents with depth information and without color information of the J drawing instructions in the N+2th drawing frame on the canvas 8, and finally obtain the drawing result with the depth information of all static objects, which can be called For depth annex D. Specifically, the electronic device may draw, on the canvas 8, the drawing content of the first drawing instruction among the J drawing instructions that has depth information but does not include color information. Then, the electronic device may draw the drawing content of the second drawing instruction among the J drawing instructions with depth information but not including color information on the canvas 8 . Until the electronic device draws the drawing content of the Jth drawing instruction with depth information and not including color information on the canvas 8 among the J drawing instructions, the finally obtained drawing result with the depth information of all static objects can be referred to as the present application. Depth Attachment D in Examples.
可以理解的是,画布7和画布8均在第三内存空间中。It can be understood that both canvas 7 and canvas 8 are in the third memory space.
这里关于深度附件D、颜色附件D具体可以参考下文图6B的步骤S109中的描述,此处先不赘述。For details about the depth attachment D and the color attachment D here, reference may be made to the description in step S109 of FIG. 6B below, which will not be repeated here.
607、电子设备根据深度附件C和深度附件D将颜色附件C和颜色附件D合成第N绘制帧的图像帧。607. The electronic device combines 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.
电子设备可以在第七内存空间中将颜色附件C和颜色附件D合成第N+2绘制帧的图像帧。可以理解的是,颜色附件C中可以包含第N+2绘制帧中的多个运动对象,颜色附件D中可以包括第N+2绘制帧中的多个静态对象。电子设备可以在深度附件C中获取到颜色附件 C中每个运动对象、以及每个像素点的深度信息。电子设备可以深度附件D中获取到颜色附件D中每个静态对象,以及每个像素点的深度信息。电子设备可以按照颜色附件C中每个像素点的深度信息,以及颜色附件D中每个像素点的深度信息将颜色附件C和颜色附件D合成图像帧。图像帧中可以包含颜色附件C中的运动对象和颜色附件D中的静态对象。举例来说,在图像帧中,在第一像素点处,若颜色附件C中第一像素点的深度值小于颜色附件D中第一像素点的深度值,那么在图像帧中,颜色附件C的第一像素点会覆盖住颜色附件D的第一像素点。在图像帧中,在第一像素点处,若颜色附件C中第一像素点的深度值大于颜色附件D中第一像素点的深度值,那么在图像帧中,颜色附件D的第一像素点会覆盖住颜色附件C的第一像素点。The electronic device may combine the color attachment C and the color attachment D into the image frame of the N+2 th drawing frame in the seventh memory space. It can be understood that the color attachment C may include multiple moving objects in the N+2 th drawing frame, and the color attachment D may include multiple static objects in the N+2 th drawing frame. The electronic device can obtain the depth information of each moving object and each pixel in the color attachment C from the depth attachment C. The electronic device can obtain the depth information of each static object in the color attachment D and the depth information of each pixel point from the depth attachment D. The electronic device may combine 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. Image frames can contain moving objects in color attachment C and static objects in color attachment D. For example, in the image frame, at the first pixel, if the depth value of the first pixel in color attachment C is less than the depth value of the first pixel in color attachment D, then in the image frame, the color attachment C The first pixel of color will cover the first pixel of color attachment D. In the image frame, at the first pixel, if the depth value of the first pixel in color attachment C is greater than the depth value of the first pixel in color attachment D, then in the image frame, the first pixel in color attachment D The dot will cover the first pixel of color attachment C.
608、电子设备显示第N+2绘制帧。608. The electronic device displays the N+2th drawing frame.
电子设备可以将第N+2绘制帧的图像帧送到显示屏进行显示,最终,电子设备中的显示屏可以显示第N+2绘制帧。The electronic device can send the image frame of the N+2 th drawing frame to the display screen for display, and finally, the display screen in the electronic device can display the N+2 th drawing frame.
图6A中(c)图示例性示出了电子设备如何预测得到第N+3预测帧的过程。如图6A中的(c)图所示,该过程如下:Figure (c) in FIG. 6A exemplarily shows the process of how the electronic device predicts the N+3 th predicted frame. As shown in (c) in Figure 6A, the process is as follows:
1、电子设备根据颜色附件A和颜色附件C计算出运动向量A,根据深度附件B和颜色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 A according to the depth attachment B and the color attachment.
附件D计算出运动向量B。Annex D calculates the motion vector B.
如图6A中的(c)图所示,电子设备可以根据颜色附件A和颜色附件C计算出运动向量A。电子设备根据深度附件B和颜色附件D计算出运动向量B。具体计算过程可以参考图6B中步骤S112中的描述,此处先不赘述。As shown in (c) of FIG. 6A , 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. For the specific calculation process, reference may be made to the description in step S112 in FIG. 6B , which will not be repeated here.
2、电子设备根据颜色附件C和运动向量A得到颜色附件E,根据颜色附件D和运动向量B得到颜色附件F。2. The electronic device obtains color attachment E according to color attachment C and motion vector A, and obtains color attachment F according to color attachment D and motion vector B.
电子设备可以根据第N+2绘制帧的颜色附件和运动向量A得到第N+3预测帧的颜色附件E。也即是说,电子设备可以根据第N+2绘制帧的运动对象以及运动对象的运动向量预测出第N+3帧中的运动对象。The electronic device may obtain the color attachment E of the N+3 th prediction frame according to the color attachment of the N+2 th drawing frame and the motion vector A. That is to say, the electronic device can predict the moving object in the N+3 th frame according to the moving object in the N+2 th drawing frame and the motion vector of the moving object.
电子设备可以根据第N+2绘制帧的颜色附件D和运动向量B得到第N+3帧的颜色附件F。也即是说,电子设备可以根据第N+2绘制帧的静态对象以及静态对象的运动对象预测出第N+3帧中的静态对象。The electronic device may obtain the color attachment F of the N+3 th frame according to the color attachment D and the motion vector B of the N+2 th frame. That is to say, the electronic device can predict the static object in the N+3 th frame according to the static object of the N+2 th drawing frame and the moving object of the static object.
这里,具体可以参考图6B中步骤S114中的描述,此处先不赘述。Here, specific reference may be made to the description in step S114 in FIG. 6B , which will not be repeated here.
3、电子设备在第七内存空间中将颜色附件E和颜色附件F合成第N+3预测帧的图像帧。3. The electronic device combines the color attachment E and the color attachment F into the image frame of the N+3 th prediction frame in the seventh memory space.
在本申请实施例中,第N+3预测帧的颜色附件E中第一坐标处的像素点的深度信息可以与第N+2绘制帧中颜色附件C中第一坐标处的像素点的深度信息相同。第N+3预测帧的颜色附件F中第二坐标处的像素点的深度信息可以与第N+2绘制帧中颜色附件D中第二坐标处的像素点的深度信息相同。也即是说,电子设备可以将深度附件C中每个像素点的深度值作为颜色附件E中每个像素点的深度值。电子设备可以将深度附件D中每个像素点的深度值作为颜色附件F中每个像素点的深度值。电子设备可以根据在深度附件C和深度附件D中取出像素点的深度值,将颜色附件E和颜色附件F合成第N+3预测帧的图像帧。In this embodiment of the present application, the depth information of the pixel at the first coordinate in the color annex E of the N+3 prediction frame may be the same as the depth information of the pixel at the first coordinate in the color annex C in the N+2 drawing frame. Information is the same. The depth information of the pixel at the second coordinate in the color attachment F of the N+3th prediction frame may be the same as the depth information of the pixel at the second coordinate in the color attachment D of the N+2th drawing frame. That is to say, the electronic device can use the depth value of each pixel in the depth attachment C as the depth value of each pixel in the color attachment E. The electronic device may use the depth value of each pixel in the depth attachment D as the depth value of each pixel in the color attachment F. The electronic device may combine the color attachment E and the color attachment F into the image frame of the N+3th predicted frame according to the depth values of the pixels extracted from the depth attachment C and the depth attachment D.
4、电子设备显示第N+3预测帧。4. The electronic device displays the N+3 predicted frame.
电子设备可以将第N+3预测帧的图像帧送到显示屏进行显示,最终,电子设备中的显示屏可以显示第N+3预测帧。The electronic device can send the image frame of the N+3 th predicted frame to the display screen for display, and finally, the display screen in the electronic device can display the N+3 th predicted frame.
图6A简要地介绍了本申请实施例提供的图像帧预测方法的基本步骤,图6B详细地介绍本申请实施例提供的图像帧预测的方法流程图,如图6B所示,本申请实施例提供的一种图像帧预测的方法可以包括:FIG. 6A briefly introduces the basic steps of the image frame prediction method provided by the embodiment of the present application, and FIG. 6B introduces the flowchart of the image frame prediction method provided by the embodiment of the present application in detail. As shown in FIG. 6B , the embodiment of the present application provides A method of image frame prediction may include:
S101-S102、电子设备开始执行图像帧预测的方法。S101-S102, the electronic device starts to perform the method for image frame prediction.
S101、在目标应用开始绘制时,电子设备的CPU向GPU发送用于指示GPU创建内存空间的指令。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.
目标应用程序为用户界面中具有动画效果的应用程序,例如游戏类应用。本申请实施例下文以目标应用为游戏应用为例进行阐述。当电子设备中安装的游戏应用运行时,电子设备的CPU向GPU发送用于指示GPU创建内存空间的指令。The target application is an application with animation effects in the user interface, such as a game application. The embodiments of the present application are described below by taking the target application as a game application as an example. When the game application installed in the electronic device runs, the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU.
S102、电子设备的GPU在内存中创建第一内存空间、第二内存空间、第三内存空间、第四内存空间、第五内存空间、第六内存空间、第七内存空间。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.
GPU响应于CPU发送的用于指示GPU创建内存空间的指令,GPU可以在内存中创建第一内存空间、第二内存空间、第三内存空间、第四内存空间、第五内存空间、第六内存空间以及第七内存空间。其中,第一内存空间可以用于存储第N绘制帧中携带转移矩阵的绘制指令的绘制结果,例如深度附件和颜色附件。第二内存空间可以用于存储第N绘制帧中未携带转移矩阵的绘制指令的绘制结果。第三内存空间可以用于存储第N+2绘制帧中携带转移矩阵的绘制指令的绘制结果。第四内存空间可以用于存储第N+2绘制帧中未携带转移矩阵的绘制指令的绘制结果。GPU可以第五内存空间中根据第一内存空间中的绘制结果和第三内存空间中的绘制结果预测出第N+3预测帧的预测绘制结果A。GPU可以在第六内存空间中根据第二内存空间中的绘制结果和第四内存空间中的绘制结果预测第N+3预测帧的预测绘制结果B。GPU可以在第七内存空间中合成图像帧。例如,GPU在第七内存空间中合成第N绘制帧,以及第N+2绘制帧,第N+3预测帧。In response to the instruction sent by the CPU for instructing the GPU to create a memory space, the GPU may create a first memory space, a second memory space, a third memory space, a fourth memory space, a fifth memory space, and a sixth memory space in the memory space and the seventh memory space. The first memory space may be used to store the drawing result of the drawing instruction carrying the transition matrix in the Nth drawing frame, such as depth attachment and color attachment. The second memory space may be used to store the drawing result of the drawing instruction that does not carry the transition matrix in the Nth drawing frame. The third memory space may be used to store the drawing result of the drawing instruction carrying the transition matrix in the N+2th drawing frame. The fourth memory space may be used to store the drawing result of the drawing instruction that does not carry the transition matrix in the N+2th drawing frame. The GPU may predict the predicted rendering result A of the N+3th predicted frame according to the rendering result in the first memory space and the rendering result in the third memory space in the fifth memory space. The GPU may predict the predicted rendering result B of the N+3th predicted frame in the sixth memory space according to the rendering result in the second memory space and the rendering result in the fourth memory space. The GPU can synthesize image frames in the seventh memory space. For example, the GPU synthesizes the Nth drawing frame in the seventh memory space, as well as the N+2th drawing frame and the N+3th prediction frame.
S103-S106、电子设备绘制第N绘制帧。S103-S106, the electronic device draws the Nth drawing frame.
S103、电子设备的CPU获取第N绘制帧的绘制参数。S103, the CPU of the electronic device acquires the drawing parameters of the Nth drawing frame.
电子设备中的目标应用在进行绘制时,该目标应用可以调用绘制指令进行绘制。电子设备100的CPU可以通过三维图像处理库中的接口获取到应用程序的第N绘制帧的绘制参数。第N绘制帧的绘制参数用于绘制并渲染第N绘制帧。第N绘制帧的绘制参数可以包括第N绘制帧的绘制指令(例如draw call指令)中携带的信息,例如draw call指令的绘制内容中的每个顶点的坐标,像素值,深度值等等信息。When the target application in the electronic device draws, the target application can call a drawing instruction to draw. The CPU of the electronic device 100 may acquire the drawing parameters of the Nth drawing frame of the application program through the interface in the three-dimensional 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 may include information carried in the drawing instructions (such as the draw call instruction) of the Nth drawing frame, such as the coordinates, pixel values, depth values and other information of each vertex in the drawing content of the draw call instruction .
S104、电子设备的CPU根据第N绘制帧的绘制参数向GPU发送用于指示GPU绘制第N绘制帧的绘制指令。S104. The CPU of the electronic device sends a drawing instruction for instructing the GPU to draw the Nth drawing frame to the GPU according to the drawing parameters of the Nth drawing frame.
电子设备的CPU可以根据第N绘制帧的绘制参数向GPU发送用于指示GPU绘制第N绘制帧的绘制指令。可以理解的是,CPU获取到的第N绘制帧的绘制参数中可以包括多个绘制指令的信息。这样,CPU可以依次地向GPU发送用于指示GPU绘制第N绘制帧的多个绘制指令。在本申请实施例中,绘制指令包括执行绘制(draw call)指令和绘制状态设置指令。The CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the Nth drawing frame to the GPU according to the drawing parameters of the Nth drawing frame. It can be understood that, the drawing parameters of the Nth drawing frame acquired by the CPU may include information of multiple drawing instructions. In this way, the CPU may sequentially send a plurality of drawing instructions to the GPU for instructing the GPU to draw the Nth drawing frame. In this embodiment of the present application, the drawing instruction includes an execution drawing (draw call) instruction and a drawing state setting instruction.
其中,执行绘制指令可以用于触发GPU针对当前绘制状态数据进行绘制渲染,并生成绘制结果,例如OpenGL中的glDrawElements指令。OpenGL是一种用于渲染2D、3D矢量图 形的跨语言、跨平台的应用程序编程接口(API)。The execution of the drawing instruction may be used to trigger the GPU to perform drawing and rendering with respect to the current drawing state data, and generate a drawing result, 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.
绘制状态设置指令可以用于设置执行绘制指令所依赖的当前绘制状态数据,例如设置该状态数据包括绘制所依赖的顶点信息缓存索引的指令,例如在OpenGL中的glBindBuffer,其中顶点信息缓存索引用于指示一绘制对象的顶点信息数据,顶点信息数据是用于在绘制渲染流程中描述一个用于绘制的二维或三维矢量模型的顶点的一组坐标位置、颜色等数据。The drawing state setting instruction can be used to set the current drawing state data on which the drawing instruction is executed. For example, setting the state data includes the instruction of the vertex information buffer index that the drawing depends on, such as glBindBuffer in OpenGL, where the vertex information buffer index is used for Indicates vertex information data of a drawing object. The vertex information data is a set of coordinate position, color and other data used to describe the vertices of a two-dimensional or three-dimensional vector model for drawing in the drawing and rendering process.
绘制状态设置指令还可以包括设置绘制对象的顶点索引、纹理信息、空间位置等指令,例如在OpenGL中glActiveTexture、glBindBufferRange指令等。一个绘制对象可以是电子设备根据一个绘制指令中所包含的所有顶点以及顶点信息可绘制出的对象。The drawing state setting instruction may further include instructions such as setting the vertex index, texture information, and spatial position of the drawing object, for example, the glActiveTexture and glBindBufferRange instructions in OpenGL. A drawing object may be an object that can be drawn by an electronic device according to all vertices and vertex information contained in a drawing instruction.
为了更形象的说明,一种可能的OpenGL绘制指令按照执行顺序可以是如下示意:For a more vivid description, a possible OpenGL drawing instruction according to the execution order can be as follows:
glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)//指示GPU修改部分绘制全局信息,例如小车的位置;glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)//Instruct the GPU to modify the partial drawing global information, such as the position of the car;
glBindBuffer(target=GL_ARRAY_BUFFER,buffer=buffer0)//指示GPU将保存了小车的顶点信息(例如顶点的位置、颜色等等信息)的buffer0索引信息存到GL_ARRAY_BUFFER中;glBindBuffer(target=GL_ARRAY_BUFFER,buffer=buffer0)//Instructs the GPU to store the buffer0 index information of the vertex information of the car (such as vertex position, color, etc.) into GL_ARRAY_BUFFER;
glBindBuffer(target=GL_ELEMENT_ARRAY_BUFFER,buffer=buffer1)//指示GPU将保存了小车的顶点索引信息(例如顶点的绘制顺序)的buffer1的索引保存到GL_ELEMENT_ARRAY_BUFFER中;glBindBuffer(target=GL_ELEMENT_ARRAY_BUFFER, buffer=buffer1)//Instructs the GPU to save the index of buffer1 that saves the vertex index information of the car (such as the drawing order of the vertices) into GL_ELEMENT_ARRAY_BUFFER;
glActiveTexture(texture=GL_TEXTURE0)glActiveTexture(texture=GL_TEXTURE0)
glBindTexture(target=GL_TEXTURE_2D,texture=texture1)//指示GPU将保存了小车的纹理信息的texture1的索引保存到GL_TEXTURE0中;glBindTexture(target=GL_TEXTURE_2D, texture=texture1)//Instruct the GPU to save the index of texture1 that stores the texture information of the car into GL_TEXTURE0;
glDrawElements(GLenummode,GLsizeicount,GLenumtype,const void*indices)//指示GPU执行小车绘制。glDrawElements(GLenummode,GLsizeicount,GLenumtype,const void*indices)//Instructs the GPU to perform cart drawing.
一种可能的实现方式中,CPU可以根据绘制状态设置指令中的针对绘制对象的空间信息的参数或数据,判断该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置发生的是否变化,来确定是否修改基于当前绘制状态数据的绘制指令的绘制结果所存储的内存空间(FBO,并解释下),其中绘制对象的空间信息的参数或数据可以是XXX指令(例如OpenGL中的glBindBufferRange)中的转移矩阵参数,所述转移矩阵用于描述模型的局部坐标系(Local/Object Space)到世界坐标系的映射关系,举例来说明,若绘制对象中的一个顶点在局部坐标系下的坐标是U(x1,y1,z1,1),转移矩阵为S,则这个顶点在世界坐标系下的位置W(x2,y2,z2,1)和局部坐标系下的坐标U(x1,y1,z1,1)之间的关系为:W=U*T。In a possible implementation manner, the CPU can set the parameters or data for the spatial information of the drawing object in the drawing state setting instruction to determine that the spatial position of the drawing object in the world coordinate system relative to the previous frame occurs. to determine whether to modify the memory space (FBO, and explain below) where the drawing result of the drawing instruction based on the current drawing state data is stored, where the parameter or data of the spatial information of the drawing object can be the XXX instruction (for example, in OpenGL The transfer matrix parameter in the glBindBufferRange), the transfer matrix is used to describe the mapping relationship between the local coordinate system (Local/Object Space) of the model to the world coordinate system. For example, if a vertex in the drawing object is in the local coordinate system The coordinates below are U(x1, y1, z1, 1), and the transition matrix is S, then the position of this vertex in the world coordinate system W(x2, y2, z2, 1) and the coordinates in the local coordinate system U(x1 , y1, z1, 1) The relationship is: W=U*T.
一种可能的实施例是,若绘制状态设置指令中存在转移矩阵参数,也即刷新对应的绘制对象的转移矩阵参数,则电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置发生了变化,则电子设备修改基于当前绘制状态数据的绘制指令的绘制结果所存储的内存空间至用于存储运动对象的内存空间(例如,第一内存空间)。若绘制状态设置指令中不存在转移矩阵参数,也即未刷新对应的绘制对象的转移矩阵参数,则电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置未发生变化。则电子设备修改基于当前绘制状态数据的绘制指令的绘制结果所存储的内存空间至用于存储静态对象的内存空间(例如,第二内存空间)。A possible embodiment is that if there is a transition matrix parameter in the drawing state setting instruction, that is, the transition matrix parameter of the corresponding drawing object is refreshed, the electronic device determines that the drawing object is in world coordinates relative to the drawing object in the previous frame. If the spatial position in the system changes, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the first memory space) for storing the moving object. If there is no transition matrix parameter in the drawing state setting instruction, that is, 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 is not change. Then, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the second memory space) for storing the static object.
一种可能的实施例是,若绘制状态设置指令中存在转移矩阵参数与对应的绘制对象的转移矩阵参数不同,则电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置发生了变化,则电子设备修改基于当前绘制状态数据的绘制指令的绘制结果所存储的内存空间至用于存储运动对象的内存空间(例如,第一内存空间)。若绘制状态设置指令中存在转移矩阵参数与对应的绘制对象的转移矩阵参数相同,电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置未发生变化。则电子设备修改基于当前绘制状态数据的绘制指令的绘制结果所存储的内存空间至用于存储静态对象的内存空间(例如,第二内存空间)。A possible embodiment is that if there is a transition matrix parameter in the drawing state setting instruction that is different from the transition matrix parameter of the corresponding drawing object, the electronic device determines that the drawing object is in the world coordinate system relative to the drawing object in the previous frame. If the spatial position of the object changes, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the first memory space) for storing the moving object. 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. Then, the electronic device modifies the memory space where the drawing result of the drawing instruction based on the current drawing state data is stored to the memory space (eg, the second memory space) for storing the static object.
例如,glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)中参数target表示绑定buffer类型,参数index表示绑定点的索引,参数buffer表示参与绑定操作的buffer的索引,参数offset表示需要绑定的位置相对于buffer起始位置的偏移量,参数size表示buffer中参与绑定的部分的size。如果glBindBufferRange函数的参数size为352,且buffer ID(738)已被保存过,即说明这个buffer对应的空间位置信息是被glBufferSubData指令修改过的位置信息。则电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置发生了变化。否则,电子设备判定该绘制对象的相对于前一帧该绘制对象在世界坐标系中的空间位置未发生变化。电子设备可以通过钩子函数获取到应该程序的绘制帧中的转移矩阵参数。例如,电子设备可以通过glBindBufferRange函数获取到转移矩阵参数。For example, in glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352), the parameter target indicates the type of the binding buffer, the parameter index indicates the index of the binding point, and the parameter buffer indicates the buffer that participates in the binding operation. The index of the buffer, the parameter offset indicates the offset of the position to be bound relative to the starting position of the buffer, and the parameter size indicates the size of the part of the buffer that participates 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 location information corresponding to the buffer is the location information modified by the glBufferSubData instruction. Then, the electronic device determines that the spatial position of the drawing object in the world coordinate system has changed with respect to the previous frame. Otherwise, the electronic device determines that the spatial position of the drawing object in the world coordinate system with respect to the previous frame has not changed. The electronic device can obtain the transition matrix parameters in the drawing frame of the program through the hook function. For example, the electronic device can obtain the transfer matrix parameters through the glBindBufferRange function.
S105、若第N绘制帧的绘制指令中携带转移矩阵,则GPU在第一内存空间中将绘制指令的绘制内容写入颜色附件A和深度附件A中;若第N绘制帧的绘制指令中未携带转移指令,则GPU在第二内存空间中将绘制指令的绘制内容写入到颜色附件B和深度附件B中。S105. If the drawing instruction of the Nth drawing frame carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space; Carrying the transfer instruction, the GPU writes the drawing content of the drawing instruction into the color attachment B and the depth attachment B in the second memory space.
第N绘制帧的绘制指令中可以包含携带转移矩阵的绘制指令和未携带转移矩阵的绘制指令。如图7A所示,图7A示例性地示出了第N绘制帧,第N绘制帧可以包括静态的背景102和运动的小车103。第N绘制帧的绘制指令中可以包括用于绘制静态背景102的绘制指令和用于绘制运动的小车103的绘制指令。The drawing instructions of the Nth drawing frame may include a drawing instruction that carries a transition matrix and a drawing instruction that does not carry a transition matrix. As shown in FIG. 7A , FIG. 7A exemplarily shows the Nth drawing frame, and the Nth drawing frame may include a static background 102 and a moving car 103 . The drawing instructions of the Nth drawing frame may include a drawing instruction for drawing the static background 102 and a drawing instruction for drawing the moving cart 103 .
若第N绘制帧的一个绘制指令携带了转移矩阵,则GPU在第一内存空间中将绘制指令的绘制内容写入颜色附件A和深度附件A。例如,绘制运动的小车的绘制指令中可以携带有转移矩阵。GPU将绘制运动的小车103的绘制指令的绘制内容写入到第一内存空间中的颜色附件A和深度附件A中。如图7B所示,图7B示例性地示出了第一内存空间的颜色附件A和深度附件A。颜色附件A和深度附件A中写入了运动的小车103的绘制指令的绘制内容。可以理解的是,颜色附件A实际上是在内存中的一块内存空间。图7B为了形象理解,把内存空间中的颜色数据按照图像比例形式来示意展示。同样地,深度附件A实际上也是在内存中的一块内存空间。图7B为了形象理解,把内存空间中的深度数据按照图像比例形式来示意展示。If a drawing instruction of the Nth drawing frame carries a transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space. For example, a drawing instruction to draw a moving car can carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the moving cart 103 into the color attachment A and the depth attachment A in the first memory space. As shown in FIG. 7B , FIG. 7B exemplarily shows the color attachment A and the depth attachment A of the first memory space. The drawing content of the drawing instruction of the moving cart 103 is written in the color attachment A and the depth attachment A. Understandably, Color Attachment A is actually a block of memory space in memory. FIG. 7B schematically shows the color data in the memory space in the form of an image scale for visual understanding. Similarly, depth attachment A is actually a memory space in memory. FIG. 7B schematically shows the depth data in the memory space in the form of an image scale for the purpose of visual understanding.
在本申请实施例中,颜色附件A可以称为第一颜色附件,深度附件A可以称为第一深度附件。In this embodiment of the present application, the color attachment A may be referred to as the first color attachment, and the depth attachment A may be referred to as the first depth attachment.
若第N绘制帧的一个绘制指令未携带转移矩阵,则GPU在第二内存空间中将该一个绘制指令的绘制内容写入到颜色附件B和深度附件B中。例如,图7A中示出的静态的背景102,用于绘制静态的背景102的绘制指令可以未携带转移矩阵。GPU将绘制静态的背景102的绘制指令的绘制内容写入到第二内存空间的颜色附件B和深度附件B中。如图7C所示,图7C 示例性地示出了第二内存空间的颜色附件B和深度附件B。颜色附件B和深度附件B中写入了静态的背景102的绘制指令的绘制内容。可以理解的是,颜色附件B实际上是在内存中的一块内存空间。图7C为了形象理解,把内存空间中的颜色数据按照图像比例形式来示意展示。同样地,深度附件B实际上也是在内存中的一块内存空间。图7C为了形象理解,把内存空间中的深度数据按照图像比例形式来示意展示。If a drawing instruction of the Nth drawing frame does not carry a transition matrix, the GPU writes the drawing content of the one drawing instruction into the color attachment B and the depth attachment B in the second memory space. For example, for the static background 102 shown in FIG. 7A, the drawing instruction for drawing the static background 102 may not carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the static background 102 into the color attachment B and the depth attachment B in the second memory space. As shown in FIG. 7C , FIG. 7C exemplarily shows color attachment B and depth attachment B of the second memory space. In the color attachment B and the depth attachment B, the rendering content of the rendering instruction of the static background 102 is written. Understandably, color attachment B is actually a block of memory space in memory. FIG. 7C schematically shows the color data in the memory space in the form of an image scale for visual understanding. Likewise, depth attachment B is actually a memory space in memory. In FIG. 7C, for visual understanding, the depth data in the memory space is shown schematically in the form of an image scale.
本申请实施例中,颜色附件B可以称为第二颜色附件,深度附件B可以称为第二深度附件。In this embodiment of the present application, the color attachment B may be referred to as the second color attachment, and the depth attachment B may be referred to as the second depth attachment.
可以理解的是,第N绘制帧中可以有多个携带了转移矩阵的绘制指令和多个未携带转移矩阵的绘制指令。GPU依次绘制第N绘制帧的每个绘制指令。GPU每绘制一个绘制指令时,可以判断该绘制指令是否携带转移矩阵。若绘制指令中携带了转移矩阵,GPU就在第一内存空间中将绘制指令的绘制内容写入颜色附件A和深度附件A中。若绘制指令中未携带转移矩阵,GPU在第二内存空间中将绘制指令的绘制内容写入到颜色附件B和深度附件B中。最后,本申请实施例的颜色附件A中依次地写入了第N绘制帧中所有携带转移矩阵的绘制指令的具有颜色信息的绘制内容。深度附件A中依次写入了第N绘制帧中所有携带转移矩阵的绘制指令的具有深度信息的绘制内容。同样地,本申请实施例的颜色附件B中依次地写入了第N绘制帧中所有未携带转移矩阵的绘制指令的具有颜色信息的绘制内容。深度附件B中依次写入了第N绘制帧中所有未携带转移矩阵的绘制指令的具有深度信息的绘制内容。It can be understood that, in the Nth drawing frame, there may be multiple drawing instructions that carry the transition matrix and multiple drawing instructions that do not carry the transition matrix. The GPU draws each drawing instruction of the Nth drawing frame in turn. Each time the GPU draws a drawing instruction, it can determine whether the drawing instruction carries a transition matrix. If the drawing instruction carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment A and the depth attachment A in the first memory space. If the transfer matrix is not carried in the drawing instruction, the GPU writes the drawing content of the drawing instruction into the color attachment B and the depth attachment B in the second memory space. Finally, the color attachment A of the embodiment of the present application sequentially writes the drawing contents with color information of all the drawing instructions carrying the transition matrix in the Nth drawing frame. The depth attachment A sequentially writes the drawing contents with depth information of all the drawing instructions carrying the transition matrix in the Nth drawing frame. Similarly, in the color annex B of the embodiment of the present application, the drawing contents with color information of all the drawing instructions that do not carry the transition matrix in the Nth drawing frame are written in sequence. The depth attachment B sequentially writes the drawing contents with depth information of all the drawing instructions that do not carry the transition matrix in the Nth drawing frame.
可以理解的是,颜色附件A和深度附件A可以是第一内存空间中两块单独的内存空间。可选地,颜色附件A和深度附件A也可以是第一内存空间中的一块内存空间,即这一块内存空间中可以写入了颜色数据和深度数据。同样地,颜色附件B和深度附件B可以是第二内存空间中两块单独的内存空间。可选地,颜色附件B和深度附件B也可以是第二内存空间中的一块内存空间,即这一块内存空间中可以写入了颜色数据和深度数据。It can be understood that the color attachment A and the depth attachment A may be two separate memory spaces in the first memory space. Optionally, the color attachment A and the depth attachment A may also be a piece of memory space in the first memory space, that is, color data and depth data can be written in this piece of memory space. Likewise, color attachment B and depth attachment B may be two separate memory spaces in the second memory space. Optionally, the color attachment B and the depth attachment B may also be a piece of memory space in the second memory space, that is, color data and depth data can be written in this piece of memory space.
步骤S105可以参考上文中的步骤602a和步骤602b。For step S105, reference may be made to steps 602a and 602b above.
S106、电子设备的GPU在第七内存空间中,根据深度附件A和深度附件B将第N绘制帧的颜色附件A和颜色附件B合成第N绘制帧。S106. In the seventh memory space, the GPU of the electronic device combines the color attachment A and the color attachment B of the Nth rendering frame into the Nth rendering frame according to the depth attachment A and the depth attachment B.
电子设备的GPU在第七内存空间中,可以根据深度附件A和深度附件B将第N绘制帧的颜色附件A和颜色附件B合成第N绘制帧。这里关于根据深度附件合成颜色附件A和颜色附件B可以参考现有技术中对深度测试中关于基于深度信息合成两个颜色附件的描述,此处不再赘述。In the seventh memory space, the GPU of the electronic device may combine the color attachment A and the color attachment B of the Nth drawing frame into the Nth drawing frame according to the depth attachment A and the depth attachment B. For synthesizing color attachment A and color attachment B according to the depth attachment, reference may be made to the description of synthesizing two color attachments based on depth information in the depth test in the prior art, which will not be repeated here.
S107-S110、电子设备绘制第N+2绘制帧。S107-S110, the electronic device draws the N+2th drawing frame.
S107、电子设备的CPU获取第N+2绘制帧的绘制参数。S107, the CPU of the electronic device acquires the drawing parameters of the N+2th drawing frame.
电子设备的CPU可以获取到第N+2绘制帧的绘制参数。具体地,电子设备100的CPU可以通过三维图像处理库中的接口获取到应用程序的第N+2绘制帧的绘制参数。第N+2绘制帧的绘制参数用于绘制并渲染第N+2绘制帧。第N+2绘制帧的绘制参数可以包括第N+2绘制帧的绘制指令(例如draw call指令)中携带的信息,例如draw call指令的绘制内容中的每个顶点的坐标,像素值,深度值等等信息。The CPU of the electronic device may acquire the drawing parameters of the N+2th drawing frame. Specifically, the CPU of the electronic device 100 can acquire the drawing parameters of the N+2 th drawing frame of the application program through the interface in the three-dimensional image processing library. The drawing parameters of the N+2th drawing frame are used to draw and render the N+2th drawing frame. The drawing parameters of the N+2 th drawing frame may include the information carried in the drawing instruction (eg, the draw call instruction) of the N+2 th drawing frame, such as the coordinates, pixel value, depth of each vertex in the drawing content of the draw call instruction value, etc.
可以理解的是,电子设备在绘制第N+2绘制帧之前,电子设备显示第N+1帧。若第N+1帧为绘制帧,电子设备可以按照步骤S107-步骤S110中绘制第N+2帧的步骤来绘制第N+1 帧。若第N+1帧为预测帧,则电子设备可以按照步骤S111-S115来预测第N+1预测帧。It can be understood that, before the electronic device draws the N+2 th drawing frame, the electronic device displays the N+1 th frame. If the N+1 th frame is a drawing frame, the electronic device may draw the N+1 th frame according to the steps of drawing the N+2 th frame in steps S107 to S110 . If the N+1 th frame is a predicted frame, the electronic device may predict the N+1 th predicted frame according to steps S111-S115.
S108、电子设备的CPU根据第N+2绘制帧的绘制参数向GPU发送用于指示GPU绘制第N+2绘制的绘制指令。S108 , the CPU of the electronic device sends a drawing instruction for instructing the GPU to draw the N+2 th drawing to the GPU according to the drawing parameters of the N+2 th drawing frame.
电子设备的CPU可以根据第N+2绘制帧的绘制参数向GPU发送用于指示GPU绘制第N+2绘制帧的绘制指令。可以理解的是,CPU获取到的第N+2绘制帧的绘制参数中可以包括多个绘制指令的信息。这样,CPU可以依次地向GPU发送用于指示GPU绘制第N+2绘制帧的多个绘制指令。这里,具体可以参考步骤S104中的描述,此处不再赘述。The CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the N+2 th drawing frame to the GPU according to the drawing parameters of the N+2 th drawing frame. It can be understood that the drawing parameters of the N+2th drawing frame acquired by the CPU may include information of multiple drawing instructions. In this way, the CPU may sequentially send multiple drawing instructions to the GPU for instructing the GPU to draw the N+2 th drawing frame. Here, specific reference may be made to the description in step S104, which is not repeated here.
S109、若第N+2绘制帧的绘制指令中携带转移矩阵,则GPU在第三内存空间中将第N+2帧的绘制指令的绘制内容写入到颜色附件C和深度附件C中;若第N+2绘制帧的绘制指令中未携带转移矩阵,则GPU在第四内存空间中将第N+2帧的绘制指令的绘制内容写入到颜色附件D和深度附件D中。S109, if the transfer matrix is carried in the drawing instruction of the N+2th drawing frame, the GPU writes the drawing content of the drawing instruction of the N+2th frame into the color attachment C and the depth attachment C in the third memory space; if The drawing instruction of the N+2th drawing frame does not carry the transition matrix, and the GPU writes the drawing content of the drawing instruction of the N+2th frame into the color attachment D and the depth attachment D in the fourth memory space.
第N+2绘制帧的绘制指令中可以包含携带转移矩阵的绘制指令和未携带转移矩阵的绘制指令。如图8A所示,图8A示例性地示出了第N+2绘制帧,第N+2绘制帧可以包括静态的背景102和运动的小车103。第N+2绘制帧的绘制指令中可以包括用于绘制静态背景102的绘制指令和用于绘制运动的小车103的绘制指令。The drawing instructions of the N+2th drawing frame may include a drawing instruction that carries a transition matrix and a drawing instruction that does not carry a transition matrix. As shown in FIG. 8A , FIG. 8A exemplarily shows the N+2 th drawing frame, and the N+2 th drawing frame may include a static background 102 and a moving cart 103 . The drawing instructions of the N+2th drawing frame may include a drawing instruction for drawing the static background 102 and a drawing instruction for drawing the moving cart 103 .
若该绘制指令携带了转移矩阵,则GPU在第三内存空间中将绘制指令的绘制内容写入颜色附件C和深度附件C。例如,绘制运动的小车的绘制指令中可以携带有转移矩阵。GPU将绘制运动的小车103的绘制指令的绘制内容写入到第三内存空间中的颜色附件C和深度附件C中。如图8B所示,图8B示例性地示出了第三内存空间的颜色附件C和深度附件C。颜色附件C和深度附件C中写入了运动的小车103的绘制指令的绘制内容。可以理解的是,颜色附件C实际上是在内存中的一块内存空间。图8B为了形象理解,把内存空间中的颜色数据按照图像比例形式来示意展示。同样地,深度附件C实际上也是在内存中的一块内存空间。图8B为了形象理解,把内存空间中的深度数据按照图像比例形式来示意展示。If the drawing instruction carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space. For example, a drawing instruction to draw a moving car can carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the moving cart 103 into the color attachment C and the depth attachment C in the third memory space. As shown in FIG. 8B , FIG. 8B exemplarily shows the color attachment C and the depth attachment C of the third memory space. The drawing content of the drawing instruction of the moving cart 103 is written in the color attachment C and the depth attachment C. Understandably, Color Attachment C is actually a block of memory space in memory. FIG. 8B schematically shows the color data in the memory space in the form of an image scale for visual understanding. Similarly, depth attachment C is actually a memory space in memory. FIG. 8B schematically shows the depth data in the memory space in the form of an image scale for visual understanding.
若绘制指令未携带转移矩阵,则GPU在第四内存空间中将绘制指令的绘制内容写入到颜色附件D和深度附件D中。例如,图8A中示出的静态的背景102,用于绘制静态的背景102的绘制指令可以未携带转移矩阵。GPU将绘制静态的背景102的绘制指令的绘制内容写入到第四内存空间的颜色附件D和深度附件D中。如图8C所示,图8C示例性地示出了第四内存空间的颜色附件D和深度附件D。颜色附件D和深度附件D中写入了静态的背景102的绘制指令的绘制内容。可以理解的是,颜色附件D实际上是在内存中的一块内存空间。图8C为了形象理解,把内存空间中的颜色数据按照图像比例形式来示意展示。同样地,深度附件D实际上也是在内存中的一块内存空间。图8C为了形象理解,把内存空间中的深度数据按照图像比例形式来示意展示。If the drawing instruction does not carry the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment D and the depth attachment D in the fourth memory space. For example, for the static background 102 shown in FIG. 8A, the drawing instruction for drawing the static background 102 may not carry a transition matrix. The GPU writes the drawing content of the drawing instruction for drawing the static background 102 into the color attachment D and the depth attachment D in the fourth memory space. As shown in FIG. 8C , FIG. 8C exemplarily shows the color attachment D and the depth attachment D of the fourth memory space. In the color attachment D and the depth attachment D, the drawing content of the drawing instruction of the static background 102 is written. Understandably, the color attachment D is actually a block of memory space in memory. In FIG. 8C , for visual understanding, the color data in the memory space is schematically displayed in the form of an image scale. Likewise, depth attachment D is actually a memory space in memory. In FIG. 8C , for visual understanding, the depth data in the memory space is schematically displayed in the form of an image scale.
在本申请实施例中,颜色附件C可以称为第三颜色附件,颜色附件D可以称为第四颜色附件。深度附件C可以称为第三深度附件,深度附件D可以称为第四深度附件。In this embodiment of the present application, the color accessory C may be referred to as the third color accessory, and the color accessory D may be referred to as the fourth color accessory. Depth attachment C may be referred to as the third depth attachment, and depth attachment D may be referred to as the fourth depth attachment.
可以理解的是,第N+2绘制帧中可以有多个携带了转移矩阵的绘制指令和多个未携带转移矩阵的绘制指令。GPU依次绘制第N+2绘制帧的每个绘制指令。GPU每绘制一个绘制指令时,可以判断该绘制指令是否携带转移矩阵。若绘制指令中携带了转移矩阵,GPU就在第三内存空间中将绘制指令的绘制内容写入颜色附件C和深度附件C中。若绘制指令中未携带 转移矩阵,GPU在第四内存空间中将绘制指令的绘制内容写入到颜色附件D和深度附件D中。最后,本申请实施例的颜色附件C中依次地写入了第N+2绘制帧中所有携带转移矩阵的绘制指令的具有颜色信息的绘制内容。深度附件C中依次写入了第N绘制帧中所有携带转移矩阵的绘制指令的具有深度信息的绘制内容。同样地,本申请实施例的颜色附件D中依次地写入了第N+2绘制帧中所有未携带转移矩阵的绘制指令的具有颜色信息的绘制内容。深度附件D中依次写入了第N+2绘制帧中所有未携带转移矩阵的绘制指令的具有深度信息的绘制内容。It can be understood that, in the N+2th drawing frame, there may be multiple drawing instructions that carry the transition matrix and multiple drawing instructions that do not carry the transition matrix. The GPU draws each drawing instruction of the N+2th drawing frame in turn. Each time the GPU draws a drawing instruction, it can determine whether the drawing instruction carries a transition matrix. If the drawing instruction carries the transition matrix, the GPU writes the drawing content of the drawing instruction into the color attachment C and the depth attachment C in the third memory space. If the transfer matrix is not carried in the drawing instruction, the GPU writes the drawing content of the drawing instruction into the color attachment D and the depth attachment D in the fourth memory space. Finally, in the color attachment C of the embodiment of the present application, the drawing contents with color information of all the drawing instructions carrying the transition matrix in the N+2 th drawing frame are written in sequence. In the depth attachment C, the drawing contents with depth information of all the drawing instructions carrying the transition matrix in the Nth drawing frame are written in sequence. Similarly, in the color attachment D of the embodiment of the present application, the drawing contents with color information of all the drawing instructions that do not carry the transition matrix in the N+2 th drawing frame are written in sequence. In the depth attachment D, the drawing contents with depth information of all drawing instructions that do not carry the transition matrix in the N+2th drawing frame are sequentially written.
可以理解的是,颜色附件A和深度附件A可以是第一内存空间中两块单独的内存空间。可选地,颜色附件A和深度附件A也可以是第一内存空间中的一块内存空间,即这一块内存空间中可以写入了颜色数据和深度数据。同样地,颜色附件B和深度附件B可以是第二内存空间中两块单独的内存空间。可选地,颜色附件B和深度附件B也可以是第二内存空间中的一块内存空间,即这一块内存空间中可以写入了颜色数据和深度数据。步骤S109可以参考上文中的步骤606a和步骤606b。It can be understood that the color attachment A and the depth attachment A may be two separate memory spaces in the first memory space. Optionally, the color attachment A and the depth attachment A may also be a piece of memory space in the first memory space, that is, color data and depth data can be written in this piece of memory space. Likewise, color attachment B and depth attachment B may be two separate memory spaces in the second memory space. Optionally, the color attachment B and the depth attachment B may also be a piece of memory space in the second memory space, that is, color data and depth data can be written in this piece of memory space. For step S109, reference may be made to steps 606a and 606b above.
S110、在第七内存空间中,GPU根据深度附件C和深度附件D将颜色附件C和颜色附件D合成第N+2绘制帧。S110. In the seventh memory space, the GPU combines the color attachment C and the color attachment D into the N+2th drawing frame according to the depth attachment C and the depth attachment D.
电子设备的GPU在第七内存空间中,可以根据深度附件C和深度附件D将第N+2绘制帧的颜色附件C和颜色附件D合成第N+2绘制帧。这里关于根据深度附件合成颜色附件C和颜色附件D可以参考现有技术中对深度测试中关于基于深度信息合成两个颜色附件的描述,此处不再赘述。In the seventh memory space, the GPU of the electronic device may combine the color attachment C and the color attachment D of the N+2 th drawing frame into the N+2 th drawing frame according to the depth attachment C and the depth attachment D. For synthesizing the color attachment C and the color attachment D according to the depth attachment, reference may be made to the description of the synthesis of the two color attachments based on the depth information in the depth test in the prior art, which will not be repeated here.
可以理解的是,当GPU将第七内存空间中的第N帧的图像帧送显后,就可以清空第七内存空间中存储的第N帧的图像帧。然后,GPU就可以在第七内存空间中合成第N+2帧的图像帧。同样地,当GPU将第七内存空间中的第N+2帧的图像帧送显后,就可以清空第七内存空间中存储的第N+2帧的图像帧。It can be understood that, after the GPU sends the image frame of the Nth frame in the seventh memory space for display, it can clear the image frame of the Nth frame stored in the seventh memory space. Then, the GPU can synthesize the image frame of the N+2th frame in the seventh memory space. Similarly, after the GPU sends the image frame of the N+2th frame in the seventh memory space for display, the image frame of the N+2th frame stored in the seventh memory space can be cleared.
S111-S115、电子设备预测第N+3预测帧。S111-S115, the electronic device predicts the N+3 th prediction frame.
S111、电子设备的CPU向GPU发送用于指示GPU计算运动向量的指令。S111. The CPU of the electronic device sends an instruction for instructing the GPU to calculate the motion vector to the GPU.
电子设备的CPU可以向GPU发送用于指示GPU计算运动向量的指令。该指令用于指示GPU中的shader计算运动向量。该指令可以是dispatch指令。本申请实施例对计算运动向量的指令的具体形式不做限定。The CPU of the electronic device may send an instruction to the GPU for instructing the GPU to calculate the motion vector. This instruction is used to instruct the shader in the GPU to calculate the motion vector. The directive can be a dispatch directive. The embodiment of the present application does not limit the specific form of the instruction for calculating the motion vector.
S112、电子设备的GPU利用颜色附件A计算出第N+2绘制帧的颜色附件C的运动向量A,利用深度附件B、深度附件D计算出第N+2绘制帧的颜色附件D的运动向量B。S112, the GPU of the electronic device calculates the motion vector A of the color appendix C of the N+2th drawing frame by using the color appendix A, and uses the depth appendix B and the depth appendix D to calculate the motion vector of the color appendix D of the N+2th drawing frame B.
电子设备的GPU可以分别计算出第N+2帧运动对象的运动向量和静态对象的运动向量。电子设备的GPU可以通过颜色附件A和颜色附件C来计算出第N+2帧中运动对象(颜色附件C)的运动向量,即运动向量A。电子设备的GPU可以根据深度附件B、深度附件D来计算出第N+2帧中静态对象(颜色附件D)的运动向量,即运动向量B。The GPU of the electronic device can separately calculate the motion vector of the moving object and the motion vector of the static object in the N+2th frame. The GPU of the electronic device can calculate the motion vector of the moving object (color attachment C) in the N+2th frame, that is, the motion vector A, by using the color attachment A and the color attachment C. The GPU of the electronic device may calculate, according to the depth attachment B and the depth attachment D, the motion vector of the static object (color attachment D) in the N+2th frame, that is, the motion vector B.
在本申请实施例,运动向量V可以称为第一运动向量,运动向量B可以称为第二运动向量。In this embodiment of the present application, the motion vector V may be referred to as the first motion vector, and the motion vector B may be referred to as the second motion vector.
在一种可能的实现方式中,电子设备的GPU利用颜色附件A计算出第N+2绘制帧的颜色附件C的运动向量A具体可以包括如下步骤:In a possible implementation manner, the GPU of the electronic device uses the color attachment A to calculate the motion vector A of the color attachment C of the N+2th drawing frame, which may specifically include the following steps:
1、GPU可以将第N+2帧的颜色附件C划分成Q个像素块。每个像素块可以包含f*f(例 如16*16)个像素点。如图9A中的(b)图所示。1. The GPU may divide the color attachment C of the N+2th frame into Q pixel blocks. Each pixel block may contain f*f (for example, 16*16) pixels. As shown in (b) of FIG. 9A .
2、GPU在颜色附件C中取第一像素块(例如图9A中(b)图中的像素块902),在第N绘制帧的颜色附件A中查找与第一像素块匹配的匹配像素块,例如图9A中(a)图中的像素块901。2. The GPU takes the first pixel block in color attachment C (for example, pixel block 902 in (b) in FIG. 9A ), and searches for a matching pixel block matching the first pixel block in color attachment A of the Nth drawing frame , such as the pixel block 901 in (a) of FIG. 9A .
在本申请实施例中,第N帧中所有候选块中,与第一像素块的RGB值的绝对差最小的候选块,称为与第像素块匹配的匹配像素块。电子设备需要在第N绘制帧中找到与像素块匹配的匹配像素块901。可选地,电子设备的GPU可以通过菱形搜索算法在第N绘制帧找到与第一像素块匹配的匹配像素块。如图9B所示,GPU可以通过菱形搜索算法在(b)图的第N帧中与找到(a)图第N+2帧中的像素块902匹配的匹配像素块。电子设备可以利用像素块901的左上角的像素点9011去进行菱形搜索。电子设备可以在第N绘制帧的找到以像素点1104为左上角的像素块901与像素块902相匹配。菱形搜索算法具体可以参考现有技术中的描述,此处不再赘述。In the embodiment of the present application, among all the candidate blocks in the Nth frame, the candidate block with the smallest absolute difference with the RGB value of the first pixel block is referred to as a matching pixel block matching the pixel block. The electronic device needs to find a matching pixel block 901 that matches the pixel block in the Nth drawing frame. Optionally, the GPU of the electronic device may find a matching pixel block that matches the first pixel block in the Nth drawing frame by using a diamond search algorithm. As shown in FIG. 9B , the GPU can find a matching pixel block 902 in the Nth frame of the (b) figure by a diamond search algorithm that matches the pixel block 902 in the N+2th frame of the (a) figure. The electronic device can use the pixel point 9011 in the upper left corner of the pixel block 901 to perform a diamond search. The electronic device may find the pixel block 901 with the pixel point 1104 as the upper left corner in the Nth drawing frame to match the pixel block 902 . For details of the diamond search algorithm, reference may be made to the description in the prior art, which will not be repeated here.
如图9C所示,图9C示例性地示出了电子设备在第N绘制帧中找到与像素块901的匹配像素块901的示意图。如图9C中的(a)图所示,电子设备对像素块902的左上角像素点9011进行菱形搜索。在一种可实现的方式中,如图9C中的(b)图所示,电子设备首先进行以第N绘制帧中像素点9012为中心点进行菱形搜索。像素点9011的坐标与像素点9012的坐标相同。电子设备可以计算出像素块902分别于以左上角像素点为像素点9012的像素块,左上角像素点为像素点1001的像素块,左上角像素点为像素点1002的像素块,左上角像素点为像素点1003的像素块,左上角像素点为像素点1004的像素块,左上角像素点为像素点1005的像素块,左上角像素点为像素点1006的像素块,左上角像素点为像素点1007的像素块,左上角像素点为像素点1008的像素块的像素值差。电子设备可以再以像素值差最小的像素块中的左上角像素点为中心进行小菱形搜索。例如上述像素块中,左上角像素点为像素点1003的像素块与像素块902的像素值差值最小。那么电子设备可以以像素点1003为中心进行小菱形搜索。即电子设备可以计算出像素块902分别于以左上角像素点为像素点1101的像素块,左上角像素点为像素点1102的像素块,左上角像素点为像素点1103的像素块,左上角像素点为像素点1104的像素块。最后,电子设备可以确定出左上角像素点为像素点1104的像素块(即图9B示出的像素块901)与像素块902的像素值差最小。那么电子设备可以确定出第N帧中像素块901为像素块902的匹配像素块。As shown in FIG. 9C , FIG. 9C exemplarily shows a schematic diagram of the electronic device finding a pixel block 901 that matches the pixel block 901 in the Nth drawing frame. As shown in (a) of FIG. 9C , the electronic device performs a diamond search for the pixel point 9011 in the upper left corner of the pixel block 902 . In an achievable manner, as shown in (b) of FIG. 9C , the electronic device first performs a diamond search with the pixel point 9012 in the Nth drawing frame as the center point. The coordinates of the pixel point 9011 are the same as the coordinates of the pixel point 9012 . The electronic device can calculate that the pixel block 902 is respectively in the pixel block with the upper left pixel point as the pixel point 9012, the upper left pixel point is the pixel block with the pixel point 1001, the upper left pixel point is the pixel block with the pixel point 1002, the upper left pixel point is the pixel block with the pixel point 1002, and the upper left pixel point is the pixel block with the pixel point 1002. The point is the pixel block of pixel 1003, the upper left pixel is the pixel block of pixel 1004, the upper left pixel is the pixel block of pixel 1005, the upper left pixel is the pixel block of pixel 1006, and the upper left pixel is the pixel block of pixel 1006. For the pixel block of pixel point 1007, the upper left pixel point is the pixel value difference of the pixel block of pixel point 1008. The electronic device can then perform a small diamond search with the upper left pixel point in the pixel block with the smallest pixel value difference as the center. For example, in the above pixel block, the pixel value difference between the pixel block whose upper left corner is the pixel point 1003 and the pixel block 902 is the smallest. Then the electronic device can perform a small diamond search with the pixel point 1003 as the center. That is, the electronic device can calculate that the pixel block 902 is respectively in the pixel block with the upper left pixel point as the pixel point 1101, the upper left pixel point is the pixel block of the pixel point 1102, the upper left pixel point is the pixel block of the pixel point 1103, and the upper left corner pixel point is the pixel block of the pixel point 1103. The pixel point is the pixel block of the pixel point 1104 . Finally, the electronic device can determine that the pixel value difference between the pixel block whose upper left pixel point is the pixel point 1104 (ie, the pixel block 901 shown in FIG. 9B ) and the pixel block 902 is the smallest. Then the electronic device can determine that the pixel block 901 in the Nth frame is a matching pixel block of the pixel block 902 .
3、GPU计算出匹配像素块到第一像素块的第一位移,根据第一位移确定出第一像素块的运动向量A1。3. The GPU calculates the first displacement from the matched pixel block to the first pixel block, and determines the motion vector A1 of the first pixel block according to the first displacement.
例如,图9B所示,图9B中与像素块902的匹配块为像素块901。那么像素块902的运动向量为图9B中(b)图示出的运动向量V1。For example, as shown in FIG. 9B , the matching block with the pixel block 902 in FIG. 9B is the pixel block 901 . Then the motion vector of the pixel block 902 is the motion vector V1 illustrated in (b) of FIG. 9B .
4、GPU可以按照上述步骤1-步骤3计算出颜色附件C中Q个像素块中每个像素块的运动向量,即为V1,V2,…,VQ。颜色附件C的运动向量即为V=(V1,V2,…,VQ)。4. The GPU can calculate the motion vector of each pixel block in the Q pixel blocks in the color annex C according to the above steps 1-3, namely V1, V2, . . . , VQ. The motion vector of color attachment C is V=(V1, V2, . . . , VQ).
在一种可能的实现方式中,电子设备的GPU利用深度附件B、深度附件D计算出第N+2绘制帧的颜色附件D的运动向量B具体可以包括如下步骤:In a possible implementation manner, the GPU of the electronic device uses the depth attachment B and the depth attachment D to calculate the motion vector B of the color attachment D of the N+2th drawing frame, which may specifically include the following steps:
1、GPU可以将第N+2帧的颜色附件D划分成Q个像素块。每个小块可以包含f*f(例如16*16)个像素点。1. The GPU may divide the color attachment D of the N+2th frame into Q pixel blocks. Each small block may contain f*f (eg 16*16) pixels.
2、GPU在绘制第N帧时,可以通过hook glBufferSubData接口获取第N帧的camera相机位置的转角信息(以一个4x4的矩阵保存),记录为M1。2. When the GPU draws the Nth frame, it can obtain the corner information of the camera position of the Nth frame through the hook glBufferSubData interface (saved in a 4x4 matrix), and record it as M1.
3、GPU在绘制第N+2帧时,可以通过hook glBufferSubData接口获取第N+2帧的camera相机位置的转角信息(以一个4x4的矩阵保存),记录为M2。GPU并计算M1与M2之间的变换矩阵T。矩阵T表征的就是两帧Camera之间的转换关系。3. When the GPU draws the N+2 frame, it can obtain the corner information of the camera position of the N+2 frame through the hook glBufferSubData interface (saved in a 4x4 matrix), and record it as M2. The GPU and computes the transformation matrix T between M1 and M2. The matrix T represents the conversion relationship between the two frames of Camera.
这里,
Figure PCTCN2021106928-appb-000001
here,
Figure PCTCN2021106928-appb-000001
Figure PCTCN2021106928-appb-000002
Figure PCTCN2021106928-appb-000002
其中,矩阵R1表示第N绘制帧中相机的旋转属性,矩阵T1表示第N绘制帧中相机的平移属性。矩阵R2表示第N+2绘制帧中相机的旋转属性,矩阵T2表示第N+2绘制帧中相机的平移属性。矩阵P为投影矩阵,GPU可以通过hook glBufferSubData接口直接获取。The matrix R1 represents the rotation property of the camera in the Nth drawing frame, and the matrix T1 represents the translation property of the camera in the Nth drawing frame. The matrix R2 represents the rotation property of the camera in the N+2th drawing frame, and the matrix T2 represents the translation property of the camera in the N+2th drawing frame. The matrix P is the projection matrix, and the GPU can directly obtain it through the hook glBufferSubData interface.
4、GPU在第N+2帧的颜色附件D中取第二像素块以及第二像素块在第N+2帧中的位置position2,并在深度附件D中获取第二像素块的深度值D2。4. The GPU obtains the second pixel block and the position 2 of the second pixel block in the N+2th frame in the color attachment D of the N+2th frame, and obtains the depth value D2 of the second pixel block in the depth attachment D .
5、GPU利用第二像素块的位置position2,深度值D2,以及矩阵T计算出第二像素块在第N绘制帧中的位置position1。那么第二像素块的运动向量B1=position2-position1。GPU可以按照计算第二像素块运动向量的步骤计算出颜色附件D中每一个像素块的运动向量B1,B2,…,BQ。颜色附件D的运动向量B=(B1,B2,…,BQ)。5. The GPU uses the position position2 of the second pixel block, the depth value D2, and the matrix T to calculate the position position1 of the second pixel block in the Nth drawing frame. Then the motion vector of the second pixel block B1=position2-position1. The GPU may calculate the motion vectors B1, B2, . . . , BQ of each pixel block in the color attachment D according to the step of calculating the motion vector of the second pixel block. Motion vector B=(B1, B2, . . . , BQ) for color attachment D.
这里,向量G2=(position2,D2,1),向量G1=G2*T,Here, vector G2=(position2, D2, 1), vector G1=G2*T,
position1=(G1.x/G1.w,G1.y/G1.w)position1=(G1.x/G1.w, G1.y/G1.w)
这里G1是一个1*4的向量,G1.x为G1的第一个元素,G1.y为G1的第二个元素,G1.w为G1的第四个元素。Here G1 is a 1*4 vector, G1.x is the first element of G1, G1.y is the second element of G1, and G1.w is the fourth element of G1.
S113、电子设备的CPU向GPU发送用于指示GPU绘制预测帧的指令。S113. The CPU of the electronic device sends an instruction for instructing the GPU to draw the predicted frame to the GPU.
电子设备100的CPU可以在GPU计算出颜色附件C的运动向量A和颜色附件D的运动向量B之后,向GPU发送用于绘制第N+3预测帧的指令。The CPU of the electronic device 100 may send an instruction for drawing the N+3 th predicted frame to the GPU after the GPU calculates the motion vector A of the color attachment C and the motion vector B of the color attachment D.
S114、GPU根据颜色附件C和运动向量A预测出第N+3预测帧的颜色附件E,根据颜色附件D和运动向量B预测出第N+3绘制帧的颜色附件F。S114. The GPU predicts the color attachment E of the N+3 th prediction frame according to the color attachment C and the motion vector A, and predicts the color attachment F of the N+3 th drawing frame according to the color attachment D and the motion vector B.
响应于指示GPU绘制第N+3预测帧的指令,GPU可以绘制出第N+3预测帧中写入运动对象的颜色附件E和写入静态对象的颜色附件F。具体地,GPU可以根据颜色附件C和运动向量A预测出第N+3预测帧的颜色附件E,根据颜色附件D和运动向量B预测出第N+3绘制帧的颜色附件F。示例性地,颜色附件E可以如图10A所示,颜色附件F可以如图10B所示。In response to the instruction instructing the GPU to draw the N+3 th predicted frame, the GPU may draw the color attachment E written in the moving object and the color attachment F written in the static object in the N+3 th predicted frame. Specifically, the GPU may predict the color attachment E of the N+3 th prediction frame according to the color attachment C and the motion vector A, and predict the color attachment F of the N+3 th drawing frame according to the color attachment D and the motion vector B. Illustratively, color attachment E may be as shown in FIG. 10A , and color attachment F may be as shown in FIG. 10B .
在本申请实施例中,颜色附件E可以称为第五颜色附件,颜色附件F可以称为第六颜色附件。In this embodiment of the present application, the color attachment E may be referred to as the fifth color attachment, and the color attachment F may be referred to as the sixth color attachment.
可以理解的是,第N绘制帧中的对象和第N+2绘制帧中的对象相同。对于同一个对象A,该对象A在第N绘制帧中的位置可以与该对象A在第N+2绘制帧中的位置不同。同样地,第N+2绘制帧和第N+3预测帧中的对象相同,只是对象在第N+2绘制帧和第N+3预测帧中的位置不同。GPU可以利用第N+2绘制帧的对象和该对象的运动向量就可以预测出第N+3预测帧。在本申请实施例中,第N绘制帧可以称为第一绘制帧。第N+2绘制帧可以称为第二绘制帧。第N+3预测帧可以称为第一预测帧。It can be understood that the object in the Nth drawing frame is the same as the object in the N+2th drawing frame. For the same object A, the position of the object A in the Nth drawing frame may be different from the position of the object A in the N+2th drawing frame. Likewise, the objects in the N+2 th rendering frame and the N+3 th prediction frame are the same, but the positions of the objects in the N+2 th rendering frame and the N+3 th prediction frame are different. The GPU can predict the N+3 prediction frame by using the object of the N+2 drawing frame and the motion vector of the object. In this embodiment of the present application, the Nth drawing frame may be referred to as the first drawing frame. The N+2th drawing frame may be referred to as the second drawing frame. The N+3 th prediction frame may be referred to as the first prediction frame.
S115、在第七内存空间中,GPU根据深度附件C和深度附件D将颜色附件E和颜色附 件F合成第N+3预测帧的图像帧。S115. In the seventh memory space, the GPU combines the color attachment E and the color attachment F according to the depth attachment C and the depth attachment D into the image frame of the N+3 th prediction frame.
电子设备的GPU在第七内存空间中,可以根据深度附件C和深度附件D将第N绘制帧的颜色附件E和颜色附件F合成第N+3绘制帧的图像帧。示例性地,第N+3预测帧可以如图10C所示。这里关于根据深度附件合成颜色附件E和颜色附件F可以参考现有技术中对深度测试中关于基于深度附件合成两个图像的描述,此处不再赘述。可以理解的是,由于第N+2绘制帧和第N+3预测帧间隔的时间很短,可以利用第N+2绘制帧中的深度信息来合成第N+3预测帧。这里,GPU也可以预测出第N+3帧的运动对象的深度附件和静态对象的深度附件。然后,利用第N+3帧运动对象的深度附件和静态对象的深度附件将颜色附件E和颜色附件F合成。本申请对此不作限定。In the seventh memory space, the GPU of the electronic device can combine the color attachment E and the color attachment F of the Nth drawing frame into the image frame of the N+3th drawing frame according to the depth attachment C and the depth attachment D. Exemplarily, the N+3 th predicted frame may be as shown in FIG. 10C . For synthesizing the color attachment E and the color attachment F according to the depth attachment, reference may be made to the description of synthesizing two images based on the depth attachment in the depth test in the prior art, which will not be repeated here. It can be understood that, since the interval between the N+2 th rendering frame and the N+3 th prediction frame is very short, the N+3 th prediction frame can be synthesized by using the depth information in the N+2 th rendering frame. Here, the GPU can also predict the depth attachments of moving objects and the depth attachments of static objects in the N+3th frame. Then, the color attachment E and the color attachment F are synthesized using the depth attachment of the moving object and the depth attachment of the static object in the N+3 frame. This application does not limit this.
电子设备绘制出绘制帧的主要过程是GPU执行若干个drawcall指令。GPU将每一个drawcall指令的内容逐一的绘制到FBO上。然后每一个drawcall指令在GPU上都需要执行一次渲染管线的流程。该渲染管线的流程主要分为顶点着色器,曲面细分(非必须),几何作色器(非必须),图元组装(非必须),光栅化、片段作色器、测试混合阶段(非必须)。这样,GPU绘制一帧绘制帧的开销很大。另外,GPU执行每一个drawcall指令所需要的顶点信息,坐标信息等都需要GPU进行准备,这些准备工作对于cpu也是很高的计算量。The main process for the electronic device to draw the drawing frame is that the GPU executes several drawcall instructions. The GPU draws the contents of each drawcall instruction to the FBO one by one. Then each drawcall instruction needs to execute the rendering pipeline process once on the GPU. The process of the rendering pipeline is mainly divided into vertex shader, tessellation (not required), geometry shader (not required), primitive assembly (not required), rasterization, fragment shader, test mixing stage (not required) must). In this way, it is expensive for the GPU to draw a frame to draw a frame. In addition, the vertex information and coordinate information required by the GPU to execute each drawcall instruction need to be prepared by the GPU, and these preparations are also very computationally intensive for the CPU.
预测一帧图像帧的过程对于CPU来说几乎没有计算消耗,只需向GPU发送部分指令。对于GPU来说,只需要计算运动对象的运动向量和静态对象的运动向量。这些计算全部是并行的,且只需要计算一次,每个计算单元执行的都是少量的基本运算,可以减少GPU的计算,提升性能。The process of predicting an image frame has almost no computational consumption for the CPU, and only needs to send some instructions to the GPU. For the GPU, only the motion vector of moving objects and the motion vector of static objects need to be calculated. These calculations are all parallel and only need to be calculated once. Each computing unit performs a small number of basic operations, which can reduce GPU calculations and improve performance.
可以理解的是,本申请实施例不限于电子设备通过第N绘制帧和第N+2绘制帧预测出第N+3预测帧。可选地,电子设备还可以通过第N帧和第N+1帧预测第N+2帧。可选地,电子设备还可以通过第N帧和第N+3帧预测第N+4帧。本申请实施例对此不做限定。It can be understood that the embodiment of the present application is not limited to the electronic device predicting the N+3 th predicted frame by using the N th drawing frame and the N+2 th drawing frame. Optionally, the electronic device may further predict the N+2 th frame by using the N th frame and the N+1 th frame. Optionally, the electronic device may also predict the N+4th frame by using the Nth frame and the N+3th frame. This embodiment of the present application does not limit this.
可以理解的是,电子设备在显示目标应用程序的视频界面的过程中,电子设备可以按照不同的策略来预测出预测帧。即电子设备在第一时间段按照第N帧和第N+2帧预测第N+3帧的策略,在第二时间段按照第N帧和第N+1帧预测第N+2帧的策略。例如,当GPU执行的任务比较多时,电子设备可以先按照第N帧和第N+2帧预测第N+3帧。当GPU执行的任务比较少时,电子设备可以按照第N帧和第N+1帧预测第N+2帧。本申请实施例对此不做限定。It can be understood that, when the electronic device displays the video interface of the target application, the electronic device can predict the predicted frame according to different strategies. That is, the strategy of the electronic device predicting the N+3th frame according to the Nth frame and the N+2th frame in the first time period, and the strategy of predicting the N+2th frame according to the Nth frame and the N+1th frame in the second time period. . For example, when the GPU performs many tasks, the electronic device may first predict the N+3 th frame according to the N th frame and the N+2 th frame. When the GPU performs few tasks, the electronic device may predict the N+2th frame according to the Nth frame and the N+1th frame. This embodiment of the present application does not limit this.
如图11示出的每秒传输90帧(90frames per second,90fps)的插帧逻辑框图。在图11中,第0帧到第2帧为绘制帧。从第3帧开始,奇数帧为预测帧,偶数帧为绘制帧。例如第3帧、第5帧、第7帧等等奇数帧为预测帧。第4帧、第6帧、第8帧等等偶数帧为绘制帧。第3帧由电子设备根据第0帧和第2帧生成。第5帧由电子设备根据第2帧和第4帧生成。第7帧由电子设备根据第4帧和第6帧生成。第89帧由电子设备根据第86帧和第88帧生成。这里第0帧可以称为第0绘制帧。第3帧可以称为第3预测帧。As shown in Figure 11, a frame insertion logic block diagram of 90 frames per second (90 frames per second, 90 fps) is transmitted. In FIG. 11, frames 0 to 2 are drawing frames. Starting from frame 3, odd-numbered frames are predicted frames, and even-numbered frames are drawn frames. For example, odd-numbered frames such as the third frame, the fifth frame, and the seventh frame are predicted frames. The 4th, 6th, 8th, etc. even-numbered frames are drawing frames. Frame 3 is generated by the electronic device based on frame 0 and frame 2. Frame 5 is generated by the electronic device based on frames 2 and 4. The 7th frame is generated by the electronic device based on the 4th and 6th frames. The 89th frame is generated by the electronic device based on the 86th and 88th frames. Here, the 0th frame may be referred to as the 0th drawing frame. The third frame may be referred to as a third predicted frame.
下面首先介绍本申请实施例提供的示例性电子设备100。The following first introduces the exemplary electronic device 100 provided by the embodiments of the present application.
图12是本申请实施例提供的电子设备100的结构示意图。FIG. 12 is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application.
下面以电子设备100为例对实施例进行具体说明。应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的 部件配置。图中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。The embodiment will be described in detail below by taking the electronic device 100 as an example. It should be understood that electronic device 100 may have more or fewer components than shown in the figures, may combine two or more components, or may have different component configurations. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2. Mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194 and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本发明实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100 . In other embodiments of the present application, the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, memory, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (NPU) Wait. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller may be the nerve center and command center of the electronic device 100 . The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may contain multiple sets of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现 通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 . In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect the processor 110 with the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. In some embodiments, the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 . The processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
SIM接口可以被用于与SIM卡接口195通信,实现传送数据到SIM卡或读取SIM卡中数据的功能。The SIM interface can be used to communicate with the SIM card interface 195 to realize the function of transferring data to the SIM card or reading data in the SIM card.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices.
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 . In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。The charging management module 140 is used to receive charging input from the charger. The charger may be a wireless charger or a wired charger.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the external memory, the display screen 194 , the camera 193 , and the wireless communication module 160 .
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波 进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In some embodiments, at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR). The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc. The GNSS may include global positioning system (global positioning system, GPS), global navigation satellite system (global navigation satellite system, GLONASS), Beidou navigation satellite system (beidou navigation satellite system, BDS), quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light). emitting diode, AMOLED), flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on. In some embodiments, the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处 理器等实现拍摄功能。The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193 . For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP may be provided in the camera 193 .
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In some embodiments, the electronic device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information, and can continuously learn by itself. Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。The internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5SDRAM)等。Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as the fifth generation DDR SDRAM is generally called DDR5 SDRAM) and so on.
非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。Non-volatile memory may include magnetic disk storage devices, flash memory.
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media Card,eMMC)等。Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cells (single-level cells, SLC), multi-level memory cells (multi-level memory cells) according to the level of storage cell potential cell, MLC), triple-level cell (TLC), fourth-level storage unit (quad-level cell, QLC), etc., according to the storage specification can include universal flash storage (English: universal flash storage, UFS) , embedded multimedia memory card (embedded multi media Card, eMMC) and so on.
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。The random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。The non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转 换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information to analog audio signal output, and also to convert analog audio input to digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。 Speaker 170A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone jack 170D is used to connect wired earphones. The earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be provided on the display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like. The capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 . In some embodiments, the angular velocity of electronic device 100 about three axes (ie, x, y, and z axes) may be determined by gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip machine, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. The electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The electronic device 100 emits infrared light to the outside through the light emitting diode. Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 . The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect the temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature. In some other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch panel". The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to touch operations may be provided through display screen 194 . In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电 子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。The SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 . The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as call and data communication.
图13是本申请实施例的电子设备100的软件结构框图。FIG. 13 is a block diagram of the software structure of the electronic device 100 according to the embodiment of the present application.
本申请实施例提供的用于实现图像帧预测的系统框架1300包括软件架构和硬件设备。其中,分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将系统分为四层,从上至下分别为应用程序层,应用程序框架层,系统库,内核层。The system framework 1300 for implementing image frame prediction provided by the embodiments of the present application includes a software architecture and hardware devices. Among them, the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, a system library, and a kernel layer.
应用程序层可以包括一系列应用程序包。The application layer can include a series of application packages.
如图13所示,应用程序层可以目标应用程序1301。应用程序层还可以包括相机(图13中未示出),图库(图13中未示出),日历(图13中未示出),通话(图13中未示出),地图(图13中未示出),导航(图13中未示出)等等应用程序(也可以称为应用)。其中,目标应用程序1301可以是游戏应用程序。As shown in Figure 13, the application layer may target application 1301. The application layer may also include camera (not shown in FIG. 13 ), gallery (not shown in FIG. 13 ), calendar (not shown in FIG. 13 ), calls (not shown in FIG. 13 ), maps (not shown in FIG. 13 ) (not shown in FIG. 13 ), navigation (not shown in FIG. 13 ), etc. applications (which may also be referred to as applications). The target application 1301 may be a game application.
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。在本申请实施例中,应用程序框架层可以包括应用程序引擎1310。其中,应用程序引擎1310中可以包括渲染系统(Rendering System)1311。当电子设备100在运行目标应用程序1301时,目标应用程序1301对应的应用程序引擎1310中的渲染系统1311可以获取目标应用程序1301的绘制参数。渲染系统1311还可以根据该绘制参数调用三维图形处理库1330中的接口,以实现目标应用程序1301的图像帧的渲染。其中,应用程序引擎1310可以是游戏应用对应的游戏引擎。三维图形处理库1330可以是Vulkan,OpenGL,OpenGL ES。The application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions. In this embodiment of the present application, the application framework layer may include an application engine 1310 . The application engine 1310 may include a rendering system (Rendering System) 1311. When the electronic device 100 is running the target application 1301 , the rendering system 1311 in the application engine 1310 corresponding to the target application 1301 can acquire the drawing parameters of the target application 1301 . The rendering system 1311 can also call the interface in the three-dimensional graphics processing library 1330 according to the drawing parameters, so as to realize the rendering of the image frame of the target application 1301 . The application engine 1310 may be a game engine corresponding to a game application. The 3D graphics processing library 1330 may be Vulkan, OpenGL, OpenGL ES.
系统库可以包括多个功能模块。例如:表面管理器(surface manager)(图13中未示出),媒体库(Media Libraries)(图13中未示出),平台接口1320,三维图形处理库1330(例如:OpenGL ES),二维图形引擎(例如:SGL)(图13中未示出)等。A system library can include multiple functional modules. For example: surface manager (not shown in Figure 13), Media Libraries (not shown in Figure 13), platform interface 1320, 3D graphics processing library 1330 (eg: OpenGL ES), two dimensional graphics engine (eg: SGL) (not shown in FIG. 13 ), etc.
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了二维(2-Dimensional,2D)和三维(3-Dimensional,3D)图层的融合。The Surface Manager is used to manage the display subsystem and provides a fusion of two-dimensional (2-Dimensional, 2D) and three-dimensional (3-Dimensional, 3D) layers for multiple applications.
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。The media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
平台接口1320可以用于接收三维图形处理库1330传输的用于配置缓存的API。响应于用于配置缓存的API,平台接口1320可以通过驱动层中的驱动程序驱动运动随机存储器。进而平台接口1320可以在运动随机存储器中配置供目标应用程序使用的存储空间。本申请实施例中平台接口1320可以是EGL。EGL是Khronos渲染API(例如OpenGL,OpenGL ES或OpenVG)与基础本机平台窗口系统之间的接口。EGL处理图形上下文管理,表面/缓冲区绑定,渲染同步,并启用“使用其他Khronos API的高性能,加速,混合模式2D和3D渲染”。The platform interface 1320 may be used to receive the API for configuring the cache transmitted by the 3D graphics processing library 1330 . In response to the API for configuring the cache, the platform interface 1320 can drive the motion random access memory through a driver in the driver layer. In turn, the platform interface 1320 may configure storage space in the Motion RAM for use by the target application. In this embodiment of the present application, the platform interface 1320 may be EGL. EGL is the interface between the Khronos rendering API (such as OpenGL, OpenGL ES or OpenVG) and the underlying native platform windowing system. EGL handles graphics context management, surface/buffer binding, rendering synchronization, and enables "high-performance, accelerated, mixed-mode 2D and 3D rendering using other Khronos APIs".
三维图形处理库用于实现3D图形绘图,图像渲染,合成,和图层处理等。三维图形处理库1330可以是OpenGL ES。OpenGL ES是一种应用程序编程接口/函数库,是OpenGL三维图形API的子集。OpenGL ES中包括多种功能函数/应用程序编程接口,例如glBindFrameBuffer接口1333’、glDrawArrays接口(图中未示出)。电子设备100可调用OpenGL ES实现图像帧的绘制。The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing. The three-dimensional graphics processing library 1330 may be OpenGL ES. OpenGL ES is an application programming interface/library that is a subset of the OpenGL 3D graphics API. OpenGL ES includes a variety of functional functions/application programming interfaces, such as glBindFrameBuffer interface 1333', glDrawArrays interface (not shown in the figure). The electronic device 100 may call OpenGL ES to implement the drawing of the image frame.
钩子模块(HOOK System)1331通过将三维图像处理库1330中的一些接口挂钩子,可以获取调用三维图像处理库1330中glBindFrameBuffer接口1333’、glDrawArrays接口等接口 的参数。例如,钩子模块(HOOK System)1331通过glBindFrameBuffer接口1333将三维图像处理库1330中的glBindFrameBuffer接口1333’挂钩子,可以获取调用三维图像处理库1330中glBindFrameBuffer接口1333’的参数。The hook module (HOOK System) 1331 can acquire and call the parameters of interfaces such as glBindFrameBuffer interface 1333' and glDrawArrays interface in the three-dimensional image processing library 1330 by hooking some interfaces in the three-dimensional image processing library 1330. For example, the hook module (HOOK System) 1331 hooks the glBindFrameBuffer interface 1333' in the 3D image processing library 1330 through the glBindFrameBuffer interface 1333, and can obtain the parameters for calling the glBindFrameBuffer interface 1333' in the 3D image processing library 1330.
在本申请实施例中,在目标应用程序1301进行绘制时,应用程序引擎1310中的渲染系统1311可以调用钩子模块1331中的eglSwapBuffers接口1332,glBindFrameBuffer接口1333等接口。然后钩子模块(HOOK System)1331通过将三维图像处理库1330中的一些接口挂钩子,可以获取调用三维图像处理库1330中glBindFrameBuffer接口1333’、glDrawArrays接口等接口的参数来实现目标应用程序1301中插入预测帧,并且实现根据目标应用程序1301的绘制帧计算运动向量以及得到预测帧。In this embodiment of the present application, when the target application 1301 draws, the rendering system 1311 in the application engine 1310 may call the eglSwapBuffers interface 1332 and the glBindFrameBuffer interface 1333 and other interfaces in the hook module 1331 . Then the hook module (HOOK System) 1331 can obtain and call the parameters of interfaces such as glBindFrameBuffer interface 1333' and glDrawArrays interface in the three-dimensional image processing library 1330 by hooking some interfaces in the three-dimensional image processing library 1330 to realize the insertion into the target application 1301. The predicted frame is realized, and the motion vector is calculated according to the drawing frame of the target application 1301 and the predicted frame is obtained.
2D图形引擎是2D绘图的绘图引擎。2D graphics engine is a drawing engine for 2D drawing.
内核层是硬件和软件之间的层。内核层可以包括驱动程序1340。其中驱动程序1340中可包括多种驱动程序,用于实现对于硬件设备的驱动。例如驱动程序1340可以包括图形内存驱动1341、GPU驱动1342等等驱动程序。The kernel layer is the layer between hardware and software. The kernel layer may include drivers 1340 . The driver 1340 may include a variety of drivers for implementing the driver for the hardware device. For example, the driver 1340 may include a graphics memory driver 1341, a GPU driver 1342, and the like.
硬件设备中可以包括:显示设备Display1350,图形处理器GPU1351、缓存1352和应用处理器1353。显示设备1350可以是图12中示出的显示屏194。图形处理器GPU1351和应用处理器1353可以集成在图12中示出的处理器110中。缓存1352可以是图12中示出的内部存储器121。这里显示设备1350可以参考上文对显示屏194的描述。图形处理器1351可以参考上文中对GPU的描述。应用处理器1353可以参考上文对图12的描述。缓存1352可以参考上文对内部存储器121的描述。此处不再赘述。The hardware devices may include: a display device Display1350 , a graphics processor GPU1351 , a cache 1352 and an application processor 1353 . Display device 1350 may be display screen 194 shown in FIG. 12 . The graphics processor GPU 1351 and the application processor 1353 may be integrated in the processor 110 shown in FIG. 12 . The cache 1352 may be the internal memory 121 shown in FIG. 12 . Here the display device 1350 may refer to the description of the display screen 194 above. The graphics processor 1351 may refer to the above description of the GPU. The application processor 1353 may refer to the description of FIG. 12 above. The cache 1352 may refer to the description of the internal memory 121 above. It will not be repeated here.
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。In the following, the workflow of the software and hardware of the electronic device 100 is exemplarily described in conjunction with the capturing and photographing scene.
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。When the touch sensor 180K receives a touch operation, a corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer. The application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and then starts the camera driver by calling the kernel layer. The camera 193 captures still images or video.
在本申请实施例中,颜色附件C为第N+2帧的绘制指令中运动绘制对象的绘制结果。颜色附件C的运动向量的计算方法可以参考上述图9A-图9C中叙述的方法。可选地,颜色附件C的运动向量计算方法还可以参考图17-图22B计算运动对象的运动向量的计算过程。In the embodiment of the present application, the color attachment C is the drawing result of the motion drawing object in the drawing instruction of the N+2th frame. For the calculation method of the motion vector of the color attachment C, reference may be made to the method described in the above-mentioned FIGS. 9A-9C . Optionally, the motion vector calculation method of color attachment C may also refer to FIG. 17-FIG. 22B for the calculation process of calculating the motion vector of the moving object.
在一种可能的实现方式中,电子设备进行图像帧预测具体可以包括:首先,电子设备将第一绘制帧和第二绘制帧分别分成R*S块。然后,电子设备在第二绘制帧中确定与第一绘制帧中的第一候选块匹配的第一匹配块。接着,电子设备计算出候选块到第一匹配块的运动向量E。电子设备根据运动向量E确定出第一匹配块从第二绘制帧到第一预测帧的运动向量F。电子设备根据运动向量F,和第一匹配块在第二绘制帧中的位置在第一预测帧中绘制第一匹配块。按照上述步骤,电子设备可以确定出第一绘制帧中的每个候选块在第二绘制帧中相匹配的匹配块。电子设备可以绘制完第一预测帧。这里,R*S的取值与电子设备(例如手机、平板电脑等移动电子设备)的GPU中的tile大小和显示屏分辨率决定。GPU可以将显示屏划分成若干个小块(tile)进行渲染。tile的大小一般为16*16或32*32。若电子设备的显示屏分辨率为U*V(例如,1580*720),那么R*S等于(U/16)*(V/16)或(U/32)*(V/32)。例如,第W绘 制帧被分为(1580/16)*(720/16)个小块。进一步地,电子设备在第二绘制帧中确定与第一绘制帧中的第一候选块匹配的第一匹配块的过程可以参考第W帧第W+2帧上述图9A-图9C中的描述,此处不再赘述。In a possible implementation manner, the image frame prediction performed by the electronic device may specifically include: first, the electronic device divides the first drawing frame and the second drawing frame into R*S blocks respectively. Then, the electronic device determines, in the second rendering frame, a first matching block that matches the first candidate block in the first rendering frame. Next, the electronic device calculates the motion vector E from the candidate block to the first matching block. The electronic device determines, according to the motion vector E, a motion vector F of the first matching block from the second drawing frame to the first prediction frame. The electronic device draws the first matching block in the first prediction frame according to the motion vector F and the position of the first matching block in the second rendering frame. According to the above steps, the electronic device can determine a matching block to which each candidate block in the first rendering frame matches in the second rendering frame. The electronic device may finish rendering the first predicted frame. Here, the value of R*S is determined by the tile size and display screen resolution in the GPU of electronic devices (such as mobile electronic devices such as mobile phones and tablet computers). The GPU can divide the display into several tiles for rendering. The size of a tile is generally 16*16 or 32*32. If the display resolution of the electronic device is U*V (eg, 1580*720), then R*S is equal to (U/16)*(V/16) or (U/32)*(V/32). For example, the Wth drawing frame is divided into (1580/16)*(720/16) tiles. Further, the process of determining the first matching block matched with the first candidate block in the first drawing frame by the electronic device in the second drawing frame can refer to the description in the Wth frame and the W+2th frame above in Figures 9A-9C. , and will not be repeated here.
如图14所示,电子设备(即平板电脑10)显示了用户界面1400。在T0时刻,用户界面10中显示了第W帧图像帧。第W帧图像帧为绘制帧。图14中时序图1403示出了从T0时刻到Tn时刻电子设备可以显示的图像帧。As shown in FIG. 14 , the electronic device (ie, tablet 10 ) displays a user interface 1400 . At time T0, the Wth image frame is displayed in the user interface 10. The W-th image frame is a drawing frame. The timing diagram 1403 in FIG. 14 shows the image frames that the electronic device can display from time T0 to time Tn.
图15示例性地示出了分16*16块的第W帧中的示意图。本申请实施例以R*S等于16*16为例。图15中的第W帧被划分成了16*16个小块。对象1501和对象1502分别有多个小块组成。电子设备需要计算出对象1501中每个块从第W帧到第W+2帧的运动向量。以对象1501中的候选块1511为例。电子设备需要在第W+2帧确定出与候选块1511匹配的匹配块。图16示例性地示出了分成16*16块的第W+2帧中的示意图。本申请实施例以R*S等于16*16为例。图16中的第W+2帧被划分成了16*16个小块。对象301和对象302分别有多个小块组成。图15和图16中示出的对象1601中的块1611与候选块1511匹配。但是,电子设备需要进行搜索才能找到与候选块1511匹配的块1611。电子设备可以利用菱形搜索算法来找到与候选块1511匹配的块1611,这里菱形搜索的具体过程可以参考图9B-图9C中的描述,此处不再赘述。FIG. 15 exemplarily shows a schematic diagram in the Wth frame divided into 16*16 blocks. In the embodiment of the present application, R*S is equal to 16*16 as an example. The Wth frame in Figure 15 is divided into 16*16 small blocks. Object 1501 and Object 1502 are each composed of a plurality of small blocks. The electronic device needs to calculate the motion vector of each block in the object 1501 from the Wth frame to the W+2th frame. Take candidate block 1511 in object 1501 as an example. The electronic device needs to determine the matching block that matches the candidate block 1511 in the W+2th frame. FIG. 16 exemplarily shows a diagram in the W+2th frame divided into 16*16 blocks. In the embodiment of the present application, R*S is equal to 16*16 as an example. The W+2th frame in Figure 16 is divided into 16*16 small blocks. The object 301 and the object 302 are respectively composed of a plurality of small blocks. The block 1611 in the object 1601 shown in FIGS. 15 and 16 matches the candidate block 1511 . However, the electronic device needs to perform a search to find a block 1611 that matches the candidate block 1511. The electronic device can use the diamond search algorithm to find the block 1611 that matches the candidate block 1511. Here, the specific process of the diamond search can refer to the description in FIG. 9B-FIG. 9C, which will not be repeated here.
为了在提高电子设备显示的应用程序视频界面的流畅度的同时,节约电子设备的功耗,本申请实施例提供了一种图像帧预测的方法,该方法可以包括:首先,电子设备根据第一绘制指令在第一绘制帧中确定第一运动对象,根据第二绘制指令在第二绘制帧中确定第二运动对象。然后,电子设备根据第一运动对象的属性和第二运动对象的属性确定第一运动对象和第二运动对象相匹配。接着,电子设备计算第一运动对象的中心点的第一坐标,和第二运动对象的第二坐标。然后,电子设备根据第一坐标到第二坐标的位移,确定第一运动对象到第二运动对象的运动向量E。最后,电子设备根据运动向量E和第二运动对象的第一像素点,确定出第一预测帧中第三运动对象的第一像素点。这样,电子设备可以在应用程序的每两个绘制帧之间插入一帧预测的图像帧,可以提高电子设备显示该应用程序视频界面的帧率。从而,可以提高电子设备显示该应用程序视频界面的流畅度。并且,电子设备可以利用对象的几何中心点的运动向量代表整个对象的运动向量,不需要单独确定对象的每个块的运动向量。这样,可以减少电子设备的计算量,从而可以节约电子设备的功耗。In order to save the power consumption of the electronic device while improving the fluency of the application program video interface displayed by the electronic device, an embodiment of the present application provides a method for predicting an image frame. The method may include: first, the electronic device according to the first The drawing instruction determines the first moving object in the first drawing frame, and the second moving object is determined in the second drawing frame according to the second drawing instruction. Then, the electronic device determines that the first moving object and the second moving object match according to the attribute of the first moving object and the attribute of the second moving object. Next, the electronic device calculates the first coordinates of the center point of the first moving object and the second coordinates of the second moving object. Then, the electronic device determines a motion vector E from the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate. Finally, the electronic device determines the first pixel of the third moving object in the first predicted frame according to the motion vector E and the first pixel of the second moving object. In this way, the electronic device can insert a predicted image frame between every two drawing frames of the application program, which can improve the frame rate at which the electronic device displays the video interface of the application program. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved. Also, the electronic device can use the motion vector of the geometric center point of the object to represent the motion vector of the entire object, and it is not necessary to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
在本申请实施例,第一运动对象的属性可以称为第一属性,第二运动对象的属性可以称为第二属性。In this embodiment of the present application, the attribute of the first motion object may be referred to as the first attribute, and the attribute of the second motion object may be referred to as the second attribute.
下面结合上述示例性电子设备100的软硬件结构,对本申请实施例提供的一种图像帧预测的方法进行具体描述。本申请实施例以电子设备根据第W绘制帧和第W+2绘制帧预测得到第W+3预测帧为例进行阐述。如图17所示,本申请实施例提供的一种图像帧预测的方法可以包括: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 software and hardware structure of the above-mentioned exemplary electronic device 100 . The embodiments of the present application are described by taking the electronic device predicting the W+3 th predicted frame according to the W th rendering frame and the W+2 th rendering frame as an example. As shown in FIG. 17 , an image frame prediction method provided by an embodiment of the present application may include:
S701-S709:电子设备绘制第W绘制帧。S701-S709: The electronic device draws the Wth drawing frame.
S701、在目标应用程序进行绘制时,电子设备100的CPU获取第W绘制帧的绘制参数。S701. When the target application is drawing, the CPU of the electronic device 100 acquires the drawing parameters of the Wth drawing frame.
目标应用程序为用户界面中具有动画效果的应用程序,例如游戏类应用。本申请实施例下文以目标应用为游戏应用为例进行阐述。当电子设备中安装的游戏应用运行时,该游戏应用可以调用绘制指令进行绘制。电子设备100的CPU可以通过三维图像处理库中的接口获取 到应用程序的第W绘制帧。第W绘制帧的绘制参数用于绘制并渲染第W绘制帧。第W绘制帧的绘制参数可以包括第W绘制帧中每个对象的属性,例如每个对象的顶点缓存ID、顶点数量、纹理ID、着色器ID、变换矩阵、模板缓存等等属性。The target application is an application with animation effects in the user interface, such as a game application. The embodiments of the present application are described below by taking the target application as a game application as an example. When the game application installed in the electronic device runs, the game application can call the drawing instruction to draw. The CPU of the electronic device 100 can obtain the Wth drawing frame of the application program through the interface in the three-dimensional image processing library. The drawing parameters of the Wth drawing frame are used to draw and render the Wth drawing frame. The drawing parameters of the Wth drawing frame may include attributes of each object in the Wth drawing frame, such as the vertex buffer ID, vertex number, texture ID, shader ID, transformation matrix, stencil buffer, etc. of each object.
具体地,CPU可以通过GL HOOK接口获取到应用程序的第W绘制帧的绘制参数。如图18所示,GL HOOK接口可以从游戏应用中获取到应用程序每一帧图像帧的绘制参数。Specifically, the CPU can obtain the drawing parameters of the Wth drawing frame of the application through the GL HOOK interface. As shown in Figure 18, the GL HOOK interface can obtain the drawing parameters of each image frame of the application from the game application.
进一步地,在一些实施例中,CPU可以通过HOOKGlBindTexture接口从OpenGL中获取texture ID并存储到对象结构体中。CPU可以通过HOOKGlBindBuffer从OpenGL中获取vertex Buffer ID并存储到对象结构体中。CPU可以通过HOOKGlBufferData接口从OpenGL中获取用于计算顶点数量的数据,并将计算得到的顶点数量存储到对象结构体中。CPU可以通过HOOKGlBufferSubData接口从OpenGL中获取对象在世界坐标系中的变换矩阵,并存储到全局矩阵变量中。Further, in some embodiments, the CPU can obtain the texture ID from OpenGL through the HOOKG1BindTexture interface and store it in the object structure. The CPU can obtain the vertex Buffer ID from OpenGL through HOOKGlBindBuffer and store it in the object structure. The CPU can obtain the data for calculating the number of vertices from OpenGL through the HOOKGlBufferData interface, and store the calculated number of vertices in the object structure. The CPU can obtain the transformation matrix of the object in the world coordinate system from OpenGL through the HOOKGlBufferSubData interface and store it in the global matrix variable.
进一步地,用于存储对象信息的对象结构体可以按照如下代码定义:Further, the object structure for storing object information can be defined according to the following code:
Figure PCTCN2021106928-appb-000003
Figure PCTCN2021106928-appb-000003
可以理解的是,一个对象结构可以用来存储对象的vertexBufferID、vertexNum、textureID、包围盒bounding box X轴坐标最小值、bounding box X轴坐标最大值、bounding box Y轴坐标最小值、bounding box Y轴坐标最大值、bounding box中心X轴坐标、bounding box中心Y轴坐标。这里,对象的bounding box X轴坐标最小值为对象所有顶点的X轴坐标中的最小值。对象的bounding box X轴坐标最大值为对象所有顶点的X轴坐标中的最大值。对象的bounding box Y轴坐标最小值为对象所有顶点的Y轴坐标中的最小值。对象的bounding box Y轴坐标最大值为对象所有顶点的Y轴坐标中的最大值。CPU根据bounding box X轴坐标最小值、bounding box X轴坐标最大值、bounding box Y轴坐标最小值、bounding box Y轴坐标最大值可以确定出bounding box中心X轴坐标、bounding box中心Y轴坐标。可以理解的是,本申请实施例中的对象结构体不限于上述示出的对象结构体,本申请实施例对此不作限定。It can be understood that an object structure can be used to store the vertexBufferID, vertexNum, textureID of the object, the minimum value of the bounding box X-axis coordinate, the maximum value of the bounding box X-axis coordinate, the minimum value of the bounding box Y-axis coordinate, and the bounding box Y-axis. The maximum coordinate value, the X-axis coordinate of the center of the bounding box, and the Y-axis coordinate of the center of the bounding box. Here, the minimum value of the X-axis coordinate of the bounding box of the object is the minimum value of the X-axis coordinates of all the vertices of the object. The maximum value of the X-axis coordinate of the bounding box of the object is the maximum value of the X-axis coordinates of all the vertices of the object. The minimum value of the Y-axis coordinate of the bounding box of the object is the minimum value of the Y-axis coordinates of all the vertices of the object. The maximum value of the object's bounding box Y-axis coordinate is the maximum value of the Y-axis coordinates of all vertices of the object. The CPU can determine the X-axis coordinate of the center of the bounding box and the Y-axis coordinate of the center of the bounding box according to the minimum value of the X-axis coordinate of the bounding box, the maximum value of the X-axis coordinate of the bounding box, the minimum value of the Y-axis coordinate of the bounding box, and the maximum value of the Y-axis coordinate of the bounding box. It can be understood that the object structure in the embodiment of the present application is not limited to the object structure shown above, which is not limited in the embodiment of the present application.
可以理解的是,在本申请实施例中,对象的属性中可以包含有变换矩阵,也可以没有包含变换矩阵。若对象的属性中包含有变换矩阵,那么该对象为本申请实施例中的运动对象。如图19A所示,以图14中元素1401对应的对象(即球体)为例。图19A中的(a)图和(b)图中的球体包含了变换矩阵,该球体为运动对象。若对象的属性中没有包含变换矩阵,那么该对象为本申请实施例中的静态对象。如图19B所示,以图14中元素1402对应的对象(即长方体)为例。图19B中的(a)图和(b)图中的长方体未包含变换矩阵,该长方体为静态对象。当 CPU确定一个对象为运动对象时,可以将运动对象设置第一标识。当CPU确定一个对象为静态对象时,可以将静态对象设置第二标识。例如,CPU可以在运动对象的stencil buffer的像素位设置第一数值。CPU可以在静态对象的stencil buffer的像素位设置第二数值。在一些可行的例子中,第一数值可以为1,第二数值可以为0。It can be understood that, in this embodiment of the present application, the attribute of the object may include a transformation matrix, or may not include a transformation matrix. If the attribute of the object includes a transformation matrix, then the object is a moving object in this embodiment of the present application. As shown in FIG. 19A , the object (ie, the sphere) corresponding to the element 1401 in FIG. 14 is taken as an example. The sphere in (a) and (b) of FIG. 19A contains the transformation matrix, and the sphere is a moving object. If the attribute of the object does not include a transformation matrix, the object is a static object in this embodiment of the application. As shown in FIG. 19B , the object (ie, the rectangular parallelepiped) corresponding to the element 1402 in FIG. 14 is taken as an example. The cuboid in (a) and (b) of FIG. 19B does not contain a transformation matrix, and the cuboid is a static object. When the CPU determines that an object is a moving object, the moving object may be set to a first identifier. When the CPU determines that an object is a static object, the static object may be set with a second identifier. For example, the CPU may set the first value in the pixel bits of the moving object's stencil buffer. The CPU can set a second value in the pixel bits of the static object's stencil buffer. In some possible examples, the first value may be 1 and the second value may be 0.
在本申请实施例中,电子设备100可以是智能手机,平板设备、智能手表、电脑等等,此处不作限定。In this embodiment of the present application, the electronic device 100 may be a smart phone, a tablet device, a smart watch, a computer, etc., which is not limited here.
S702、电子设备100的CPU向GPU发送用于申请内存空间的指令A。S702 , the CPU of the electronic device 100 sends an instruction A for applying for a memory space to the GPU.
当CPU在获取到图像帧的绘制参数时或之前,电子设备100的CPU可以向GPU发送申请内存空间的指令A。即目标应用程序在开始调用绘制指令进行绘制时,CPU向GPU申请内存空间A,内存空间A用于存储第W绘制帧的模板缓冲,即stencil buffer1。模版缓冲(stencil buffer)或印模缓冲,是在OpenGL三维绘图等计算机图像硬件中常见的除颜色缓冲、像素缓冲、深度缓冲之外另一种数据缓冲。模版缓冲是以像素为单位的,整数数值的缓冲,通常给每个像素分配一个字节长度的数值。When or before the CPU acquires the drawing parameters of the image frame, the CPU of the electronic device 100 may send the instruction A for applying for memory space to the GPU. That is, when the target application starts to call the drawing instruction to draw, the CPU applies to the GPU for memory space A, and the memory space A is used to store the stencil buffer of the Wth drawing frame, that is, stencil buffer1. Stencil buffer (stencil buffer) or stencil buffer is another kind of data buffer other than color buffer, pixel buffer and depth buffer, which is common in computer graphics hardware such as OpenGL three-dimensional drawing. The stencil buffer is a pixel-based, integer-valued buffer, usually assigning a byte-length value to each pixel.
这里,指令A可以是指令glGenTextures(1,&texture)和指令glBindTexture(target,texture)。CPU可以向GPU发送指令glGenTextures(1,&texture)和指令glBindTexture(target,texture),用来向GPU申请内存空间A。可以理解的是,本申请实施例对指令A的具体形式不做限定。Here, the instruction A may be the instruction glGenTextures(1,&texture) and the instruction glBindTexture(target,texture). The CPU can send the instruction glGenTextures(1,&texture) and the instruction glBindTexture(target,texture) to the GPU to apply for memory space A from the GPU. It can be understood that the specific form of the instruction A is not limited in the embodiments of the present application.
S703、电子设备100的GPU分配用于第W绘制帧的模板缓冲的内存空间A。S703. The GPU of the electronic device 100 allocates the memory space A for the template buffer of the Wth drawing frame.
响应于CPU发送的指令A,GPU分配用于第W绘制帧的模板缓冲的内存空间A。举例来说,如图14所示,图14中的示出的T0时刻-Tn时刻这一时间段内,应用程序的绘制帧为第W帧、第W+2帧、第W+4帧、第W+6帧、…、第W+n帧。内存空间A存储第W绘制帧的模板缓冲。当GPU将第W绘制帧送到显示屏进行显示后,内存空间A用于存储第W+4绘制帧的模板缓冲。当GPU将第W+2绘制帧送到显示屏进行显示后,内存空间A用于存储第W+6绘制帧的模板缓冲。当GPU将第W+4绘制帧送到显示屏进行显示后,内存空间A用于存储第W+8绘制帧的模板缓冲。当GPU将第W+6绘制帧送到显示屏进行显示后,内存空间A用于存储第W+10绘制帧的模板缓冲。当应用程序的所有绘制帧完成绘制、渲染并显示到显示屏中后,GPU可以释放内存空间A。In response to the instruction A sent by the CPU, the GPU allocates a memory space A for the stencil buffer of the Wth drawing frame. For example, as shown in FIG. 14 , in the time period from time T0 to time Tn shown in FIG. 14 , the drawing frames of the application are the Wth frame, W+2th frame, W+4th frame, W+6th frame, ..., W+nth frame. Memory space A stores the stencil buffer for the Wth drawing frame. After the GPU sends the Wth drawing frame to the display screen for display, the memory space A is used to store the stencil buffer of the W+4th drawing frame. After the GPU sends the W+2 drawing frame to the display screen for display, the memory space A is used to store the stencil buffer of the W+6 drawing frame. After the GPU sends the W+4 drawing frame to the display screen for display, the memory space A is used to store the stencil buffer of the W+8 drawing frame. After the GPU sends the W+6th drawing frame to the display screen for display, the memory space A is used to store the stencil buffer of the W+10th drawing frame. After all the drawing frames of the application are drawn, rendered and displayed on the display, the GPU can release the memory space A.
可以理解的是,当GPU将第W绘制帧送到显示屏进行显示后,内存空间A用于存储第W+4绘制帧的模板缓冲,具体包括:当GPU将第W绘制帧送到显示屏进行显示后,GPU将内存空间A中第W绘制帧的模板缓冲清空,存储第W+4绘制帧的模板缓冲。It can be understood that after the GPU sends the Wth drawing frame to the display screen for display, the memory space A is used to store the stencil buffer of the W+4th drawing frame, which specifically includes: when the GPU sends the Wth drawing frame to the display screen. After displaying, the GPU clears the stencil buffer of the Wth drawing frame in the memory space A, and stores the stencil buffer of the W+4th drawing frame.
进一步地,内存空间A中可以包括第一模板缓存和第二模板缓存。第一模板缓存用于GPU绘制第W绘制帧的对象对应的模板图像。也即是说,GPU可以在第一模板缓存中绘制对象。第二模板缓存用于备份第一模板缓存中绘制的对象。对象对应的模板图像可以是指GPU根据对象的stencil buffer绘制出的图像,该图像没有使用对象着色ID的对应的着色器进行着色。若对象的stencil buffer中的像素位为第一数值(例如1),即对象为运动对象时,GPU可以将运动对象的模板图像绘制为具有第一颜色的模板图像。若对象的stencil buffer中的像素位为第二数值(例如0),GPU可以将静态图像的模板图像绘制为具有第二颜色的模板图像。第一颜色和第二颜色不同。可选地,第一颜色为黑色,第二颜色为白色。Further, the memory space A may include a first template cache and a second template cache. The first template buffer is used for the GPU to draw the template image corresponding to the object of the Wth drawing frame. That is, the GPU can draw objects in the first stencil buffer. The second stencil buffer is used to back up the objects drawn in the first stencil buffer. The stencil image corresponding to the object may refer to an image drawn by the GPU according to the stencil buffer of the object, and the image is not colored by the shader corresponding to the object coloring ID. If the pixel bit in the stencil buffer of the object is the first value (for example, 1), that is, when the object is a moving object, the GPU can draw the template image of the moving object as a template image with the first color. If the pixel bit in the object's stencil buffer is a second value (eg, 0), the GPU can draw the stencil image of the still image as a stencil image with the second color. The first color and the second color are different. Optionally, the first color is black and the second color is white.
S704、电子设备100的CPU根据绘制参数确定出第W绘制帧中包含的运动对象、以及 运动对象的属性。S704, the CPU of the electronic device 100 determines, according to the drawing parameters, the moving object contained in the Wth drawing frame and the attributes of the moving object.
电子设备100的CPU根据可以第W帧绘制帧的绘制参数确定出第W绘制帧中包含的多个对象,以及确定出多个对象的属性。例如,第W绘制帧的绘制参数中包含两个对象(对象A和对象B)的参数,那么CPU可以确定出第W绘制帧中的对象A和对象B。The CPU of the electronic device 100 determines, according to the drawing parameters that can draw the Wth frame, the multiple objects included in the Wth drawing frame, and determines the attributes of the multiple objects. For example, if the drawing parameters of the Wth drawing frame include parameters of two objects (object A and object B), the CPU can determine the object A and the object B in the Wth drawing frame.
S705、电子设备100的CPU根据第W绘制帧中包含的运动对象以及运动对象的属性建立第一索引表。S705 , the CPU of the electronic device 100 establishes a first index table according to the motion objects included in the Wth drawing frame and the attributes of the motion objects.
CPU可以根据第W绘制帧包含的多个对象以及多个对象的属性建立第一索引表。第一索引表中只存储第W绘制帧中运动对象的索引信息(例如,运动对象的ID以及运动对象对应的属性)。若第W绘制帧中只有两个运动对象,运动对象1和运动对象2。那么第W绘制帧的第一索引表可以如表1所示。运动对象1对应表1中的对象ID01,即,表明运动对象1的ID为01。对象ID01可以包括顶点缓存ID01、顶点数量、纹理ID01、着色器ID01、变换矩阵M01、模板缓存等等属性。对象ID01为运动对象,因此,对象ID01的属性中包括变换矩阵M01。运动对象2对应表1中的对象ID11,即,表明对象2的ID为11。对象ID11可以包括顶点缓存ID11、顶点数量、纹理ID11、着色器ID11、变换矩阵M11、模板缓存等等属性。对象ID11为运动对象,因此,对象ID11的属性中包括变换矩阵M11。The CPU may establish the first index table according to the multiple objects included in the Wth drawing frame and the attributes of the multiple objects. The first index table only stores the index information of the moving object in the Wth drawing frame (for example, the ID of the moving object and the attribute corresponding to the moving object). If there are only two moving objects in the Wth drawing frame, moving object 1 and moving object 2. Then, the first index table of the Wth drawing frame may be as shown in Table 1. The moving object 1 corresponds to the object ID 01 in Table 1, that is, it indicates that the ID of the moving object 1 is 01. Object ID01 may include attributes such as vertex buffer ID01, vertex count, texture ID01, shader ID01, transformation matrix M01, stencil buffer, and so on. The object ID01 is a moving object, so the attributes of the object ID01 include the transformation matrix M01. The moving object 2 corresponds to the object ID 11 in Table 1, that is, it indicates that the ID of the object 2 is 11. Object ID11 may include attributes such as vertex buffer ID11, vertex count, texture ID11, shader ID11, transformation matrix M11, stencil buffer, and so on. The object ID11 is a moving object, so the attributes of the object ID11 include the transformation matrix M11.
表1Table 1
Figure PCTCN2021106928-appb-000004
Figure PCTCN2021106928-appb-000004
S706、电子设备100的CPU向GPU发送用于内存映射的指令B。S706, the CPU of the electronic device 100 sends the instruction B for memory mapping to the GPU.
电子设备100的CPU可以向GPU发送用于映射第一索引表的指令B。这里,指令B可以是glMapBufferRange()。CPU可以通过向GPU发送指令glMapBufferRange(),从而来让GPU映射第一索引表。本申请实施例对指令B的具体形式不做限定。The CPU of the electronic device 100 may send the instruction B for mapping the first index table to the GPU. Here, instruction B may be glMapBufferRange(). The CPU can let the GPU map the first index table by sending the instruction glMapBufferRange() to the GPU. The specific form of the instruction B is not limited in this embodiment of the present application.
S707、响应于指令B,电子设备100的GPU映射CPU中的第一索引表。S707. In response to the instruction B, the GPU of the electronic device 100 maps the first index table in the CPU.
响应于指令B,电子设备100的GPU可以映射CPU中的第一索引表。这里,CPU可以在硬件上存储第一索引表,GPU映射CPU中的第一索引表,是指GPU可以在该硬件上访问和读取该第一索引表。In response to the instruction B, the GPU of the electronic device 100 may map the first index table in the CPU. Here, the CPU can store the first index table on the hardware, and the GPU maps the first index table in the CPU, which means that the GPU can access and read the first index table on the hardware.
S708、电子设备100的CPU向GPU发送用于绘制第W绘制帧的第一绘制指令。S708: The CPU of the electronic device 100 sends a first drawing instruction for drawing the Wth drawing frame to the GPU.
CPU可以向GPU发送用于绘制第W绘制帧的绘制指令。第W绘制帧的绘制指令可以是glDrawArrays()。即,CPU可以向GPU发送指令glDrawArrays(),响应于该指令,GPU开始绘制第W绘制帧。可以理解的是,第W绘制帧的绘制指令中可以包括多条用于绘制第W绘制帧中对象的指令。GPU可以根据多条用于绘制对象的指令来绘制第W绘制帧中多个对象。The CPU may send a drawing instruction for drawing the Wth drawing frame to the GPU. The drawing instruction for the Wth drawing frame may be glDrawArrays(). That is, the CPU may send the instruction glDrawArrays( ) to the GPU, and in response to the instruction, the GPU starts to draw the Wth drawing frame. It can be understood that, the drawing instruction of the Wth drawing frame may include a plurality of instructions for drawing objects in the Wth drawing frame. The GPU may draw multiple objects in the Wth drawing frame according to multiple instructions for drawing objects.
S709、电子设备100的GPU绘制第W绘制帧中的对象和在内存空间A中绘制运动对象 的模板图像。S709, the GPU of the electronic device 100 draws the object in the wth drawing frame and draws the template image of the moving object in the memory space A.
GPU可以绘制第W绘制帧中的所有对象并渲染送显。GPU绘制一个完整绘制帧的过程可以参考现有技术中GPU绘制的过程,此处不再赘述。The GPU can draw all objects in the Wth drawing frame and render them for display. For the process of drawing a complete drawing frame by the GPU, reference may be made to the process of GPU drawing in the prior art, and details are not described herein again.
GPU还可以在内存空间A中绘制运动对象的模板图像,该模板图像用于后续步骤中的运动向量计算。关于运动向量计算的具体过程在S719-S721中描述,此处不再赘述。The GPU can also draw a template image of the moving object in the memory space A, and the template image is used for the motion vector calculation in the subsequent steps. The specific process of the motion vector calculation is described in S719-S721, which will not be repeated here.
GPU绘制运动对象模板图像的过程可以参考图20A-图20C示出的模板图像绘制过程。如图20A中的(b)图所示,GPU可以在第一模板缓存中绘制第W绘制帧的对象1的模板图像。对象1为运动对象,GPU绘制的对象1的模板图像的像素位为1(可以用黑色示意)。如图20A中的(a)图所示,第二模板缓存初始状态为空。即,在初始状态时,第二模板缓存中未存储任何内容。GPU每在第一模板缓存中绘制完一个对象,就将在第一模板缓存中绘制的对象保存到第二模板缓存中。如图20B中的(c)图所示,GPU将在第一模板缓存中绘制的对象保存到第二模板缓存中。如图20B中的(d)图所示,GPU可以在第一模板缓存中绘制第W绘制帧的对象2的模板图像。对象2为静态对象,所以GPU绘制的对象2的模板图像的像素位为0(可以用白色示意)。如图20C中的(e)图所示,GPU可以再次将在第一模板缓存中绘制的对象2的模板图像保存到第二模板缓存中。这里,第W绘制帧可以是上图15中示出的第W绘制帧。对象1可以为图15中的元素1501对应的球体对象。对象2可以为元素1502对应的长方体对象。For the process of drawing the template image of the moving object by the GPU, reference may be made to the process of drawing the template image shown in FIGS. 20A-20C . As shown in (b) of FIG. 20A , the GPU may draw the template image of the object 1 of the Wth drawing frame in the first template buffer. Object 1 is a moving object, and the pixel bit of the template image of Object 1 drawn by the GPU is 1 (which can be indicated by black). As shown in (a) of FIG. 20A , the initial state of the second template cache is empty. That is, in the initial state, nothing is stored in the second template cache. After drawing an object in the first stencil buffer, the GPU saves the object drawn in the first stencil buffer into the second stencil buffer. As shown in (c) of FIG. 20B , the GPU saves the object drawn in the first stencil buffer to the second stencil buffer. As shown in (d) of FIG. 20B , the GPU may draw the template image of the object 2 of the Wth drawing frame in the first template buffer. Object 2 is a static object, so the pixel bit of the template image of Object 2 drawn by the GPU is 0 (which can be indicated by white). As shown in (e) of FIG. 20C , the GPU may again save the stencil image of the object 2 drawn in the first stencil buffer to the second stencil buffer. Here, the W-th drawing frame may be the W-th drawing frame shown in FIG. 15 above. Object 1 may be a sphere object corresponding to element 1501 in FIG. 15 . Object 2 may be a cuboid object corresponding to element 1502 .
可选地,GPU可以只在第一模板缓存中绘制第W绘制帧的运动对象的模板图像。Optionally, the GPU may only draw the template image of the moving object of the Wth drawing frame in the first template buffer.
S710-S718:电子设备绘制第W+2绘制帧。S710-S718: The electronic device draws the W+2th drawing frame.
S710、电子设备100的CPU获取第W+2绘制帧的绘制参数。S710. The CPU of the electronic device 100 acquires the drawing parameters of the W+2 th drawing frame.
CPU可以通过GL HOOK接口获取到应用程序的第W+2绘制帧的绘制参数。第W+2绘制帧的绘制参数用于绘制并渲染第W+2绘制帧。第W+2绘制帧的绘制参数可以包括第W+2绘制帧中每个对象的对象属性,例如每个对象的顶点缓存ID、顶点数量、纹理ID、着色器ID、变换矩阵、模板缓存等等属性。这里,具体可以参考步骤S701中的描述,此处不再赘述。The CPU can obtain the drawing parameters of the W+2 drawing frame of the application through the GL HOOK interface. The drawing parameters of the W+2 th drawing frame are used to draw and render the W+2 th drawing frame. The drawing parameters of the W+2th drawing frame may include object attributes of each object in the W+2th drawing frame, such as the vertex buffer ID, vertex number, texture ID, shader ID, transformation matrix, stencil buffer, etc. of each object and other properties. Here, for details, reference may be made to the description in step S701, which is not repeated here.
S711、电子设备100的CPU向GPU发送用于申请内存空间的指令C。S711 , the CPU of the electronic device 100 sends an instruction C for applying for a memory space to the GPU.
电子设备100的CPU可以向GPU发送申请内存空间的指令C。指令C可以用于申请内存空间B。内存空间B用于存储第W+2绘制帧的模板缓冲,即stencil buffer2。这里,指令C的描述可以参考指令A的描述,此处不再赘述。步骤S711可以参考步骤S702的描述,此处不再赘述。The CPU of the electronic device 100 may send the instruction C to apply for memory space to the GPU. Instruction C can be used to request memory space B. Memory space B is used to store the stencil buffer of the W+2 drawing frame, that is, stencil buffer2. Here, for the description of the instruction C, reference may be made to the description of the instruction A, which will not be repeated here. For step S711, reference may be made to the description of step S702, which will not be repeated here.
S712、电子设备100的GPU分配用于第W+2绘制帧的模板缓冲的内存空间B。S712. The GPU of the electronic device 100 allocates a memory space B for the stencil buffer of the W+2 th drawing frame.
响应于CPU发送的指令C,GPU分配用于第W绘制帧的模板缓冲的内存空间B。举例来说,如图14所示,图14中的示出的T0时刻-Tn时刻这一时间段内,应用程序的绘制帧为第W帧、第W+2帧、第N+4帧、第N+6帧、…、第N+n帧。内存空间B存储第W+2绘制帧的模板缓冲。当GPU将第W+2绘制帧送到显示屏进行显示后,内存空间B用于存储第N+6绘制帧的模板缓冲。In response to the instruction C sent by the CPU, the GPU allocates a memory space B for the stencil buffer of the Wth drawing frame. For example, as shown in FIG. 14 , in the time period from time T0 to time Tn shown in FIG. 14 , the drawing frames of the application are the Wth frame, W+2th frame, N+4th frame, Frame N+6, ..., frame N+n. Memory space B stores the stencil buffer of the W+2 drawing frame. After the GPU sends the W+2 drawing frame to the display screen for display, the memory space B is used to store the stencil buffer of the N+6 drawing frame.
当GPU将第W+2绘制帧送到显示屏进行显示后,内存空间B用于存储第N+6绘制帧的模板缓冲,具体包括:当GPU将第W绘制帧送到显示屏进行显示后,GPU将内存空间B中第W+2绘制帧的模板缓冲清空,存储第N+6绘制帧的模板缓冲。After the GPU sends the W+2 drawing frame to the display screen for display, the memory space B is used to store the stencil buffer of the N+6 drawing frame, which specifically includes: after the GPU sends the Wth drawing frame to the display screen for display , the GPU clears the stencil buffer of the W+2th drawing frame in the memory space B, and stores the stencil buffer of the N+6th drawing frame.
进一步地,内存空间B中可以包括第三模板缓存和第四模板缓存。第三模板缓存用于GPU绘制第W+2绘制帧的对象对应的模板图像。也即是说,GPU可以在第三模板缓存中绘制对 象。第四模板缓存用于备份第一模板缓存中绘制的对象。Further, the memory space B may include a third template cache and a fourth template cache. The third stencil buffer is used for the GPU to draw the stencil image corresponding to the object of the W+2 th drawing frame. That is, the GPU can draw objects in the third stencil buffer. The fourth stencil buffer is used to back up the objects drawn in the first stencil buffer.
这里,步骤S712参考步骤S703中的描述,此处不再赘述。Here, step S712 refers to the description in step S703, and details are not repeated here.
可选地,GPU可以只在第三模板缓存中绘制第W+2绘制帧的运动对象的模板图像。Optionally, the GPU may only draw the template image of the moving object of the W+2 th drawing frame in the third template buffer.
S713、电子设备100的CPU根据绘制参数确定出第W+2绘制帧中包含的运动对象、以及运动对象的属性。S713 , the CPU of the electronic device 100 determines, according to the drawing parameters, the moving objects included in the W+2 th drawing frame and the attributes of the moving objects.
电子设备的CPU可以根据第W+2绘制帧的绘制参数确定出第W+2绘制帧中包含的多个对象、以及确定出多个对象的属性。其中,CPU可以确定出第W+2绘制帧中的运动对象以及运动对象的属性。步骤713可以参考步骤S704中的描述,此处不再赘述。The CPU of the electronic device may determine, according to the drawing parameters of the W+2 th drawing frame, multiple objects included in the W+2 th drawing frame, and determine the attributes of the multiple objects. The CPU can determine the moving object in the W+2th drawing frame and the attributes of the moving object. In step 713, reference may be made to the description in step S704, which is not repeated here.
S714、电子设备100的CPU根据第W+2绘制帧中包含的运动对象以及运动对象的属性建立第二索引表。S714 , the CPU of the electronic device 100 establishes a second index table according to the moving objects included in the W+2 th drawing frame and the attributes of the moving objects.
CPU可以根据第W+2绘制帧包含的多个对象以及多个对象的属性建立第二索引表。例如,若第W+2绘制帧只包括两个运动对象,例如运动对象1和运动对象2。那么第W绘制帧的第二索引表可以如表2所示。运动对象1对应表2中的对象ID02,即,表明运动对象1的ID为02。对象ID02可以包括顶点缓存ID02、顶点数量、纹理ID02、着色器ID02、变换矩阵M02、模板缓存等等属性。对象ID02为运动对象,因此,对象ID02的属性中包括变换矩阵M02。运动对象2对应表1中的对象ID12,即,表明对象2的ID为12。对象ID12可以包括顶点缓存ID12、顶点数量、纹理ID12、着色器ID12、变换矩阵M12、模板缓存等等属性。对象ID12为运动对象,因此,对象ID12的属性中包括变换矩阵M12。The CPU may establish the second index table according to the multiple objects included in the W+2 th drawing frame and the attributes of the multiple objects. For example, if the W+2-th drawing frame only includes two moving objects, such as moving object 1 and moving object 2 . Then, the second index table of the Wth drawing frame may be as shown in Table 2. The moving object 1 corresponds to the object ID 02 in Table 2, that is, it indicates that the ID of the moving object 1 is 02. Object ID02 may include attributes such as vertex buffer ID02, vertex count, texture ID02, shader ID02, transformation matrix M02, stencil buffer, and so on. The object ID02 is a moving object, so the attributes of the object ID02 include the transformation matrix M02. The moving object 2 corresponds to the object ID 12 in Table 1, that is, it indicates that the ID of the object 2 is 12. Object ID12 may include attributes such as vertex buffer ID12, vertex count, texture ID12, shader ID12, transformation matrix M12, stencil buffer, and so on. The object ID12 is a moving object, so the attributes of the object ID12 include the transformation matrix M12.
表2Table 2
Figure PCTCN2021106928-appb-000005
Figure PCTCN2021106928-appb-000005
S715、电子设备100的CPU向GPU发送用于内存映射的指令D。S715 , the CPU of the electronic device 100 sends the instruction D for memory mapping to the GPU.
CPU还可以向GPU发送指令D。指令D可以参考上文中指令B的描述,此处不再赘述。指令D用于指示GPU映射CPU中的第二索引表。这里,步骤S715可以步骤S706,此处不再赘述。The CPU can also send instruction D to the GPU. For the instruction D, reference may be made to the description of the instruction B above, which will not be repeated here. Instruction D is used to instruct the GPU to map the second index table in the CPU. Here, step S715 may be step S706, which will not be repeated here.
S716、响应于指令D,电子设备100的GPU映射CPU中的第二索引表。S716. In response to the instruction D, the GPU of the electronic device 100 maps the second index table in the CPU.
响应于指令D,GPU可以映射CPU中的第二索引表。即GPU可以访问和读取CPU存储在某个硬件中的第二索引表。第二索引表可以是上述表2中示出的对象索引表。步骤S716可以参考步骤S707,此处不再赘述。In response to instruction D, the GPU may map the second index table in the CPU. That is, the GPU can access and read the second index table stored by the CPU in some hardware. The second index table may be the object index table shown in Table 2 above. Step S716 may refer to step S707, which will not be repeated here.
S717、电子设备100的CPU向GPU发送用于绘制第W+2绘制帧的绘制指令。S717: The CPU of the electronic device 100 sends a drawing instruction for drawing the W+2 th drawing frame to the GPU.
CPU可以向GPU发送用于绘制第W+2绘制帧的绘制指令。第W+2绘制帧的绘制指令可以参考第W绘制帧的绘制指令的描述。响应于该第W+2绘制帧的绘制指令,GPU开始绘 制第W+2绘制帧。可以理解的是,第W+2绘制帧的绘制指令可以包括多条用于绘制第W+2绘制帧中对象的指令。即当第W+2绘制帧中有多个对象时,GPU可以根据多条用于绘制对象的指令绘制第W+2绘制帧中的多个对象。The CPU may send a drawing instruction to the GPU for drawing the W+2 th drawing frame. For the drawing instruction of the W+2 th drawing frame, reference may be made to the description of the drawing instruction of the W th drawing frame. In response to the drawing instruction of the W+2 th drawing frame, the GPU starts to draw the W+2 th drawing frame. It can be understood that the drawing instruction of the W+2 th drawing frame may include a plurality of instructions for drawing objects in the W+2 th drawing frame. That is, when there are multiple objects in the W+2 th drawing frame, the GPU may draw the multiple objects in the W+2 th drawing frame according to multiple instructions for drawing objects.
S718、电子设备100的GPU绘制第W+2绘制帧中的对象和在内存空间B中绘制运动对象的模板图像。S718 , the GPU of the electronic device 100 draws the object in the W+2 th drawing frame and the template image of the moving object in the memory space B.
GPU可以绘制第W+2绘制帧中的所有对象并渲染送显。GPU绘制一个完整绘制帧的过程可以参考现有技术中GPU绘制的过程,此处不再赘述。The GPU can draw all objects in the W+2 drawing frame and render them for display. For the process of drawing a complete drawing frame by the GPU, reference may be made to the process of GPU drawing in the prior art, and details are not described herein again.
GPU还可以在内存空间B中绘制运动对象的模板图像,该模板图像用于后续步骤中的运动向量计算。可以理解的是,步骤S718中的运动对象指第W+2绘制帧中的运动对象。关于运动向量计算的具体过程在S719-S721中描述,此处不再赘述。The GPU can also draw a template image of the moving object in the memory space B, and the template image is used for the motion vector calculation in the subsequent steps. It can be understood that the moving object in step S718 refers to the moving object in the W+2 drawing frame. The specific process of the motion vector calculation is described in S719-S721, which will not be repeated here.
GPU绘制运动对象模板图像的过程可以参考图21A-图21C示出的模板图像绘制过程。如图21A中的(b)图所示,GPU可以在第三模板缓存中绘制第W+2绘制帧的对象1的模板图像。对象1为运动对象,所以GPU绘制的对象1的模板图像为的像素位为1(可以用黑色示意)。如图21A中的(a)图所示,第四模板缓存初始状态为空。即,在初始状态时,第二模板缓存中未存储任何内容。GPU每在第三模板缓存中绘制完一个对象,就将在第三模板缓存中绘制的对象保存到第四模板缓存中。如图21B中的(c)图所示,GPU将在第三模板缓存中绘制的对象保存到第四模板缓存中。如图21B中的(d)图所示,GPU可以在第一模板缓存中绘制第W+2绘制帧的对象2的模板图像。对象2为静态对象,所以GPU绘制的对象2的模板图像的像素位为0(可以用白色示意)。如图21C中的(e)图所示,GPU可以再次将在第三模板缓存中绘制的对象2的模板图像保存到第四模板缓存中。这里,第W+2绘制帧可以是上图16中示出的第N+3绘制帧。对象1可以为图16中的元素1601对应的球体对象。对象2可以为元素1602对应的长方体对象。For the process of drawing a template image of a moving object by the GPU, reference may be made to the process of drawing a template image shown in FIGS. 21A-21C . As shown in (b) of FIG. 21A , the GPU may draw the template image of the object 1 of the W+2-th drawing frame in the third template buffer. Object 1 is a moving object, so the pixel bit of the template image of Object 1 drawn by the GPU is 1 (it can be indicated by black). As shown in (a) of FIG. 21A , the initial state of the fourth template cache is empty. That is, in the initial state, nothing is stored in the second template cache. After drawing an object in the third stencil buffer, the GPU saves the object drawn in the third stencil buffer into the fourth stencil buffer. As shown in (c) of FIG. 21B , the GPU saves the object drawn in the third stencil buffer into the fourth stencil buffer. As shown in (d) of FIG. 21B , the GPU may draw the template image of the object 2 of the W+2 th drawing frame in the first template buffer. Object 2 is a static object, so the pixel bit of the template image of Object 2 drawn by the GPU is 0 (which can be indicated by white). As shown in (e) of FIG. 21C, the GPU may again save the stencil image of the object 2 drawn in the third stencil buffer to the fourth stencil buffer. Here, the W+2 th drawing frame may be the N+3 th drawing frame shown in FIG. 16 above. Object 1 may be a sphere object corresponding to element 1601 in FIG. 16 . Object 2 may be the cuboid object corresponding to element 1602 .
S719-S724:预测第W+3预测帧。S719-S724: Predict the W+3 th prediction frame.
S719、电子设备100中的CPU向GPU发送用于指示GPU计算运动向量的指令。S719. The CPU in the electronic device 100 sends an instruction for instructing the GPU to calculate the motion vector to the GPU.
电子设备100中的CPU可以向GPU发送用于指示GPU计算运动向量的指令。该指令用于指示GPU中的shader计算运动向量。该指令可以是dispatch指令。本申请实施例对计算运动向量的指令的具体形式不做限定。The CPU in the electronic device 100 may send an instruction to the GPU for instructing the GPU to calculate the motion vector. This instruction is used to instruct the shader in the GPU to calculate the motion vector. The directive can be a dispatch directive. The embodiment of the present application does not limit the specific form of the instruction for calculating the motion vector.
可以理解的是,在电子设备显示应用程序的视频界面的时间周期内,CPU可以循环向GPU发送用于计算运动向量的指令。GPU绘制完一帧绘制帧后,CPU可以向GPU发送一次用于指示GPU计算运动向量的指令。即在步骤S709后,CPU也可以执行步骤S719。It can be understood that, during the time period when the electronic device displays the video interface of the application, the CPU may cyclically send an instruction for calculating the motion vector to the GPU. After the GPU draws a frame, the CPU can send an instruction to the GPU for instructing the GPU to calculate the motion vector once. That is, after step S709, the CPU can also execute step S719.
S720-S722:计算运动向量。S720-S722: Calculate the motion vector.
S720、电子设备100中的GPU在第一索引表中确定出第一运动对象,第一运动对象与第二索引表中的第二运动对象相匹配。S720. The GPU in the electronic device 100 determines the first moving object in the first index table, and the first moving object matches the second moving object in the second index table.
GPU可以现在第二索引表中取出第二运动对象,然后再去第一索引表中找出与第二运动对象匹配的第一运动对象。The GPU can now retrieve the second moving object from the second index table, and then go to the first index table to find the first moving object that matches the second moving object.
第W+2绘制帧对应的第二索引表中若只有一个运动对象,那么该运动对象即为第二运动对象。GPU可以根据第W+2绘制帧中每个对象携带的标识确定出运动对象和静态对象。即携带第一标识的对象为运动对象,携带第二标识的对象为静态对象。第二索引表中只保存地N+2绘制帧中的运动对象。第二运动对象可以是第二索引表中的任意一个运动对象。第W+2 绘制帧可以包含多个对象,若多个对象中只有一个运动对象,那么该运动对象即为第二运动对象。在一种可能的实现方式中,GPU可以在第W+2绘制帧中的第二索引表中取出第二运动对象。然后GPU在第W绘制帧的第一索引表中找到与第二运动对象匹配的第一运动对象。If there is only one moving object in the second index table corresponding to the W+2 th drawing frame, the moving object is the second moving object. The GPU may determine the moving object and the static object according to the identifier carried by each object in the W+2th drawing frame. That is, the object carrying the first identification is a moving object, and the object carrying the second identification is a static object. Only the moving objects in the N+2 drawing frames are stored in the second index table. The second moving object may be any moving object in the second index table. The W+2 th drawing frame may contain multiple objects. If there is only one moving object among the multiple objects, the moving object is the second moving object. In a possible implementation manner, the GPU may retrieve the second moving object from the second index table in the W+2 th drawing frame. Then the GPU finds the first moving object matching the second moving object in the first index table of the Wth drawing frame.
这里,第一运动对象和第二运动对象相匹配是指,第一运动对象的M个属性与第二运动对象的M个属性相同。这里,M为正整数,例如M的值可以是1,也可以是2,3或其他整数。M的取值不作限定。例如,第一运动对象的顶点数量、纹理ID、着色器ID、变换矩阵、模板缓存等等属性,与第二运动对象的顶点数量、纹理ID、着色器ID、变换矩阵、模板缓存等等属性相同。可以理解的是,在目标应用程序的图像帧序列中,第一运动对象和第二运动对象可以是相同的对象。但是,第一运动对象的像素点在第W绘制帧中的坐标,与第二运动对象的像素点在第W+2绘制帧中的坐标不相同。在一种可行的实现方式中,GPU可以按照如下代码确定第一运动对象和第二运动对象相匹配。Here, the matching of the first moving object and the second moving object means that the M attributes of the first moving object are the same as the M attributes of the second moving object. Here, M is a positive integer, for example, the value of M can be 1, 2, 3 or other integers. The value of M is not limited. For example, the number of vertices, texture ID, shader ID, transformation matrix, stencil buffer, etc. of the first moving object, and the number of vertices, texture ID, shader ID, transformation matrix, stencil buffer, etc. attributes of the second moving object same. It can be understood that, in the image frame sequence of the target application, the first moving object and the second moving object may be the same object. However, the coordinates of the pixels of the first moving object in the Wth drawing frame are different from the coordinates of the pixels of the second moving object in the W+2th drawing frame. In a feasible implementation manner, the GPU may determine that the first moving object matches the second moving object according to the following code.
//判断两个对象的索引是否相同,表征是否是同一个对象/ / Determine whether the index of the two objects is the same, whether the representation is the same object
Figure PCTCN2021106928-appb-000006
Figure PCTCN2021106928-appb-000006
S721、电子设备100中的GPU根据第一运动对象的模板图像计算第一运动对象的几何中心点在第W绘制帧中的第一坐标,以及根据第二运动对象的模板图像计算第二运动对象的几何中心点在第W+2绘制帧中的第二坐标。S721, the GPU in the electronic device 100 calculates the first coordinate of the geometric center point of the first moving object in the Wth drawing frame according to the template image of the first moving object, and calculates the second moving object according to the template image of the second moving object The second coordinate of the geometric center point in the W+2th drawing frame.
电子设备100的GPU可以利用shader根据第一运动对象的模板图像获取到第一运动对象的所有像素点的坐标。首先,GPU可以根据第一运动对象所有像素点坐标中X轴的最小值X1min、X轴的最大值X1max、Y轴的最小值Y1min、Y轴的最大值Y1max确定出第一运动对象的包围盒。第一运动对象的包围盒的四个顶点的坐标可以分别为(X1min,Y1min)、(X1max,Y1min)、(X1min,Y1max)、(X1max,Y1max)。GPU可以根据第一运动对象的包围盒确定出第一运动对象的第一坐标。第一坐标即为((X1min+X1max)/2,(Y1min+Y1max)/2)。The GPU of the electronic device 100 can obtain the coordinates of all the pixels of the first moving object by using the shader according to the template image of the first moving object. First, the GPU can determine the bounding box of the first moving object according to the minimum value X1min of the X axis, the maximum value X1max of the X axis, the minimum value Y1min of the Y axis, and the maximum value Y1max of the Y axis in the coordinates of all the pixel points of the first moving object. . The coordinates of the four vertices of the bounding box of the first moving object may be respectively (X1min, Y1min), (X1max, Y1min), (X1min, Y1max), and (X1max, Y1max). The GPU may determine the first coordinate of the first moving object according to the bounding box of the first moving object. The first coordinate is ((X1min+X1max)/2, (Y1min+Y1max)/2).
电子设备100的GPU可以利用shader根据第二运动对象的模板图像获取到第一运动对象的所有像素点的坐标。首先,GPU可以根据第二运动对象所有像素点坐标中X轴的最小值X2min、X轴的最大值X2max、Y轴的最小值Y2min、Y轴的最大值Y2max确定出第二运动对象的包围盒。第二运动对象的包围盒的四个顶点的坐标可以分别为(X2min,Y2min)、(X2max,Y2min)、(X2min,Y2max)、(X2max,Y2max)。GPU可以根据第二运动对象的包围盒确定出第二运动对象的第二坐标。第二坐标即为((X2min+X2max)/2,(Y2min+Y2max)/2)。The GPU of the electronic device 100 can use the shader to obtain the coordinates of all the pixels of the first moving object according to the template image of the second moving object. First, the GPU can determine the bounding box of the second moving object according to the minimum value X2min of the X axis, the maximum value X2max of the X axis, the minimum value Y2min of the Y axis, and the maximum value Y2max of the Y axis in the coordinates of all the pixel points of the second moving object. . The coordinates of the four vertices of the bounding box of the second moving object may be respectively (X2min, Y2min), (X2max, Y2min), (X2min, Y2max), and (X2max, Y2max). The GPU may determine the second coordinates of the second moving object according to the bounding box of the second moving object. The second coordinate is ((X2min+X2max)/2, (Y2min+Y2max)/2).
S722、电子设备100中的GPU根据第一坐标到第二坐标的位移确定出第一运动对象从第W绘制帧到第W+2绘制帧的运动向量E,根据运动向量E确定出第二运动对象从第W+2绘制帧到第N+3预测帧的运动向量F。S722, the GPU in the electronic device 100 determines the motion vector E of the first moving object from the Wth drawing frame to the W+2th drawing frame according to the displacement from the first coordinate to the second coordinate, and determines the second motion according to the motion vector E The motion vector F of the object from the W+2-th drawn frame to the N+3-th predicted frame.
GPU可以根据第一坐标到第二坐标的位移确定出第一运动对象移动到第二运动对象的运动向量E。然后,GPU再根据运动向量E确定出第二运动对象从第W+2绘制帧到第N+3预测帧的运动向量F。运动向量F等于运动向量E的K倍。K为大于0且小于1。可选地,K=0.5。即,在应用程序的图像帧序列中,同一个运动对象的运动是匀速地。也即是说,第一运动对象从第一帧运动到第二帧的速度,和从第二帧运动到第三帧的运动速度相同。The GPU may determine the motion vector E for moving the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate. Then, the GPU determines the motion vector F of the second moving object from the W+2 th drawing frame to the N+3 th prediction frame according to the motion vector E. The motion vector F is equal to K times the motion vector E. K is greater than 0 and less than 1. Optionally, K=0.5. That is, in the image frame sequence of the application, the movement of the same moving object is uniform. That is to say, the speed of the first moving object moving from the first frame to the second frame is the same as the speed of moving from the second frame to the third frame.
如图22A所示,第一运动对象可以是图22A中(a)图示出的运动对象2201。第二运动对象可以是图22A中(b)图示出的运动对象2202。如图22B中的(c)图所示,第一运动对象移动到第二运动对象的运动向量E即为图22B中的(c)图中运动对象2201移动到运动对象2202的运动向量。如图22B中的(d)图所示,运动对象501的几何中心点为点2203。运动对象2202的几何中心点为点2204。运动对象2201到运动对象2202的运动向量即为点2203到点2204的运动向量2205。运动向量E可以是图22B中的运动向量2205。运动向量F可以是运动向量2205的K倍。As shown in FIG. 22A , the first moving object may be the moving object 2201 illustrated in (a) of FIG. 22A . The second moving object may be the moving object 2202 illustrated in (b) of FIG. 22A . As shown in (c) of FIG. 22B , the motion vector E of the first moving object moving to the second moving object is the motion vector of moving the moving object 2201 to the moving object 2202 in (c) of FIG. 22B . As shown in (d) of FIG. 22B , the geometric center point of the moving object 501 is the point 2203 . The geometric center point of the moving object 2202 is point 2204 . The motion vector from the moving object 2201 to the moving object 2202 is the motion vector 2205 from the point 2203 to the point 2204 . Motion vector E may be motion vector 2205 in Figure 22B. The motion vector F may be K times the motion vector 2205.
S723、电子设备100中的CPU向GPU发送用于绘制第N+3预测帧的指令E。S723. The CPU in the electronic device 100 sends an instruction E for drawing the N+3 th predicted frame to the GPU.
电子设备100的CPU可以在GPU计算运动向量F后,向GPU发送用于绘制第N+3预测帧的指令E。GPU接收到该指令E后,响应于指令E,GPU绘制第N+3预测帧。可以理解的是,指令E可以包括多条用于绘制对象的指令,即GPU可以根据多条用于绘制对象的指令绘制N+3预测帧中的多个对象。After the GPU calculates the motion vector F, the CPU of the electronic device 100 may send an instruction E for drawing the N+3 th predicted frame to the GPU. After the GPU receives the instruction E, in response to the instruction E, the GPU draws the N+3 predicted frame. It can be understood that the instruction E may include multiple instructions for drawing objects, that is, the GPU may draw multiple objects in the N+3 predicted frame according to the multiple instructions for drawing objects.
S724、电子设备100中的GPU根据运动向量F和第二运动对象的每个像素点在第W+2绘制帧的坐标在第N+3预测帧中绘制出第三运动对象。S724 , the GPU in the electronic device 100 draws the third moving object in the N+3 th prediction frame according to the motion vector F and the coordinates of each pixel point of the second moving object in the W+2 th drawing frame.
响应于指令D,GPU绘制第N+3预测帧。具体地,GPU根据运动向量F和第二运动对象的每个像素点在第W+2绘制帧的坐标绘制出第N+3预测帧中的第三运动对象,其中第二运动对象和第二运动对象匹配。即第二运动对象中的每个像素点以运动向量F运动位移后的像素点,即为组成第三运动向量的像素点。第三运动向量与运动向量F的顶点数量相同,着色器ID相同、纹理ID相同、以及变换矩阵等等属性相同。In response to instruction D, the GPU draws the N+3 predicted frame. Specifically, the GPU draws the third moving object in the N+3 prediction frame according to the motion vector F and the coordinates of each pixel of the second moving object in the W+2 drawing frame, wherein the second moving object and the second moving object Motion object matching. That is, each pixel in the second moving object is shifted by the motion vector F, that is, the pixel constituting the third motion vector. The third motion vector and the motion vector F have the same number of vertices, the same shader ID, the same texture ID, and the same attributes such as transformation matrices.
可以理解的是当电子设备绘制完第W绘制帧后,即电子设备执行完步骤S709后,电子设备还会绘制第W+1帧。第W+1帧可以是绘制帧,也可以是预测帧。如图11所示,若第W绘制帧为第0帧,则第W+1帧为第1帧,那么此时第W+1帧即为第W+1绘制帧,那么电子设备可以按照步骤S701-S709中示出的绘制过程绘制第W+1绘制帧。若第W绘制帧为图11中示出的第2帧,那么第W+1帧为图11中的第3帧,此时第W+1帧为第W+1预测帧。电子设备可以按照步骤S719-步骤S724示出的步骤绘制第W+1预测帧。It can be understood that after the electronic device draws the Wth drawing frame, that is, after the electronic device completes step S709, the electronic device will also draw the W+1th frame. The W+1th frame may be a drawing frame or a prediction frame. As shown in Figure 11, if the W-th drawing frame is the 0th frame, then the W+1-th frame is the first frame, then the W+1-th frame is the W+1-th drawing frame, then the electronic device can follow the steps The drawing process shown in S701-S709 draws the W+1 th drawing frame. If the W-th drawing frame is the second frame shown in FIG. 11 , then the W+1-th frame is the third frame in FIG. 11 , and at this time, the W+1-th frame is the W+1-th predicted frame. The electronic device may draw the W+1 th predicted frame according to the steps shown in steps S719 to S724.
可以理解的是,电子设备可以重复执行步骤S719-步骤722,直至预测出每一个运动对象的运动向量。It can be understood that, the electronic device can repeatedly perform steps S719 to 722 until the motion vector of each moving object is predicted.
可以理解的是,本申请实施例不限于电子设备通过第W绘制帧和第W+2绘制帧预测出第W+3预测帧。可选地,电子设备还可以通过第W帧和第W+1帧预测第W+2帧。可选地,电子设备还可以通过第W帧和第W+3帧预测第W+4帧。本申请实施例对此不做限定。It can be understood that the embodiment of the present application is not limited to the electronic device predicting the W+3 th predicted frame by using the W th rendering frame and the W+2 th rendering frame. Optionally, the electronic device may also predict the W+2 th frame by using the W th frame and the W+1 th frame. Optionally, the electronic device may also predict the W+4th frame by using the Wth frame and the W+3th frame. This embodiment of the present application does not limit this.
可以理解的是,相对于电子设备通过第W绘制帧和第W+2绘制帧预测出第W+3预测帧来说,电子设备通过第W帧和第W+1帧预测第W+2帧对GPU的计算能力要求更高,即GPU要在第W+1帧显示完之前计算出运动向量并绘制出第W+2帧。若GPU的计算能力达不到要求,那么电子设备显示完第N+1帧后电子设备的视频界面会卡顿。It can be understood that, with respect to the electronic device predicting the W+3 prediction frame through the Wth drawing frame and the W+2 drawing frame, the electronic device predicts the W+2th frame through the Wth frame and the W+1th frame. The computing power of the GPU is required to be higher, that is, the GPU needs to calculate the motion vector and draw the W+2th frame before the W+1th frame is displayed. If the computing power of the GPU does not meet the requirements, the video interface of the electronic device will freeze after the electronic device displays the N+1th frame.
可以理解的是,电子设备在显示目标应用程序的视频界面的过程中,电子设备可以按照不同的策略来预测出预测帧。即电子设备在第一时间段按照第W帧和第W+2帧预测第N+3帧的策略,在第二时间段按照第W帧和第W+1帧预测第W+2帧的策略。例如,当GPU执行的任务比较多时,电子设备可以先按照第W帧和第W+2帧预测第W+3帧。当GPU执行的任务比较少时,电子设备可以按照第W帧和第W+1帧预测第W+2帧。本申请实施例对此不做限定。It can be understood that, when the electronic device displays the video interface of the target application, the electronic device can predict the predicted frame according to different strategies. That is, the strategy of the electronic device predicting the N+3th frame according to the Wth frame and the W+2th frame in the first time period, and the strategy of predicting the W+2th frame according to the Wth frame and the W+1th frame in the second time period. . For example, when the GPU performs many tasks, the electronic device may first predict the W+3 th frame according to the W th frame and the W+2 th frame. When the GPU performs few tasks, the electronic device may predict the W+2 th frame according to the W th frame and the W+1 th frame. This embodiment of the present application does not limit this.
通过实施本申请实施例提供的一种图像帧预测的方法,电子设备可以根据第一绘制指令在第一绘制帧中确定第一运动对象,根据第二绘制指令在第二绘制帧中确定第二运动对象。然后,电子设备根据第一运动对象的第一属性和第二运动对象的第二属性确定第一运动对象和第二运动对象相匹配。接着,电子设备计算第一运动对象的中心点的第一坐标,和计算第二运动对象的第二坐标。然后,电子设备根据第一坐标到第二坐标的位移,确定第一运动对象到第二运动对象的运动向量E。最后,电子设备根据运动向量E和第二运动对象的第一像素点,确定出第一预测帧中第三运动对象的第一像素点。这样,电子设备可以在应用程序的每两个绘制帧之间插入一帧预测的图像帧,可以提高电子设备显示该应用程序视频界面的帧率。从而,可以提高电子设备显示该应用程序视频界面的流畅度。并且,电子设备可以利用对象的几何中心点的运动向量代表整个对象的运动向量,不需要单独确定对象的每个块的运动向量。这样,可以减少电子设备的计算量,从而可以节约电子设备的功耗。By implementing the image frame prediction method provided by the embodiment of the present application, the electronic device can determine the first moving object in the first drawing frame according to the first drawing instruction, and determine the second moving object in the second drawing frame according to the second drawing instruction moving objects. Then, the electronic device determines that the first moving object and the second moving object match according to the first attribute of the first moving object and the second attribute of the second moving object. Next, the electronic device calculates the first coordinates of the center point of the first moving object, and calculates the second coordinates of the second moving object. Then, the electronic device determines a motion vector E from the first moving object to the second moving object according to the displacement from the first coordinate to the second coordinate. Finally, the electronic device determines the first pixel of the third moving object in the first predicted frame according to the motion vector E and the first pixel of the second moving object. In this way, the electronic device can insert a predicted image frame between every two drawing frames of the application program, which can improve the frame rate at which the electronic device displays the video interface of the application program. Therefore, the smoothness of displaying the video interface of the application program on the electronic device can be improved. Also, the electronic device can use the motion vector of the geometric center point of the object to represent the motion vector of the entire object, and it is not necessary to separately determine the motion vector of each block of the object. In this way, the calculation amount of the electronic device can be reduced, so that the power consumption of the electronic device can be saved.
下面结合图23介绍实现本申请提供的一种图像帧预测方法的图像帧预测装置的相关模块。如图23所示,该图像帧预测装置可以包括如下模块:HOOK system模块2300、帧合成(Frame buffer Object Composition)模块2310、UI控件分离(UI Separating)模块2320、运动向量计算(Motion vector computation)模块2330、帧预测(Frame Prediction)模块2340、系统调试(Debug system)模块2350、帧率控制(Frame Rate Control)模块2360。其中:The following describes the relevant modules of the image frame prediction apparatus for implementing an image frame prediction method provided by the present application with reference to FIG. 23 . As shown in Figure 23, the image frame prediction apparatus may include the following modules: HOOK system module 2300, Frame buffer Object Composition module 2310, UI Separating module 2320, Motion vector computation Module 2330 , Frame Prediction module 2340 , Debug system module 2350 , Frame Rate Control module 2360 . in:
钩子模块HOOK system2300用于调用三维图形处理库的相关接口获取目标应用程序的绘制参数。此处可参考图13中对钩子模块1331的描述,此处不再赘述。The hook module HOOK system2300 is used to call the relevant interface of the 3D graphics processing library to obtain the drawing parameters of the target application. Here, reference may be made to the description of the hook module 1331 in FIG. 13 , which will not be repeated here.
帧合成模块2310用于将分离的UI控件和目标应用程序的界面内容合成一帧数据。The frame synthesis module 2310 is used for synthesizing the separated UI controls and the interface content of the target application into one frame of data.
UI控件分离模块2320用于从目标应用程序获取的绘制参数中将UI控件分离出来。这里UI控件是指目标应用程序的用户界面中的一些按钮、输入框等等可以用来接收用户操作的控件。UI控件分离模块2320可以包括UI控件检测(UI Detection)模块2321和UI帧缓冲转储(UI Frame buffer Dump)模块2322。其中,UI控件检测模块2321用于检测UI控件。UI帧缓冲转储模块2322用于存储UI检测模块2321检测到的UI控件。The UI control separation module 2320 is used to separate the UI controls from the drawing parameters obtained from the target application. Here UI controls refer to some buttons, input boxes, etc. in the user interface of the target application that can be used to receive user operations. The UI control separation module 2320 may include a UI control detection (UI Detection) module 2321 and a UI frame buffer dump (UI Frame buffer Dump) module 2322. Among them, the UI control detection module 2321 is used to detect UI controls. The UI frame buffer dump module 2322 is used to store the UI controls detected by the UI detection module 2321 .
运动向量计算模块2330用于计算图像帧的运动向量。运动向量计算模块2330可以包括:菱形搜索算法(Diamond Search Algorithm)模块2331、重投影算法(Reprojection Algorithm)模块2332、基于对象算法(Object Based Algorithm)模块2333。其中,菱形搜索算法模块2331用于通过菱形搜索算法计算图像帧中每个小块的运动向量。重投影算法模块2332用于计算图像帧中静态对象的运动向量。基于对象算法模块2333用于计算图像帧中运动对象的运动向量。The motion vector calculation module 2330 is used to calculate the motion vector of the image frame. The motion vector calculation module 2330 may include: a diamond search algorithm (Diamond Search Algorithm) module 2331, a reprojection algorithm (Reprojection Algorithm) module 2332, and an object based algorithm (Object Based Algorithm) module 2333. The diamond search algorithm module 2331 is used to calculate the motion vector of each small block in the image frame through the diamond search algorithm. The reprojection algorithm module 2332 is used to calculate motion vectors of static objects in the image frame. The object-based algorithm module 2333 is used to calculate the motion vector of the moving object in the image frame.
帧预测模块2340可以用于根据目标应用程序的两帧绘制帧来预测一帧图像帧。预测得到的图像帧即为本申请实施例中的预测帧。The frame prediction module 2340 can be used to predict one image frame according to the two-frame rendering frame of the target application. The predicted image frame is the predicted frame in this embodiment of the present application.
系统调试模块2350用于输出测试数据,转存预测的帧,绘制调试系统模块2350可以包括调试电源键(Debug Power Key)模块2351、运动向量显示(Motion Vector Showing)模块2352、UI信息(UI Information)模块2353、帧转储(FrameDump)模块2354。其中,电源键调试模块2351可以用于触发运动向量计算模块2330中菱形搜索算法模块2331、重投影算法模块2332、基于对象算法模块2333等模块的切换。运动向量显示模块2352可以用于在帧数据上绘制运动向量箭头,将运动向量可视化。UI信息模块2353可以用于显示帧率等信息。帧转储模块2354可以用于将预测帧数据dump成图像image文件,以用于debug。The system debugging module 2350 is used to output test data, dump the predicted frame, and the drawing and debugging system module 2350 may include a Debug Power Key module 2351, a Motion Vector Showing module 2352, and a UI Information (UI Information) module. ) module 2353, frame dump (FrameDump) module 2354. The power button debugging module 2351 can be used to trigger the switching of the diamond search algorithm module 2331 , the reprojection algorithm module 2332 , the object-based algorithm module 2333 and other modules in the motion vector calculation module 2330 . The motion vector display module 2352 can be used to draw motion vector arrows on the frame data to visualize the motion vectors. The UI information module 2353 can be used to display information such as frame rate. The frame dump module 2354 can be used to dump the predicted frame data into an image file for debugging.
帧率控制模块2360用于对电子设备显示的目标应用程序的图像帧的帧率进行控制。The frame rate control module 2360 is used to control the frame rate of the image frame of the target application program displayed by the electronic device.
随着多媒体技术的迅猛发展,人们对视频分辨率的要求也随来越高。但是,当前很多视频的帧率只有30帧/秒,人们在观看这种视频时,视觉感知上会出现卡顿等问题,难以满足用户对视频的要求。通常情况下,视频的帧率越高,其流畅度和平滑度表现越好,因此,现有技术可以通过在视频流的原始帧中插入预测帧来提高视频的帧率,提高视频的流畅度,提升用户体验。With the rapid development of multimedia technology, people have higher requirements for video resolution. However, the current frame rate of many videos is only 30 frames per second. When people watch such videos, problems such as visual perception will appear, which makes it difficult to meet users' requirements for videos. Generally, the higher the frame rate of the video, the better the performance of its fluency and smoothness. Therefore, the existing technology can increase the frame rate of the video by inserting the predicted frame into the original frame of the video stream, and improve the smoothness of the video. , to improve the user experience.
在一种可能的实现方式中,电子设备生成预测帧通常采用块匹配算法。具体的,电子设备将视频帧进行分块之后,直接将块的运动向量应用在该块的所有像素上,得到预测帧。然而,该方法在相邻块的运动向量差距较大的情况下,会造成预测帧中出现空洞和画面模糊的情况。In a possible implementation manner, the electronic device generally uses a block matching algorithm to generate the predicted frame. Specifically, after the electronic device divides the video frame into blocks, the motion vector of the block is directly applied to all pixels of the block to obtain the predicted frame. However, when the motion vectors of adjacent blocks are far apart, this method will cause holes and blurred images in the predicted frame.
本申请实施例提供了一种帧预测方法、电子设备及计算机可读存储介质,该方法中,电子设备先针对块的每一个顶点,根据该顶点四周的块的从目标参考帧到预测帧的预测运动向量确定该顶点在预测帧中的位置,进而,针对每一个块,根据块的四个顶点在参考帧和预测帧之间的对应关系来计算该块的每个像素在预测帧中的位置,最后得到整个预测帧。Embodiments of the present application provide a frame prediction method, an electronic device, and a computer-readable storage medium. In the method, the electronic device first, for each vertex of a block, according to the block around the vertex from the target reference frame to the prediction frame. The predicted motion vector determines the position of the vertex in the predicted frame, and further, for each block, the corresponding relationship between the four vertices of the block in the reference frame and the predicted frame is used to calculate the position of each pixel of the block in the predicted frame. position, and finally get the entire predicted frame.
上述的帧预测方法中通过确定顶点,再根据第一块四周的块的预测运动向量对第一块进行拉伸,其中,第一块为参考帧中的一个块,从而使预测帧中相邻的块的顶点是重合的,并且块与块之间连续,没有空洞。In the above-mentioned frame prediction method, the vertex is determined, and then the first block is stretched according to the predicted motion vectors of the blocks around the first block, wherein the first block is a block in the reference frame, so that the adjacent prediction frames are made. The vertices of the blocks are coincident, and the blocks are continuous without holes.
下面介绍本申请实施例中相关的一些概念。The following introduces some related concepts in the embodiments of the present application.
1、视频后处理技术1. Video post-processing technology
本申请实施例中,视频后处理技术是指,通过视频后处理算法对采集的视频进行处理,得到视频效果在某个方面有所提升的视频处理技术,包括视频稳像(video stabilization)技术、视频高动态成像(high dynamic range,HDR)处理技术和帧率转换技术等。其中,视频后处理算法用于对采集的多张图片或者视频进行处理。In the embodiments of the present application, the video post-processing technology refers to a video processing technology that processes the collected video through a video post-processing algorithm to obtain a video effect that is improved in a certain aspect, including video stabilization technology, Video high dynamic range (HDR) processing technology and frame rate conversion technology, etc. Among them, the video post-processing algorithm is used to process the collected multiple pictures or videos.
本实施例中,视频后处理算法可被本申请实施例提供的图像处理模块调用对采集的图片或视频进行处理。In this embodiment, the video post-processing algorithm may be invoked by the image processing module provided in this embodiment of the present application to process the collected pictures or videos.
2、帧率2. Frame rate
帧率,为视频中每秒图像的帧数,也就是每秒钟视频更新图像的次数。由于视觉暂留机理,当连续播放的图像达到每秒16帧及以上时,该图像序列的就会达到看上去平滑和连贯的视觉效果。一般,普通分辨率视频达到30帧/秒被认为是可接受的,帧率达到60帧/秒的视 频被认为是高清视频。通常,视频的帧率越高,视频的流畅度和平滑度表现越好。The frame rate is the number of frames per second in the video, that is, the number of times the video is updated per second. Due to the persistence of vision mechanism, when images are played continuously at 16 frames per second and above, the image sequence will achieve a visual effect that looks smooth and coherent. In general, normal resolution video up to 30 frames per second is considered acceptable, and video with frame rates up to 60 frames per second is considered high definition video. Generally, the higher the frame rate of the video, the better the smoothness and smoothness of the video.
随着智能终端及多媒体技术的迅猛发展,人们对视频分辨率的要求也随来越高。目前,很多视频的帧率只有30帧/秒,人们在观看这种视频时,视觉感知上会出现卡顿等问题,用户体验较差。因此,电子设备可以通过视频帧率转换技术,将低帧率的视频插值为高帧率视频,例如,电子设备可将视频的帧率从30帧/秒提升至60帧/秒,使视频更加的平滑和连续,从而提升人们在观看视频的逼真感和交互感。With the rapid development of intelligent terminals and multimedia technologies, people have higher requirements for video resolution. At present, the frame rate of many videos is only 30 frames per second. When people watch this kind of video, there will be problems such as stuttering in visual perception, and the user experience will be poor. Therefore, the electronic device can use the video frame rate conversion technology to interpolate the low frame rate video into the high frame rate video. For example, the electronic device can increase the video frame rate from 30 frames per second to 60 frames per second, making the video more smooth and continuous, so as to enhance the realism and interaction of people watching videos.
3、帧率转换技术3. Frame rate conversion technology
帧率转换技术主要分为两大类,一类是非运动补偿算法,另一类为基于运动估计和运动补偿的算法。Frame rate conversion technology is mainly divided into two categories, one is a non-motion compensation algorithm, and the other is an algorithm based on motion estimation and motion compensation.
其中,非运动补偿算法包括简单的帧重复和帧平均算法。具体的,帧重复算法通过直接复制输入视频序列中的帧来完成帧插值的工作,该方法简单高效,但对于视频中存在运动的物体插值帧的质量表现较差,会出现非常明显的模糊和重叠问题;帧平均算法通过将输入视频序列中相邻帧之间按照一定规则进行加权并取平均值来合成中间帧,该方法有较低的时间空间复杂度,但对于存在运动的场景,插值帧图像中运动物体出现明显的混叠问题。Among them, non-motion compensation algorithms include simple frame repetition and frame averaging algorithms. Specifically, the frame repetition algorithm completes the frame interpolation by directly copying the frames in the input video sequence. This method is simple and efficient, but the quality of the interpolation frames for moving objects in the video is poor, and there will be very obvious blurring and blurring. Overlapping problem; the frame averaging algorithm synthesizes intermediate frames by weighting and averaging between adjacent frames in the input video sequence according to certain rules. This method has low time and space complexity, but for scenes with motion, interpolation Obvious aliasing problems with moving objects in frame images.
在处理存在运动场景的视频时,为了合成高质量的插入帧,电子设备可以采用基于运动估计和运动补偿的算法来生成插入帧。基于运动估计和运动补偿的算法的主要思想是,捕获视频帧序列中物体的运动信息,然后根据运动信息与输入的相邻帧进行融合合成插入帧。When processing a video with a motion scene, in order to synthesize high-quality interpolated frames, the electronic device may use an algorithm based on motion estimation and motion compensation to generate interpolated frames. The main idea of the algorithm based on motion estimation and motion compensation is to capture the motion information of objects in the video frame sequence, and then fuse and synthesize the inserted frames according to the motion information and the input adjacent frames.
4、块匹配算法4. Block matching algorithm
基于运动估计和运动补偿的算法包括块匹配算法(Block Matching Algorithm,BMA)。该算法的主要步骤是,首先将原视频帧分为若干个像素块,并假设像素块内的所有像素有相同的位移,再根据一定的匹配查找原则在参考帧中找到与当前像素块匹配的块,并算出两个匹配块之间的相对位移来作为两帧之间的每个块的运动向量。Algorithms based on motion estimation and motion compensation include Block Matching Algorithm (BMA). The main steps of the algorithm are: firstly, the original video frame is divided into several pixel blocks, and it is assumed that all pixels in the pixel block have the same displacement, and then, according to a certain matching search principle, find the matching current pixel block in the reference frame. block, and calculate the relative displacement between the two matching blocks as the motion vector of each block between the two frames.
现有技术中,基于块匹配算法的帧预测方法的主要思想是,电子设备在得到参考帧中每个块的预测运动向量后,针对每一个块,将块的预测运动向量直接应用在该块的所有像素上,得到在预测帧中的对应的块,最后得到整个预测帧,其中,该预测运动向量为块从参考帧到预测帧的运动向量。在相邻块之间的运动向量差距较大的情况下,该方法会造成预测帧中出现局部不连续的情况,造成空洞效应。In the prior art, the main idea of the frame prediction method based on the block matching algorithm is that after the electronic device obtains the predicted motion vector of each block in the reference frame, for each block, the predicted motion vector of the block is directly applied to the block. On all pixels of , the corresponding block in the predicted frame is obtained, and finally the entire predicted frame is obtained, wherein the predicted motion vector is the motion vector of the block from the reference frame to the predicted frame. When the motion vector gap between adjacent blocks is large, this method will cause local discontinuity in the predicted frame, resulting in a hole effect.
下面结合图12,具体介绍本申请实施例提供的帧预测方法。The frame prediction method provided by the embodiment of the present application is described in detail below with reference to FIG. 12 .
该方法可以由上述图12所示的电子设备100来实现,请参见图24,图24为本申请实施例公开的一种帧预测方法的流程图,如图24所示,该帧预测方法包括如下部分或全部步骤:This method can be implemented by the electronic device 100 shown in FIG. 12 . Please refer to FIG. 24 . FIG. 24 is a flowchart of a frame prediction method disclosed in an embodiment of the present application. As shown in FIG. 24 , the frame prediction method includes: Some or all of the following steps:
S101、获取第一参考帧和第二参考帧。S101. Acquire a first reference frame and a second reference frame.
具体的,电子设备可以从视频流中获取两帧相邻的图像,将获取的两帧相邻的图像分别确定为第一参考帧和第二参考帧,其中,该视频流可以为视频,也可以为游戏,还可以为其他多媒体资源,此处不做限定。Specifically, the electronic device may acquire two adjacent frames of images from a video stream, and determine the acquired two adjacent frames of images as a first reference frame and a second reference frame, wherein the video stream may be video, or It can be a game or other multimedia resources, which is not limited here.
具体的,请参见图25,图25为本申请实施例公开的一种获取参考帧的示意图,其中,横轴表示的是视频流的时间,横轴上的箭头表示视频流中的视频帧。如图所示,该视频流是由按照时间顺序排列的多个视频帧组成的图像序列,具体的,该视频流包括第一帧,第二帧,第三帧以及第N帧等多帧图像。例如,电子设备可以获取视频流中的第二帧和第三帧,将视频流中的第二帧确定为第一参考帧,将视频流中的第三帧确定为第二参考帧。Specifically, please refer to FIG. 25 , which is a schematic diagram of obtaining a reference frame disclosed in an embodiment of the present application, wherein the horizontal axis represents the time of the video stream, and the arrows on the horizontal axis represent the video frames in the video stream. As shown in the figure, the video stream is an image sequence composed of multiple video frames arranged in time sequence. Specifically, the video stream includes multiple frames of images such as the first frame, the second frame, the third frame, and the Nth frame. . For example, the electronic device may acquire the second frame and the third frame in the video stream, determine the second frame in the video stream as the first reference frame, and determine the third frame in the video stream as the second reference frame.
请参见图26,图26为本申请实施例公开的另一种获取参考帧的示意图。其中,图26中 的(A)表示一个球运动的视频,具体的,视频画面中有一个球,球按照虚像方向运动,虚线箭头代表球运动的方向,视频背景为具有放射形图案的静止画面,球顶部的线为指示球运动位置的参考线;图26中的(B)和(C)的图像分别为电子设备从该视频中获取的两帧参考帧,其中,图26中的(B)为第一参考帧,图26中的(C)为第二参考帧,如图所示,以球顶部的线为参考,第一参考帧中的球位于第十一位置,第二参考帧中的球在第十二位置,由球在第一参考帧和第二参考帧中的相对位置可知,第一参考帧和第二参考帧中的球相对于背景是运动的,球从第一参考帧到第二参考帧存在位移。Please refer to FIG. 26. FIG. 26 is another schematic diagram of obtaining a reference frame disclosed by an embodiment of the present application. Among them, (A) in Figure 26 represents a video of a ball moving, specifically, there is a ball in the video screen, the ball moves in the direction of the virtual image, the dashed arrow represents the direction of the ball movement, and the video background is a still image with a radial pattern , the line at the top of the ball is a reference line indicating the position of the ball; the images of (B) and (C) in Figure 26 are two reference frames obtained by the electronic device from the video respectively, wherein (B) in Figure 26 ) is the first reference frame, (C) in FIG. 26 is the second reference frame, as shown in the figure, taking the line at the top of the ball as a reference, the ball in the first reference frame is at the eleventh position, and the second reference frame The ball in the twelfth position is in the twelfth position. It can be known from the relative position of the ball in the first reference frame and the second reference frame. The ball in the first reference frame and the second reference frame is moving relative to the background. There is a displacement from the reference frame to the second reference frame.
S102、根据需预测的帧的位置,从第一参考帧和第二参考帧中确定目标参考帧。S102. Determine a target reference frame from the first reference frame and the second reference frame according to the position of the frame to be predicted.
具体的,电子设备可以根据需预测的帧的位置,从第一参考帧和第二参考帧中确定一帧图像作为目标参考帧。需要说明的是,需预测帧的位置可以根据应用场景和用户需求确定,例如,为提升游戏的帧率,电子设备可以根据前两帧图像来生成前两帧图像的后一帧图像,该方法可以避免游戏延时太长,又例如,在处理没有实时要求的视频时,电子设备可以根据两帧相邻的视频帧生成中间的图像,该方法生成的预测帧更加准确。Specifically, the electronic device may determine a frame of image from the first reference frame and the second reference frame as the target reference frame according to the position of the frame to be predicted. It should be noted that the position of the frame to be predicted can be determined according to the application scenario and user requirements. For example, in order to improve the frame rate of the game, the electronic device can generate the next frame of the first two frames of images according to the first two frames of images. Too long game delay can be avoided. For another example, when processing video without real-time requirements, the electronic device can generate an intermediate image according to two adjacent video frames, and the predicted frame generated by this method is more accurate.
请参见图27,图27为本申请实施例公开的一种确定目标参考帧的示意图。其中,如图27中的(A)所示,电子设备可以将视频流中的第二帧和第三帧确定为第一参考帧和第二参考帧,电子设备根据需预测的帧的位置确定目标参考帧包括如图27中的(B)和(C)所示的两种情况。其中,如图27中的(B)所示,在需预测的帧的位置位于第一参考帧和第二参考帧之间时,电子设备可以确定第一参考帧为目标参考帧,相应的,第二参考帧为匹配帧;如图27中的(C)所示,当需预测的帧的位置位于为第二参考帧和第四帧之间时,电子设备可以确定第二参考帧为目标参考帧,相应的,第一参考帧为匹配帧。需要说明的,预测帧的位置可以位于两帧图像之间的中间位置,也可以位于两帧图像之间的其它位置,此处不作限定。Please refer to FIG. 27. FIG. 27 is a schematic diagram of determining a target reference frame disclosed by an embodiment of the present application. Wherein, as shown in (A) in FIG. 27 , the electronic device may determine the second frame and the third frame in the video stream as the first reference frame and the second reference frame, and the electronic device determines the position of the frame to be predicted according to the position of the frame to be predicted. The target reference frame includes two cases as shown in (B) and (C) in FIG. 27 . Wherein, as shown in (B) in FIG. 27 , when the position of the frame to be predicted is between the first reference frame and the second reference frame, the electronic device can determine that the first reference frame is the target reference frame, and accordingly, The second reference frame is a matching frame; as shown in (C) in FIG. 27 , when the position of the frame to be predicted is located between the second reference frame and the fourth frame, the electronic device can determine that the second reference frame is the target Reference frame, correspondingly, the first reference frame is a matching frame. It should be noted that the position of the predicted frame may be located at a middle position between the two frames of images, or may be located at other positions between the two frames of images, which is not limited here.
S103、按照第一大小的方形块,将目标参考帧划分为块。S103. Divide the target reference frame into blocks according to the square blocks of the first size.
具体的,电子设备先可以对目标参考帧进行划分,其中,划分的大小可以为4×4、8×8和16×16等。请参见图28,图28为本申请实施例公开的一种划分目标参考帧的示意图。如图所示,图28中的(A)为目标参考帧,电子设备对目标参考帧进行分块之后,可以得到如图28中的(B)所示的划分后的目标参考帧。为更好的示意分块后的参考帧的情况,取球边缘的区域示意说明本方案,球边缘的区域放大后可以如图28中的(C)所示,其中,斜线区域为球,不规则线性区域为静止的背景区域。需要说明的是,图28中的(C)为放大后的球,图28中的(C)的球的条纹间隔比图28中的(A)和(B)中的条纹间隔较宽,因作图原因在图28中未能明显体现,特此说明。Specifically, the electronic device may firstly divide the target reference frame, wherein the size of the division may be 4×4, 8×8, and 16×16. Please refer to FIG. 28. FIG. 28 is a schematic diagram of dividing a target reference frame according to an embodiment of the present application. As shown in the figure, (A) in FIG. 28 is the target reference frame. After the electronic device divides the target reference frame into blocks, the divided target reference frame as shown in (B) in FIG. 28 can be obtained. In order to better illustrate the situation of the reference frame after the block, the area of the edge of the ball is taken to illustrate the scheme. After the area of the edge of the ball is enlarged, it can be shown in (C) in FIG. Irregular linear regions are stationary background regions. It should be noted that (C) in Figure 28 is an enlarged ball, and the fringe interval of the ball in (C) in Figure 28 is wider than that in (A) and (B) in Figure 28, because The reasons for the drawing are not clearly reflected in Figure 28, and are hereby explained.
S104、计算第一块从目标参考帧到预测帧的运动向量,第一块为目标参考帧中的一个块。S104: Calculate the motion vector of the first block from the target reference frame to the predicted frame, where the first block is a block in the target reference frame.
具体地,电子设备可以先获取块从目标参考帧到匹配帧的运动向量,进而,根据块从目标参考帧到匹配帧的运动向量,计算块从目标参考帧到预测帧的预测运动向量。例如,目标参考帧为第一参考帧时,电子设备可以先获取块从第一参考帧到第二参考帧的运动向量,再根据块从第一参考帧到第二参考帧的运动向量,计算块从第一参考帧到预测帧的预测运动向量。Specifically, the electronic device may first obtain the motion vector of the block from the target reference frame to the matching frame, and then calculate the predicted motion vector of the block from the target reference frame to the predicted frame according to the motion vector of the block from the target reference frame to the matching frame. For example, when the target reference frame is the first reference frame, the electronic device may first obtain the motion vector of the block from the first reference frame to the second reference frame, and then calculate the motion vector of the block from the first reference frame to the second reference frame according to the motion vector of the block from the first reference frame to the second reference frame. The predicted motion vector of the block from the first reference frame to the predicted frame.
请参见图29,图29为本申请实施例公开的一种计算块从目标参考帧到预测帧的预测运动向量的流程示意图,步骤S104可以包括以下部分或全部步骤:Please refer to FIG. 29. FIG. 29 is a schematic flowchart of calculating a predicted motion vector of a block from a target reference frame to a predicted frame disclosed in an embodiment of the present application. Step S104 may include some or all of the following steps:
S1041、获取块从目标参考帧到匹配帧的运动向量。S1041. Obtain the motion vector of the block from the target reference frame to the matching frame.
具体的,电子设备可以根据目标参考帧中的块,在匹配帧中确定该块的匹配块,其中,目标参考帧中的块在匹配帧中对应的区域即为匹配块,再根据目标参考帧中的块到该块在匹配帧中的匹配块的位移,确定该块从目标参考帧到匹配帧的运动向量。例如,目标参考帧为第一参考帧时,电子设备可以获取第一参考帧中的每一个块从第一参考帧到第二参考帧的运动向量,又例如,目标参考帧为第二参考帧时,电子设备可以获取第二参考帧中的每一个块从第二参考帧到第一参考帧的运动向量。Specifically, the electronic device can determine the matching block of the block in the matching frame according to the block in the target reference frame, wherein the area corresponding to the block in the target reference frame in the matching frame is the matching block, and then according to the target reference frame The displacement of the block in to the matching block of the block in the matching frame, determines the motion vector of the block from the target reference frame to the matching frame. For example, when the target reference frame is the first reference frame, the electronic device may acquire the motion vector of each block in the first reference frame from the first reference frame to the second reference frame. For another example, the target reference frame is the second reference frame When , the electronic device may acquire a motion vector of each block in the second reference frame from the second reference frame to the first reference frame.
请参见图30,图30为本申请实施例公开的一种获取块从目标参考帧到匹配帧的示意图。如图所示,图30中的(A)为目标参考帧,根据该目标参考帧中的块,在匹配帧中确定的匹配块可以如图30中的(B)所示。进一步的,根据图30中的(A)和(B),可以得到如图30中的(C)所示的运动向量,其中,箭头表示块从目标参考帧到预测帧的位移。如图30中的(C)所示,图中有三个块存在从目标参考帧到匹配帧的位移,电子设备可以将目标参考帧中的块到匹配帧中该块的匹配块的位移确定为该块从目标参考帧到匹配帧的运动向量,则该示意图中其他没有位移的块的运动向量为0。Please refer to FIG. 30. FIG. 30 is a schematic diagram of an acquisition block from a target reference frame to a matching frame disclosed in an embodiment of the present application. As shown in the figure, (A) in FIG. 30 is the target reference frame, and according to the blocks in the target reference frame, the matching block determined in the matching frame may be as shown in (B) in FIG. 30 . Further, according to (A) and (B) in FIG. 30 , a motion vector as shown in (C) in FIG. 30 can be obtained, wherein the arrow indicates the displacement of the block from the target reference frame to the prediction frame. As shown in (C) of FIG. 30 , there are three blocks in the figure that have displacements from the target reference frame to the matching frame, and the electronic device can determine the displacement of the block in the target reference frame to the matching block of the block in the matching frame as The motion vector of the block from the target reference frame to the matching frame, the motion vector of other blocks without displacement in the schematic diagram is 0.
其中,电子设备根据目标参考帧中块在匹配帧中找匹配块的方法包括全搜索法(Full Search Method,FS)、三步法和菱形搜索法等。具体的,全搜索法是对搜索范围内的所有参考像素点位置计算绝对误差和,运动矢量为绝对误差和最小点对应的偏移量。由于在搜索区域中心位置的附近大多会出现最佳匹配点,因此,FS算法主要采用以区域为中心的螺旋形搜索顺序,以中心点为起点,在当前帧内由内向外逆时针进行螺旋式搜索,直到遍历完宏块内所有目标像素为止。需要说明的是,电子设备在匹配帧中确定的多个块之间可以是重叠的,相应的,匹配帧中可能存在部分区域未被确定为匹配块。The method for the electronic device to find the matching block in the matching frame according to the block in the target reference frame includes a full search method (Full Search Method, FS), a three-step method, a diamond search method, and the like. Specifically, the full search method calculates the absolute error sum for all reference pixel positions within the search range, and the motion vector is the offset corresponding to the absolute error and the minimum point. Since most of the best matching points appear near the center of the search area, the FS algorithm mainly adopts a spiral search sequence centered on the area, with the center point as the starting point, and spirals from the inside to the outside in the current frame. Search until all target pixels in the macroblock are traversed. It should be noted that, the blocks determined by the electronic device in the matching frame may overlap, and accordingly, there may be some regions in the matching frame that are not determined as matching blocks.
在其他一些实施例中,电子设备也可以根据硬件设备获取块从目标参考帧到匹配帧的运动向量,还可以有其他方法获取块从目标参考帧到匹配帧的运动向量,此处不作限定。In some other embodiments, the electronic device may also obtain the motion vector of the block from the target reference frame to the matching frame according to the hardware device, and there may be other methods to obtain the motion vector of the block from the target reference frame to the matching frame, which is not limited here.
S1042、根据块从目标参考帧到匹配帧的运动向量,确定该块从目标参考帧到预测帧的预测运动向量。S1042. Determine the predicted motion vector of the block from the target reference frame to the predicted frame according to the motion vector of the block from the target reference frame to the matching frame.
在一种实现中,目标参考帧为第一参考帧时,电子设备可以根据块从第一参考帧到第二参考帧的运动向量,确定块从第一参考帧到预测帧的预测运动向量。In one implementation, when the target reference frame is the first reference frame, the electronic device may determine the predicted motion vector of the block from the first reference frame to the predicted frame according to the motion vector of the block from the first reference frame to the second reference frame.
在一些实施例中,可以将块之间的运动认为是匀速运动的,可以理解的,在该情况下,电子设备可以将块从第一参考帧到第二参考帧的运动向量的一半确定为该块的预测运动向量。具体的,请参见图31A,图31A为本申请实施例公开的一种确定块的预测运动向量的示意图。如图所示,图中示意性的画出了目标参考帧中的一个块,其中,Mv为块从第一参考帧到第二参考帧的运动向量,以实线箭头表示;Mv’为块从第一参考帧到预测帧的预测运动向量,以虚线箭头表示。如图所示,块从第一参考帧到第二参考帧的运动向量为(3,5),电子设备可以将块从目标参考帧到预测帧的预测运动向量的一半确定为该块的预测运动向量,也即是,根据Mv’=1/2Mv,得到该块的预测运动向量为(1.5,2.5)。In some embodiments, the motion between blocks may be considered as uniform motion, and it is understood that, in this case, the electronic device may determine half of the motion vector of the block from the first reference frame to the second reference frame as The predicted motion vector for this block. Specifically, please refer to FIG. 31A , which is a schematic diagram of determining a predicted motion vector of a block according to an embodiment of the present application. As shown in the figure, a block in the target reference frame is schematically drawn, wherein Mv is the motion vector of the block from the first reference frame to the second reference frame, represented by a solid arrow; Mv' is the block The predicted motion vector from the first reference frame to the predicted frame, indicated by dashed arrows. As shown in the figure, the motion vector of the block from the first reference frame to the second reference frame is (3, 5), and the electronic device may determine half of the predicted motion vector of the block from the target reference frame to the predicted frame as the prediction of the block The motion vector, that is, according to Mv'=1/2Mv, the predicted motion vector of the block is obtained as (1.5, 2.5).
在另一种实现中,目标参考帧为第二参考帧时,电子设备可以根据块从第二参考帧到第一参考帧的运动向量,确定块从第二参考帧到预测帧的预测运动向量。In another implementation, when the target reference frame is the second reference frame, the electronic device may determine the predicted motion vector of the block from the second reference frame to the predicted frame according to the motion vector of the block from the second reference frame to the first reference frame .
在一些实施例中,将块之间的运动认为是匀速运动的,可以理解的,在该情况下,电子设备可以将块从第二参考帧到第一参考帧的运动向量的负值的一半确定为该块的预测运动向量。具体的,请参见图31B,图31B为本申请实施例公开的另一种确定块的预测运动向量的示意图。如图所示,图中示意性的画出了目标参考帧中的一个块,其中,Mv为块从第二参考 帧到第一参考帧的运动向量,以实线箭头表示;Mv’为块从第二参考帧到预测帧的预测运动向量,以虚线箭头表示。如图所示,块从第一参考帧到第二参考帧的运动向量为(-3,-5),电子设备可以将块从目标参考帧到预测帧的预测运动向量的负值的一半确定为该块的预测运动向量,也即是,根据Mv’=-1/2Mv,得到该块的预测运动向量为(1.5,2.5)。In some embodiments, the motion between blocks is considered to be a uniform motion, and it is understood that in this case, the electronic device may convert the block from the second reference frame to the first reference frame by half the negative value of the motion vector Determined as the predicted motion vector for this block. Specifically, please refer to FIG. 31B , which is a schematic diagram of another method of determining a predicted motion vector of a block disclosed by an embodiment of the present application. As shown in the figure, a block in the target reference frame is schematically drawn, wherein Mv is the motion vector of the block from the second reference frame to the first reference frame, represented by a solid arrow; Mv' is the block The predicted motion vector from the second reference frame to the predicted frame, indicated by dashed arrows. As shown in the figure, the motion vector of the block from the first reference frame to the second reference frame is (-3, -5), and the electronic device can determine the negative half of the predicted motion vector of the block from the target reference frame to the predicted frame. is the predicted motion vector of the block, that is, according to Mv'=-1/2Mv, the predicted motion vector of the block is obtained as (1.5, 2.5).
在另一些实施例中,电子设备也可以通过一个感知视频运动加速度的网络模型来获取块从目标参考帧到预测帧的预测运动向量,具体的,该网络模型利用了二次方光流预测方法,其中,二次方光流预测方法的主要思想是,假设物体在区间内的运动是匀加速的,电子设备可以通过获取物体的初始速度和物体在该区间的加速度,计算物体在该区间内的任一时刻的位移。通过该方法,可以更准确估计相邻帧之间的运动向量。需要说明的是,电子设备还可以通过其他方法获取块从目标参考帧到预测帧的预测运动向量,此处不作限定。In other embodiments, the electronic device can also obtain the predicted motion vector of the block from the target reference frame to the predicted frame through a network model that senses video motion acceleration. Specifically, the network model uses the quadratic optical flow prediction method , among which, the main idea of the quadratic optical flow prediction method is that, assuming that the motion of the object in the interval is uniformly accelerated, the electronic device can calculate the object in the interval by obtaining the initial velocity of the object and the acceleration of the object in the interval. displacement at any time. With this method, the motion vector between adjacent frames can be estimated more accurately. It should be noted that, the electronic device may also obtain the predicted motion vector of the block from the target reference frame to the predicted frame by other methods, which is not limited here.
S105、根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从目标参考帧到预测帧的预测运动向量,第一顶点为第一块中的一个顶点。S105. Determine the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, where the first vertex is a vertex in the first block.
具体的,电子设备可以先在目标参考帧中确定顶点四周的块,再根据该顶点周围的块的预测运动向量,确定该顶点的预测运动向量,其中,块的预测运动向量为块从目标参考帧到预测帧的运动向量,顶点的预测运动向量为顶点从目标参考帧到预测帧的运动向量。Specifically, the electronic device can first determine the block around the vertex in the target reference frame, and then determine the predicted motion vector of the vertex according to the predicted motion vector of the block around the vertex, wherein the predicted motion vector of the block is the block from the target reference frame. The motion vector from frame to predicted frame, and the predicted motion vector of the vertex is the motion vector of the vertex from the target reference frame to the predicted frame.
在一些实施例中,电子设备可以针对目标参考帧中的每一个块的每个顶点,在目标参考帧中确定顶点四周的块,再根据每个顶点周围的块的预测运动向量,确定每个顶点的预测运动向量。在一些实施例中,电子设备可以将距离顶点最近的块确定为顶点周围的块。具体的,请参见图32A,图32A为本申请实施例公开的一种确定顶点四周的块的示意图。如图32A所示,以目标参考帧中的一个块为例,块A的顶点a最近的四个块分别为块A、块B、块C和块D,电子设备可以将这四个块确定为顶点a周围的四个块。In some embodiments, the electronic device may, for each vertex of each block in the target reference frame, determine the blocks around the vertex in the target reference frame, and then determine each vertex according to the predicted motion vector of the blocks around each vertex. The predicted motion vector for the vertex. In some embodiments, the electronic device may determine the block closest to the vertex as the block surrounding the vertex. Specifically, please refer to FIG. 32A , which is a schematic diagram of determining blocks around a vertex according to an embodiment of the present application. As shown in FIG. 32A, taking a block in the target reference frame as an example, the four blocks closest to the vertex a of block A are block A, block B, block C, and block D, respectively. The electronic device can determine these four blocks. are the four blocks around vertex a.
进而,电子设备可以将顶点四周的块的预测运动向量的平均值确定为该顶点的预测运动向量。具体的,请参见图32B,图32B为本申请实施例公开的一种确定顶点的预测运动向量的示意图。如图32B所示,块A的运动向量为Mv’A,其中,Mv’A=0,块B的运动向量为Mv’B,块C的运动向量为Mv’C,块D的运动向量为Mv’D,电子设备将顶点四周的块的预测运动向量的平均值确定为该顶点的预测运动向量,得到顶点a的坐标。需要说明的是,目标参考帧的边上的块的顶点的周围并没有四个块,可选地,电子设备可以将目标参考帧边上的顶点的预测运动向量确定为零。Further, the electronic device may determine the average value of the predicted motion vectors of the blocks around the vertex as the predicted motion vector of the vertex. Specifically, please refer to FIG. 32B , which is a schematic diagram of determining a predicted motion vector of a vertex according to an embodiment of the present application. As shown in FIG. 32B, the motion vector of block A is Mv'A, where Mv'A=0, the motion vector of block B is Mv'B, the motion vector of block C is Mv'C, and the motion vector of block D is Mv'D, the electronic device determines the average value of the predicted motion vectors of the blocks around the vertex as the predicted motion vector of the vertex, and obtains the coordinates of the vertex a. It should be noted that there are no four blocks around the vertex of the block on the edge of the target reference frame. Optionally, the electronic device may determine the predicted motion vector of the vertex on the edge of the target reference frame to be zero.
S106、根据目标参考帧中的第一顶点的坐标和第一顶点的预测运动向量,确定第一顶点在预测帧中的坐标。S106. Determine the coordinates of the first vertex in the predicted frame according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex.
具体的,电子设备可以将顶点在目标参考帧中的坐标与该顶点的预测运动向量进行加和,得到该顶点在预测帧中的坐标。请参见图33,图33为本申请实施例公开的一种确定顶点坐标的示意图。如图所示,顶点a在目标参考帧中的坐标为(x a1,y a1),顶点a的预测运动向量为(1,2),电子设备将顶点a在目标参考帧中的坐标与该顶点a的预测运动向量进行加和,得到顶点a在预测帧中的坐标为(x a1+1,y a1+2)。 Specifically, the electronic device may add the coordinates of the vertex in the target reference frame and the predicted motion vector of the vertex to obtain the coordinates of the vertex in the predicted frame. Please refer to FIG. 33 , which is a schematic diagram of determining vertex coordinates according to an embodiment of the present application. As shown in the figure, the coordinates of vertex a in the target reference frame are (x a1 , y a1 ), the predicted motion vector of vertex a is (1, 2), and the electronic device compares the coordinates of vertex a in the target reference frame with this The predicted motion vectors of vertex a are added to obtain the coordinates of vertex a in the predicted frame as (x a1 +1, y a1 +2).
在一些实施例中,电子设备可以对目标参考帧中的每一个顶点进行计算,最终可以得到目标参考帧中所有顶点在预测帧中的坐标。需要说明的是,在将目标参考帧边上的顶点的预测运动向量确定为零的情况中,目标参考帧中的顶点坐标等于预测帧中的顶点坐标。In some embodiments, the electronic device may calculate each vertex in the target reference frame, and finally obtain the coordinates of all the vertices in the target reference frame in the predicted frame. It should be noted that, in the case where the predicted motion vectors of the vertices on the edge of the target reference frame are determined to be zero, the coordinates of the vertices in the target reference frame are equal to the coordinates of the vertices in the predicted frame.
S107、根据第一块的顶点在预测帧中的坐标和在目标参考帧中的坐标,确定第一块在预测帧中的像素块。S107: Determine the pixel block of the first block in the predicted frame according to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame.
具体的,电子设备可以先根据第一块的顶点在目标参考帧中的坐标和预测帧中的坐标,获得第一块的顶点在目标参考帧中的坐标和在预测帧中的坐标的对应关系,进而,将第一块的顶点在目标参考帧中的坐标和预测帧中的坐标的对应关系确定为第一块的像素在目标参考帧和预测帧中的坐标的对应关系,最后,根据第一块的像素在目标参考帧中的坐标和预测帧中的坐标的对应关系,确定块中的像素在预测帧中的坐标,其中,第一块为目标参考帧中的一个块。Specifically, the electronic device may first obtain the correspondence between the coordinates of the vertices of the first block in the target reference frame and the coordinates in the predicted frame according to the coordinates of the vertices of the first block in the target reference frame and the coordinates in the predicted frame , and further determine the correspondence between the coordinates of the vertex of the first block in the target reference frame and the coordinates in the predicted frame as the correspondence between the coordinates of the pixels of the first block in the target reference frame and the predicted frame, and finally, according to the The correspondence between the coordinates of the pixels in the block in the target reference frame and the coordinates in the predicted frame determines the coordinates of the pixels in the block in the predicted frame, wherein the first block is a block in the target reference frame.
请参见图34,图34为本申请实施例公开的一种确定块中的像素在预测帧中的坐标的流程图,步骤S107可以包括以下步骤:Please refer to FIG. 34. FIG. 34 is a flowchart of determining coordinates of pixels in a block in a predicted frame disclosed in an embodiment of the present application. Step S107 may include the following steps:
S1071、根据块的顶点在目标参考帧中的坐标和预测帧中的坐标,获得该块的像素在目标参考帧中的坐标和在预测帧的坐标的对应关系。S1071 , according to the coordinates of the vertices of the block in the target reference frame and the coordinates in the predicted frame, obtain the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame.
具体的,电子设备可以根据块的四对坐标,得到该块对应的单应性变换公式,其中,一个顶点在目标参考帧中的坐标和预测帧中的坐标为一对坐标,该块对应的单应性变换公式用于表示该块的像素在目标参考帧中的坐标和预测帧中的坐标的对应关系。可以理解的,电子设备对目标参考帧中的每一个块进行计算,可以得到每一个块对应的单应性变换公式。Specifically, the electronic device can obtain the homography transformation formula corresponding to the block according to the four pairs of coordinates of the block, wherein the coordinates of a vertex in the target reference frame and the coordinates in the predicted frame are a pair of coordinates, and the block corresponding to The homography transformation formula is used to express the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame. It can be understood that the electronic device calculates each block in the target reference frame, and can obtain a homography transformation formula corresponding to each block.
请参见图35A,图35A为本申请实施例公开的一种获取块对应的单应性变换公式的示意图,如图所示,块A的四个顶点分别为顶点a,顶点b,顶点c和顶点d,一个顶点在目标参考帧和预测帧中的坐标为一对坐标,具体的,顶点a的一对坐标为(x a,y a)和(x a',y a'),顶点b的一对坐标为(x b,y b)和(x b',y b'),顶点c的一对坐标为(x c,y c)和(x c',y c'),顶点d的一对坐标为(x d,y d)和(x d',y d')。 Please refer to FIG. 35A. FIG. 35A is a schematic diagram of a homography transformation formula corresponding to an acquisition block disclosed by an embodiment of the present application. As shown in the figure, the four vertices of block A are vertex a, vertex b, vertex c and Vertex d, the coordinates of a vertex in the target reference frame and the predicted frame are a pair of coordinates, specifically, a pair of coordinates of vertex a are (x a , y a ) and (x a ', y a '), vertex b A pair of coordinates of (x b , y b ) and (x b ', y b '), a pair of coordinates of vertex c are (x c , y c ) and (x c ', y c '), vertex d A pair of coordinates is (x d , y d ) and (x d ', y d ').
如图所示,电子设备可以将块A的4对坐标分别输入单应性变换公式,得到块A对应的方程组,其中,该方程组包括4个方程。其中,单应性变换公式如下:As shown in the figure, the electronic device can input the four pairs of coordinates of the block A into the homography transformation formula respectively to obtain the equation group corresponding to the block A, wherein the equation group includes four equations. Among them, the homography transformation formula is as follows:
Figure PCTCN2021106928-appb-000007
Figure PCTCN2021106928-appb-000007
其中,(x 1,y 1)为顶点在目标参考帧中的坐标,(x 1',y 1')为在目标参考帧中的坐标为(x 1,y 1)的顶点在预测帧中的坐标,H为未知的单应性变换矩阵。其中,单应性变换矩阵如下: Among them, (x 1 , y 1 ) is the coordinates of the vertex in the target reference frame, (x 1 ', y 1 ') is the vertex in the target reference frame whose coordinates are (x 1 , y 1 ) in the predicted frame The coordinates of , H is the unknown homography transformation matrix. Among them, the homography transformation matrix is as follows:
Figure PCTCN2021106928-appb-000008
Figure PCTCN2021106928-appb-000008
进一步的,电子设备通过解块A对应的方程组,可以得到块A对应的单应性矩阵H A,再将块A对应的单应性矩阵H A代入单应性变换公式中,可以得到块A对应的单应性变换公式,块A对应的单应性变换公式如下: Further, the electronic device can obtain the homography matrix HA corresponding to the block A by solving the equation system corresponding to the block A , and then substitute the homography matrix HA corresponding to the block A into the homography transformation formula to obtain the block A. The homography transformation formula corresponding to A, and the homography transformation formula corresponding to block A are as follows:
Figure PCTCN2021106928-appb-000009
Figure PCTCN2021106928-appb-000009
其中,块A对应的单应性变换公式用于表示该块的像素在目标参考帧中的坐标和预测帧中的坐标的对应关系。The homography transformation formula corresponding to the block A is used to represent the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame.
S1072、根据块的像素在目标参考帧的坐标和在预测帧的坐标的对应关系,确定块的像素 在预测帧中的坐标。S1072. Determine the coordinates of the pixels of the block in the predicted frame according to the correspondence between the coordinates of the pixels of the block in the target reference frame and the coordinates in the predicted frame.
具体的,电子设备可以根据第一块对应的单应性变换公式,确定第一块在预测帧中的像素块。Specifically, the electronic device may determine the pixel block of the first block in the predicted frame according to the homography transformation formula corresponding to the first block.
其中,电子设备可以将块中的像素在目标参考帧中的坐标输入该块对应的单应性变换公式,得到该像素在预测帧中的坐标。The electronic device may input the coordinates of the pixels in the block in the target reference frame into the homography transformation formula corresponding to the block to obtain the coordinates of the pixels in the predicted frame.
请参见图35B,图35B为本申请实施例公开的一种确定像素在预测帧中的坐标的示意图,如图所示,以块A中的两个像素点为例,块A中的一个像素点在目标参考帧中的坐标为(x 1,y 1),将(x 1,y 1)输入块A对应的单应性变换公式,可以得到该像素点在预测帧中的坐标(x 1',y 1'),块A中的另一个像素点在目标参考帧中的坐标为(x 2,y 2),将(x 2,y 2)输入块A对应的单应性变换公式,可以得到该像素点在预测帧中的坐标(x 2',y 2')。 Please refer to FIG. 35B . FIG. 35B is a schematic diagram of determining the coordinates of pixels in a predicted frame disclosed by an embodiment of the present application. As shown in the figure, taking two pixels in block A as an example, one pixel in block A The coordinates of the point in the target reference frame are (x 1 , y 1 ), and by inputting (x 1 , y 1 ) into the homography transformation formula corresponding to block A, the coordinates of the pixel in the predicted frame (x 1 ',y 1 '), the coordinate of another pixel in block A in the target reference frame is (x 2 , y 2 ), input (x 2 , y 2 ) into the homography transformation formula corresponding to block A, The coordinates (x 2 ', y 2 ') of the pixel in the predicted frame can be obtained.
在一些实施例中,电子设备可以先根据第一块的四个顶点,确定第一块在预测帧中的像素块的区域,例如,将第一块的四个顶点连线得到的四边形确定为第一块在预测帧中的像素块的区域。In some embodiments, the electronic device may first determine the area of the pixel block of the first block in the predicted frame according to the four vertices of the first block, for example, determine the quadrilateral obtained by connecting the four vertices of the first block as The first block is the region of the pixel block in the predicted frame.
在一种实现中,在第一块在预测帧的像素块的区域面积大于第一块在目标参考帧区域面积时,电子设备可以将第一块的每一个像素在目标参考帧中的坐标输入该块对应的单应性变换公式,得到第一块中的每一个像素在预测帧中的坐标,例如,得到的第一块在预测帧中的坐标的个数可以为N个,N为大于0的正整数。In one implementation, when the area of the pixel block of the first block in the predicted frame is larger than the area of the first block in the target reference frame, the electronic device may input the coordinates of each pixel of the first block in the target reference frame The homography transformation formula corresponding to the block is used to obtain the coordinates of each pixel in the first block in the predicted frame. For example, the number of obtained coordinates of the first block in the predicted frame can be N, where N is greater than A positive integer of 0.
进一步的,电子设备可以获取像素块的区域中的坐标,例如,在像素块的区域中有M个坐标,此时,可以理解的,M>N,M为大于0的正整数。进一步的,电子设备可以在预测帧的像素块区域包括的M个坐标中剔除N个第一块中的像素在预测帧中的坐标,得到第一坐标,其中,第一坐标包括至少两个坐标,将第一坐标输入第一块对应的单应性变换公式,得到第一坐标在目标参考帧中的像素。Further, the electronic device may acquire coordinates in the area of the pixel block. For example, there are M coordinates in the area of the pixel block. In this case, it can be understood that M>N, and M is a positive integer greater than 0. Further, the electronic device may remove the coordinates of the pixels in the N first blocks in the predicted frame from the M coordinates included in the pixel block area of the predicted frame to obtain the first coordinates, where the first coordinates include at least two coordinates. , input the first coordinate into the homography transformation formula corresponding to the first block, and obtain the pixel of the first coordinate in the target reference frame.
在另一种实现中,在第一块在预测帧的像素块的区域面积大于第一块在目标参考帧区域面积时,电子设备可以获取像素块的区域中的坐标,将像素块的区域中的每一个坐标分别输入第一块对应的单应性变换公式,得到像素块的区域中的每一个坐标在目标参考帧中的坐标,进而,得到第一块对应的像素块。In another implementation, when the area of the first block in the pixel block of the predicted frame is larger than the area of the first block in the target reference frame, the electronic device may obtain the coordinates in the area of the pixel block, and put the area of the pixel block in the area of the pixel block. Enter the homography transformation formula corresponding to the first block for each coordinate of , and obtain the coordinates of each coordinate in the area of the pixel block in the target reference frame, and then obtain the pixel block corresponding to the first block.
请参见图35C,图35C为本申请实施例公开的一种预测帧的示意图,以块A为例,电子设备根据块A对应的单应性变换公式,得到的块A对应的像素块可以如图35C所示。Please refer to FIG. 35C . FIG. 35C is a schematic diagram of a prediction frame disclosed in an embodiment of the present application. Taking block A as an example, the electronic device obtains a pixel block corresponding to block A according to the homography transformation formula corresponding to block A, which can be as follows shown in Figure 35C.
S108、显示预测帧,其中包括第一块在预测帧中的像素块。S108. Display the predicted frame, which includes the pixel blocks of the first block in the predicted frame.
电子设备可以通过步骤S101~S107对预测帧中的每一个块进行处理,可以得到每一个块在预测帧中的像素块,其中,像素块中的每一个坐标都对应到目标参考帧中的像素,电子设备可以通过显示屏显示每一个像素块,最后,显示的预测帧是连续的。请参见图36,图36为本申请实施例公开的一种预测帧的示意图,图中以预测帧的部分为例,电子设备最后得到的预测帧中的块呈现拉伸的状态,预测帧中块与块之间是连续的,没有空洞区域。The electronic device can process each block in the predicted frame through steps S101 to S107, and can obtain a pixel block of each block in the predicted frame, wherein each coordinate in the pixel block corresponds to a pixel in the target reference frame , the electronic device can display each pixel block through the display screen, and finally, the displayed predicted frame is continuous. Please refer to FIG. 36 . FIG. 36 is a schematic diagram of a prediction frame disclosed by an embodiment of the present application. Taking part of the prediction frame as an example in the figure, the blocks in the prediction frame finally obtained by the electronic device are in a stretched state. The blocks are continuous and there is no void area.
电子设备在预测图像帧的过程中,电子设备不仅可以预测出预测帧的颜色信息,还可以预测出预测帧的深度信息。这样,电子设备可以根据预测出的深度信息还合成预测帧。During the process of predicting the image frame by the electronic device, the electronic device can not only predict the color information of the predicted frame, but also can predict the depth information of the predicted frame. In this way, the electronic device can also synthesize the predicted frame according to the predicted depth information.
本申请提供一种图像帧生成方法,该方法可包括:根据第十一块和第十二块的深度值、所述第十一块和所述第十二块在图像帧中位置坐标,确定预测块的第十一顶点在预测图像帧中的第十位置坐标;其中,所述第十一块为第一图像帧中的一个块;所述第十二块为第二图 像帧中根据匹配算法确定出的与所述第十一块匹配的块;根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块;生成所述预测图像帧,所述预测图像帧包括所述预测块。The present application provides an image frame generation method, which may include: determining, 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, determining The tenth position coordinate of the eleventh vertex of the predicted block in the predicted image frame; wherein, the eleventh block is a block in the first image frame; the twelfth block is in the second image frame according to matching The block determined by the algorithm that matches the eleventh block; the predicted block is generated according to the color data of the reference block and the tenth position coordinate, and the reference block is the eleventh block or the twelfth block one of the blocks; generating the predicted image frame, the predicted image frame including the predicted block.
其中,颜色数据可以是块中包括的每个像素的RGB值。Among them, the color data may be the RGB value of each pixel included in the block.
可见,本申请实施例中结合深度值针对块进行预测,使得生成的预测块可以根据深度值进行缩放,进而使得预测图像帧展示的画面与电子设备根据实际数据绘制的场景更加吻合;使得在电子设备在根据实际数据绘制的原始图像帧中插入预测图像帧时,原始图像帧与预测图像帧之间的过渡更加自然平滑,提升了用户体验。It can be seen that in the embodiment of the present application, the block is predicted in combination with the depth value, so that the generated predicted block can be scaled according to the depth value, so that the picture displayed by the predicted image frame is more consistent with the scene drawn by the electronic device according to the actual data; When the device inserts the predicted image frame into the original image frame drawn according to the actual data, the transition between the original image frame and the predicted image frame is more natural and smooth, which improves the user experience.
在一种实施方式中,电子设备在运行应用程序的过程中,电子设备可以根据图像帧f 1和图像帧f 2生成图像帧f 3;图像帧f 1和图像帧f 2为原始图像帧,图像帧f 3为预测图像帧。将预测图像帧插入到原始图像帧中,可实现提高帧率的目的。举例来说,电子设备可以根据块匹配算法确定出图像帧f 1和图像帧f 2之间相互匹配的块;每组匹配的块包括块B 1和块B 2,块B 1位于图像帧f 1中,块B 2位于图像帧f 2中;针对每组匹配的块执行以下操作:根据块B 1在图像帧f 1中的坐标和块B 2在图像帧f 2中的坐标确定该组匹配的块对应的位移向量;根据块B 1或块B 2在图像帧中的坐标,以及位移向量确定出块B 1或块B 2在图像帧f 3中的坐标(图像帧f 3中的块由块B 1或块B 2构成,例如图像帧f 3由多个块B 1重组(进行位置变换)得到)。可见,针对每组匹配的块执行上述操作可以确定出每组匹配的块中的一个块在图像帧f 3中的位置,进而根据每组匹配的块和块在图像帧f 3中的位置生成图像帧f 3。本实施例生成了预测帧,可实现提高帧率的目的。上述实施方式中,图像帧的显示内容呈现三维空间中的场景时,具备“近大远小”的特性;具体的,图像帧的显示内容可以视为三维空间中的场景投影到投影平面上呈现的效果;投影过程可以视为三维空间中的场景通过相机点投影到投影平面上;根据相机拍摄物体的原理,相机点可以视为焦点,具体的,如图46E所示,相机点可以是图46E中的camera点。三维空间中的同一物体,若该物体与相机点的距离较近,则在图像帧中该物体的显示面积较大;若该物体与相机点的距离较远,则在图像帧中该物体的显示面积较小。本实施方式中,电子设备仅根据位移向量确定出块在图像帧f 3中的坐标,由于位移向量指的是平面中的位移向量,仅包含三维空间中两个维度的变量,因此丢失了另一维度数据,使得最终生成的图像帧f 3不能呈现出“近大远小”的效果;因此,图像帧f 3的显示内容与应用程序的运行数据构建的三维场景有一定的偏差,使得电子设备在原始图像帧(本示例中的f 1,f 2)中插入的预测帧(本示例中的f 3)后,电子设备在显示图像帧的过程中过渡不平滑。 In one embodiment, when the electronic device runs the application program, the electronic device can generate the image frame f 3 according to the image frame f 1 and the image frame f 2 ; the image frame f 1 and the image frame f 2 are original image frames, Image frame f3 is a predicted image frame. Inserting the predicted image frame into the original image frame can achieve the purpose of increasing the frame rate. For example, the electronic device can determine blocks that match each other between the image frame f 1 and the image frame f 2 according to a block matching algorithm; each set of matched blocks includes a block B 1 and a block B 2 , and the block B 1 is located in the image frame f 1 , block B 2 is located in image frame f 2 ; for each group of matched blocks do the following: Determine the group from the coordinates of block B 1 in image frame f 1 and the coordinates of block B 2 in image frame f 2 The displacement vector corresponding to the matched block; according to the coordinates of the block B 1 or block B 2 in the image frame, and the displacement vector, determine the coordinates of the block B 1 or block B 2 in the image frame f 3 (the coordinates in the image frame f 3 A block consists of a block B 1 or a block B 2 , for example, the image frame f 3 is obtained by recombining (by performing position transformation) a plurality of blocks B 1 ). It can be seen that by performing the above operations for each group of matched blocks, the position of one block in each group of matched blocks in the image frame f3 can be determined, and then the generation of a block according to each group of matched blocks and the position of the block in the image frame f3 can be generated. Image frame f3 . This embodiment generates a predicted frame, which can achieve the purpose of increasing the frame rate. In the above-mentioned embodiment, when the display content of the image frame presents the scene in the three-dimensional space, it has the characteristics of "closer and farther small"; specifically, the display content of the image frame can be regarded as the scene in the three-dimensional space projected onto the projection plane for presentation. The projection process can be regarded as the scene in the three-dimensional space projected onto the projection plane by the camera point; according to the principle of the camera shooting the object, the camera point can be regarded as the focal point. Specifically, as shown in Figure 46E, the camera point can be the image The camera point in 46E. For the same object in three-dimensional space, if the distance between the object and the camera point is short, the display area of the object in the image frame is larger; if the distance between the object and the camera point is far, the object's Display area is small. In this embodiment, the electronic device only determines the coordinates of the block in the image frame f3 according to the displacement vector. Since the displacement vector refers to the displacement vector in the plane, it only includes two-dimensional variables in the three-dimensional space, so the other One-dimensional data, so that the final generated image frame f 3 cannot show the effect of "near big and far small"; therefore, there is a certain deviation between the display content of the image frame f 3 and the three-dimensional scene constructed by the running data of the application, which makes the electronic After the device inserts the predicted frame (f 3 in this example) in the original image frame (f 1 , f 2 in this example), the electronic device does not have a smooth transition during the display of the image frame.
在一些实施例中,提供一种生成图像帧的方法。电子设备可以根据原始图像帧的三维数据生成预测图像帧,使得预测帧中物体的显示面积具有“近大远小”的效果。实施本实施例的方法,在插入预测图像帧提升电子设备的帧率的同时,预测帧还原的场景与根据应用程序的数据构建的三维场景更加贴近,进而使得原始图像帧和预测图像帧之间的过渡更加自然平滑。In some embodiments, a method of generating an image frame is provided. The electronic device may generate the predicted image frame according to the three-dimensional data of the original image frame, so that the display area of the object in the predicted frame has the effect of "closer and far smaller". Implementing the method of this embodiment, while inserting the predicted image frame to improve the frame rate of the electronic device, the scene restored by the predicted frame is closer to the three-dimensional scene constructed according to the data of the application program, thereby making the difference between the original image frame and the predicted image frame. transitions are more natural and smooth.
下面实施例介绍本申请实施例提供的一种图像帧生成方法。如图37所示,该方法可以包括:The following embodiments introduce an image frame generation method provided by the embodiments of the present application. As shown in Figure 37, the method may include:
S3701,电子设备针对参考图像帧进行块划分,得到参考块。S3701, the electronic device performs block division on the reference image frame to obtain a reference block.
其中,电子设备首先根据需预测的图像帧f 3相对于图像帧f 1和图像帧f 2的位置确定图像帧f 1和图像帧f 2中的一帧图像帧为参考图像帧。 The electronic device first determines one of the image frames f1 and f2 as the reference image frame according to the position of the image frame f3 to be predicted relative to the image frame f1 and the image frame f2.
其中,图像帧f 1和图像帧f 2是根据应用程序的数据绘制得到的图像帧;图像帧f 3是根据 图像帧f 1和图像帧f 2预测得到的预测图像帧。 The image frame f 1 and the image frame f 2 are image frames drawn according to the data of the application program; the image frame f 3 is the predicted image frame predicted according to the image frame f 1 and the image frame f 2 .
其中,图像帧f 1在数据流中位于图像帧f 2之前,电子设备可以预设置图像帧f 1和图像帧f 2中的一帧图像帧为参考图像帧;例如,电子设备可以设置数据流中靠前的图像帧f 1为参考图像帧。需要说明的是,图像帧在数据流中的位置越靠前,电子设备根据数据流显示图像帧时,显示图像帧的时间点越靠前。 Wherein, the image frame f 1 is located before the image frame f 2 in the data stream, and the electronic device can preset the image frame f 1 and one image frame in the image frame f 2 as a reference image frame; for example, the electronic device can set the data stream. The image frame f 1 at the front of the middle is the reference image frame. It should be noted that the earlier the position of the image frame in the data stream is, the earlier the time point of displaying the image frame is when the electronic device displays the image frame according to the data stream.
可选的,参考图像帧是根据图像帧f3在数据流中相对于图像帧f 1和图像帧f 2的位置确定的。举例来说,可以包括以下两种情况:(1)如图38所示的位置关系一:图像帧f 1在数据流中位于图像帧f 2之前;若图像帧f 3位于图像帧f 1和图像帧f 2之间,则参考图像帧为图像帧f 1和图像帧f 2中靠前的图像帧f 1。(2)如图38所示的位置关系二:图像帧f 1在数据流中位于图像帧f 2之前;若图像帧f 3位于图像帧f 1和图像帧f 2之后,则参考图像帧为图像帧f 1和图像帧f 2中靠后的图像帧f 2。需要说明的是,图像帧f 3在数据流中的位置可以根据应用场景和用户需求确定,例如,为提升游戏的帧率,电子设备可以根据前两帧图像预测生成后一帧图像,该方法可以避免游戏延时太长,即图38中的位置关系二;又例如,在处理对延时没有要求或要求较低的视频时,电子设备可以根据相邻的两帧图像帧生成中间的图像帧,该方法生成的预测帧更加准确,即图38中的位置关系一。 Optionally, the reference image frame is determined according to the position of the image frame f3 relative to the image frame f1 and the image frame f2 in the data stream. For example, it can include the following two situations: (1) Position relationship 1 as shown in FIG. 38: the image frame f 1 is located before the image frame f 2 in the data stream; if the image frame f 3 is located in the image frame f 1 and Between the image frames f 2 , the reference image frame is the image frame f 1 and the image frame f 1 in front of the image frame f 2 . (2) Positional relationship 2 shown in Fig. 38: the image frame f 1 is located before the image frame f 2 in the data stream; if the image frame f 3 is located after the image frame f 1 and the image frame f 2 , the reference image frame is Image frame f 1 and image frame f 2 following the image frame f 2 . It should be noted that the position of the image frame f3 in the data stream can be determined according to the application scenario and user requirements. For example, in order to improve the frame rate of the game, the electronic device can predict and generate the next frame of the image according to the first two frames of images. It can avoid the game delay being too long, that is, the position relationship 2 in Figure 38; for example, when processing a video with no or low requirements for delay, the electronic device can generate an intermediate image according to two adjacent image frames. frame, the predicted frame generated by this method is more accurate, that is, the position relationship 1 in Figure 38.
其中,电子设备按照第一大小的块针对参考图像帧进行划分,第一大小可以是预设置的大小。举例来说,电子设备可以设置第一大小是参考图像帧面积的50分之一;又例如,电子设备可以设置第一大小是参考图像帧中九个像素构成的大小。The electronic device divides the reference image frame according to blocks of a first size, and the first size may be a preset size. For example, the electronic device may set the first size to be 1/50 of the area of the reference image frame; for another example, the electronic device may set the first size to be a size formed by nine pixels in the reference image frame.
举例来说,图像帧f 1和图像帧f 2如图39A所示,若图像帧f 1为参考图像帧,针对图像帧f 1进行块划分,则可以得到图39B所示的效果。 For example, the image frame f 1 and the image frame f 2 are shown in FIG. 39A . If the image frame f 1 is a reference image frame, and the image frame f 1 is divided into blocks, the effect shown in FIG. 39B can be obtained.
S3702,电子设备确定匹配图像帧中与参考块匹配的匹配块,得到图像帧f 1中的块B 1和图像帧f 2中的块B 2为相互匹配的块。 S3702 , the electronic device determines a matching block in the matching image frame that matches the reference block, and obtains that the block B1 in the image frame f1 and the block B2 in the image frame f2 are mutually matched blocks.
其中,匹配图像帧是图像帧f 1和图像帧f 2中所述参考图像帧之外的一帧图像帧。 The matching image frame is an image frame other than the reference image frame in the image frame f 1 and the image frame f 2 .
具体的,在图像帧f 1为参考图像帧的情况下,则图像帧f 2为匹配图像帧;在图像帧f 2为参考图像帧的情况下,则图像帧f 1为匹配图像帧。 Specifically, when the image frame f 1 is a reference image frame, the image frame f 2 is a matching image frame; when the image frame f 2 is a reference image frame, the image frame f 1 is a matching image frame.
具体的,请参阅图40A,步骤S3703具体包括以下步骤:Specifically, please refer to FIG. 40A , step S3703 specifically includes the following steps:
S1021,电子设备确定参考块在参考图像帧中的位置坐标(x c,y c)和深度值d cS1021, the electronic device determines the position coordinates (x c , y c ) and the depth value d c of the reference block in the reference image frame.
其中,图像帧中的位置坐标具体指在屏幕坐标系下的坐标。屏幕坐标系为二维坐标系。屏幕坐标系的横纵坐标的最大值是根据电子设备的显示面积(图像帧/屏幕的显示面积)中包含的像素的数量确定出最大值的;The position coordinates in the image frame specifically refer to coordinates in the screen coordinate system. The screen coordinate system is a two-dimensional coordinate system. The maximum value of the horizontal and vertical coordinates of the screen coordinate system is determined according to the number of pixels contained in the display area of the electronic device (image frame/display area of the screen);
电子设备存储有图像帧中每个像素在图像帧中对应的位置坐标,块在图像帧中的位置可以是块中全部像素在图像帧中的位置坐标求平均得到。可选的,可以指定块中一个点的坐标为块在图像帧中的坐标;例如,指定块中距离左上角的顶点最近的像素在图像帧中的坐标为块的坐标;或者,指定块中距离中心点最近的像素在图像帧中的位置为块在图像帧中的坐标。The electronic device stores the corresponding position coordinates of each pixel in the image frame in the image frame, and the position of the block in the image frame may be obtained by averaging the position coordinates of all pixels in the block in the image frame. Optionally, you can specify the coordinates of a point in the block as the coordinates of the block in the image frame; for example, specify the coordinates in the image frame of the pixel closest to the vertex in the upper left corner of the block as the coordinates of the block; or, specify the coordinates of the block in the image frame. The position of the pixel closest to the center point in the image frame is the coordinate of the block in the image frame.
其中,电子设备存储有图像帧中每个像素对应的深度值,深度值可以表示相机(camera)坐标系下像素在Z维度的坐标,Z维度是相机坐标系下与投影平面垂直的维度;电子设备在绘制得到图像帧时,可以视为首先电子设备根据应用程序的数据在相机坐标系下构建三维场景,之后将构建的三维场景投影到投影屏幕上,进而在投影平面上得到图像帧。举例来说,当电子设备运行开放图形库(Open Graphics Library,OpenGL)时,电子设备将绘制的图像帧的绘制结果存储到帧缓存对象(Frame Buffer Object,FBO),帧缓存对象中设置有颜色附 件(ColorAttachment)和深度附件(Depth Attachment),颜色附件中存储有像素的颜色值信息和像素在图像帧中的位置坐标;深度附件中存储有像素对应的深度值。Among them, the electronic device stores the depth value corresponding to each pixel in the image frame, and the depth value can represent the coordinates of the pixel in the Z dimension in the camera coordinate system, and the Z dimension is the dimension perpendicular to the projection plane in the camera coordinate system; When the device draws an image frame, it can be considered that the electronic device constructs a three-dimensional scene in the camera coordinate system according to the data of the application program, and then projects the constructed three-dimensional scene on the projection screen, and then obtains the image frame on the projection plane. For example, when the electronic device runs the Open Graphics Library (OpenGL), the electronic device stores the drawing result of the drawn image frame in the frame buffer object (Frame Buffer Object, FBO), and the frame buffer object is set with a color Attachment (ColorAttachment) and depth attachment (Depth Attachment), the color value information of the pixel and the position coordinates of the pixel in the image frame are stored in the color attachment; the depth value corresponding to the pixel is stored in the depth attachment.
具体的,块的深度值可以根据参考块中包含的像素的深度值计算得到。具体的,块的深度值可以是块中包含的全部像素取平均值得到的。可选的,块的深度值可以是块中指定像素对应的深度值,例如设置块的中心点的像素(距离中心点最近的像素)的深度值为块的深度值。Specifically, the depth value of the block can be calculated according to the depth value of the pixels included in the reference block. Specifically, the depth value of the block may be obtained by averaging all pixels included in the block. Optionally, the depth value of the block may be the depth value corresponding to the specified pixel in the block, for example, setting the depth value of the pixel at the center point of the block (the pixel closest to the center point) as the depth value of the block.
S1022,电子设备根据深度值d c确定第二大小的区域。 S1022 , the electronic device determines an area of a second size according to the depth value dc.
其中,d c越小,第二大小越大;d c越大,第二大小越小。举例来说,第二大小用S A表示,若参考块的大小为S B,整个图像帧的大小为S C;Q=S C÷S B,则可通过如下公式: Wherein , the smaller the dc, the larger the second size; the larger the dc , the smaller the second size. For example, the second size is represented by S A. If the size of the reference block is S B , the size of the entire image frame is S C ; Q=S C ÷ S B , the following formula can be used:
S A=Q (1-d c )*S B S A = Q (1-d c ) *S B
本示例中,深度值的取值范围可以为0至1;可见,通过上述公式,在d c=0时,S A=S C;在d c=1时,S A=S B;在0<d c<1时,随着d 1的逐渐增大,S A逐渐增大。 In this example, the value range of the depth value can be from 0 to 1; it can be seen that through the above formula, when dc =0, S A =S C ; when dc =1, S A =S B ; when 0 When <d c <1, SA gradually increases as d 1 increases gradually.
可选的,电子设备可以预设置d c和第二大小S A的映射关系。例如,w 1<d c≤w 2时,第二大小S A的面积为S 1;w 3<d c≤w 4时,第二大小S A的面积为S 2……w (H-1)<d c≤w H时,第二大小S A的面积为S H;当d c>w H时,第二大小S A等于块的大小S B;其中,w 1为正整数;w 1<w 2<w 3<w 4<……<w (H-1)<w H;S 1>S 2>……>S HOptionally, the electronic device may preset the mapping relationship between dc and the second size SA . For example, when w 1 <d c ≤w 2 , the area of the second size SA is S 1 ; when w 3 <d c ≤w 4 , the area of the second size SA is S 2 ......w (H-1 ) <d c ≤ w H , the area of the second size S A is SH ; when d c >w H , the second size S A is equal to the size S B of the block; wherein, w 1 is a positive integer; w 1 <w 2 <w 3 <w 4 <...<w (H-1) <w H ; S 1 >S 2 >... > S H .
其中,区域的形状可以是预设置的,例如区域的形状可以是正方形,圆形,三角形等。The shape of the region may be preset, for example, the shape of the region may be a square, a circle, a triangle, and the like.
S1023,电子设备在第二大小的区域中确定出与参考块相似度最高的块为匹配块,得到块B 1和块B 2为一组相互匹配的块。 S1023, the electronic device determines, in the area of the second size, the block with the highest similarity with the reference block as a matching block, and obtains that block B 1 and block B 2 are a set of mutually matching blocks.
需要说明的是,电子设备可以根据深度值值计算出在相机坐标系下该深度值表示的坐标在Z维度与相机点(camera)之间的距离。图像帧的显示内容可以视为相机坐标系中的场景投影到投影平面上呈现的效果;三维场景中的位置点与相机点(camera)的连线与投影平面的交点即为投影到投影屏幕上的位置点。It should be noted that the electronic device can calculate the distance between the Z dimension and the camera point (camera) of the coordinates represented by the depth value in the camera coordinate system according to the depth value. The display content of the image frame can be regarded as the effect of projecting the scene in the camera coordinate system onto the projection plane; the intersection of the line connecting the position point in the 3D scene with the camera point (camera) and the projection plane is the projection onto the projection screen. location point.
举例来说,假设参考图像帧为图像帧f 1,则匹配图像帧为图像帧f 2;根据深度值d 1进行计算,设计算得到z 1,z 1表示深度值d 1转换到相机坐标系下表示的坐标。请参阅图40B,当z 1=z 4时,块I 1'是Z=z 4平面上的四边形I 1投影得到的。此时,搜索范围是由以(x 1,y 1)为中心,25个块构成的区域。请参阅图40C,当z 1=z 5时,z 5>z 4;四边形I 1置于Z=z 5平面上,则四边形I 1投影到投影平面上得到的块I 1”小于块I 1';因此,可以理解是,距离相机点camera越远,同一物体投影到投影平面上的面积越小;且距离相机点camera越远,同一物体在X维度和Y维度上的进行同样距离的位移,位移投影到投影平面上也越小。因此,电子设备可以设置在z 1=z 5条件下的搜索范围小于z 1=z 4条件下的搜索范围;如图40C所示,z 1=z 5时,搜索范围是由以(x 1,y 1)为中心,9个块构成的区域。可见,由于d 1可以间接的表示块在相机坐标系下对应的位置坐标与相机点(camera)的距离,因此,本申请实施例中可以直接根据d 1确定出第二大小的区域。 For example, assuming that the reference image frame is image frame f 1 , the matching image frame is image frame f 2 ; the calculation is performed according to the depth value d 1 , and z 1 is calculated by design, and z 1 represents the conversion of the depth value d 1 to the camera coordinate system The coordinates indicated below. Referring to FIG. 40B , when z 1 =z 4 , the block I 1 ′ is obtained by the projection of the quadrilateral I 1 on the Z=z 4 plane. At this time, the search range is an area consisting of 25 blocks centered on (x 1 , y 1 ). Please refer to Fig. 40C, when z 1 =z 5 , z 5 >z 4 ; the quadrilateral I 1 is placed on the Z=z 5 plane, then the block I 1 ″ obtained by projecting the quadrilateral I 1 onto the projection plane is smaller than the block I 1 '; therefore, it can be understood that the farther away from the camera point camera, the smaller the projected area of the same object on the projection plane; and the farther away from the camera point camera, the same object is displaced by the same distance in the X and Y dimensions. , the displacement projection on the projection plane is also smaller. Therefore, the electronic device can set the search range under the condition of z 1 =z 5 to be smaller than the search range under the condition of z 1 =z 4 ; as shown in Figure 40C, z 1 =z When the value is 5 , the search range is an area consisting of 9 blocks centered at (x 1 , y 1 ). It can be seen that since d 1 can indirectly represent the position coordinates and camera points corresponding to the block in the camera coordinate system Therefore, in this embodiment of the present application, the area of the second size can be directly determined according to d 1 .
需要说明的是,电子设备在搜索范围内搜索匹配的块的过程中,电子设备可以每次移动一个像素来进行匹配查找。例如,在搜索范围内电子设备首先判断块的左上角的顶点与搜索范围的左上角的顶点重合的块B S1是否与参考块匹配;若不匹配,则将B S1向右平移一个像素,电子设备判断是否匹配;若不匹配,……直至块B S1右上角的顶点与搜索范围的右上角的顶点重合;若不匹配,则电子设备将块下移一行(一个像素),重复上述操作,直至块遍历完成整个搜索范围。 It should be noted that, during the process that the electronic device searches for a matching block within the search range, the electronic device may move one pixel at a time to perform matching search. For example, within the search range, the electronic device first determines whether the block B S1 whose upper left corner vertex coincides with the upper left corner vertex of the search range matches the reference block; The device judges whether it matches; if it does not match, ... until the vertex in the upper right corner of block B S1 coincides with the vertex in the upper right corner of the search range; if it does not match, the electronic device moves the block down one line (one pixel), and repeats the above operations, Until the block traversal completes the entire search range.
S3703,电子设备根据块B 1和块B 2的深度值、块B 1和块B 2在图像帧中位置坐标,确定预测块的顶点Yp 1在预测图像帧中的位置坐标(x 31,y 31)。 S3703 , the electronic device determines the position coordinates of the vertex Yp 1 of the predicted block in the predicted image frame ( x 31 , y 31 ).
其中,块B 1和块B 2是相互匹配的块。块B 1表示图像帧f 1中的一个块,块B 2表示图像帧f 2中的一个块。 Among them, block B 1 and block B 2 are blocks that match each other. Block B 1 represents a block in image frame f 1 and block B 2 represents a block in image frame f 2 .
本示例中,用块中的一个顶点在图像帧中的位置坐标表示块的位置坐标;电子设备可以设置块中的顶点p 1表示块的坐标,顶点p 1相对于块的位置是预设置的。具体的,块的形状为正方形,电子设备设置在屏幕坐标系下位于块左上角的顶点为p 1。本示例中,在屏幕坐标系下块B 1左上角的顶点B 1p 1在图像帧f 1中的位置坐标表示块B 1在图像帧f 1中的位置坐标;在屏幕坐标系下块B 2左上角的顶点B 2p 1在图像帧f 2的位置坐标表示块B 2在图像帧f 2中的位置坐标;在屏幕坐标系下预测块左上角的顶点Yp 1在参考图像帧中的位置表示预测块在参考图像帧中的位置坐标。 In this example, the position coordinates of a vertex in the block in the image frame are used to represent the position coordinates of the block; the electronic device can set the vertex p 1 in the block to represent the coordinates of the block, and the position of the vertex p 1 relative to the block is preset . Specifically, the shape of the block is a square, and the vertex located at the upper left corner of the block in the screen coordinate system is set as p 1 by the electronic device. In this example, the position coordinates of the vertex B 1 p 1 in the upper left corner of the block B 1 in the image frame f 1 in the screen coordinate system represent the position coordinates of the block B 1 in the image frame f 1 ; in the screen coordinate system, the block B 2 The position coordinates of the upper left corner vertex B 2 p 1 in the image frame f 2 represent the position coordinates of the block B 2 in the image frame f 2 ; in the screen coordinate system, the upper left corner vertex Yp 1 of the predicted block is in the reference image frame. The position represents the position coordinates of the prediction block in the reference image frame.
请参阅图41A,步骤S3703具体包括以下步骤:Please refer to FIG. 41A, step S3703 specifically includes the following steps:
S1031,电子设备根据块B 1的深度值d 1和块B 1在图像帧f 1中的位置坐标(x 1,y 1)计算得到相机坐标系下的位置坐标(x e1,y e1,z e1)。 S1031, the electronic device calculates the position coordinates (x e1 , y e1 , z in the camera coordinate system) according to the depth value d 1 of the block B 1 and the position coordinates (x 1 , y 1 ) of the block B 1 in the image frame f 1 e1 ).
本示例中,用块中的一个顶点在图像帧中的位置坐标表示块的位置坐标。具体的,可以设置块B 1的顶点Bp 1的在图像帧f 1中的位置坐标表示块B 1的位置坐标。举例来说,块B 1的形状为正方形,块B 1置于图像帧f 1中的情况下,顶点Bp 1是屏幕坐标系下位于块B 1左上角的顶点。 In this example, the position coordinates of a block are represented by the position coordinates of a vertex in the block in the image frame. Specifically, the position coordinates of the vertex Bp 1 of the block B 1 in the image frame f 1 may be set to represent the position coordinates of the block B 1 . For example, the shape of the block B 1 is a square, and when the block B 1 is placed in the image frame f 1 , the vertex Bp 1 is the vertex located at the upper left corner of the block B 1 in the screen coordinate system.
其中,图像帧中的位置坐标具体指屏幕坐标系下的坐标;电子设备根据深度值d 1和位置坐标(x 1,y 1)计算得到位置坐标(x e1,y e1,z e1)的具体过程包括: The position coordinates in the image frame specifically refer to the coordinates in the screen coordinate system; the electronic device calculates the specific position coordinates (x e1 , y e1 , z e1 ) according to the depth value d 1 and the position coordinates (x 1 , y 1 ). The process includes:
若屏幕坐标系下屏幕的分辨率为(Sw,Sh),即横坐标包括Sw个像素,纵坐标包括Sh个像素,屏幕坐标系下左下角的像素的位置坐标为(0,0),右上角的像素的位置坐标为(Sw-1,Sh-1);电子设备首先将屏幕坐标系下的位置坐标(x 1,y 1)进行归一化处理,得到(x n1,y n1);其中,x n1=x 1/(Sw-1)*2-1;y n1=y 1/(Sh-1)*2-1。深度值的取值范围为(0,1),对深度值d 1归一化处理可得到z n1;具体的,z n1=d 1*2-1。归一化后的x n1,y n1和z n1取值范围均在(-1,1)之间。因此,根据位置坐标(x 1,y 1)和d 1可得到归一化后的坐标(x n1,y n1,z n1,w n1);其中,w n1=-1。 If the resolution of the screen in the screen coordinate system is (Sw, Sh), that is, the abscissa includes Sw pixels, the ordinate includes Sh pixels, and the position coordinates of the pixel in the lower left corner of the screen coordinate system are (0, 0), and the upper right The position coordinates of the corner pixels are (Sw-1, Sh-1); the electronic device first normalizes the position coordinates (x 1 , y 1 ) in the screen coordinate system to obtain (x n1 , y n1 ); Wherein, x n1 =x 1 /(Sw-1)*2-1; y n1 =y 1 /(Sh-1)*2-1. The value range of the depth value is (0, 1), and z n1 can be obtained by normalizing the depth value d 1 ; specifically, z n1 =d 1 *2-1. The normalized values of x n1 , y n1 and z n1 are all between (-1, 1). Therefore, normalized coordinates (x n1 , y n1 , z n1 , wn1 ) can be obtained according to the position coordinates (x 1 , y 1 ) and d 1 ; wherein, wn1 =-1.
之后,将归一化后的(x n1,y n1,z n1,w n1)转换到裁剪坐标系,得到(x c1,y c1,z c1,w c1);将裁剪坐标系下的(x c1,y c1,z c1,w c1)转换到相机坐标系下,得到(x e1,y e1,z e1,1);其中,w c1=-z e1。且(x c1,y c1,z c1,w c1)和(x e1,y e1,z e1,1)具有如下关系: After that, convert the normalized (x n1 , y n1 , z n1 , w n1 ) to the clipping coordinate system to obtain (x c1 , y c1 , z c1 , w c1 ); c1 , y c1 , z c1 , w c1 ) are converted into the camera coordinate system to obtain (x e1 , y e1 , z e1 , 1); wherein, w c1 =-z e1 . And (x c1 , y c1 , z c1 , w c1 ) and (x e1 , y e1 , z e1 , 1) have the following relationship:
Figure PCTCN2021106928-appb-000010
Figure PCTCN2021106928-appb-000010
其中,w c1=-z e1。矩阵P为已知的,矩阵P具体如下: where w c1 =-z e1 . The matrix P is known, and the matrix P is as follows:
Figure PCTCN2021106928-appb-000011
Figure PCTCN2021106928-appb-000011
其中,
Figure PCTCN2021106928-appb-000012
r,n,f和t均为已知常量。
in,
Figure PCTCN2021106928-appb-000012
r, n, f and t are all known constants.
裁剪坐标系下w c1=-z e1;因此,在已知w n1=-1,w c1=-z e1和(x n1,y n1,z n1,w n1)情况下课计算得到裁剪坐标系下的坐标;在已知裁剪坐标系下的(x c1,y c1,z c1,w c1),w c1=-z e1;和矩阵P的条件下,电子设备可以计算得到相机坐标系下的(x e1,y e1,z e1,1)。 Under the clipping coordinate system w c1 =-z e1 ; therefore, under the condition of known w n1 =-1, w c1 =-z e1 and (x n1 , y n1 , z n1 , w n1 ), we can get the clipping coordinate system coordinates; under the known clipping coordinate system (x c1 , y c1 , z c1 , w c1 ), w c1 =-z e1 ; and matrix P, the electronic device can calculate ( x e1 , y e1 , z e1 , 1).
可见,电子设备可以根据块B 1的d 1和(x 1,y 1)计算得到块B 1在相机坐标系下对应的位置坐标(x e1,y e1,z e1,1)。 It can be seen that the electronic device can obtain the corresponding position coordinates (x e1 , y e1 , z e1 , 1) of the block B 1 in the camera coordinate system according to d 1 and (x 1 , y 1 ) of the block B 1 .
S1032,电子设备根据块B 2的深度值d 2和块B 2在参考图像帧中的位置坐标(x 2,y 2)计算得到相机坐标系下的位置坐标(x e2,y e2,z e2)。 S1032, the electronic device calculates the position coordinates (x e2 , y e2 , z e2 ) in the camera coordinate system according to the depth value d 2 of the block B 2 and the position coordinates (x 2 , y 2 ) of the block B 2 in the reference image frame ).
具体的,请参阅S1041的计算过程,电子设备可以根据块B 2的d 2和(x 2,y 2)计算得到块B 2在相机坐标系下的位置坐标(x e2,y e2,z e2,1)。 Specifically, please refer to the calculation process of S1041. The electronic device can obtain the position coordinates (x e2 , y e2 , z e2 ) of the block B 2 in the camera coordinate system according to d 2 and (x 2 , y 2 ) of the block B 2 ,1).
S1033,电子设备根据块B 1在相机坐标系下对应的位置坐标(x e1,y e1,z e1,1)和块B 2在相机坐标系下对应的位置坐标(x e2,y e2,z e2,1),计算得到相机坐标系下的位置坐标(x e3,y e3,z e3,1)。 S1033, the electronic device is based on the position coordinates (x e1 , y e1 , z e1 , 1) corresponding to the block B 1 in the camera coordinate system and the position coordinates (x e2 , y e2 , z ) corresponding to the block B 2 in the camera coordinate system e2 , 1), the position coordinates (x e3 , y e3 , z e3 , 1) in the camera coordinate system are obtained by calculation.
其中,(x e3,y e3,z e3,1)是预测得到的;(x e1,y e1,z e1,1)表示块B 1在相机坐标系下的位置坐标;(x e2,y e2,z e2,1)表示块B 2在相机坐标系下的位置坐标;本申请实施例中,预测块的一个顶点在预测图像帧中的位置是根据块B 1和块B 2预测得到的;本示例中,电子设备首先根据块B 1和块B 2在相机坐标下的对应的位置坐标预测得到相机坐标系下的位置坐标(x e3,y e3,z e3,1);便于之后将相机坐标系下的(x e3,y e3,z e3,1)转换到屏幕坐标系下,得到预测块其中一个顶点在屏幕坐标系下的位置坐标(x 31,y 31)。 Among them, (x e3 , y e3 , z e3 , 1) are predicted; (x e1 , y e1 , z e1 , 1) represent the position coordinates of block B 1 in the camera coordinate system; (x e2 , y e2 ) , z e2 , 1) represent the position coordinates of the block B 2 in the camera coordinate system; in the embodiment of the present application, the position of a vertex of the predicted block in the predicted image frame is predicted according to the block B 1 and the block B 2 ; In this example, the electronic device first predicts the position coordinates (x e3 , y e3 , z e3 , 1) under the camera coordinate system according to the corresponding position coordinates of the block B 1 and the block B 2 under the camera coordinates; (x e3 , y e3 , z e3 , 1) in the coordinate system is converted to the screen coordinate system, and the position coordinates (x 31 , y 31 ) of one vertex of the prediction block in the screen coordinate system are obtained.
其中,(x e1,y e1,z e1,1)和(x e2,y e2,z e2,1)中最后一个分量均为1,仅便于计算。相机坐标系是三维坐标系,电子设备可以根据相机坐标系下的(x e1,y e1,z e1)和(x e2,y e2,z e2)计算得到(x e3,y e3,z e3),进而得到(x e3,y e3,z e3,1)。 Wherein, the last components in (x e1 , y e1 , z e1 , 1) and (x e2 , y e2 , z e2 , 1) are all 1, which is only convenient for calculation. The camera coordinate system is a three-dimensional coordinate system, and the electronic device can calculate (x e3 , y e3 , z e3 ) according to (x e1 , y e1 , z e1 ) and (x e2 , y e2 , z e2 ) in the camera coordinate system , and then get (x e3 , y e3 , z e3 , 1).
图像帧f 1在数据流中位于图像帧f 2之前。块B 1在屏幕坐标系下的位置坐标为A 1(x e1,y e1,z e1),块B 2在相机坐标系下对应的位置点A 2(x e2,y e2,z e2)。电子设备可以计算出A 1至A 2的位移向量β 1。之后,确定A 3(x e3,y e3,z e3)等于参考块在相机坐标系下的位置坐标(若参考块为块B 1,则参考块在相机坐标系下对应的位置坐标为点A 1;若参考块为块B 2,则参考块在相机坐标系下对应的位置坐标为点A 2)加上第一比例的位移向量β 1;第一比例等于:预测图像帧在数据流中的时间点减去参考图像帧在数据流中的时间点,与,图像帧f 2在数据流中的时间点减去图像帧f 1在数据流中的时间点,的比值。 Image frame f1 precedes image frame f2 in the data stream. The position coordinates of the block B 1 in the screen coordinate system are A 1 (x e1 , y e1 , z e1 ), and the block B 2 corresponds to the position point A 2 (x e2 , y e2 , z e2 ) in the camera coordinate system. The electronic device can calculate the displacement vector β 1 of A 1 to A 2 . After that, it is determined that A 3 (x e3 , y e3 , z e3 ) is equal to the position coordinates of the reference block in the camera coordinate system (if the reference block is block B 1 , the corresponding position coordinates of the reference block in the camera coordinate system are point A 1 ; if the reference block is block B 2 , the position coordinate corresponding to the reference block in the camera coordinate system is point A 2 ) plus the displacement vector β 1 of the first scale; the first scale is equal to: the predicted image frame is in the data stream The ratio of the time point of the reference image frame in the data stream minus the time point of the reference image frame in the data stream, and the time point of the image frame f 2 in the data stream minus the time point of the image frame f 1 in the data stream.
举例来说,请参阅图41B,图41B示意了本申请实施例中图像帧f 1和图像帧f 2中一组相互匹配的块,块B 1和块B 2。请参阅图41C,将图41B中的块B 1和块B 2置于屏幕坐标系中,得到图41C所示的示意图。请参阅图41D,图41D是本申请实施例提供的一种相机坐标系的 示意图。图41D中包括块B 1在相机坐标系下对应的位置点A 1(x e1,y e1,z e1),块B 2在相机坐标系下对应的位置点A 2(x e2,y e2,z e2)。电子设备可以计算出A 1至A 2的位移向量β 1(x e2-x e1,y e2-y e1,z e2-z e1)。记预测图像帧为f 3。(1)请参阅图41E,若图像帧f 1,图像帧f 2和图像帧f 3如图41E所示的位置关系一:图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 3,图像帧f 3在数据流中对应的时间点为t 2,则可以设置图像帧f 1为参考图像帧,即块B 1为参考块;第一比例等于(t 2-t 1)与(t 3-t 1)的比值,则可以确定出:位移向量β 2=(t 2-t 1)/(t 3-t 11,则A 3(x e3,y e3,z e3)=(x e1,y e1,z e1)+(t 2-t 1)/(t 3-t 11。(2)请参阅图41F,若图像帧f 1,图像帧f 2和图像帧f 3如图41F所示的位置关系二:图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 2,图像帧f 3在数据流中对应的时间点为t 3;则可以设置图像帧f 2为参考图像帧,即块B 2为参考块;第一比例等于(t 3-t 2)与(t 2-t 1)的比值,则可以确定出:位移向量β 2=(t 3-t 2)/(t 2-t 11,则A 3(x e3,y e3,z e3)=(x e2,y e2,z e2)+(t 3-t 2)/(t 2-t 11For example, please refer to FIG. 41B . FIG. 41B illustrates a set of mutually matched blocks, block B 1 and block B 2 , in the image frame f 1 and the image frame f 2 in the embodiment of the present application. Referring to FIG. 41C , the block B 1 and block B 2 in FIG. 41B are placed in the screen coordinate system to obtain the schematic diagram shown in FIG. 41C . Please refer to FIG. 41D. FIG. 41D is a schematic diagram of a camera coordinate system provided by an embodiment of the present application. Figure 41D includes the position point A 1 (x e1 , y e1 , z e1 ) corresponding to the block B 1 in the camera coordinate system, and the position point A 2 (x e2 , y e2 , y e2 ) corresponding to the block B 2 in the camera coordinate system, z e2 ). The electronic device can calculate displacement vectors β 1 (x e2 -x e1 , y e2 -y e1 , z e2 -z e1 ) of A 1 to A 2 . Denote the predicted image frame as f 3 . (1) Please refer to Fig. 41E, if the image frame f 1 , the image frame f 2 and the image frame f 3 have the positional relationship 1 shown in Fig. 41E: the time point corresponding to the image frame f 1 in the data stream is t 1 , the image The time point corresponding to the frame f 2 in the data stream is t 3 , and the time point corresponding to the image frame f 3 in the data stream is t 2 , then the image frame f 1 can be set as the reference image frame, that is, the block B 1 is the reference block ; the first ratio is equal to the ratio of (t 2 -t 1 ) to (t 3 -t 1 ), then it can be determined: displacement vector β 2 =(t 2 -t 1 )/(t 3 -t 11 , then A 3 (x e3 , y e3 , z e3 )=(x e1 , y e1 , z e1 )+(t 2 -t 1 )/(t 3 -t 11 . (2) Please refer to Fig. 41F, if the image frame f 1 , the image frame f 2 and the image frame f 3 have the positional relationship 2 shown in Fig. 41F: the time point corresponding to the image frame f 1 in the data stream is t 1 , and the image The time point corresponding to the frame f 2 in the data stream is t 2 , and the time point corresponding to the image frame f 3 in the data stream is t 3 ; then the image frame f 2 can be set as the reference image frame, that is, the block B 2 is the reference block ; the first ratio is equal to the ratio of (t 3 -t 2 ) to (t 2 -t 1 ), then it can be determined: displacement vector β 2 =(t 3 -t 2 )/(t 2 -t 11 , then A 3 (x e3 , y e3 , z e3 )=(x e2 , y e2 , z e2 )+(t 3 -t 2 )/(t 2 -t 11 .
S1034,电子设备根据将相机坐标系下的(x e3,y e3,z e3,1)转换到屏幕坐标系下,得到(x 31,y 31)。 S1034 , the electronic device converts (x e3 , y e3 , z e3 , 1) in the camera coordinate system to the screen coordinate system to obtain (x 31 , y 31 ).
具体的,由相机坐标系转换到屏幕坐标系是步骤S1041中的整个过程的逆变换,具体可以由如下步骤完成:Specifically, the transformation from the camera coordinate system to the screen coordinate system is the inverse transformation of the entire process in step S1041, which can be completed by the following steps:
Figure PCTCN2021106928-appb-000013
Figure PCTCN2021106928-appb-000013
其中,w c1=-z e1。根据w c1=-z e1和[x c3y c3z c3w c3]计算得到归一化坐标(x n3,y n3,z n3,w n3);根据归一化坐标(x n3,y n3,z n3,w n3)和屏幕的分辨率为(Sw,Sh)将就散得到屏幕坐标系下的(x 31,y 31)。 where w c1 =-z e1 . According to w c1 =-z e1 and [x c3 y c3 z c3 w c3 ], the normalized coordinates (x n3 , y n3 , z n3 , w n3 ) are calculated; according to the normalized coordinates (x n3 , y n3 , z n3 , w n3 ) and the screen resolution (Sw, Sh) will be scattered to obtain (x 31 , y 31 ) in the screen coordinate system.
其中,归一化坐标视为在归一化坐标系中的坐标。Among them, the normalized coordinates are regarded as coordinates in the normalized coordinate system.
需要说明的是,本申请实施例中的屏幕坐标系,归一化坐标,裁剪坐标系,相机坐标系的解释说明可以参阅书:第七版的《OpenGL超级宝典》的第四章节,3D图形计算章节中,OpenGL中的坐标空间的解释说明。(英文名称:OpenGLSuperBible,Chapter 4,mathfor 3D Graphics,Coordinate spacesinOpenGL)。具体的,屏幕坐标系在英文原著中对应的是(Windowspace);归一化坐标系在英文原著中对应的是(Normalizeddevicecoordinate(NDC)space),裁剪坐标系在英文原著中对应的是(Clip Space),相机坐标系在英文原著中对应的是(View Space)。It should be noted that, for the explanation of the screen coordinate system, normalized coordinate system, clipping coordinate system, and camera coordinate system in the embodiments of the present application, please refer to the book: Chapter 4 of the Seventh Edition "OpenGL Super Collection", 3D In the Graphics Computing chapter, an explanation of the coordinate space in OpenGL. (English name: OpenGLSuperBible, Chapter 4, mathfor 3D Graphics, Coordinate spaces inOpenGL). Specifically, the screen coordinate system corresponds to (Windowspace) in the English original; the normalized coordinate system corresponds to (Normalizeddevicecoordinate(NDC)space) in the English original, and the clip coordinate system corresponds to (Clip Space) in the English original ), the camera coordinate system corresponds to (View Space) in the English original.
S3704,电子设备根据块B 3和块B 4的深度值、所述块B 3和所述块B 4在图像帧中位置坐标,确定预测块的顶点Yp 2在预测图像帧中对应的位置坐标(x 32,y 32)。 S3704, the electronic device determines the corresponding position coordinates of the vertex Yp 2 of the predicted block in the predicted image frame according to the depth values of the blocks B 3 and B 4 and the position coordinates of the block B 3 and the block B 4 in the image frame (x 32 , y 32 ).
需要说明的是,步骤S3705的执行过程与步骤S3704相同。将S3704中块B 1的深度值和在图像帧中的位置坐标分别替换为块B 3的深度值和在图像帧中的位置坐标;将S3704中块B 2的深度值和在图像帧中的位置坐标分别替换为块B 4的深度值和在图像帧中的位置坐标;则输出的结果即为顶点Yp 2在预测图像帧中对应的位置坐标(x 32,y 32)。 It should be noted that, the execution process of step S3705 is the same as that of step S3704. Replace the depth value of block B 1 in S3704 and the position coordinates in the image frame with the depth value of block B 3 and the position coordinates in the image frame respectively; replace the depth value of block B 2 in S3704 with the position coordinates in the image frame. The position coordinates are respectively replaced with the depth value of the block B 4 and the position coordinates in the image frame; then the output result is the position coordinates (x 32 , y 32 ) corresponding to the vertex Yp 2 in the predicted image frame.
其中,块B 3是图像帧f 1中与块B 1相邻的一个块,块B 4是图像帧f 2中与块B 2相邻的一个块,且块B 3和块B 4是相互匹配的块,对于块之间匹配的解释请参阅步骤S3703; Among them, block B 3 is a block adjacent to block B 1 in image frame f 1 , block B 4 is a block adjacent to block B 2 in image frame f 2 , and block B 3 and block B 4 are mutually Matching blocks, please refer to step S3703 for the explanation of matching between blocks;
其中,顶点Yp 2相对于预测块的位置和Yp 1相对于预测块的位置不同。 The position of the vertex Yp 2 relative to the prediction block is different from the position of the vertex Yp 1 relative to the prediction block.
由于块B 1和块B 2是相互匹配的块,块B 3和块B 4是相互匹配的块,块B 1和块B 3相邻,块B 2和块B 4相邻;因此,块B 3相对于块B 1的位置和块B 4相对于块B 2的位置相同。本申请实施例中,预测块的顶点Yp 2与块B3和块B4具有预设置的关联关系;举例来说,顶点Yp 2为预测块右上角的顶点,则块B 3是块B 1右侧的块。(需要说明的是,本申请实施例中,预测块的顶点Yp 1是由块B 1和块B 2确定出的,且预测块的颜色数据是根据块B 1和/或块B 2的颜色数据确定出的,因此本示例中顶点Yp 1表示预测块中的一个顶点;本示例中预测块的顶点Yp 2是根据与块B 1和块B 2相邻的块确定出的,在块为正方形的情况下,Yp 2可以表示预测块中顶点Yp 1之外的另外三个顶点中的任意一个)。 Since block B 1 and block B 2 are mutually matched blocks, block B 3 and block B 4 are mutually matched blocks, block B 1 and block B 3 are adjacent, and block B 2 and block B 4 are adjacent; therefore, the block The position of B3 relative to block B1 is the same as that of block B4 relative to block B2 . In the embodiment of the present application, the vertex Yp 2 of the prediction block has a preset association relationship with the block B3 and the block B4; for example, the vertex Yp 2 is the vertex in the upper right corner of the prediction block, then the block B 3 is the right side of the block B 1 block. (It should be noted that, in this embodiment of the present application, the vertex Yp 1 of the prediction block is determined by block B 1 and block B 2 , and the color data of the prediction block is based on the color of block B 1 and/or block B 2 Therefore, the vertex Yp 1 in this example represents a vertex in the prediction block; the vertex Yp 2 of the prediction block in this example is determined according to the blocks adjacent to the block B 1 and the block B 2 , and the block is In the case of a square, Yp 2 can represent any one of the other three vertices in the prediction block other than the vertex Yp 1 ).
在一些实施例中,块为正方形,块的左上角的顶点在屏幕坐标系下的位置坐标视为块在屏幕系下的位置坐标。请参阅图42,图42是本申请实施例中提供的确定预测块各个顶点的示意图。预测块的顶点Yp 1表示预测块左上角的顶点。顶点Yp 1在预测的图像帧f 3中对应的位置坐标是根据块B 1左上角的顶点B 1p 1和块B 2左上角的顶点B 2p 2计算得到的。预测块的顶点Yp 2表示预测块右上角的顶点;顶点Yp 2在预测的图像帧f 3中对应的位置坐标是根据块B 3左上角的顶点B 3p 1和块B 4左上角的顶点B 4p 1计算得到的;块B 3是块B 1右侧相邻的一个块,块B 4是块B 2右侧相邻的一个块。预测块的顶点Yp 3表示预测块右下角的顶点;顶点Yp 3在预测的图像帧f 3中对应的位置坐标是根据块B 5左上角的顶点B 5p 1和块B 6左上角的顶点B 6p 1计算得到的;块B 5的左上角的顶点与是块B 1右下角的顶点重合,块B 6的左上角的顶点与块B 2右下角的顶点重合。预测块的顶点Yp 4表示预测块左下角的顶点;顶点Yp 4在预测的图像帧f 3中的位置坐标是根据块B 7左上角的顶点B 7p 1和块B 8左上角的顶点B 8p 1计算得到的;块B 7的左上角的顶点与是块B 1左下角的顶点重合,块B 8的左上角的顶点与块B 2左下角的顶点合。 In some embodiments, the block is a square, and the position coordinates of the upper left corner of the block in the screen coordinate system are regarded as the position coordinates of the block in the screen system. Please refer to FIG. 42. FIG. 42 is a schematic diagram of determining each vertex of a prediction block provided in an embodiment of the present application. The vertex Yp 1 of the prediction block represents the vertex of the upper left corner of the prediction block. The corresponding position coordinates of the vertex Yp 1 in the predicted image frame f 3 are calculated according to the vertex B 1 p 1 in the upper left corner of the block B 1 and the vertex B 2 p 2 in the upper left corner of the block B 2 . The vertex Yp 2 of the prediction block represents the vertex of the upper right corner of the prediction block; the corresponding position coordinates of the vertex Yp 2 in the predicted image frame f 3 are based on the vertex B 3 p 1 of the upper left corner of the block B 3 and the vertex of the upper left corner of the block B 4 B 4 p 1 is calculated; block B 3 is a block adjacent to the right of block B 1 , and block B 4 is a block adjacent to the right of block B 2 . The vertex Yp 3 of the prediction block represents the vertex of the lower right corner of the prediction block; the corresponding position coordinates of the vertex Yp 3 in the predicted image frame f 3 are based on the vertex B 5 p 1 of the upper left corner of the block B 5 and the vertex of the upper left corner of the block B 6 Calculated by B 6 p 1 ; the top left vertex of block B 5 coincides with the bottom right vertex of block B 1 , and the top left vertex of block B 6 coincides with the bottom right vertex of block B 2 . The vertex Yp 4 of the prediction block represents the vertex of the lower left corner of the prediction block; the position coordinates of the vertex Yp 4 in the predicted image frame f 3 are based on the vertex B 7 p 1 of the upper left corner of the block B 7 and the vertex B of the upper left corner of the block B 8 8 calculated by p 1 ; the vertex of the upper left corner of block B 7 coincides with the vertex of the lower left corner of block B 1 , and the vertex of the upper left corner of block B 8 is coincident with the vertex of the lower left corner of block B 2 .
S3705,电子设备根据参考块的颜色数据和预测块的顶点Yp 1和顶点Yp 2在预测图像帧中的位置坐标生成预测图像帧。 S3705, the electronic device generates the predicted image frame according to the color data of the reference block and the position coordinates of the vertex Yp 1 and the vertex Yp 2 of the predicted block in the predicted image frame.
具体的,电子设备首先根据参考块的颜色数据和预测块的顶点Yp 1和顶点Yp 2生成预测块;由于预测图像帧是由多个预测块组成的,因此可根据多个预测块生成预测图像帧。 Specifically, the electronic device first generates a prediction block according to the color data of the reference block and the vertices Yp 1 and Yp 2 of the prediction block; since the prediction image frame is composed of multiple prediction blocks, the prediction image can be generated according to the multiple prediction blocks frame.
其中,颜色数据具体可以指像素的颜色值,例如像素的RGB值。颜色数据可以存储在FBO的颜色附件中。The color data may specifically refer to the color value of the pixel, for example, the RGB value of the pixel. Color data can be stored in the FBO's color attachment.
具体的,参考块和预测块的顶点相互对应,电子设备根据顶点的对应关系、块中像素相对顶点的位置关系和参考块的颜色数据,生成预测块。参考块左上角的顶点与预测块左上角的顶点对应,参考块右上角的顶点与预测块右上角的顶点对应,参考块右下角的顶点与预测块右下角的顶点对应,参考块左下角的顶点与预测块左下角的顶点对应;之后按照上述对应关系将参考块中的显示内容置于预测块的顶点构成的区域内,生成预测块;具体的,电子设备需对参考块中的显示内容执行以下操作中的一项或多项:拉伸,缩小。举例来说,在参考块为块B 1的情况下,请参阅图43,电子设备根据块B 1的顶点和预测块的顶点之间的关系将块B 1的颜色数据(显示内容)映射到图像帧f 3中,生成图像帧f 3中的预测块。需要说明的是, 上述过程在一些实施例中称为“贴图”;即将块B 1的纹理贴图到预测块的四个顶点中的过程;具体的,贴图过程中电子设备是以三角形的来进行贴图的,因此,可将块B 1拆分为两个等边直角三角形,将预测块拆分为两个三角形;之后根据顶点之间的对应关系将块B 1中的两个三角形中的内容分别贴图到预测块的两个三角形中。 Specifically, the vertices of the reference block and the predicted block correspond to each other, and the electronic device generates the predicted block according to the corresponding relationship of the vertices, the positional relationship of the pixels in the block relative to the vertices, and the color data of the reference block. The vertex in the upper left corner of the reference block corresponds to the vertex in the upper left corner of the prediction block, the vertex in the upper right corner of the reference block corresponds to the vertex in the upper right corner of the prediction block, the vertex in the lower right corner of the reference block corresponds to the vertex in the lower right corner of the prediction block, and the vertex in the lower left corner of the reference block corresponds to the vertex in the upper right corner of the prediction block. The vertices correspond to the vertices in the lower left corner of the prediction block; then the display content in the reference block is placed in the area formed by the vertices of the prediction block according to the above-mentioned corresponding relationship, and the prediction block is generated; Do one or more of the following: stretch, shrink. For example, in the case where the reference block is block B1, referring to FIG. 43, the electronic device maps the color data ( display content ) of block B1 to the In image frame f3 , a prediction block in image frame f3 is generated. It should be noted that the above process is called "mapping" in some embodiments; that is, the process of mapping the texture of block B 1 to the four vertices of the predicted block; specifically, the electronic device performs the mapping process in triangles Therefore, the block B 1 can be split into two equilateral right triangles, and the prediction block can be split into two triangles; then the contents of the two triangles in block B 1 can be split according to the correspondence between the vertices Map to the two triangles of the prediction block respectively.
可选的,电子设备可以根据参考块和预测块四个顶点构成的四对坐标,得到两个块对应的单应性变换公式,其中,参考图像帧中的坐标和预测图像帧中对应的一对顶点的坐标为一对坐标,块对应的单应性变换公式用于表示块的像素在参考图像帧中的坐标和预测帧中的坐标的对应关系。可以理解的,电子设备对参考图像帧中的每一个块进行计算,可以得到每一个块对应的单应性变换公式。Optionally, the electronic device can obtain the homography transformation formula corresponding to the two blocks according to the four pairs of coordinates formed by the four vertices of the reference block and the predicted block, wherein the coordinates in the reference image frame and the corresponding one in the predicted image frame are obtained. The coordinates of the pair of vertices are a pair of coordinates, and the homography transformation formula corresponding to the block is used to represent the correspondence between the coordinates of the pixels of the block in the reference image frame and the coordinates in the predicted frame. It can be understood that the electronic device calculates each block in the reference image frame, and can obtain the homography transformation formula corresponding to each block.
具体的,若参考块为块B 1;块B 1的四个顶点分别为顶点B 1p 1,顶点B 1p 2,顶点B 1p 3和顶点B 1p 4;预测块的四个顶点分别是:顶点Yp 1,顶点Yp 2,顶点Yp 3,顶点Yp 4;顶点B 1p 1与顶点Yp 1对应,顶点B 1p 2与顶点Yp 2对应,顶点B 1p 3与顶点Yp 3对应,顶点B 1p 4与顶点Yp 4对应;一个顶点在参考图像帧中的位置坐标和对应顶点在预测图像帧中的位置坐标为一对位置坐标,具体的,顶点B 1p 1的一对位置坐标为(x a,y a)和(x a',y a'),顶点B 1p 2的一对位置坐标为(x b,y b)和(x b',y b'),顶点B 1p 3的一对位置坐标为(x c,y c)和(x c',y c'),顶点B 1p 4的一对位置坐标为(x d,y d)和(x d',y d')。 Specifically, if the reference block is block B 1 ; the four vertices of block B 1 are respectively vertex B 1 p 1 , vertex B 1 p 2 , vertex B 1 p 3 and vertex B 1 p 4 ; the four vertices of the prediction block are They are: vertex Yp 1 , vertex Yp 2 , vertex Yp 3 , vertex Yp 4 ; vertex B 1 p 1 corresponds to vertex Yp 1 , vertex B 1 p 2 corresponds to vertex Yp 2 , vertex B 1 p 3 corresponds to vertex Yp 3 Correspondingly, vertex B 1 p 4 corresponds to vertex Yp 4 ; the position coordinate of a vertex in the reference image frame and the position coordinate of the corresponding vertex in the predicted image frame are a pair of position coordinates, specifically, a pair of position coordinates of vertex B 1 p 1 The pair of position coordinates are (x a , y a ) and (x a ', y a '), and the pair of position coordinates of vertex B 1 p 2 are (x b , y b ) and (x b ', y b ') , a pair of position coordinates of vertex B 1 p 3 are (x c , y c ) and (x c ', y c '), and a pair of position coordinates of vertex B 1 p 4 are (x d , y d ) and ( x d ',y d ').
电子设备可以将块B 1的4对位置坐标分别输入单应性变换公式,得到块B 1对应的方程组,其中,该方程组包括4个方程。其中,单应性变换公式如下: The electronic device may input the four pairs of position coordinates of the block B 1 into the homography transformation formula respectively to obtain an equation group corresponding to the block B 1 , where the equation group includes four equations. Among them, the homography transformation formula is as follows:
Figure PCTCN2021106928-appb-000014
Figure PCTCN2021106928-appb-000014
其中,(x 1,y 1)为顶点在参考块中的位置坐标,在预测图像帧中与参考块中的顶点(x 1,y 1)对应的顶点的位置坐标为(x 1',y 1'),H为未知的单应性变换矩阵。其中,单应性变换矩阵如下: Among them, (x 1 , y 1 ) is the position coordinate of the vertex in the reference block, and the position coordinate of the vertex corresponding to the vertex (x 1 , y 1 ) in the reference block in the predicted image frame is (x 1 ', y 1 '), H is the unknown homography transformation matrix. Among them, the homography transformation matrix is as follows:
Figure PCTCN2021106928-appb-000015
Figure PCTCN2021106928-appb-000015
进一步的,电子设备通过解块B 1对应的方程组,可以得到块B 1对应的单应性矩阵H A,再将块B 1对应的单应性矩阵H A代入单应性变换公式中,可以得到块B 1对应的单应性变换公式,块B 1对应的单应性变换公式如下: Further, the electronic device can obtain the homography matrix H A corresponding to the block B 1 by solving the equation system corresponding to the block B 1 , and then substitute the homography matrix H A corresponding to the block B 1 into the homography transformation formula, The homography transformation formula corresponding to block B 1 can be obtained, and the homography transformation formula corresponding to block B 1 is as follows:
Figure PCTCN2021106928-appb-000016
Figure PCTCN2021106928-appb-000016
其中,块B 1对应的单应性变换公式用于表示块B 1的像素在参考图像帧中的位置坐标和预测图像帧中的位置坐标的对应关系。 The homography transformation formula corresponding to the block B 1 is used to represent the correspondence between the position coordinates of the pixels of the block B 1 in the reference image frame and the position coordinates in the predicted image frame.
之后,电子设备根据块的像素在参考图像帧中的位置坐标和在预测图像帧中的位置坐标的对应关系,确定参考块的像素在预测图像帧中的位置坐标。After that, the electronic device determines the position coordinates of the pixels of the reference block in the predicted image frame according to the correspondence between the position coordinates of the pixels of the block in the reference image frame and the position coordinates in the predicted image frame.
其中,电子设备可以将参考块中的像素在参考图像帧中的位置坐标输入该块对应的单应性变换公式,得到该像素在预测帧中的位置坐标。The electronic device may input the position coordinates of the pixels in the reference block in the reference image frame into the homography transformation formula corresponding to the block to obtain the position coordinates of the pixels in the predicted frame.
之后,电子设备根据参考块的中每个像素的颜色数据和每个像素在预测图像帧中的位置坐标将颜色数据映射到预测图像帧中的位置坐标上,生成预测块。After that, the electronic device maps the color data to the position coordinates in the predicted image frame according to the color data of each pixel in the reference block and the position coordinates of each pixel in the predicted image frame to generate a predicted block.
具体的,在图像帧f 1、图像帧f 2和图像帧f 3之间的位置关系如图41E所示的位置关系一的情况下,根据图像帧f 1、图像帧f 2生成的图像帧f 3如图44A所示;为了便于观察图像帧f 1,图像帧f 2和图像帧f 3中汽车的位置变化和汽车的缩放程度,将图像帧f 1,图像帧f 2和图像帧f 3中的汽车放入同一坐标系下,得到图44B。 Specifically, in the case of the positional relationship between the image frame f 1 , the image frame f 2 and the image frame f 3 as shown in the positional relationship 1 in FIG. 41E , the image frame generated according to the image frame f 1 and the image frame f 2 f 3 is shown in Fig. 44A; in order to facilitate the observation of image frame f 1 , image frame f 2 and image frame f 3 , the position change of the car and the zoom degree of the car, image frame f 1 , image frame f 2 and image frame f The car in 3 is placed in the same coordinate system, resulting in Figure 44B.
具体的,在图像帧f 1、图像帧f 2和图像帧f 3之间的位置关系如图41F所示的位置关系二的情况下,根据图像帧f 1、图像帧f 2生成的图像帧f 3如图45A所示;为了便于观察图像帧f 1,图像帧f 2和图像帧f 3中汽车的位置变化和汽车的缩放程度,将图像帧f 1,图像帧f 2和图像帧f 3中的汽车放入同一坐标系下,得到图45B。 Specifically, in the case of the positional relationship between the image frame f 1 , the image frame f 2 and the image frame f 3 as shown in the second positional relationship in FIG. 41F , the image frame generated according to the image frame f 1 and the image frame f 2 f 3 is shown in Fig. 45A; in order to facilitate the observation of image frame f 1 , image frame f 2 and image frame f 3 , the position change of the car and the zoom degree of the car, image frame f 1 , image frame f 2 and image frame f The car in 3 is placed in the same coordinate system, resulting in Figure 45B.
下面实施例介绍本申请实施例提供的一种图像帧生成方法。如图46A所示,该方法可以包括:The following embodiments introduce an image frame generation method provided by the embodiments of the present application. As shown in Figure 46A, the method may include:
S201,电子设备针对参考图像帧进行块划分,得到参考块。S201, the electronic device performs block division on a reference image frame to obtain a reference block.
其中,划分后的图像帧f 1中包括块B 1,图像帧f 2中包括块B 2,参考块是块B 1和块B 2中的一个块,块B 3是参考块缩放得到的,块B 3指的是预测图像帧中的预测块。 The divided image frame f 1 includes block B 1 , the image frame f 2 includes block B 2 , the reference block is one of block B 1 and block B 2 , and block B 3 is obtained by scaling the reference block, Block B3 refers to the predicted block in the predicted image frame.
具体解释说明请参阅S3701。For specific explanations, please refer to S3701.
S202,电子设备确定参考块到块B 3的预测位移向量,预测位移向量是指图像帧所在平面内的位移向量。 S202, the electronic device determines a predicted displacement vector from the reference block to block B3 , where the predicted displacement vector refers to a displacement vector in the plane where the image frame is located.
其中,块B 3中的显示内容是根据参考块的内容缩放得到的;块B 3在图像帧f 3中的位置坐标是根据参考块的在参考图像帧中的坐标平移得到的。图像帧f 3是预测图像帧,即块B 3是预测得到。 The display content in block B3 is obtained by scaling according to the content of the reference block; the position coordinates of block B3 in the image frame f3 are obtained by shifting the coordinates of the reference block in the reference image frame. Image frame f3 is a predicted image frame, ie block B3 is predicted.
其中,电子设备针对图39A所示的图像帧f 1和图像帧f 2执行块匹配算法,确定出块B 1匹配的块B 2,块B 1是图像帧f 1中的一个块,块B 2是图像帧f 2中的一个块。 The electronic device performs a block matching algorithm on the image frame f 1 and the image frame f 2 shown in FIG. 39A , and determines the block B 2 matched by the block B 1 , the block B 1 is a block in the image frame f 1 , and the block B 2 is a block in image frame f2 .
参考块可以是图像帧f 1中的块B 1,也可以是图像帧f 2中的块B 2。具体的,参考块可以是预设置的。举例来说,图像帧f 1在数据流中位于图像帧f 2之前;可以设置参考块为图像帧f 1中的块,即参考块为块B 1;也可以设置参考块为图像帧f 2中的块,即参考块为块B 2The reference block may be the block B 1 in the image frame f 1 or the block B 2 in the image frame f 2 . Specifically, the reference block may be preset. For example, the image frame f 1 is located before the image frame f 2 in the data stream; the reference block can be set as the block in the image frame f 1 , that is, the reference block is block B 1 ; the reference block can also be set as the image frame f 2 The block in , that is, the reference block is block B 2 .
可选的,参考块可以是根据图像帧f 3在数据流中相对于图像帧f 1和图像帧f 2的位置确定的,可以包括以下两种情况:(1)若图像帧f 3位于图像帧f 1和图像帧f 2之间,则参考块为在数据流中靠前的图像帧f 1中的块,如图46C所示,位置关系一:在数据流中图像帧f 1位于图像帧f 3之前,图像帧f 3位于图像帧f 2之前,参考块为图像帧f 1中的块B 1;(2)若图像帧f 3位于图像帧f 1和图像帧f 2之后,则参考块为在数据流中靠后的图像帧f 2中的块,如图46D所示,位置关系二:在数据流中图像帧f 1位于图像帧f 2之前,图像帧f 2位于图像帧f 3之前,参考块为图像帧f 2中的块B 2。需要说明的是,图像帧f 3在数据流中的位置可以根据应用场景和用户需求确定,例如,为提升游戏的帧率,电子设备可以根据前两帧图像预测生成后一帧图像,该方法可以避免游戏延时太长,即图46D中的位置关系二;又例如,在处理对延时没有要求或要求较低的视频时,电子设备可以根据相邻的两帧图像帧生成中间的图像帧,该方法生成的预测帧更加准确,即图46C中的位置关系一。 Optionally, the reference block may be determined according to the position of the image frame f3 relative to the image frame f1 and the image frame f2 in the data stream, which may include the following two cases: ( 1 ) If the image frame f3 is located in the image frame f3 Between the frame f1 and the image frame f2, the reference block is the block in the image frame f1 earlier in the data stream, as shown in Figure 46C, positional relationship 1 : the image frame f1 is located in the image frame f1 in the data stream. Before frame f3 , image frame f3 is located before image frame f2, and the reference block is block B1 in image frame f1 ; ( 2 ) if image frame f3 is located after image frame f1 and image frame f2 , then The reference block is the block in the image frame f 2 that is later in the data stream, as shown in Figure 46D, the positional relationship 2: in the data stream, the image frame f 1 is located before the image frame f 2 , and the image frame f 2 is located in the image frame Before f3 , the reference block is block B2 in image frame f2 . It should be noted that the position of the image frame f3 in the data stream can be determined according to the application scenario and user requirements. For example, in order to improve the frame rate of the game, the electronic device can predict and generate the next frame of the image according to the first two frames of images. It can avoid the game delay being too long, that is, the position relationship 2 in Figure 46D; for example, when processing a video with no or low requirements for delay, the electronic device can generate an intermediate image according to two adjacent image frames. frame, the predicted frame generated by this method is more accurate, that is, the position relationship 1 in FIG. 46C.
电子设备可以根据块B 1和块B 2在图像帧所在的平面中的坐标确定出参考块的预测位移向量。需要说明的是,电子设备在生成或显示图像帧时,图像帧中每个像素都有对应的坐标。电子设备可以根据块中像素的坐标确定出块的坐标;根据块B 1的坐标和块B 2的坐标确定出参考块的预测位移向量。具体的,块的坐标可以是根据以下三种方式中的任意一种确定出的:(1)块中包含的所有像素的坐标取平均值得到的坐标作为块的坐标;(2)块的中心点(像素)的坐标作为块的坐标;(3)块的指定顶点对应的坐标作为块的坐标,例如,块的左上角的顶点的坐标作为块的坐标。 The electronic device may determine the predicted displacement vector of the reference block according to the coordinates of the block B 1 and the block B 2 in the plane where the image frame is located. It should be noted that when the electronic device generates or displays an image frame, each pixel in the image frame has corresponding coordinates. The electronic device may determine the coordinates of the block according to the coordinates of the pixels in the block; and determine the predicted displacement vector of the reference block according to the coordinates of the block B 1 and the coordinates of the block B 2 . Specifically, the coordinates of the block can be determined according to any one of the following three ways: (1) the coordinates obtained by averaging the coordinates of all pixels included in the block are taken as the coordinates of the block; (2) the center of the block The coordinates of the point (pixel) are used as the coordinates of the block; (3) the coordinates corresponding to the specified vertices of the block are used as the coordinates of the block, for example, the coordinates of the vertex of the upper left corner of the block are used as the coordinates of the block.
具体的,图像帧f 1中包括块B 1,块B 1在图像帧所在的平面中的坐标为(x 1,y 1);图像帧f 2中包括块B 2,块B 2在图像帧所在的平面中的坐标为(x 2,y 2);为便于查看块B 1与块B 2之间的关系,将图像帧f 1中包括块B 1的汽车图像和图像帧f 2中包括块B 2的汽车图像,置于图46E所示的直角坐标系中,得到图46B。如图46B所示,块B 1至块B 2的位移向量为β 1=(x 2-x 1,y 2-y 1)。 Specifically, the image frame f 1 includes a block B 1 , and the coordinates of the block B 1 in the plane where the image frame is located are (x 1 , y 1 ); the image frame f 2 includes a block B 2 , and the block B 2 is in the image frame The coordinates in the plane where it is located are (x 2 , y 2 ); for the convenience of viewing the relationship between block B 1 and block B 2 , the image frame f 1 includes the car image of block B 1 and the image frame f 2 includes The car image of block B2, placed in the Cartesian coordinate system shown in Figure 46E, results in Figure 46B. As shown in FIG. 46B , the displacement vector of block B 1 to block B 2 is β 1 =(x 2 -x 1 , y 2 -y 1 ).
如图46C所示,图像帧f 1,f 2,f 3在数据流中的相对位置为位置关系一的情况下,图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 3,图像帧f 3在数据流中对应的时间点为t 2;参考块为图像帧f 1中的块B 1。计算图像帧f 3对应的时间点t 2与图像帧f 1对应的时间点t 1之间的差值得到差值d 1=(t 2-t 1);计算图像帧f 2对应的时间点t 3与图像帧f 1对应的时间点t 1之间的差值得到差值d 2=(t 3-t 1);得到d 1与d 2的比值d 1/d 2。假设图像帧中的物体在t 1至t 3的时间段内为匀速运动,可以确定参考块的预测位移向量β 2=d 1/d 21=(t 2-t 1)/(t 3-t 1)*(x 2-x 1,y 2-y 1)=((t 2-t 1)/(t 3-t 1)*(x 2-x 1),(t 2-t 1)/(t 3-t 1)*(y 2-y 1))。 As shown in FIG. 46C , when the relative positions of the image frames f 1 , f 2 , and f 3 in the data stream are position relationship 1, the time point corresponding to the image frame f 1 in the data stream is t 1 , and the image frame f 2 The corresponding time point in the data stream is t 3 , the corresponding time point of the image frame f 3 in the data stream is t 2 ; the reference block is the block B 1 in the image frame f 1 . Calculate the difference between the time point t 2 corresponding to the image frame f 3 and the time point t 1 corresponding to the image frame f 1 to obtain the difference value d 1 =(t 2 -t 1 ); calculate the time point corresponding to the image frame f 2 The difference between t 3 and the time point t 1 corresponding to the image frame f 1 is obtained as the difference d 2 =(t 3 -t 1 ); the ratio d 1 /d 2 of d 1 and d 2 is obtained. Assuming that the object in the image frame is moving at a uniform speed in the time period from t 1 to t 3 , the predicted displacement vector of the reference block can be determined as β 2 =d 1 /d 21 =(t 2 -t 1 )/(t 3 -t 1 )*(x 2 -x 1 , y 2 -y 1 )=((t 2 -t 1 )/(t 3 -t 1 )*(x 2 -x 1 ), (t 2 -t 1 )/(t 3 -t 1 )*(y 2 -y 1 )).
如图46D所示,在图像帧f 1,f 2,f 3在数据流中的相对位置为位置关系二的情况下,图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 2,图像帧f 3在数据流中对应的时间点为t 3;参考块为图像帧f 2中的块B 2。计算图像帧f 3对应的时间点t 3与图像帧f 2对应的时间点t 1之间的差值得到差值d 3=(t 3-t 2);计算图像帧f 2对应的时间点t 2与图像帧f 1对应的时间点t 1之间的差值得到差值d 4=(t 2-t 1);得到d 3与d 4的比值d 3/d 4。假设图像帧中的物体在t 1至t 3的时间段内为匀速运动的情况下,可以确定参考块的预测位移向量β 2=d 3/d 41=(t 3-t 2)/t 2-t 1)*(x 2-x 1,y 2-y 1)=((t 3-t 2)/t 2-t 1)*(x 2-x 1),(t 3-t 2)/t 2-t 1)*(y 2-y 1))。 As shown in FIG. 46D , when the relative positions of the image frames f 1 , f 2 , and f 3 in the data stream are position relationship two, the time point corresponding to the image frame f 1 in the data stream is t 1 , and the image frame The time point corresponding to f 2 in the data stream is t 2 , and the time point corresponding to the image frame f 3 in the data stream is t 3 ; the reference block is block B 2 in the image frame f 2 . Calculate the difference between the time point t 3 corresponding to the image frame f 3 and the time point t 1 corresponding to the image frame f 2 to obtain the difference value d 3 =(t 3 -t 2 ); calculate the time point corresponding to the image frame f 2 The difference between t 2 and the time point t 1 corresponding to the image frame f 1 obtains the difference d 4 =(t 2 −t 1 ); obtains the ratio d 3 /d 4 of d 3 and d 4 . Assuming that the object in the image frame is moving at a constant speed in the time period from t 1 to t 3 , the predicted displacement vector of the reference block can be determined as β 2 =d 3 /d 41 =(t 3 -t 2 ) /t 2 -t 1 )*(x 2 -x 1 , y 2 -y 1 )=((t 3 -t 2 )/t 2 -t 1 )*(x 2 -x 1 ),(t 3 - t 2 )/t 2 -t 1 )*(y 2 -y 1 )).
需要说明的是,图像帧在数据流中对应的时间点可以表示根据数据流显示图像帧的时间点;例如当前数据流为时长30秒的视频数据,若图像帧f 1在数据流中对应的时间点为第15秒,图像帧f 2在数据流中对应的时间点为17秒;则电子设备播放该视频时,在视频播放到第15秒时显示图像帧f 1,在视频播放到第17秒时显示图像帧f 2It should be noted that the time point corresponding to the image frame in the data stream may represent the time point at which the image frame is displayed according to the data stream; for example, the current data stream is video data with a duration of 30 seconds, if the image frame f 1 corresponds to the data stream The time point is the 15th second, and the corresponding time point of the image frame f 2 in the data stream is 17 seconds; then when the electronic device plays the video, the image frame f 1 is displayed when the video is played to the 15th second, and the image frame f 1 is displayed when the video is played to the 15th second. Image frame f2 is displayed at 17 seconds.
可选的,若数据流中不包括图像帧的时间数据,则电子设备可以根据系统预设置的帧率,计算出显示每一帧图像帧对应的时间点,利用显示该图像帧的时间点代替该图像帧在数据流中对应的时间点;例如,电子设备预设置的帧率为30帧/秒,若数据流中包括300帧图像帧,则数据流对应的播放时长为10秒,进而电子设备可以计算出显示数据流中每一帧图像帧时的时间点;进而执行图46C和图46D所示的方法。Optionally, if the time data of the image frame is not included in the data stream, the electronic device can calculate the time point corresponding to displaying each image frame according to the frame rate preset by the system, and use the time point of displaying the image frame instead. The corresponding time point of the image frame in the data stream; for example, the preset frame rate of the electronic device is 30 frames per second, if the data stream includes 300 image frames, the corresponding playback time of the data stream is 10 seconds, and the electronic device The device can calculate the time point when each image frame in the data stream is displayed; and then execute the methods shown in FIG. 46C and FIG. 46D .
在图46C和图46D中,参考块在图像帧所在的平面的坐标上加上参考块的预测位移向量可以得到(x 3,y 3),(x 3,y 3)即为块B 3在图像帧所在的平面中的坐标;块B 3位于图像帧f 3中;块B 3在是根据参考块缩放得到的。 In FIG. 46C and FIG. 46D , the predicted displacement vector of the reference block is added to the coordinates of the plane where the image frame is located to obtain (x 3 , y 3 ), and (x 3 , y 3 ) is the block B 3 in Coordinates in the plane where the image frame is located; block B 3 is located in image frame f 3 ; block B 3 is scaled according to the reference block.
S203,电子设备根据块B 1和块B 2在Z维度的坐标,确定出块参考块到块B 3的缩放比例。 S203, the electronic device determines the scaling ratio of the block reference block to the block B3 according to the coordinates of the block B1 and the block B2 in the Z dimension.
其中,参考块到块B 3的缩放比例指的是块B 3的面积相对于参考块的面积的缩放比例。 The scaling ratio of the reference block to the block B 3 refers to the scaling ratio of the area of the block B 3 relative to the area of the reference block.
为便于更好的理解本申请实施例,首先介绍电子设备生成图像帧时应用的原理。相机拍摄得到图像帧时会产生“近大远小”的特征,即同一物体离相机越近,则该物体在生成的图像中越大。同理,本申请实施例中,图像帧的数据中包括三维数据;电子设备在生成图像帧时,可以视为电子设备首先在三维空间中根据图像帧的数据构建了三维场景,之后将三维场景投影到三维空间中到的投影平面上,生成图像帧,投影平面位于三维场景的一侧。可以理解的是,若三维场景中的物体距离投影平面越近,则该物体在图像帧中的显示面积越大;若三维场景中的物体距离投影平面越远,则该物体在图像帧中的显示面积越小。In order to facilitate a better understanding of the embodiments of the present application, a principle applied when an electronic device generates an image frame is first introduced. When the camera captures the image frame, it will produce the feature of "closer and far smaller", that is, the closer the same object is to the camera, the larger the object will be in the generated image. Similarly, in the embodiment of the present application, the data of the image frame includes three-dimensional data; when the electronic device generates the image frame, it can be considered that the electronic device firstly constructs the three-dimensional scene in the three-dimensional space according to the data of the image frame, and then converts the three-dimensional scene into the three-dimensional scene. Projecting onto the projection plane in the 3D space to generate an image frame, the projection plane is located on one side of the 3D scene. It can be understood that if the object in the 3D scene is closer to the projection plane, the display area of the object in the image frame will be larger; if the object in the 3D scene is farther from the projection plane, the object in the image frame will be displayed. The smaller the display area.
举例来说,请参阅图46E,图46E为电子设备生成图像帧时应用的原理的示意图。在图46E中建立三维直角坐标系,根据图像帧的数据构建的三维场景中包括汽车。投影平面可以是X维度和Y维度构建的平面;电子设备可以在三维空间中设置相机点camera,三维场景通过相机点camera投影到投影平面N上,三维场景中任意一点与相机点camera构成的直线与投影平面的交点即为所述任意一点投影在投影平面上的位置点。相机点camera在Z维度的坐标为z c,投影平面N在Z维度上的坐标为z n。需要说明的是,本申请实施例中,投影平面N和相机点camera在三维场景的同一侧。图46E中包括场景一和场景二;场景一和场景二中汽车上的任意一点在X维度和Y维度的坐标是相同的,仅在Z维度上坐标不同。投影平面N在Z维度上的坐标为z n;汽车上包括点p 1和点p 2;在场景一中,点p 1和点p 2在Z维度的坐标为z 5,点p 1和点p 2投影到投影平面上分别对应点p 1'和点p 2';在场景二中,点p 1和点p 2在Z维度的坐标为z 6,点p 1和点p 2投影到投影平面分别对应点p 1”和点p 2”,z 5<z 6;由于z 5<z 6,z 5-z c<z 6-z c,因此在场景一中点p 1和点p 2距离相机点camera更近;因此,根据几何知识可以确定出点p 1'和点p 2'之间的距离大于p 1”和点p 2”之间的距离;具体的,|p 2”-p 1”|/|p 2'-p 1'|=|z 5-z c|/|z 6-z c|。可见,三维空间中,在两点之间距离确定且两点构成的直线与投影平面平行的情况下,两点距离投影平面的距离越近,则投影到投影平面上的两点之间距离越远;同理,可得出三维空间中的物体距离投影平面越近,则投影到投影平面上所占的面积越大。 For example, please refer to FIG. 46E. FIG. 46E is a schematic diagram of a principle applied when an electronic device generates an image frame. A three-dimensional Cartesian coordinate system is established in FIG. 46E, and a car is included in the three-dimensional scene constructed from the data of the image frame. The projection plane can be a plane constructed by the X dimension and the Y dimension; the electronic device can set the camera point camera in the three-dimensional space, the three-dimensional scene is projected onto the projection plane N through the camera point camera, and the straight line formed by any point in the three-dimensional scene and the camera point camera The intersection point with the projection plane is the position point where the arbitrary point is projected on the projection plane. The coordinate of the camera point camera in the Z dimension is z c , and the coordinate of the projection plane N in the Z dimension is z n . It should be noted that, in the embodiment of the present application, the projection plane N and the camera point camera are on the same side of the three-dimensional scene. Figure 46E includes scene 1 and scene 2; the coordinates of any point on the car in scene 1 and scene 2 are the same in the X dimension and the Y dimension, and only the coordinates are different in the Z dimension. The coordinate of the projection plane N in the Z dimension is z n ; the car includes point p 1 and point p 2 ; in scene 1, the coordinates of point p 1 and point p 2 in the Z dimension are z 5 , point p 1 and point p 2 The projection of p 2 onto the projection plane corresponds to point p 1 ' and point p 2 'respectively; in scene 2, the coordinates of point p 1 and point p 2 in the Z dimension are z 6 , and the point p 1 and point p 2 are projected to the projection The plane corresponds to point p 1 ” and point p 2 ” respectively, z 5 <z 6 ; since z 5 <z 6 , z 5 -z c <z 6 -z c , so in scene one, point p 1 and point p 2 It is closer to the camera point camera; therefore, according to geometric knowledge, it can be determined that the distance between point p 1 ' and point p 2 ' is greater than the distance between p 1 " and point p 2 "; specifically, |p 2 "- p 1 ”|/|p 2 '-p 1 '|=|z 5 -z c |/|z 6 -z c |. It can be seen that in three-dimensional space, when the distance between two points is determined and the line formed by the two points is parallel to the projection plane, the closer the distance between the two points to the projection plane, the closer the distance between the two points projected on the projection plane. In the same way, it can be concluded that the closer the object in the three-dimensional space is to the projection plane, the larger the area occupied by the projection onto the projection plane.
本实施例中,图像帧f 3是根据图像帧f 1和图像帧f 2预测得到的,因此,可以根据图像帧f 1中块B 1和图像帧f 2中块B 2在Z维度的坐标预测得到块B 3在Z维度的坐标。具体的,请参阅图46C和图46D,图46C和图46D分别示意了两种位置关系的示意图;位置关系一和位置关系二。 In this embodiment, the image frame f 3 is predicted according to the image frame f 1 and the image frame f 2. Therefore, the coordinates of the block B 1 in the image frame f 1 and the block B 2 in the image frame f 2 in the Z dimension can be obtained according to the The prediction yields the coordinates of block B 3 in the Z dimension. Specifically, please refer to FIG. 46C and FIG. 46D. FIG. 46C and FIG. 46D respectively illustrate schematic diagrams of two kinds of positional relationships; positional relationship one and positional relationship two.
对于位置关系一:结合图46C和图46E,块B 1位于图像帧f 1中,块B 1在Z维度上的坐标为z 1;块B 2位于图像帧f 2中,块B 2在Z维度上的坐标为z 2;块B 3位于图像帧f 3中,假设块B 3在Z维度上的坐标为z 3;参考块为B 1;具体的,z 1,z 2和z 3的关系请参阅图46F。图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 3,图像帧f 3在数据流中对应的时间点为t 2;则计算图像帧f 3对应的时间点t 2与图像帧f 1对应的时间点t 1之间的差值,得到时间差值d 1=(t 2-t 1);计算图像帧f 2对应的时间点t 3与图像帧f 1对应的时间点t 1之间的差值,得到时间差值d 2=(t 3-t 1);得到d 1与d 2的比值d 1/d 2。计算块B 2与块B 1在Z维度上距离的差值,得到z 2-z 1;则z 3可以由z 1、z 2-z 1和d 1/d 2计算得到,具体的,z 3=z 1+(z 2-z 1)d 1/d 2。结合图46E,若相机点camera在Z维度的位置为z c;块B 1在Z维度的坐标与相机点camera的距离Δ 1=|z 1-z c|;块B 3对应的Z维度的坐标与相机点camera的距离Δ 2=|z 3-z c|;根据图46E可以得出的结论,三维空间中同一物体距离相机点的距离越远,投影到投影平面上的面积越小;本申请实施例中块B 1和块B 2是匹配的块,即块B 1和块B 2显示的是三维空间中同一物体;由于块B 3是根据块B 1和块B 2预测得到的,因此,块B 3,块B 1和块B 2显示的均为三 维空间中的同一物体;结合图46E,块B 3的边长L B3与块B 1的边长L B1的比值等于Δ 1与Δ 2的比值,即L B3/L B1=Δ 12。块B 3的面积S B3与块B 1的面积S B1的比值等于Δ 1与Δ 2的比值的平方,S B3/S B1=(Δ 12) 2。则在位置关系一的情况下参考块B 1缩放比例为(Δ 12) 2。将上式展开:(Δ 12) 2=(z 1-z c) 2/(z 3-z c) 2=(z 1-z c) 2/(z 1-z c+(z 2-z 1)d 1/d 2) 2=(z 1-z c) 2/(z 1-z c+(z 2-z 1)(t 2-t 1)/(t 3-t 1)) 2For positional relationship 1: in conjunction with FIG. 46C and FIG. 46E, block B 1 is located in image frame f 1 , and the coordinate of block B 1 in the Z dimension is z 1 ; block B 2 is located in image frame f 2 , and block B 2 is located in Z The coordinate in the dimension is z 2 ; the block B 3 is located in the image frame f 3 , assuming that the coordinate of the block B 3 in the Z dimension is z 3 ; the reference block is B 1 ; See Figure 46F for the relationship. The corresponding time point of the image frame f 1 in the data stream is t 1 , the corresponding time point of the image frame f 2 in the data stream is t 3 , and the corresponding time point of the image frame f 3 in the data stream is t 2 ; then calculate The difference between the time point t 2 corresponding to the image frame f 3 and the time point t 1 corresponding to the image frame f 1 , obtain the time difference value d 1 =(t 2 -t 1 ); calculate the time corresponding to the image frame f 2 The difference between the point t 3 and the time point t 1 corresponding to the image frame f 1 is obtained as the time difference d 2 =(t 3 -t 1 ); the ratio d 1 /d 2 of d 1 and d 2 is obtained. Calculate the difference between block B 2 and block B 1 in the Z dimension to obtain z 2 -z 1 ; then z 3 can be calculated from z 1 , z 2 -z 1 and d 1 /d 2 , specifically, z 3 =z 1 +(z 2 −z 1 )d 1 /d 2 . 46E, if the position of the camera point camera in the Z dimension is z c ; the distance between the coordinates of the block B 1 in the Z dimension and the camera point camera Δ 1 =|z 1 -z c |; the Z dimension corresponding to the block B 3 The distance between the coordinates and the camera point camera Δ 2 =|z 3 -z c |; according to the conclusion that can be drawn from Figure 46E, the farther the distance of the same object in the three-dimensional space from the camera point, the smaller the area projected onto the projection plane; In this embodiment of the present application, block B 1 and block B 2 are matched blocks, that is, block B 1 and block B 2 display the same object in three-dimensional space; since block B 3 is predicted based on block B 1 and block B 2 , therefore, block B 3 , block B 1 and block B 2 all show the same object in three-dimensional space; in conjunction with FIG. 46E , the ratio of the side length L B3 of block B 3 to the side length L B1 of block B 1 is equal to Δ The ratio of 1 to Δ2 , ie L B3 /L B112 . The ratio of the area S B3 of block B 3 to the area S B1 of block B 1 is equal to the square of the ratio of Δ 1 to Δ 2 , S B3 /S B1 =(Δ 12 ) 2 . Then, in the case of position relationship one, the scaling ratio of the reference block B 1 is (Δ 12 ) 2 . Expand the above formula: (Δ 12 ) 2 =(z 1 -z c ) 2 /(z 3 -z c ) 2 =(z 1 -z c ) 2 /(z 1 -z c +(z 2 -z 1 )d 1 /d 2 ) 2 =(z 1 -z c ) 2 /(z 1 -z c +(z 2 -z 1 )(t 2 -t 1 )/(t 3 -t 1 )) 2 .
对于位置关系二:结合图46D和图46E,块B 1位于图像帧f 1中,块B 1在Z维度上的坐标为z 1;块B 2位于图像帧f 2中,块B 2在Z维度上的坐标为z 2;块B 3位于图像帧f 3中,假设块B 3在Z维度上的坐标为z 3;参考块为B 2;具体的,z 1,z 2和z 3的关系请参阅图46H。图像帧f 1在数据流中对应的时间点为t 1,图像帧f 2在数据流中对应的时间点为t 2,图像帧f 3在数据流中对应的时间点为t 3;则计算图像帧f 3对应的时间点t 3与图像帧f 2对应的时间点t 2之间的差值,得到时间差值d 3=(t 3-t 2);计算图像帧f 2对应的时间点t 2与图像帧f 1对应的时间点t 1之间的差值,得到时间差值d 4=(t 2-t 1);得到d 3与d 4的比值d 3/d 4。计算块B 2与块B 1在Z维度上距离的差值,得到z 2-z 1;z 3可以由z 2、z 2-z 1和d 3/d 4计算得到,可选的,z 3=z 2+(z 2-z 1)d 3/d 4。结合图46E,若相机点camera在Z维度的位置为z c;块B 2在Z维度的坐标与相机点camera的距离Δ 3=|z 2-z c|;块B 3对应的Z维度的坐标与相机点camera的距离Δ 4=|z 3-z c|;根据图46E可以得出的结论,三维空间中同一物体距离相机点的距离越远,投影到投影平面上的面积越小;本申请实施例中块B 1和块B 2是匹配的块,即块B 1和块B 2显示的是三维空间中同一物体;由于块B 3是根据块B 1和块B 2预测得到的,因此,块B 3,块B 1和块B 2显示的均为三维空间中的同一物体;结合图46E,块B 3的边长L B3与块B 2的边长L B2的比值等于Δ 3与Δ 4的比值,即L B3/L B2=Δ 34。块B 3的面积S B3与块B 2的面积S B2的比值等于Δ 3与Δ 4的比值的平方,S B3/S B1=(Δ 34) 2。则在位置关系二的情况下参考块B 2缩放比例为(Δ 34) 2。将上式展开:(Δ 34) 2=(z 2-z c) 2/(z 3-z c) 2=(z 2-z c) 2/(z 2-z c+(z 2-z 1)d 3/d 4) 2=(z 2-z c) 2/(z 2-z c+(z 2-z 1)(t 3-t 2)/(t 2-t 1)) 2For positional relationship two: in conjunction with FIG. 46D and FIG. 46E, block B 1 is located in image frame f 1 , and the coordinate of block B 1 in the Z dimension is z 1 ; block B 2 is located in image frame f 2 , and block B 2 is located in Z The coordinate in the dimension is z 2 ; the block B 3 is located in the image frame f 3 , assuming that the coordinate of the block B 3 in the Z dimension is z 3 ; the reference block is B 2 ; See Figure 46H for the relationship. The corresponding time point of the image frame f 1 in the data stream is t 1 , the corresponding time point of the image frame f 2 in the data stream is t 2 , and the corresponding time point of the image frame f 3 in the data stream is t 3 ; then calculate The difference between the time point t 3 corresponding to the image frame f 3 and the time point t 2 corresponding to the image frame f 2 , obtain the time difference value d 3 =(t 3 -t 2 ); calculate the time corresponding to the image frame f 2 The difference between the point t 2 and the time point t 1 corresponding to the image frame f 1 is obtained as the time difference d 4 =(t 2 -t 1 ); the ratio d 3 /d 4 of d 3 and d 4 is obtained. Calculate the difference between block B 2 and block B 1 in the Z dimension, and obtain z 2 -z 1 ; z 3 can be calculated from z 2 , z 2 -z 1 and d 3 /d 4 , optional, z 3 =z 2 +(z 2 -z 1 )d 3 /d 4 . 46E, if the position of the camera point camera in the Z dimension is z c ; the distance between the coordinates of the block B 2 in the Z dimension and the camera point camera Δ 3 =|z 2 -z c |; the Z dimension corresponding to the block B 3 The distance between the coordinates and the camera point camera Δ 4 =|z 3 -z c |; according to the conclusion that can be drawn from Figure 46E, the farther the distance of the same object in the three-dimensional space from the camera point, the smaller the area projected onto the projection plane; In this embodiment of the present application, block B 1 and block B 2 are matched blocks, that is, block B 1 and block B 2 display the same object in a three-dimensional space; since block B 3 is predicted based on block B 1 and block B 2 , therefore, block B 3 , block B 1 and block B 2 all show the same object in three-dimensional space; in conjunction with FIG. 46E , the ratio of the side length L B3 of block B 3 to the side length L B2 of block B 2 is equal to Δ The ratio of 3 to Δ4, ie L B3 /L B234 . The ratio of the area S B3 of block B 3 to the area S B2 of block B 2 is equal to the square of the ratio of Δ 3 to Δ 4 , S B3 /S B1 =(Δ 34 ) 2 . Then, in the case of the second positional relationship, the scaling ratio of the reference block B 2 is (Δ 34 ) 2 . Expand the above formula: (Δ 34 ) 2 =(z 2 -z c ) 2 /(z 3 -z c ) 2 =(z 2 -z c ) 2 /(z 2 -z c +(z 2 -z 1 )d 3 /d 4 ) 2 =(z 2 -z c ) 2 /(z 2 -z c +(z 2 -z 1 )(t 3 -t 2 )/(t 2 -t 1 )) 2 .
S204,电子设备根据参考块和参考块缩放比例生成块B 3S204, the electronic device generates a block B 3 according to the reference block and the reference block scaling ratio.
具体的,如S3703所述,对于位置关系一,将参考块B 1缩放(Δ 12) 2即可得到块B 3;对于位置关系二,将参考块B 2缩放(Δ 34) 2即可得到块B 3Specifically, as described in S3703, for position relationship 1, block B 3 can be obtained by scaling the reference block B 1 by (Δ 12 ) 2 ; for position relationship 2, scaling the reference block B 23 /Δ ) 4 ) 2 to get block B 3 .
S205,电子设备根据参考块在图像帧所在的平面的坐标,参考块的预测位移向量和参考块缩放比例确定出块B 3在图像帧所在的平面的坐标。 S205 , the electronic device determines, according to the coordinates of the reference block on the plane where the image frame is located, the predicted displacement vector of the reference block and the scaling ratio of the reference block, the coordinates of the block B3 on the plane where the image frame is located.
根据步骤S3703的解释说明,结合图46C,在位置关系一的情况下:若块B 1的中心点的坐标为(x 1,y 1),则块B 1上任意一点(x b1,y b1)以中心点进行缩放后的坐标为(x b112+x 1*(Δ 21)/Δ 2,y b112+y 1*(Δ 21)/Δ 2);缩放后的坐标与预测位移向量相加,结合图46C,即可得到块B 3在图像帧所在的平面的坐标,即B 3(x b112+x 1*(Δ 21)/Δ 2+(t 2-t 1)/(t 3-t 1)*(x 2-x 1),y b112+y 1*(Δ 21)/Δ 2+(t 2-t 1)/(t 3-t 1)*(y 2-y 1))。 According to the explanation of step S3703, in conjunction with FIG. 46C, in the case of position relationship 1: if the coordinates of the center point of block B 1 are (x 1 , y 1 ), then any point on block B 1 (x b1 , y b1 ) ) scaled by the center point is (x b112 +x 1 *(Δ 21 )/Δ 2 , y b112 +y 1 *(Δ 2 - Δ 1 )/Δ 2 ); the scaled coordinates are added to the predicted displacement vector, and with reference to FIG. 46C , the coordinates of the block B 3 on the plane where the image frame is located can be obtained, that is, B 3 (x b112 ) +x 1 *(Δ 21 )/Δ 2 +(t 2 -t 1 )/(t 3 -t 1 )*(x 2 -x 1 ), y b112 +y 1 *(Δ 21 )/Δ 2 +(t 2 -t 1 )/(t 3 -t 1 )*(y 2 -y 1 )).
结合图46D,在位置关系二的情况下:若块B 2的中心点的坐标为(x 2,y 2),则块B 2上任意一点(x b2,y b2)以中心点进行缩放后的坐标为(x b234+x 2*(Δ 43)/Δ 4,y b234+y 3*(Δ 43)/Δ 4);缩放后的坐标与预测位移向量相加,结合图46D,即可得到块B 3在图像帧所在的平面的坐标,即B 3(x b234+x 2*(Δ 43)/Δ 4+(t 3-t 2)/t 2-t 1)*(x 2-x 1),y b234+y 3*(Δ 43)/Δ 4+(t 3-t 2)/t 2-t 1)*(y 2-y 1))。 46D, in the case of position relationship 2: if the coordinates of the center point of block B 2 are (x 2 , y 2 ), then any point (x b2 , y b2 ) on block B 2 is scaled with the center point The coordinates of (x b234 +x 2 *(Δ 43 )/Δ 4 , y b234 +y 3 *(Δ 43 )/Δ 4 ) ; The scaled coordinates are added to the predicted displacement vector, and combined with Figure 46D, the coordinates of the block B 3 in the plane where the image frame is located can be obtained, that is, B 3 (x b234 +x 2 *(Δ 43 )/Δ 4 +(t 3 -t 2 )/t 2 -t 1 )*(x 2 -x 1 ), y b234 +y 3 *(Δ 43 ) /Δ 4 +(t 3 -t 2 )/t 2 -t 1 )*(y 2 -y 1 )).
S206,电子设备根据块B 3和块B 3在图像帧所在的平面的坐标生成图像帧f 3S206, the electronic device generates an image frame f3 according to the coordinates of the block B3 and the block B3 on the plane where the image frame is located.
结合图46B和图46C;针对S204-S206,请参阅图46G,电子设备首先按照缩放比例针 对块B 1进行缩放,缩放后的块B 1记为块B 4;之后,按照预测位移向量β 2针对块B 4进行平移,得到图像帧f 3中的块B 3;最终多个块B 3构成图像帧f 346B and 46C; for S204-S206, please refer to FIG. 46G, the electronic device first scales the block B 1 according to the scaling ratio, and the scaled block B 1 is denoted as block B 4 ; then, according to the predicted displacement vector β 2 The block B 4 is translated to obtain the block B 3 in the image frame f 3 ; finally, a plurality of blocks B 3 constitute the image frame f 3 .
结合图46B和图46D;针对S204-S206,请参阅图46I,电子设备首先按照缩放比例针对块B 2进行缩放,缩放后的块B 2记为块B 5;之后,按照预测位移向量β 2针对块B 5进行平移,得到图像帧f 3中的块B 3;最终多个块B 3构成图像帧f 346B and 46D; for S204-S206, please refer to FIG. 46I, the electronic device first scales the block B 2 according to the scaling ratio, and the scaled block B 2 is denoted as block B 5 ; then, according to the predicted displacement vector β 2 The block B 5 is translated to obtain the block B 3 in the image frame f 3 ; finally, a plurality of blocks B 3 constitute the image frame f 3 .
需要说明的是,图46G和图46I是为了便于更好的理解本方案;具体的,电子设备可以根据参考块的数据,缩放比例和预测位移向量β 2生成图像帧f 3的数据,并根据图像帧f 3的数据显示图像帧f 3It should be noted that FIG. 46G and FIG. 46I are for better understanding of this solution; specifically, the electronic device can generate the data of the image frame f 3 according to the data of the reference block, the scaling ratio and the predicted displacement vector β 2 , and according to The data of image frame f3 shows image frame f3 .
可见,本申请实施例中,电子设备在根据原始图像帧(图像帧f 1和图像帧f 2)生成预测图像帧(图像帧f 3)时,可以结合垂直于图像帧所在平面的Z维度的坐标对图像帧中的块进行缩放,进而使得插入预测图像帧后,原始图像帧和预测图像帧之间的过渡更加自然;使得用户观察到的预测图像帧与电子设备根据应用程序的数据构建的场景更加吻合,提升了插入预测图像帧时的视觉体验。 It can be seen that, in the embodiment of the present application, when the electronic device generates the predicted image frame (image frame f 3 ) according to the original image frame (image frame f 1 and image frame f 2 ), it can combine the Z dimension perpendicular to the plane where the image frame is located. The coordinates scale the blocks in the image frame, so that after inserting the predicted image frame, the transition between the original image frame and the predicted image frame is more natural; it makes the predicted image frame observed by the user and the electronic device constructed according to the data of the application. The scene fits better, improving the visual experience when inserting predicted image frames.
请参阅图47,本申请实施例中,电子设备可以在缓存1352中建立存储空间401,存储空间401中包括附件,具体的,可以根据实际情况确定附件的种类和数量。结合S3701至106,S201至S205;电子设备可以设置A类型附件和B类型附件;电子设备可以将对应的绘制结果存储到A类型附件和B类型附件中;具体的,存储空间401可以具体指OpenGL中的帧缓存对象(Frame Buffer Object,FBO);A类型附件可以是颜色附件,在OpenGL中具体可以是ColorAttachment,可用于存储图像帧中的颜色数据,例如图像帧中像素的RGB值等,同时A类型附件中还可以包括像素在图像帧中的坐标,如S3702中,电子设备可以根据像素的坐标确定出块的坐标,并根据块的坐标确定出预测位移向量。B类型附件可以存储图像帧的深度信息的深度附件,在在OpenGL中具体可以是:Depth Attachment,深度信息具体可以是S3701至S3705,S201至S205中所述的Z维度的数据。Referring to FIG. 47 , in this embodiment of the present application, the electronic device may create a storage space 401 in the cache 1352 , and the storage space 401 includes accessories. Specifically, the type and quantity of the accessories may be determined according to the actual situation. Combining S3701 to 106, S201 to S205; the electronic device can set A-type attachments and B-type attachments; the electronic device can store the corresponding drawing results in the A-type attachments and B-type attachments; specifically, the storage space 401 may specifically refer to OpenGL The frame buffer object (Frame Buffer Object, FBO) in the; A type attachment can be a color attachment, in OpenGL, it can be ColorAttachment, which can be used to store the color data in the image frame, such as the RGB value of the pixel in the image frame, etc., and at the same time Type A attachments may also include the coordinates of the pixels in the image frame. For example, in S3702, the electronic device may determine the coordinates of the block according to the coordinates of the pixels, and determine the predicted displacement vector according to the coordinates of the block. The B-type attachment can store the depth attachment of the depth information of the image frame. In OpenGL, it can specifically be: Depth Attachment, and the depth information can specifically be the data of the Z dimension described in S3701 to S3705, and S201 to S205.
本申请实施例中的存储空间为电子设备在缓存中定义的一块空间。存储空间包括以下作用:(1)存储根据应用程序的数据生成的绘制结果;具体的,存储空间中可以包括至少一种附件,且每种附件至少包括一种缓冲类型,缓冲类型可以包括颜色类型,深度类型和模板类型;电子设备可以根据绘制指令将绘制结果存储到不同的附件上,最终在存储空间中构成图像帧。(2)在存储空间中存储并合成图像帧:电子设备可以将绘制结果绘制到一个存储空间中,进而生成图像帧。用于存储图像帧的存储空间可以设置至少一个;电子设备可以在不同的存储空间中存储不同的图像帧,例如在第一存储空间中存储第一图像帧,在第二存储空间中存储第二图像帧。本申请实施例中,电子设备可以根据第一存储空间中的第一图像帧和第二存储空间中的第二图像帧在第三存储空间中生成预测图像帧。The storage space in the embodiment of the present application is a space defined in the cache of the electronic device. The storage space includes the following functions: (1) Store the drawing results generated according to the data of the application; specifically, the storage space can include at least one attachment, and each attachment includes at least one buffer type, and the buffer type can include a color type , depth type and template type; the electronic device can store the drawing results on different attachments according to the drawing instructions, and finally form an image frame in the storage space. (2) Storing and synthesizing image frames in the storage space: The electronic device can draw the drawing results into a storage space, and then generate image frames. At least one storage space for storing image frames can be set; the electronic device can store different image frames in different storage spaces, for example, the first image frame is stored in the first storage space, and the second image frame is stored in the second storage space. image frame. In this embodiment of the present application, the electronic device may generate the predicted image frame in the third storage space according to the first image frame in the first storage space and the second image frame in the second storage space.
本申请实施例中,存储空间在硬件设备上的位置具体可以设置于图形处理器1351的随机存储器中,也可以设置于与GPU通信连接的随机存储器中。In this embodiment of the present application, the location of the storage space on the hardware device may be specifically set in the random access memory of the graphics processor 1351, or may be set in the random access memory communicatively connected with the GPU.
本申请实施例中的存储空间的一些通用的叫法可以是:帧缓存存储器,简称帧缓存,或帧缓冲;需要说明的是,在不同的编程语言中存储空间可以有其他不同的叫法。Some common names for the storage space in the embodiments of the present application may be: frame buffer memory, frame buffer for short, or frame buffer; it should be noted that the storage space may be called by other different names in different programming languages.
一个帧缓冲中包括至少一个附件;一个附件当中至少包括一个缓冲类型;缓冲类型可以包括:颜色类型,深度类型和模板类型。例如帧缓冲中可以包括三个附件,具体可以是:一 个颜色类型的附件,一个深度类型的附件和一个模板类型的附件。A frame buffer includes at least one attachment; an attachment includes at least one buffer type; the buffer type may include: color type, depth type and template type. For example, the frame buffer may include three attachments, which may specifically be: a color type attachment, a depth type attachment and a template type attachment.
举例来说,本申请实施例中的存储空间在Vulkan编程语言中可以称为vkframebuffer;在开放图形库(Open Graphics Library,OpenGL)编程语言中称为帧缓存对象(Frame Buffer Object,FBO)。For example, the storage space in the embodiments of the present application may be called vkframebuffer in the Vulkan programming language; it may be called a frame buffer object (Frame Buffer Object, FBO) in the Open Graphics Library (Open Graphics Library, OpenGL) programming language.
请参阅图48,图48是本申请实施例提供的一种电子设备100的另一种示意图;结合图43和图44A,以及上文中的图12示出的电子设备100的软件框图。其中,电子设备100可以包括应用处理器1353,图形处理器1351和显示设备1350;本申请实施例中,应用处理器1353可以运行目标应用程序1301,并根据目标应用程序1301运行过程中的数据和需求调用三维图形处理框架中的API,实现对于应用程序数据的处理;应用处理器1353与图形处理器1351之间可以进行数据通信,应用处理器1353中的三维图形处理框架可以向图形处理器1351中的三维图形处理服务器发送目标应用程序1301的数据和执行API的指令;响应于三维图形处理框架发送的应用程序数据和执行API的指令,三维图形处理服务器可调用三维图形处理库1330执行绘制操作,最终将绘制完成的图像帧存储至缓存1352中;之后图形处理器1351将缓存中的图像帧传输至显示设备1350进行显示。本申请实施例中,缓存1352可以具体指图形处理器1351中的动态随机存储器。举例来说,本示例中三维图形处理库1330可以是OpenGL ES;三维图形处理框架可以是OpenGL ES框架;三维图形处理服务器可以是OpenGL ES服务器。Please refer to FIG. 48. FIG. 48 is another schematic diagram of an electronic device 100 provided by an embodiment of the present application; the software block diagram of the electronic device 100 shown in FIG. 43 and FIG. 44A and FIG. 12 above is combined. The electronic device 100 may include an application processor 1353, a graphics processor 1351 and a display device 1350; in this embodiment of the present application, the application processor 1353 may run the target application 1301, and according to the data and data in the running process of the target application 1301 It is required to call the API in the 3D graphics processing framework to realize the processing of application data; data communication can be performed between the application processor 1353 and the graphics processor 1351, and the three-dimensional graphics processing framework in the application processor 1353 can communicate with the graphics processor 1351. The 3D graphics processing server in the 3D graphics processing server sends the data of the target application 1301 and the instruction to execute the API; in response to the application data and the instruction to execute the API sent by the 3D graphics processing framework, the 3D graphics processing server can call the 3D graphics processing library 1330 to perform the rendering operation , and finally store the rendered image frame in the cache 1352 ; then the graphics processor 1351 transmits the image frame in the cache to the display device 1350 for display. In this embodiment of the present application, the cache 1352 may specifically refer to a dynamic random access memory in the graphics processor 1351 . For example, in this example, the three-dimensional graphics processing library 1330 may be OpenGL ES; the three-dimensional graphics processing framework may be an OpenGL ES framework; and the three-dimensional graphics processing server may be an OpenGL ES server.
电子设备在执行S3701至106的步骤之前,电子设备首先启动应用程序,并根据应用程序的需求分配和/或创建存储空间;之后在存储空间中执行S3701至S106的步骤。举例来说,电子设备运行OpenGL,存储空间为FBO;电子设备在S3701至S106的步骤之前,包括:电子设备在应用程序启动时,电子设备分配给应用程序对应的FBO 0,之后,电子设备根据应用程序的数据调用创建指令创建至少三个FBO,本申请实施例中在执行S3701至S106的步骤时,电子设备可以只创建三个FBO:FBO 1,FBO 2和FBO 3;FBO 1用于存储图像帧f 1对应的绘制结果,FBO 2用于存储图像帧f 2对应的绘制结果和FBO 3用于存储图像帧f 3对应的绘制结果。上述分配FBO 0和创建FBO 1,FBO 2,FBO 3的具体过程可以参阅图49A,图49A包括S301和S302: Before the electronic device performs the steps of S3701 to 106, the electronic device first starts the application program, and allocates and/or creates a storage space according to the requirements of the application program; then performs the steps of S3701 to S106 in the storage space. For example, the electronic device runs OpenGL, and the storage space is FBO; before the steps of S3701 to S106, the electronic device includes: when the electronic device starts the application, the electronic device assigns the FBO 0 corresponding to the application, and then the electronic device according to The data call creation instruction of the application program creates at least three FBOs. In this embodiment of the present application, when the steps from S3701 to S106 are executed, the electronic device may only create three FBOs: FBO 1, FBO 2 and FBO 3; FBO 1 is used for storage The drawing result corresponding to the image frame f 1 , the FBO 2 is used to store the drawing result corresponding to the image frame f 2 , and the FBO 3 is used to store the drawing result corresponding to the image frame f 3 . The specific process of allocating FBO 0 and creating FBO 1, FBO 2, and FBO 3 above can refer to FIG. 49A, which includes S301 and S302:
S301,应用处理器1353启动应用程序,应用处理器1353指示图形处理器1351针对应用程序配置FBO 0。S301, the application processor 1353 starts the application program, and the application processor 1353 instructs the graphics processor 1351 to configure FBO 0 for the application program.
S302,应用处理器1353调用用于创建存储空间的创建指令,并向图形处理器1351发送创建指令,图形处理器1351创建FBO 1,FBO 2和FBO 3。S302, the application processor 1353 calls the creation instruction for creating the storage space, and sends the creation instruction to the graphics processor 1351, and the graphics processor 1351 creates FBO 1, FBO 2 and FBO 3.
创建指令具体可以是OpenGL中的glGenFramebuffers API。The creation instruction can be the glGenFramebuffers API in OpenGL.
其中,FBO 1,FBO 2和FBO 3可以分别用于存储图像帧f 1,图像帧f 2和图像帧f 3对应的绘制结果。 Wherein, FBO 1 , FBO 2 and FBO 3 may be used to store the drawing results corresponding to the image frame f 1 , the image frame f 2 and the image frame f 3 respectively.
其中,电子设备在执行完成S301之后,电子设备绘制和显示图像f 1或图像帧f 2的过程请参阅图49B,图49B以电子设备绘制和显示图像帧f 1作为示例,包括S401~S406。 Wherein, after the electronic device performs S301, please refer to FIG. 49B for the process of drawing and displaying the image f1 or the image frame f2 by the electronic device. FIG. 49B uses the electronic device to draw and display the image frame f1 as an example, including S401-S406.
S401,应用处理器1353调用用于将应用程序与存储空间绑定的绑定指令,并向图形处理器1351发送绑定指令,图形处理器1351将应用程序与FBO 1进行绑定。S401, the application processor 1353 invokes a binding instruction for binding the application program to the storage space, and sends the binding instruction to the graphics processor 1351, and the graphics processor 1351 binds the application program to the FBO 1.
其中,绑定指令具体可以是OpenGL中的glBindFrameBuffer API。当应用程序与FBO绑定时,电子设备根据应用程序的数据进行绘制得到的绘制结果存储到绑定的FBO中。Specifically, the binding instruction may be the glBindFrameBuffer API in OpenGL. When the application is bound to the FBO, the drawing result obtained by the electronic device drawing according to the data of the application is stored in the bound FBO.
S402,应用处理器1353调用用于在存储空间中添加附件的附件添加指令,并向图形处理器1351发送附件添加指令,图形处理器1351在FBO 1中添加A类型附件和B类型附件。S402, the application processor 1353 invokes the attachment adding instruction for adding an attachment in the storage space, and sends the attachment adding instruction to the graphics processor 1351, and the graphics processor 1351 adds the A-type attachment and the B-type attachment in the FBO 1.
其中,附件添加指令用于在FBO中添加附件。附件添加指令具体可以是OpenGL中的glFramebufferTexture2D API。A类型附件可以是颜色附件,在OpenGL中具体可以是:ColorAttachment;B类型附件可以是深度附件,在OpenGL中具体可以是Depth Attachment。A类型附件中存储有像素的颜色值的信息和像素在图像帧中的坐标信息,具体包括S3702中所述的图像帧所在平面内的坐标。B类型附件中存储有深度信息,具体包括深度值,深度值可以表示相机坐标系下垂直于投影平面的Z维度的数据。Among them, the attachment adding instruction is used to add attachments in the FBO. The attachment adding instruction can be the glFramebufferTexture2D API in OpenGL. Type A attachments can be color attachments, which in OpenGL can be: ColorAttachment; Type B attachments can be depth attachments, which can be Depth Attachment in OpenGL. The information of the color value of the pixel and the coordinate information of the pixel in the image frame are stored in the A-type attachment, which specifically includes the coordinates in the plane where the image frame is located as described in S3702. Depth information is stored in the B-type attachment, which specifically includes a depth value. The depth value can represent the data of the Z dimension perpendicular to the projection plane in the camera coordinate system.
S403,应用处理器1353调用用于进行绘制的绘制指令,并向图形处理器1351发送绘制指令,图形处理器1351执行绘制操作,并将绘制结果存储在FBO 1的A类型附件和B类型附件中,得到图像帧f 1S403, the application processor 1353 calls the drawing instruction for drawing, and sends the drawing instruction to the graphics processor 1351, the graphics processor 1351 performs the drawing operation, and stores the drawing result in the A-type attachment and B-type attachment of the FBO 1 , get the image frame f 1 .
其中,绘制指令可以包括多种不同的绘制指令,进而在执行绘制操作时实现不同的功能。绘制指令具体可以是OpenGL中的glDraw API;glDraw API可以包括glDrawArrays API和glDrawElementsAPI。Wherein, the drawing instructions may include a variety of different drawing instructions, so as to realize different functions when performing the drawing operation. The drawing instruction can be the glDraw API in OpenGL; the glDraw API can include the glDrawArrays API and the glDrawElements API.
S404,应用处理器1353调用附件绑定指令,并向图形处理器1351发送附件绑定指令,图形处理器1351将FBO 1中的A类型附件和B类型附件绑定至FBO 0;S404, the application processor 1353 calls the attachment binding instruction, and sends the attachment binding instruction to the graphics processor 1351, and the graphics processor 1351 binds the A-type attachment and B-type attachment in FBO 1 to FBO 0;
需要说明的是,本申请实施例中FBO 0和FBO K的作用不同,K为正整数。It should be noted that the functions of FBO 0 and FBO K in the embodiments of the present application are different, and K is a positive integer.
FBO K用于存储应用程序的绘制结果/数据;FBO 0的作用是:电子设备可以将FBO 0中的图像帧送显到显示屏上。具体的,电子设备运行应用程序时,可以根据应用程序的数据存储需求,针对应用程序创建至少一个FBO K。FBO 0是电子设备应用程序启动时给应用程序分配的。电子设备显示图像帧时,需要首先将FBO K中的图像帧绘制(复制)到FBO 0中,电子设备才可以在垂直同步信号到来时,将FBO 0中的图像帧进行送显,进而在显示屏上显示图像帧。电子设备设置至少一个FBO 0。FBO K is used to store the drawing results/data of the application; the function of FBO 0 is: the electronic device can send the image frame in FBO 0 to the display screen. Specifically, when the electronic device runs the application, at least one FBO K can be created for the application according to the data storage requirements of the application. FBO 0 is assigned to the application when the electronic device application starts. When an electronic device displays an image frame, it needs to draw (copy) the image frame in FBO K to FBO 0 first, so that the electronic device can send and display the image frame in FBO 0 when the vertical synchronization signal arrives, and then display the image frame in FBO 0. The image frame is displayed on the screen. The electronic device sets at least one FBO 0.
在电子设备设置的FBO 0的数量大于两个的情况下:电子设备可以将其中一个FBO 0中的图像帧送显到显示设备,同时,在其余的FBO 0中绘制图像帧,进而减小“绘制至送显”整个过程的时间,提升电子设备“生成至显示”图像帧的效率。举例来说,电子设备的应用程序设置有FBO 1,FBO 2和FBO 3,应用程序的FBO 0包括FBO 01和FBO 02,电子设备在FBO 1中绘制得到图像帧f 1对应的绘制结果后,将图像帧f 1对应的绘制结果绘制到FBO 01,之后,电子设备调用轮换指令,轮换指令具体可以是OpenGL中的eglSwapBuffers API,将FBO 01中图像帧f 1对应的绘制结果送显到显示设备进行显示;在将FBO 01中的图像帧f 1对应的绘制结果送显到显示设备进行显示的过程中:电子设备可以在FBO 2中绘制得到图像帧f 2对应的绘制结果,并在完成对于图像帧f 2的绘制后,将FBO 2中图像帧f 2对应的绘制结果绘制到FBO 02中。之后,电子设备调用轮换指令,将FBO 02中图像帧f 2对应的绘制结果送显到显示设备进行显示;同时,电子设备可以根据FBO 1中图像帧f 1对应的绘制结果和FBO 2中图像帧f 2对应的绘制结果在FBO 3中绘制得到图像帧f 3对应的绘制结果,并在完成对于图像帧f 3的绘制后,将FBO 3中图像帧f 3对应的绘制结果绘制到FBO 01中。 In the case where the number of FBO 0s set by the electronic device is greater than two: the electronic device can send the image frame in one of the FBO 0 to the display device, and at the same time, draw the image frame in the remaining FBO 0, thereby reducing the " The time of the whole process of "draw to display" improves the efficiency of "generate to display" image frames of electronic devices. For example, the application program of the electronic device is set with FBO 1, FBO 2 and FBO 3, and the FBO 0 of the application program includes FBO 01 and FBO 02. After the electronic device draws in FBO 1 and obtains the drawing result corresponding to the image frame f 1 , The drawing result corresponding to the image frame f 1 is drawn to the FBO 01. After that, the electronic device calls the rotation instruction. The rotation instruction can be the eglSwapBuffers API in OpenGL, and the drawing result corresponding to the image frame f 1 in the FBO 01 is sent to the display device for display. Display; in the process of sending the drawing result corresponding to the image frame f 1 in the FBO 01 to the display device for display: the electronic device can draw in the FBO 2 to obtain the drawing result corresponding to the image frame f 2 , and after the completion of the drawing result for the image frame f 2 After the image frame f 2 is drawn, the drawing result corresponding to the image frame f 2 in the FBO 2 is drawn into the FBO 02 . After that, the electronic device calls the rotation instruction to send the drawing result corresponding to the image frame f 2 in the FBO 02 to the display device for display; at the same time, the electronic device can according to the drawing result corresponding to the image frame f 1 in the FBO 1 and the image in the FBO 2 The drawing result corresponding to frame f 2 is drawn in FBO 3 to obtain the drawing result corresponding to image frame f 3 , and after the drawing of image frame f 3 is completed, the drawing result corresponding to image frame f 3 in FBO 3 is drawn to FBO 01 middle.
其中,电子设备将FBO 1中的A类型附件和B类型附件绑定至FBO 0,可以视为电子设备将FBO 1中的A类型附件和B类型作为FBO 0的输入,以便于后续根据FBO 0的输入进 行处理,在FBO 0得到最终可以在显示屏上显示的图像帧。Among them, the electronic device binds the A-type accessories and B-type accessories in FBO 1 to FBO 0, which can be regarded as the electronic device taking the A-type accessories and B-type accessories in FBO 1 as the input of FBO 0, so as to facilitate the follow-up according to FBO 0 The input is processed, and the final image frame that can be displayed on the display is obtained at FBO 0.
其中,附件绑定指令具体可以是OpenGL中的glBindTexture API。The attachment binding instruction may specifically be the glBindTexture API in OpenGL.
S405,应用处理器1353调用绘制指令,并向图形处理器1351发送绘制指令,图形处理器1351对A类型附件和B类型附件中的绘制结果执行绘制操作,生成图像帧f 1,将图像帧f 1存储至FBO 0中。 S405, the application processor 1353 calls the drawing instruction, and sends the drawing instruction to the graphics processor 1351, and the graphics processor 1351 performs the drawing operation on the drawing results in the A-type attachment and B-type attachment, generates an image frame f 1 , and converts the image frame f 1 is stored in FBO 0.
其中,绘制指令具体可以是OpenGL中的glDraw API。S306中执行的绘制操作与S304中执行的绘制操作不同。Specifically, the drawing instruction may be the glDraw API in OpenGL. The drawing operation performed in S306 is different from the drawing operation performed in S304.
S406,应用处理器1353调用用于将图像帧送显的轮换指令,并向图形处理器1351发送轮换指令,图形处理器1351将FBO 0中的图像帧传输至显示屏340,显示屏340显示图像帧。S406, the application processor 1353 calls the rotation instruction for sending the image frame for display, and sends the rotation instruction to the graphics processor 1351, and the graphics processor 1351 transmits the image frame in the FBO 0 to the display screen 340, and the display screen 340 displays the image frame.
其中,轮换指令具体可以是OpenGL中的eglSwapBuffers API。在FBO 0包含两个FBO时,电子设备调用轮换指令可以将FBO 0中的FBO交替送显。具体的,FBO 0包括FBO 01和FBO 02,若电子设备当前将FBO 01中的图像帧进行送显,电子设备调用轮换指令eglSwapBuffers API,则电子设备将FBO 02中的图像帧进行送显。当再次调用轮换指令eglSwapBuffers API时,电子设备将FBO 01中的图像帧进行送显。重复上述操作即可实现对FBO 01和FBO 02中的图像帧交替送显的过程。Specifically, the rotation instruction may be the eglSwapBuffers API in OpenGL. When FBO 0 contains two FBOs, the electronic device can call the rotation instruction to alternately display the FBOs in FBO 0. Specifically, FBO 0 includes FBO 01 and FBO 02. If the electronic device currently sends and displays the image frame in FBO 01, and the electronic device calls the rotation instruction eglSwapBuffers API, the electronic device sends the image frame in FBO 02 for display. When the rotation command eglSwapBuffers API is called again, the electronic device will send and display the image frame in FBO 01. Repeating the above operation can realize the process of alternately sending and displaying the image frames in FBO 01 and FBO 02.
其中,电子设备在执行完成S301之后,电子设备绘制和显示图像f 3的过程请参阅图49C,图49C包括S501~S507。由S3701至S106可以确定,电子设备在生成图像帧f 3时,电子设备已经绘制完成图像帧f 1和图像帧f 2;本示例中,图像帧f 1对应的绘制结果存储在FBO 1中,图像帧f 2对应的绘制结果存储在FBO 2中,图像帧f 1对应的A类型附件记为A f1,图像帧f 2对应的B类型附件记为B f1;图像帧f 2对应的A类型附件记为A f2,图像帧f 2对应的B类型附件记为B f2Wherein, after the electronic device completes S301, please refer to FIG. 49C for the process of drawing and displaying the image f3 by the electronic device, and FIG. 49C includes S501-S507. It can be determined from S3701 to S106 that when the electronic device generates the image frame f3 , the electronic device has completed the drawing of the image frame f1 and the image frame f2 ; in this example, the drawing result corresponding to the image frame f1 is stored in the FBO1 , The drawing result corresponding to the image frame f 2 is stored in the FBO 2, the A-type attachment corresponding to the image frame f 1 is denoted as A f1 , the B-type attachment corresponding to the image frame f 2 is denoted as B f1 ; the A-type attachment corresponding to the image frame f 2 The attachment is denoted as A f2 , and the B-type attachment corresponding to the image frame f 2 is denoted as B f2 .
S501,应用处理器1353调用用于将应用程序与存储空间绑定的绑定指令,并向图形处理器1351发送绑定指令,图形处理器1351将应用程序与FBO 3进行绑定。S501, the application processor 1353 invokes the binding instruction for binding the application program to the storage space, and sends the binding instruction to the graphics processor 1351, and the graphics processor 1351 binds the application program to the FBO 3.
其中,绑定指令具体可以是OpenGL中的glBindFrameBuffer API。Specifically, the binding instruction may be the glBindFrameBuffer API in OpenGL.
S502,应用处理器1353调用附件绑定指令,并向图形处理器1351发送附件绑定指令,图形处理器1351将FBO 1中的A f1、B f1,FBO 2中的A f2,B f2与FBO 3进行绑定。 S502, the application processor 1353 calls the attachment binding instruction, and sends the attachment binding instruction to the graphics processor 1351, and the graphics processor 1351 associates A f1 and B f1 in FBO 1 and A f2 and B f2 in FBO 2 with the FBO 3 to bind.
其中,将A f1、B f1、A f2和B f2与FBO 3进行绑定;具体作用是:图形处理器1351后续执行绘制操作时,以A f1、B f1、A f2和B f2作为输入,将根据A f1、B f1、A f2和B f2得到的绘制结果存储到FBO 3中。 Among them, A f1 , B f1 , A f2 and B f2 are bound to FBO 3; the specific function is: when the graphics processor 1351 performs subsequent drawing operations, A f1 , B f1 , A f2 and B f2 are used as inputs, The drawing results obtained from A f1 , B f1 , A f2 and B f2 are stored in FBO 3 .
其中,附件绑定指令具体可以是OpenGL中的glBindTexture API。The attachment binding instruction may specifically be the glBindTexture API in OpenGL.
S503,应用处理器1353调用附件添加指令,并向图形处理器1351发送附件添加指令,图形处理器1351在FBO 3中添加A类型附件,记为A f3S503 , the application processor 1353 invokes the attachment adding instruction, and sends the attachment adding instruction to the graphics processor 1351 , and the graphics processor 1351 adds an A-type attachment in the FBO 3 , denoted as A f3 .
其中,A类型附件具体是颜色附件,在OpenGL中具体可以是:ColorAttachment。Among them, the A-type attachment is specifically a color attachment, and in OpenGL, it can specifically be: ColorAttachment.
其中,附件添加指令具体可以是OpenGL中的:glFramebufferTexture2D API。Among them, the attachment adding instruction can be specifically in OpenGL: glFramebufferTexture2D API.
S504,应用处理器1353调用绘制指令,并向图形处理器1351发送绘制指令,图形处理器1351根据A f1、B f1、A f2和B f2执行绘制操作,将得到的绘制结果存储至A f3中。 S504, the application processor 1353 calls the drawing instruction, and sends the drawing instruction to the graphics processor 1351, and the graphics processor 1351 performs the drawing operation according to A f1 , B f1 , A f2 and B f2 , and stores the obtained drawing result in A f3 .
其中,绘制指令具体可以是OpenGL中的glDraw API。Specifically, the drawing instruction may be the glDraw API in OpenGL.
其中,S405中根据A f1、B f1、A f2和B f2执行绘制操作,具体执行的算法可以是S3701至106,S201至205所述的算法。 Wherein, the drawing operation is performed according to A f1 , B f1 , A f2 and B f2 in S405 , and the specific algorithms to be performed may be the algorithms described in S3701 to 106 and S201 to 205 .
S505,应用处理器1353调用附件绑定指令,并向图形处理器1351发送附件绑定指令,图形处理器1351将FBO 3中的A f3绑定至FBO 0; S505, the application processor 1353 calls the attachment binding instruction, and sends the attachment binding instruction to the graphics processor 1351, and the graphics processor 1351 binds A f3 in FBO 3 to FBO 0;
其中,FBO 0的解释请参阅S307。Among them, please refer to S307 for the explanation of FBO 0.
其中,电子设备将FBO 3中的A f3绑定至FBO 0,可以视为电子设备将FBO 3中的A f3作为FBO 0的输入,以便于后续根据FBO 0的输入进行绘制操作,得到图像帧。 Among them, the electronic device binds A f3 in FBO 3 to FBO 0, which can be regarded as the electronic device using A f3 in FBO 3 as the input of FBO 0, so as to facilitate subsequent drawing operations according to the input of FBO 0 to obtain image frames .
其中,附件绑定指令具体可以是OpenGL中的glBindTexture API。The attachment binding instruction may specifically be the glBindTexture API in OpenGL.
S506,应用处理器1353调用绘制指令,并向图形处理器1351发送绘制指令,图形处理器1351根据A f3中的绘制结果执行绘制操作,生成图像帧f 3,将图像帧f 3存储至FBO 0中。 S506, the application processor 1353 calls the drawing instruction, and sends the drawing instruction to the graphics processor 1351, and the graphics processor 1351 performs the drawing operation according to the drawing result in A f3 , generates the image frame f 3 , and stores the image frame f 3 in the FBO 0 middle.
其中,绘制指令具体可以是OpenGL中的glDraw API。S407与S405中的绘制操作不同。Specifically, the drawing instruction may be the glDraw API in OpenGL. The drawing operation in S407 is different from that in S405.
S507,应用处理器1353调用用于将图像帧送显的轮换指令,并向图形处理器1351发送轮换指令,图形处理器1351将FBO 0中的图像帧f 3传输至显示屏340,显示屏340显示图像帧f 3S507, the application processor 1353 calls the rotation instruction for sending the image frame for display, and sends the rotation instruction to the graphics processor 1351, and the graphics processor 1351 transmits the image frame f3 in the FBO 0 to the display screen 340, and the display screen 340 Image frame f3 is displayed.
其中,轮换指令具体可以是OpenGL中的eglSwapBuffers API。Specifically, the rotation instruction may be the eglSwapBuffers API in OpenGL.
电子设备显示的游戏界面中,可以包含游戏内容和UI控件。一般地,游戏界面中的UI控件的位置以及大小不发生改变。因此,在本申请实施例中,电子设备在进行绘制应用程序下发的绘制帧时,电子设备可以绘制出第一帧绘制帧中的UI控件,后面的绘制帧可以直接使用第一帧绘制帧中的UI控件的绘制结果。这样,可以避免重复绘制,节约电子设备功耗。The game interface displayed by the electronic device may include game content and UI controls. Generally, the position and size of UI controls in the game interface do not change. Therefore, in the embodiment of the present application, when the electronic device draws the drawing frame issued by the application program, the electronic device can draw the UI controls in the drawing frame of the first frame, and the subsequent drawing frames can directly use the drawing frame of the first frame to draw the frame. The drawing result of the UI controls in . In this way, repeated drawing can be avoided and the power consumption of the electronic device can be saved.
本申请实施例中,将根据目标应用程序的数据生成的图像帧自定义的划分为动态图层和用户界面图层(User Interface,UI)图层;需要说明的是,以上划分仅仅是为了更好的理解本申请实施例中的技术方案;实际情况中,电子设备根据目标应用程序的数据执行绘制操作,最终生成图像帧,并没有动态图层和UI图层的概念。In the embodiment of the present application, the image frame generated according to the data of the target application program is divided into a dynamic layer and a user interface layer (User Interface, UI) layer; it should be noted that the above division is only for the purpose of more A good understanding of the technical solutions in the embodiments of the present application; in practice, the electronic device performs a drawing operation according to the data of the target application, and finally generates an image frame, and there is no concept of a dynamic layer and a UI layer.
举例来说,目前,在电子设备上玩电子游戏已经成为众多用户娱乐休闲的重要方式之一。电子设备在运行游戏应用程序的过程中,是通过在显示屏上显示一帧一帧的图像帧构建出流畅的游戏画面的。请参阅图50A,图50A是一种游戏场景中动态图层的示意图,该动态图层可以是游戏场景中的游戏画面,游戏画面可以随着游戏应用程序的实际运行情况而不断变化。For example, at present, playing video games on electronic devices has become one of the important ways for many users to entertain and relax. During the process of running the game application program, the electronic device constructs a smooth game screen by displaying frame-by-frame image frames on the display screen. Please refer to FIG. 50A . FIG. 50A is a schematic diagram of a dynamic layer in a game scene. The dynamic layer may be a game screen in the game scene, and the game screen may change continuously with the actual operation of the game application.
本申请实施例中定义的UI图层主要包括显示界面中的控件,通常情况下控件在显示界面中的位置比较固定,且目标应用程序在运行的整个过程中控件都存在于显示界面上;例如,导航栏,视窗框、文本框、按钮、下拉式菜单等;具体的,在游戏场景中,控件可以指游戏应用程序中的操控按键,设置按键等,举例来说,请参阅图50B,图50B是一种游戏场景中UI图层的示意图,如图所示,控件可以包括方向指标,游戏时长,游戏延迟,游戏设置按键,游戏操控按键;可见上述控件在游戏场景中一直存在于显示屏上,只是显示的数据有所变化,例如游戏延迟控件会根据网络状况的变化更新延迟的数值,但游戏延迟控件一直在显示屏上显示。The UI layer defined in the embodiment of the present application mainly includes controls in the display interface. Usually, the positions of the controls in the display interface are relatively fixed, and the controls exist on the display interface during the entire process of running the target application; for example, , navigation bar, window frame, text box, button, drop-down menu, etc.; specifically, in the game scene, the controls may refer to the control buttons, setting buttons, etc. in the game application program, for example, please refer to Figure 50B, 50B is a schematic diagram of a UI layer in a game scene. As shown in the figure, the controls may include direction indicators, game duration, game delay, game setting buttons, and game control buttons; it can be seen that the above controls always exist on the display screen in the game scene. Only the displayed data changes. For example, the game lag control will update the lag value according to changes in network conditions, but the game lag control will always be displayed on the display.
电子设备最终显示的图像帧1C可以由本申请实施例中定义的如图50A所示的动态图层和如图50B所示的UI图层构成。The image frame 1C finally displayed by the electronic device may be composed of the dynamic layer as shown in FIG. 50A and the UI layer as shown in FIG. 50B defined in the embodiments of the present application.
本申请实施例中的存储空间为电子设备在缓存中定义的一块空间,存储空间可视为挂载点,通过该挂载点建立纹理图像和渲染对象之间的关联。存储空间包括以下作用:(1)存储根据目标应用程序的数据生成的绘制结果;具体的,存储空间中可以包括至少一种附件,且 每种附件至少包括一种缓冲类型,缓冲类型可以包括颜色类型,深度类型和模板类型;电子设备可以根据绘制指令将绘制结果存储到不同的附件上,最终在存储空间中构成图像帧。(2)在存储空间中存储并合成图像帧:电子设备可以将多个存储空间中存储的绘制结果存储至同一个存储空间中,并在该存储空间中合成图像帧。(3)在垂直同步信号VSYNC到来时将存储的图像帧传送至显示屏进行显示;用于存储图像帧的存储空间可以设置至少一个;当用于存储图像帧的存储空间的数量大于等于2时,目标应用程序可以调用第一指令,对存储有图像帧的存储空间进行轮换;举例来说,若用于存储图像帧的第九存储空间由第十三存储空间和第十四存储空间构成,则当目标应用程序调用第一指令时,电子设备可以首先将存储有图像帧的第十三存储空间轮换到第一状态,当第十三存储空间处于第一状态时,垂直同步信号VSYNC到来时可将第十三存储空间中的图像帧传输至显示设备,进而显示设备显示图像帧;在第十三存储空间处于第一状态时,电子设备可以根据目标应用程序的绘制指令在第十四存储空间中绘制生成第八图像帧;当目标应用程序再次调用第一指令时,电子设备将第十四存储空间轮换至第一状态,并在第十三存储空间中绘制生成第九图像帧;不断重复上述操作,则可以实现画面的显示。当存储空间处于第二状态时,电子设备可以根据目标应用程序的指令在存储空间中绘制或合成图像帧。本申请实施例中,第九存储空间在由至少两个存储空间构成的情况下,可实现离屏渲染功能。当电子设备中的目标应用程序启动时,电子设备可以针对目标应用程序配置至少一块存储空间;电子设备在运行目标应用程序的过程中,电子设备可以选择一块存储空间进行绑定,之后,电子设备可以根据目标应用程序的绘制指令,将绘制得到的绘制结果和渲染结果存储到绑定的存储空间中;具体的,电子设备可以根据绘制指令将得到的绘制结果存储至不同的存储空间中。需要说明的是,本申请实施例中,在一个存储空间由多个存储空间构成的情况下,表示多个存储空间在本申请实施例中具有相同的至少一个特性;例如,本申请实施例的权利要求中,第七存储空间由第十存储空间和第十一存储空间构成,表示第十存储空间和第十一存储空间具有相同的特性,即第十存储空间和第十一存储空间均用于存储在绘制条件满足第一条件时的绘制结果。The storage space in the embodiment of the present application is a space defined by the electronic device in the cache, and the storage space can be regarded as a mount point, and an association between a texture image and a rendering object is established through the mount point. The storage space includes the following functions: (1) Store the drawing results generated according to the data of the target application; specifically, the storage space can include at least one attachment, and each attachment includes at least one buffer type, and the buffer type can include color type, depth type and template type; the electronic device can store the drawing results on different attachments according to the drawing instructions, and finally form an image frame in the storage space. (2) Storing and synthesizing image frames in the storage space: The electronic device can store the drawing results stored in multiple storage spaces in the same storage space, and synthesize image frames in the storage space. (3) When the vertical synchronization signal VSYNC arrives, the stored image frames are transmitted to the display screen for display; at least one storage space for storing image frames can be set; when the number of storage spaces for storing image frames is greater than or equal to 2 , the target application can call the first instruction to rotate the storage space in which the image frame is stored; for example, if the ninth storage space for storing the image frame consists of the thirteenth storage space and the fourteenth storage space, Then when the target application program calls the first instruction, the electronic device can firstly rotate the thirteenth storage space storing the image frame to the first state, and when the thirteenth storage space is in the first state, when the vertical synchronization signal VSYNC arrives. The image frame in the thirteenth storage space can be transmitted to the display device, and then the display device displays the image frame; when the thirteenth storage space is in the first state, the electronic device can store the image frame in the fourteenth storage space according to the drawing instruction of the target application. Drawing in the space to generate the eighth image frame; when the target application calls the first instruction again, the electronic device rotates the fourteenth storage space to the first state, and draws in the thirteenth storage space to generate the ninth image frame; By repeating the above operations, the display of the screen can be realized. When the storage space is in the second state, the electronic device may draw or synthesize image frames in the storage space according to the instruction of the target application. In this embodiment of the present application, when the ninth storage space is composed of at least two storage spaces, an off-screen rendering function can be implemented. When the target application in the electronic device is started, the electronic device can configure at least one storage space for the target application; when the electronic device runs the target application, the electronic device can select a storage space for binding, and then the electronic device can The drawing results and rendering results obtained by drawing can be stored in the bound storage space according to the drawing instructions of the target application; specifically, the electronic device can store the obtained drawing results in different storage spaces according to the drawing instructions. It should be noted that, in the embodiment of the present application, in the case where one storage space is composed of multiple storage spaces, it means that the multiple storage spaces have the same at least one characteristic in the embodiment of the present application; for example, the In the claims, the seventh storage space is composed of the tenth storage space and the eleventh storage space, indicating that the tenth storage space and the eleventh storage space have the same characteristics, that is, the tenth storage space and the eleventh storage space are both used. for storing the drawing result when the drawing condition satisfies the first condition.
本申请实施例中,存储空间在硬件设备上的位置具体可以设置于图形处理器(graphics processingunit,GPU)的随机存储器中,也可以设置于与GPU通信连接的随机存储器中。In the embodiment of the present application, the location of the storage space on the hardware device may be specifically set in a random access memory of a graphics processing unit (graphics processing unit, GPU), or may be set in a random access memory communicatively connected with the GPU.
本申请实施例中的存储空间的一些通用的叫法可以是:帧缓存存储器,简称帧缓存,或帧缓冲;需要说明的是,在不同的编程语言中可以有其他不同的叫法。Some common names of the storage space in the embodiments of the present application may be: frame buffer memory, frame buffer for short, or frame buffer; it should be noted that there may be other different names in different programming languages.
一个帧缓冲中包括至少一个附件;一个附件当中至少包括一个缓冲类型;缓冲类型可以包括:颜色类型,深度类型和模板类型。例如帧缓冲中可以包括三个附件,具体可以是:一个颜色类型的附件,一个深度类型的附件和一个模板类型的附件。A frame buffer includes at least one attachment; an attachment includes at least one buffer type; the buffer type may include: color type, depth type and template type. For example, the frame buffer may include three attachments, which may specifically be: a color type attachment, a depth type attachment, and a template type attachment.
举例来说,本申请实施例中的存储空间在Vulkan编程语言中可以称为vkframebuffer;在开放图形库(Open Graphics Library,OpenGL)编程语言中称为帧缓存对象(Frame Buffer Object,FBO)。下面针对OpenGL中的FBO进行详细的说明:在OpenGL中,创建一个FBO需至少满足以下条件:FBO至少包含一个附件,附件可以是颜色附件,深度附件,模板缓冲附件;附件中至少一个是颜色附件;且上述附件已经位于缓存之中。目标应用程序在启动后可以首先调用OpenGL中的glGenFramebuffers应用编程接口(application programming interface,API)生成至少一个FBO,glGenFramebuffers API具体用于创建和生成FBO;之后,根据目标应用程序的绘制指令,调用glBindFrameBuffer API将步目标应用程序与至少一个FBO中的一个FBO进行绑定,glBindFrameBuffer API具体用于将目标应用程序和FBO进行绑定;在目标应 用程序与FBO绑定的情况下,目标应用程序可调用glDrawElements API执行绘制操作,glDrawElements API为绘制指令,具体用于在FBO中执行绘制操作;之后,将绘制结果存入绑定的FBO中;之后,将至少一个FBO中已有的绘制结果存入轮换FBO中,并在FBO中合成图像帧;当接收到eglSwapBuffers API时,针对轮换FBO进行轮换,使得在处于第一状态时,轮换FBO中的图像帧在VSYNC到来时可以送显到显示设备;eglSwapBuffers API即为第一指令在OpenGL中的具体表现形式。For example, the storage space in the embodiments of the present application may be called vkframebuffer in the Vulkan programming language; it may be called a frame buffer object (Frame Buffer Object, FBO) in the Open Graphics Library (Open Graphics Library, OpenGL) programming language. The following is a detailed description of FBO in OpenGL: In OpenGL, to create an FBO, at least the following conditions must be met: FBO contains at least one attachment, which can be a color attachment, a depth attachment, or a stencil buffer attachment; at least one of the attachments is a color attachment ; and the above attachment is already in the cache. After the target application is started, it can first call the glGenFramebuffers application programming interface (application programming interface, API) in OpenGL to generate at least one FBO, and the glGenFramebuffers API is specifically used to create and generate FBO; then, according to the drawing instructions of the target application, call glBindFrameBuffer The API binds the target application to one of at least one FBO. The glBindFrameBuffer API is specifically used to bind the target application to the FBO; when the target application is bound to the FBO, the target application can call The glDrawElements API performs the drawing operation, and the glDrawElements API is the drawing instruction, which is specifically used to perform the drawing operation in the FBO; after that, the drawing result is stored in the bound FBO; after that, the existing drawing result in at least one FBO is stored in the rotation In FBO, and synthesize image frames in FBO; when receiving eglSwapBuffers API, rotate for rotating FBO, so that in the first state, the image frame in rotating FBO can be sent to the display device when VSYNC arrives; eglSwapBuffers The API is the specific representation of the first instruction in OpenGL.
在一些实施例中,电子设备可以向目标应用程序配置至少一个存储空间;当目标应用程序与不同的存储空间进行绑定时,电子设备可以根据绘制指令将不同的绘制结果存储至不同的存储空间中。In some embodiments, the electronic device may configure at least one storage space for the target application; when the target application is bound to different storage spaces, the electronic device may store different drawing results in different storage spaces according to the drawing instruction middle.
举例来说,本申请实施例中,电子设备根据目标应用程序的绘制指令将绘制结果存储到不同的存储空间中,在绘制指令满足第一条件时,将绘制结果存储到第七存储空间;绘制指令满足第二条件时,将绘制结果存储到第八存储空间;本申请实施例中,第一条件为绘制指令中包括启用深度测试的指令的情况,绘制结果可以呈现三维效果,在第一条件下的绘制结果可以视为用于呈现图50A所示的动态图层;第二条件为绘制指令中包括关闭深度测试的情况,绘制结果仅能呈现二维效果。因此,在第二条件下的绘制结果可以视为用于呈现图50B所示的UI图层。最后,电子设备将第七存储空间中的绘制结果和第八存储空间中的绘制结果在第九存储空间中进行混合,即可在第九存储空间中合成图50C所示的图像帧。For example, in the embodiment of the present application, the electronic device stores the drawing result in different storage spaces according to the drawing instruction of the target application, and when the drawing instruction satisfies the first condition, stores the drawing result in the seventh storage space; drawing When the instruction satisfies the second condition, the drawing result is stored in the eighth storage space; in the embodiment of the present application, the first condition is that the drawing instruction includes an instruction for enabling depth testing, and the drawing result can present a three-dimensional effect. The drawing result below can be regarded as being used to present the dynamic layer shown in FIG. 50A ; the second condition is that the drawing instruction includes the case where the depth test is disabled, and the drawing result can only present a two-dimensional effect. Therefore, the drawing result under the second condition can be regarded as being used to render the UI layer shown in FIG. 50B . Finally, the electronic device mixes the drawing result in the seventh storage space and the drawing result in the eighth storage space in the ninth storage space, so as to synthesize the image frame shown in FIG. 50C in the ninth storage space.
本申请实施例中,在绘制指令满足第一条件的情况下,根据绘制指令执行绘制操作,得到第一绘制结果;若第一绘制结果呈现到显示屏上,则呈现的效果可以是如图50A所示的三维图层/图像;在绘制指令满足第二条件的情况下,根据绘制指令执行绘制操作,得到第二绘制结果,若第二绘制结果最终呈现到显示屏上,呈现的效果可以是如图50B所示的二维图层/图像;电子设备最终将绘制指令满足不同条件时的对应的绘制结果进行混合,得到最终的图像帧,如图50C所示。具体的,本申请实施例中,电子设备执行目标应用程序的绘制过程如图50D所示,可以看出,目标应用程序在执行绘制的过程中,目标应用程序的绘制指令在满足第一条件和满足第二条件之间不断的进行切换;电子设备的图像帧中每两图像帧共用一个绘制指令满足第二条件时的绘制结果,使得电子设备在生成图像帧时可以减少一半绘制指令满足第二条件时的绘制操作,降低了电子设备的功耗。需要说明的是,在游戏场景中,如图50A所示的动态图层是影响游戏体验的根本原因,在动态图层的帧率较高的情况下,用户会感觉游戏画面流畅;反之,用户会感觉游戏画面卡顿,认为游戏应用程序掉帧;如图50B所示的UI图层在游戏场景中变化较小,并不是影响游戏体验的根本原因。因此,本申请实施例中每两帧图像共用一个绘制指令满足第二条件时对应的绘制结果,在影响游戏体验较小甚至不影响游戏体验的情况下,降低了电子设备的功耗。具体的,本申请实施例中第一条件指的是绘制指令中包含启用深度测试的指令;第二条件指的是绘制指令中包含关闭深度测试的指令。In the embodiment of the present application, when the drawing instruction satisfies the first condition, the drawing operation is performed according to the drawing instruction to obtain the first drawing result; if the first drawing result is displayed on the display screen, the presented effect may be as shown in FIG. 50A The three-dimensional layer/image shown; when the drawing instruction satisfies the second condition, the drawing operation is performed according to the drawing instruction to obtain the second drawing result. If the second drawing result is finally presented on the display screen, the presented effect can be as follows: The two-dimensional layer/image shown in FIG. 50B ; the electronic device finally mixes the corresponding drawing results when the drawing instructions meet different conditions to obtain a final image frame, as shown in FIG. 50C . Specifically, in the embodiment of the present application, the drawing process of the electronic device executing the target application is shown in FIG. 50D . It can be seen that during the drawing process of the target application, the drawing instruction of the target application satisfies the first condition and the Continuously switch between satisfying the second condition; every two image frames in the image frame of the electronic device share a drawing result when the drawing instruction satisfies the second condition, so that the electronic device can reduce the drawing instruction by half when generating the image frame to satisfy the second condition. Conditional drawing operations reduce the power consumption of electronic devices. It should be noted that, in the game scene, the dynamic layer as shown in Figure 50A is the fundamental reason that affects the game experience. When the frame rate of the dynamic layer is high, the user will feel that the game screen is smooth; The game screen may feel stuck, and the game application may drop frames; the UI layer shown in Figure 50B changes little in the game scene, which is not the root cause of affecting the game experience. Therefore, in the embodiment of the present application, every two frames of images share a drawing instruction corresponding to the drawing result when the second condition is satisfied, which reduces the power consumption of the electronic device with little or no impact on the game experience. Specifically, in the embodiment of the present application, the first condition refers to that the drawing instruction includes an instruction to enable depth testing; the second condition refers to that the drawing instruction includes an instruction to disable depth testing.
本申请实施例中,一个绘制周期表示一帧图像帧从开始绘制到绘制完成图像帧的整个绘制过程占用的时长;具体的,当电子设备运行目标应用程序时,电子设备可以根据目标应用程序的绘制指令确定出图像帧开始绘制和结束绘制的时间点,进而确定出该帧图像帧的绘制周期。具体的,目标应用程序调用第一指令的时间点可以是相邻两个绘制后期结束和开始的时间点;第一指令的具体作用请参阅对于存储空间的解释说明。In this embodiment of the present application, one drawing period represents the time taken for the entire drawing process of one image frame from the start of drawing to the completion of drawing the image frame; specifically, when the electronic device runs the target application, the electronic device can The drawing instruction determines the time points when the image frame starts and ends, and then determines the drawing period of the image frame. Specifically, the time point when the target application program calls the first instruction may be the time point when two adjacent drawing stages end and start; please refer to the explanation of the storage space for the specific function of the first instruction.
本申请实施例提供了一种生成图像帧的方法,以降低电子设备运行游戏应用程序时的功耗。An embodiment of the present application provides a method for generating an image frame, so as to reduce power consumption when an electronic device runs a game application.
示例性的,请参阅图50E,图50E是本申请实施例中生成图像帧的一种可能的示意图,如图50E所示,Exemplarily, please refer to FIG. 50E. FIG. 50E is a possible schematic diagram of generating an image frame in this embodiment of the present application. As shown in FIG. 50E,
步骤(1):在电子设备检测到目标应用程序启动时,电子设备首先创建关联目标应用程序的第七存储空间5001,第八存储空间5002和第九存储空间5003;Step (1): when the electronic device detects that the target application is started, the electronic device first creates a seventh storage space 5001, an eighth storage space 5002 and a ninth storage space 5003 associated with the target application;
步骤(2):在目标应用程序的绘制指令满足第一条件时,将绘制结果存入第七存储空间5001中,作为第一绘制结果;Step (2): when the drawing instruction of the target application satisfies the first condition, the drawing result is stored in the seventh storage space 5001 as the first drawing result;
步骤(3):在目标应用程序的绘制指令满足第二条件时,将绘制结果存入第七存储空间5002中,作为第二绘制结果;Step (3): when the drawing instruction of the target application satisfies the second condition, the drawing result is stored in the seventh storage space 5002 as the second drawing result;
步骤(4):将第七存储空间5001中的第一绘制结果和第八存储空间5002中的第二绘制结果存储至第九存储空间5003中,在第九存储空间5003中根据第一绘制结果和第二绘制结果合成第七图像帧;Step (4): store the first drawing result in the seventh storage space 5001 and the second drawing result in the eighth storage space 5002 in the ninth storage space 5003, and in the ninth storage space 5003 according to the first drawing result and synthesizing the seventh image frame with the second drawing result;
步骤(5):在目标应用程序的绘制指令满足第一条件时,将绘制结果覆盖存入第七存储空间5001中,作为第三绘制结果;Step (5): when the drawing instruction of the target application satisfies the first condition, the drawing result is overwritten and stored in the seventh storage space 5001 as the third drawing result;
步骤(6):将第七存储空间5001中的第三绘制结果和第八存储空间5002中的第二绘制结果存储至第九存储空间5003中,在第九存储空间5003中根据存入的三绘制结果和第二绘制结果合成第八图像帧。Step (6): store the third drawing result in the seventh storage space 5001 and the second drawing result in the eighth storage space 5002 into the ninth storage space 5003, and in the ninth storage space 5003 according to the stored three The drawing result and the second drawing result are combined into an eighth image frame.
其中,步骤(2),步骤(3)和步骤(4)可以构成第一绘制周期;步骤(5)和步骤(6)可以构成第二绘制周期。Wherein, step (2), step (3) and step (4) may constitute a first drawing cycle; step (5) and step (6) may constitute a second drawing cycle.
需要说明的是,本示例中,第九存储空间可以包含至少两个存储空间。It should be noted that, in this example, the ninth storage space may include at least two storage spaces.
电子设备在目标存储空间中合成图像帧之后,需要将图像帧传输至显示屏进行显示,之后将图像帧删除,以便于合成并存储下一图像帧。例如图50E中,电子设备首先合成第七图像帧,之后,将第九存储空间5003中的第七图像帧传输至显示屏进行显示,之后,清空第九存储空间5003,以便于在第九存储空间5003中合成第八图像帧。需要说明的是,电子设备还可以设置多个存储空间,多个存储空间构成第九存储空间5003;将生成的图像帧存储到不同的存储空间中,进而根据第一指令实现存储空间的轮换,进而不断的将存储空间中的图像帧传输到显示屏上显示。例如第九存储空间可以设置第十三存储空间和第八存储空间;当存储第七图像帧的第十三存储空间处于第一状态时,即电子设备的显示屏上显示第七图像帧时,电子设备可以在第十四存储空间中合成第八图像帧。After the electronic device synthesizes the image frames in the target storage space, it needs to transmit the image frames to the display screen for display, and then delete the image frames to facilitate the synthesis and storage of the next image frame. For example, in FIG. 50E , the electronic device first synthesizes the seventh image frame, then transmits the seventh image frame in the ninth storage space 5003 to the display screen for display, and then clears the ninth storage space 5003 so as to store the seventh image frame in the ninth storage space 5003 for display. The eighth image frame is synthesized in space 5003 . It should be noted that the electronic device can also be set with multiple storage spaces, and the multiple storage spaces constitute the ninth storage space 5003; the generated image frames are stored in different storage spaces, and then the rotation of the storage spaces is realized according to the first instruction, Then, the image frames in the storage space are continuously transmitted to the display screen for display. For example, a thirteenth storage space and an eighth storage space can be set in the ninth storage space; when the thirteenth storage space for storing the seventh image frame is in the first state, that is, when the seventh image frame is displayed on the display screen of the electronic device, The electronic device may synthesize the eighth image frame in the fourteenth storage space.
可见,本申请实施例中,将绘制指令满足不同条件时得到的绘制结果分开存储,实现了对于部分绘制结果的复用,减少了运行目标应用程序时电子设备的数据处理量,降低了电子设备在运行目标应用程序时的功耗。It can be seen that in the embodiment of the present application, the drawing results obtained when the drawing instructions meet different conditions are stored separately, which realizes the multiplexing of some drawing results, reduces the data processing amount of the electronic device when running the target application program, and reduces the electronic device. Power consumption while running the target application.
如图51A所示,该方法可以包括:As shown in Figure 51A, the method may include:
S5101,在第一绘制周期时,根据目标应用程序的绘制指令,当绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当绘制指令满足第二条件时,将绘制结果存入第八存储空间,作为第二绘制结果。S5101, in the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, store the drawing result in the seventh storage space as the first drawing result, when the drawing instruction satisfies the second condition , and the drawing result is stored in the eighth storage space as the second drawing result.
其中,相邻的两个绘制周期开始和结束的时间节点可以是目标应用程序调用第一指令的时间点,第一指令用于轮换存储空间;举例来说,当绘制指令为OpenGL中的指令时,第一绘制指具体可以是eglSwapBuffers API;The time nodes at the start and end of two adjacent drawing cycles may be the time points when the target application calls the first instruction, and the first instruction is used to rotate the storage space; for example, when the drawing instruction is an instruction in OpenGL , the first drawing finger can be eglSwapBuffers API;
本示例中,电子设备在首次拦截到第一指令时,电子设备可以创建第七存储空间和第八存储空间;第七存储空间用于存储绘制指令中满足第一条件时的绘制结果;第八存储空间用于存储绘制指令中满足第二条件时的绘制结果;In this example, when the electronic device intercepts the first instruction for the first time, the electronic device can create a seventh storage space and an eighth storage space; the seventh storage space is used to store the drawing result when the first condition is satisfied in the drawing instruction; the eighth storage space The storage space is used to store the drawing result when the second condition is satisfied in the drawing instruction;
其中,电子设备设置有拦截模块;拦截模块可以针对目标应用程序的指令进行拦截,并根据拦截到的指令执行操作;当电子设备拦截到目标应用程序的绘制指令时,若绘制执行中包含启用深度测试的指令,则确定绘制指令满足第一条件;若绘制指令中包含关闭深度测试的指令,则确定绘制指令满足第二条件。当绘制指令满足第一条件时,电子设备在根据目标应用程序执行绘制的过程,深度测试处于启用状态;当绘制指令满足第二条件时,电子设备在根据目标应用程序执行绘制的过程,深度测试处于关闭状态。Among them, the electronic device is provided with an interception module; the interception module can intercept the instructions of the target application, and perform operations according to the intercepted instructions; when the electronic device intercepts the drawing instructions of the target application, if the drawing execution includes the enabling depth If the test instruction is used, it is determined that the drawing instruction satisfies the first condition; if the drawing instruction includes an instruction to close the depth test, it is determined that the drawing instruction satisfies the second condition. When the drawing instruction satisfies the first condition, the electronic device is performing the drawing process according to the target application, and the depth test is enabled; when the drawing instruction satisfies the second condition, the electronic device is performing the drawing process according to the target application, and the depth test is is closed.
本申请实施例中,电子设备设置有拦截模块,拦截模块可拦截目标应用程序的绘制指令,实现绘制指令的识别,进而判断绘制指令满足第一条件或第二条件。In the embodiment of the present application, the electronic device is provided with an interception module, and the interception module can intercept the drawing instruction of the target application, realize the identification of the drawing instruction, and then judge that the drawing instruction satisfies the first condition or the second condition.
其中,电子设备设置有计数单元,计数单元的初始化数值为第一数值,计数单元的数值每更新一次在第一数值和第二数值之间切换一次;绘制周期开始的时刻为计数单元更新的时刻;在一个绘制周期中,若更新后的计数单元的数值为第二数值,则清空第八存储空间;并在绘制指令满足第二条件时,将绘制结果存入第八存储空间;若更新后的计数单元的数值为第一数值,则不清空第二存储单元;并在绘制指令满足第二条件时,不执行绘制。由于相邻的两个绘制周期开始和结束的时间节点可以是目标应用程序调用第一指令的时间点;因此当拦截模块每拦截到一次第一指令时,计数单元更新一次。具体的,第一数值可以为0,第二数值可以为1。The electronic device is provided with a counting unit, the initialization value of the counting unit is the first value, and the value of the counting unit is switched between the first value and the second value every time the value of the counting unit is updated; the moment when the drawing cycle starts is the moment when the counting unit is updated In a drawing cycle, if the numerical value of the updated counting unit is the second numerical value, then the eighth storage space is emptied; and when the drawing instruction meets the second condition, the drawing result is stored in the eighth storage space; if after the update If the value of the count unit is the first value, the second storage unit is not emptied; and when the drawing instruction satisfies the second condition, the drawing is not performed. Since the time nodes at the start and end of two adjacent drawing cycles may be the time points at which the target application calls the first instruction; therefore, when the intercepting module intercepts the first instruction once, the counting unit is updated once. Specifically, the first value may be 0, and the second value may be 1.
其中,若将第一绘制结果呈现到显示设备上,则最终呈现的显示效果可以如图50A所示。Wherein, if the first drawing result is presented on the display device, the final presented display effect may be as shown in FIG. 50A .
S5102,根据第一绘制结果和第二绘制结果生成第七图像帧;S5102, generating a seventh image frame according to the first drawing result and the second drawing result;
其中,电子设备可以在第七存储空间5001中合成第七图像帧;也可以在第九存储空间5003中合成图像帧。若电子设备在第七存储空间5001中合成第七图像帧,则第七存储空间5001可由至少两个存储空间构成。若电子在第九存储空间5003中合成第七图像帧,则第九存储空间可由至少两个存储空间构成。电子设备可以将存储图像帧的存储空间进行轮换,使得存储空间中的图像帧可以传输到显示设备,进而由显示设备进行显示。Wherein, the electronic device may synthesize the seventh image frame in the seventh storage space 5001 ; and may also synthesize the image frame in the ninth storage space 5003 . If the electronic device synthesizes the seventh image frame in the seventh storage space 5001, the seventh storage space 5001 may be composed of at least two storage spaces. If the electrons synthesize the seventh image frame in the ninth storage space 5003, the ninth storage space may be composed of at least two storage spaces. The electronic device can rotate the storage space for storing the image frames, so that the image frames in the storage space can be transmitted to the display device, and then displayed by the display device.
请参阅图51B,图51B是根据第七存储空间5001中的第一绘制结果和第八存储空间5002中的第二绘制结果在第九存储空间5003中合成第七图像帧的示意图。Please refer to FIG. 51B , which is a schematic diagram of synthesizing a seventh image frame in the ninth storage space 5003 according to the first drawing result in the seventh storage space 5001 and the second drawing result in the eighth storage space 5002 .
请参阅图51C,图51C是根据第七存储空间5001中的第一绘制结果和第八存储空间5002中的第二绘制结果在第七存储空间5001中合成第七图像帧的示意图。Please refer to FIG. 51C , which is a schematic diagram of synthesizing a seventh image frame in the seventh storage space 5001 according to the first drawing result in the seventh storage space 5001 and the second drawing result in the eighth storage space 5002 .
其中,第七图像帧最终呈现到显示设备上的效果可以如图50C所示。The effect that the seventh image frame is finally presented on the display device may be as shown in FIG. 50C .
S5103,在第二绘制周期时,根据目标应用程序的绘制指令,当绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第三绘制结果,当绘制指令满足第二条件时,不进行绘制;S5103, in the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, store the drawing result in the seventh storage space as the third drawing result, when the drawing instruction satisfies the second condition , do not draw;
其中,若将第三绘制结果呈现到显示设备上,则最终呈现的显示效果可以如图51D所示;Wherein, if the third drawing result is presented on the display device, the final presented display effect may be as shown in Figure 51D;
S5104,根据第三绘制结果和第二绘制结果生成第八图像帧。S5104: Generate an eighth image frame according to the third rendering result and the second rendering result.
其中,第八图像帧最终呈现到显示设备上的效果可以如图51E所示。The effect that the eighth image frame is finally presented on the display device may be as shown in FIG. 51E .
其中,请参阅步骤S5102的解释说明,同理,第八图像帧的可以在第七存储空间5001中合成也可以是在第九存储空间5003中合成。Wherein, please refer to the explanation of step S5102. Similarly, the eighth image frame may be synthesized in the seventh storage space 5001 or may be synthesized in the ninth storage space 5003.
可见,上述示例中,电子设备在第一绘制周期中将绘制指令满足第一条件时得到的第一 绘制结果和绘制指令满足第二条件时的第二绘制指令分开存储,并根据第一绘制结果和第二绘制结果生成第七图像帧;在第二绘制周期中,电子设备只需在绘制指令满足第一条件时进行绘制,得到第三绘制结果,复用第二绘制结果,根据第二绘制结果和第三绘制结果生成第八图像帧;降低了电子设备在绘制指令满足第一条件时电子设备的数据处理量,降低了电子设备的功耗。It can be seen that in the above example, the electronic device stores the first drawing result obtained when the drawing instruction satisfies the first condition and the second drawing instruction obtained when the drawing instruction satisfies the second condition separately in the first drawing cycle, and according to the first drawing result and the second drawing result to generate the seventh image frame; in the second drawing cycle, the electronic device only needs to draw when the drawing instruction meets the first condition, obtain the third drawing result, reuse the second drawing result, and draw according to the second drawing The result and the third drawing result generate an eighth image frame; the data processing amount of the electronic device when the drawing instruction satisfies the first condition is reduced, and the power consumption of the electronic device is reduced.
下面结合一个可能的示例针对图51A所示的流程进行解释说明。The flow shown in FIG. 51A is explained below with reference to a possible example.
请参阅图51F,图51F中包括第七存储空间5001,第八存储空间5002,第九存储空间5003和计数单元5104。电子设备在每个绘制周期中绘制一帧图像帧;如图所示,计数单元的初始值为第一数值,附图中第一数值具体用0表示;当目标应用程序启动,拦截模块首次拦截到目标应用程序对于第一指令的调用时;计数单元5104的数值更新为第二数值,附图中第二数值具体用1表示;进入第一绘制周期,在第一绘制周期中,在绘制指令满足第一条件时,将第一绘制结果存入第七存储空间5001;在绘制指令满足第二条件时,由于计数单元的数值为第二数值,因此将第二绘制结果存入第二储空间5002;之后根据第一绘制结果和第二绘制结果在第九存储空间5003中合成第七图像帧。当拦截模块再次拦截到目标应用程序对于第一指令的调用时;计数单元5104的数值更新为第一数值;进入第二绘制周期,在第二绘制周期中,在绘制指令满足第一条件时,将第三绘制结果存入第七存储空间5001;在绘制指令满足第二条件时,由于计数单元的数值为第一数值,因此不执行绘制操作;之后,根据第三绘制结果和第二绘制结果在第九存储空间5003中合成第八图像帧。同理可得第九图像帧和第十图像帧。可见,本示例中,通过计数单元的数值可以判断在当前绘制周期中,在绘制指令满足第二条件时,是否执行绘制操作。具体的,第一数值可以为0,第二数值可以为1。需要说明的是,计数单元的数值可以根据具体情况进行调整。例如,技术单元可以在按照0,1……N,的顺序进行切换,N为大于等于2的正整数;计数单元的初始值为0;在一个绘制周期中,在一个绘制周期中,若更新后的计数单元的数值为1,则在绘制周期开始的时刻清空第八存储空间;并在绘制指令满足第二条件时,将绘制结果存入第八存储空间;若更新后的计数单元的数值为1之外的数值,则在绘制周期开始的时刻不清空第二存储单元;并在绘制指令满足第二条件时,不执行绘制。Please refer to FIG. 51F . FIG. 51F includes a seventh storage space 5001 , an eighth storage space 5002 , a ninth storage space 5003 and a counting unit 5104 . The electronic device draws one image frame in each drawing cycle; as shown in the figure, the initial value of the counting unit is the first value, and the first value in the figure is specifically represented by 0; when the target application is started, the interception module intercepts for the first time When the target application program calls the first instruction; the numerical value of the counting unit 5104 is updated to the second numerical value, and the second numerical value is specifically represented by 1 in the accompanying drawing; Enter the first drawing cycle, in the first drawing cycle, in the drawing instruction When the first condition is met, the first drawing result is stored in the seventh storage space 5001; when the drawing instruction meets the second condition, since the value of the counting unit is the second value, the second drawing result is stored in the second storage space 5002; and then synthesize the seventh image frame in the ninth storage space 5003 according to the first rendering result and the second rendering result. When the interception module intercepts the invocation of the first instruction by the target application program again; the value of the counting unit 5104 is updated to the first value; the second drawing cycle is entered, and in the second drawing cycle, when the drawing instruction satisfies the first condition, The third drawing result is stored in the seventh storage space 5001; when the drawing instruction satisfies the second condition, since the value of the counting unit is the first value, the drawing operation is not performed; after that, according to the third drawing result and the second drawing result The eighth image frame is synthesized in the ninth storage space 5003 . Similarly, the ninth image frame and the tenth image frame can be obtained. It can be seen that, in this example, the value of the counting unit can be used to determine whether to perform a drawing operation in the current drawing cycle when the drawing instruction satisfies the second condition. Specifically, the first value may be 0, and the second value may be 1. It should be noted that the value of the counting unit can be adjusted according to specific conditions. For example, the technology unit can be switched in the order of 0, 1...N, where N is a positive integer greater than or equal to 2; the initial value of the counting unit is 0; in one drawing cycle, in one drawing cycle, if the update If the value of the counting unit after the update is 1, the eighth storage space is emptied at the moment when the drawing cycle begins; and when the drawing instruction satisfies the second condition, the drawing result is stored in the eighth storage space; if the value of the updated counting unit is If it is a value other than 1, the second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed.
请参阅图52,图52是本申请实施例提供的一种模块化的交互示意图;图52中包括目标应用程序1301,拦截模块5201,存储空间配置模块5202,缓存1352和显示设备1350;具体的,可以结合图13参阅本示例。Please refer to FIG. 52, which is a schematic diagram of a modular interaction provided by an embodiment of the present application; FIG. 52 includes a target application 1301, an interception module 5201, a storage space configuration module 5202, a cache 1352 and a display device 1350; specifically , you can refer to this example in conjunction with Figure 13.
拦截模块5201可以是位于图13所示的三维图形处理库1330中。拦截模块5201用于拦截目标应用程序1301的绘制指令,并响应于对于绘制指令的拦截,调用三维图形处理库1330中的API,完成对目标应用程序的数据的处理;需要说明的是,本申请实施例对于拦截模块在软件框架中的位置不做限定,拦截模块也可以位于应用程序框架层和系统库之间或者,拦截模块位于应用程序框架层。The interception module 5201 may be located in the three-dimensional graphics processing library 1330 shown in FIG. 13 . The interception module 5201 is used to intercept the drawing instruction of the target application 1301, and in response to the interception of the drawing instruction, call the API in the three-dimensional graphics processing library 1330 to complete the processing of the data of the target application; it should be noted that this application The embodiment does not limit the position of the interception module in the software framework. The interception module may also be located between the application framework layer and the system library, or the interception module may be located in the application framework layer.
存储空间配置模块5202可以位于图13所示的三维图形处理库1330中,缓存配置模块可以通过调用三维图形处理库1330中的功能函数/指令/API,实现对于存储空间的配置。The storage space configuration module 5202 can be located in the 3D graphics processing library 1330 shown in FIG. 13 , and the cache configuration module can configure the storage space by calling the function/instruction/API in the 3D graphics processing library 1330 .
显示设备1350用于显示合成的图像帧。 Display device 1350 is used to display the composite image frame.
下面针对部分功能函数/指令/API的功能进行解释说明:绑定指令:绑定指令用于将目标应用程序与存储空间进行绑定,将绘制结果存储到绑定的存储空间中;绘制指令:用于根据 目标应用程序1301执行绘制操作;第一指令用于将存储有图像帧的存储空间轮换至显示设备1350可以读取的状态。第一指令可以作为两个相邻周期结束和开始的时间节点。具体的,在三维图形处理库1330为OpenGL的情况下,绑定指令可以是glBindFrameBuffer API;绘制指令可以是:glDrawElements API;第一指令可以是eglSwapBuffersAPI。The following explains the functions of some functional functions/instructions/APIs: Binding instructions: The binding instructions are used to bind the target application to the storage space, and store the drawing results in the bound storage space; drawing instructions: It is used to perform a drawing operation according to the target application 1301; the first instruction is used to rotate the storage space where the image frame is stored to a state that can be read by the display device 1350. The first instruction may serve as a time node where two adjacent cycles end and start. Specifically, when the three-dimensional graphics processing library 1330 is OpenGL, the binding instruction may be the glBindFrameBuffer API; the drawing instruction may be: glDrawElements API; and the first instruction may be eglSwapBuffers API.
本申请实施例中图像帧生成方法可以包括如图52所示的步骤:The image frame generation method in this embodiment of the present application may include the steps shown in FIG. 52 :
步骤(1)电子设备在目标应用程序1301启动时创建第七存储空间5001和第八存储空间5002;Step (1) The electronic device creates a seventh storage space 5001 and an eighth storage space 5002 when the target application 1301 is started;
第七存储空间5001用于存储绘制指令满足第一条件时得到的绘制结果;The seventh storage space 5001 is used to store the drawing result obtained when the drawing instruction satisfies the first condition;
第八存储空间5002用于存储绘制指令满足第二条件时得到的绘制结果。The eighth storage space 5002 is used to store the drawing result obtained when the drawing instruction satisfies the second condition.
步骤(2)电子设备拦截到目标应用程序1301的绑定指令,将目标应用程序1301首先与第七存储空间5001进行绑定。Step (2) The electronic device intercepts the binding instruction of the target application 1301, and firstly binds the target application 1301 with the seventh storage space 5001.
步骤(3)电子设备拦截到绘制指令,根据绘制指令,在绘制指令满足第一条件时,将绘制过程中得到的绘制结果存入第七存储空间5001,在绘制指令满足第二条件时,将绘制过程中得到的绘制结果存入第八存储空间5002。电子设备可将第七存储空间5001中的绘制结果和第八存储空间5002中的绘制结果存入第九存储空间5003中;并在第九存储空间5003中合成第七图像帧。Step (3) The electronic device intercepts the drawing instruction, and according to the drawing instruction, when the drawing instruction satisfies the first condition, the drawing result obtained in the drawing process is stored in the seventh storage space 5001, and when the drawing instruction satisfies the second condition, the The drawing result obtained during the drawing process is stored in the eighth storage space 5002 . The electronic device may store the drawing result in the seventh storage space 5001 and the drawing result in the eighth storage space 5002 into the ninth storage space 5003 ; and synthesize the seventh image frame in the ninth storage space 5003 .
具体的,当绘制指令中包括启用深度测试的指令时,确定绘制指令满足第一条件;电子设备调用绑定指令将目标应用程序与第七存储空间5001进行绑定,使得根据目标应用程序的数据生成的绘制结果存入第七存储空间5001中;当绘制指令中包括关闭深度测试的指令时,确定绘制指令满足第二条件;电子设备调用绑定指令将目标应用程序与第八存储空间5002进行绑定,使得根据目标应用程序的数据生成的绘制结果存入第八存储空间5002中。Specifically, when the drawing instruction includes an instruction for enabling depth testing, it is determined that the drawing instruction satisfies the first condition; the electronic device calls the binding instruction to bind the target application with the seventh storage space 5001, so that according to the data of the target application The generated drawing result is stored in the seventh storage space 5001; when the drawing instruction includes an instruction to close the depth test, it is determined that the drawing instruction satisfies the second condition; the electronic device calls the binding instruction to carry out the target application with the eighth storage space 5002. Binding, so that the drawing result generated according to the data of the target application is stored in the eighth storage space 5002 .
步骤(4)电子设备拦截到第一指令,将第九存储空间5003轮换到可以传输图像帧至显示设备1350的状态;使得垂直同步信号到来时将第七图像帧传输至显示设备1350进行显示。Step (4) The electronic device intercepts the first instruction, and rotates the ninth storage space 5003 to a state where the image frame can be transmitted to the display device 1350; when the vertical synchronization signal arrives, the seventh image frame is transmitted to the display device 1350 for display.
需要说明的是,电子设备拦截到第一指令的时间点可以表示两个相邻的绘制周期结束和开始的时间节点。It should be noted that, the time point when the electronic device intercepts the first instruction may represent the time node when two adjacent drawing cycles end and start.
步骤(5)电子设备拦截到绘制指令,根据绘制指令,在绘制指令满足第一条件时,将绘制过程中得到的绘制结果覆盖存入第七存储空间5001,在绘制指令满足第二条件时,不执行绘制。电子设备可将第七存储空间5001中的绘制结果和第八存储空间5002中的绘制结果存入第九存储空间5003中;并在第九存储空间5003中合成第八图像帧。Step (5) The electronic device intercepts the drawing instruction, and according to the drawing instruction, when the drawing instruction satisfies the first condition, the drawing result obtained in the drawing process is overwritten and stored in the seventh storage space 5001, and when the drawing instruction satisfies the second condition, Drawing is not performed. The electronic device may store the drawing result in the seventh storage space 5001 and the drawing result in the eighth storage space 5002 into the ninth storage space 5003 ; and synthesize the eighth image frame in the ninth storage space 5003 .
步骤(6)电子设备拦截到第一指令,将第九存储空间5003轮换到可以传输图像帧至显示设备1350的状态;使得垂直同步信号到来时将第八图像帧传输至显示设备1350进行显示。Step (6) The electronic device intercepts the first instruction, and rotates the ninth storage space 5003 to a state where the image frame can be transmitted to the display device 1350; when the vertical synchronization signal arrives, the eighth image frame is transmitted to the display device 1350 for display.
需要说明的是,第九存储空间可以由多个存储空间构成,即存储第七图像帧和存储第八图像帧的存储空间可以不同;电子设备在步骤(4)中将第九存储空间中存储有第七图像帧的存储空间轮换到可以传输图像帧至显示设备1350的状态;在步骤(6)中将第九存储空间中存储有第八图像帧的存储空间轮换到可以传输图像帧至显示设备1350的状态;存储第七图像帧和存储第八图像帧的存储空间不是同一个存储空间。It should be noted that the ninth storage space may be composed of multiple storage spaces, that is, the storage space for storing the seventh image frame and the storage space for storing the eighth image frame may be different; the electronic device stores the ninth storage space in step (4). The storage space with the seventh image frame is rotated to the state where the image frame can be transmitted to the display device 1350; in step (6), the storage space stored with the eighth image frame in the ninth storage space is rotated to be able to transmit the image frame to the display. The state of the device 1350; the storage space for storing the seventh image frame and the storage space for storing the eighth image frame is not the same storage space.
当前,电子设备在运行目标应用程序时,若想提高目标应用程序对应的显示画面的帧率,通常有两种常用的方法;一种方法是根据目标应用程序的数据在单位时间内生成更多实际绘制的图像帧,进而在单位时间内根据更多的图像帧生成显示画面,达到提升帧率的目的;另一种方法是电子设备可以根据至少两张实际绘制的图像帧生成一张预测的图像帧;电子设备 在显示屏上根据实际绘制的图像帧和预测的图像帧生成显示画面,由于加入了预测的图像帧,因此达到了提升帧率的目的。At present, when an electronic device runs a target application, if it wants to increase the frame rate of the display screen corresponding to the target application, there are usually two common methods; one method is to generate more data per unit time according to the data of the target application The actual drawn image frames, and then generate a display screen based on more image frames per unit time to achieve the purpose of improving the frame rate; another method is that the electronic device can generate a predicted image frame based on at least two actually drawn image frames. Image frame: The electronic device generates a display screen according to the actual drawn image frame and the predicted image frame on the display screen. Since the predicted image frame is added, the purpose of improving the frame rate is achieved.
下面实施例介绍本申请实施例提供的另一种图像帧的生成方法,以期在插入预测帧的情况下降低电子设备的功耗。如图53A所示,该方法可以包括:The following embodiment introduces another method for generating an image frame provided by the embodiment of the present application, so as to reduce the power consumption of an electronic device when a prediction frame is inserted. As shown in Figure 53A, the method may include:
S5301,在第一绘制周期时,电子设备根据目标应用程序的绘制指令,当绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当绘制指令满足第二条件时,将绘制结果存入第八存储空间,作为第二绘制结果;根据第一绘制结果和第二绘制结果生成第七图像帧。S5301, in the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the electronic device stores the drawing result in the seventh storage space as the first drawing result, when the drawing instruction satisfies the second condition When conditions are met, the drawing result is stored in the eighth storage space as the second drawing result; the seventh image frame is generated according to the first drawing result and the second drawing result.
S5302,在第三绘制周期时,电子设备根据目标应用程序的绘制指令,当绘制指令满足第一条件时,将绘制结果存入第七存储空间中,作为第四绘制结果,当绘制指令满足第二条件时,将绘制结果存入第八存储空间,作为第五绘制结果,第三绘制周期位于第一绘制周期之后;根据第四绘制结果和第五绘制结果生成第九图像帧。S5302, in the third drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the electronic device stores the drawing result in the seventh storage space, as the fourth drawing result, when the drawing instruction satisfies the first condition In the second condition, the drawing result is stored in the eighth storage space as the fifth drawing result, and the third drawing period is located after the first drawing period; the ninth image frame is generated according to the fourth drawing result and the fifth drawing result.
S5303,在第四绘制周期时,电子设备根据第一绘制结果和第四绘制结果生成第六绘制结果;根据第六绘制结果和第七绘制结果生成第十图像帧;第七绘制结果为在第五绘制周期中,目标应用程序的绘制指令满足第二条件时得到的绘制结果,第五绘制周期在第四绘制周期之前。S5303, during the fourth drawing cycle, the electronic device generates a sixth drawing result according to the first drawing result and the fourth drawing result; generates a tenth image frame according to the sixth drawing result and the seventh drawing result; In five drawing cycles, the drawing result obtained when the drawing instruction of the target application satisfies the second condition, the fifth drawing cycle is before the fourth drawing cycle.
其中,根据第一绘制结果和第四绘制结果生成第六绘制结果的具体过程可以包括如下步骤:Wherein, the specific process of generating the sixth drawing result according to the first drawing result and the fourth drawing result may include the following steps:
需要说明的是,为便于说明根据第一绘制结果和第四绘制结果生成第六绘制结果的过程,本示例中将第一绘制结果,第四绘制结果和第六绘制结果可能呈现出的显示效果图示意性的如图53B-图53D展示出来;图53B表示第一绘制结果可能呈现出的效果图;图53C表示第四绘制结果可能呈现出的效果图;图53D表示第六绘制结果可能呈现出的效果图。It should be noted that, in order to facilitate the description of the process of generating the sixth drawing result according to the first drawing result and the fourth drawing result, in this example, the possible display effects of the first drawing result, the fourth drawing result and the sixth drawing result are used. Figure 53B-Figure 53D are shown schematically; Figure 53B shows the effect diagram that the first drawing result may present; Figure 53C shows the effect diagram that the fourth drawing result may present; Figure 53D indicates that the sixth drawing result may present The resulting effect diagram.
s11:电子设备针对第一绘制结果和第四绘制结果执行块匹配算法,确定出第一绘制结果和第四绘制结果中相互之间匹配的块;s11: the electronic device performs a block matching algorithm on the first drawing result and the fourth drawing result, and determines the blocks that match each other in the first drawing result and the fourth drawing result;
请参阅图53B;其中,第一目标块的位置坐标为(x 1,y 1),第一目标块具体显示了汽车上第一区域。请参阅图53C;其中,第二目标块的位置坐标为(x 2,y 2),第二目标块与第一目标块同样显示汽车上的第一区域;由于第一目标块和第二目标块表示了汽车上的同一区域,因此,第一目标块和第二目标块为相互之间匹配的块。 Please refer to FIG. 53B ; wherein, the position coordinates of the first target block are (x 1 , y 1 ), and the first target block specifically displays the first area on the car. Please refer to FIG. 53C; wherein, the position coordinates of the second target block are (x 2 , y 2 ), and the second target block and the first target block display the first area on the car as well; since the first target block and the second target block The blocks represent the same area on the car, so the first target block and the second target block are blocks that match each other.
s12:电子设备根据相互之间匹配的块计算出每一对匹配的块对应的运动向量,得到第四绘制结果中每个块对应的运动向量;s12: The electronic device calculates the motion vector corresponding to each pair of matched blocks according to the blocks matched with each other, and obtains the motion vector corresponding to each block in the fourth drawing result;
请参阅图53C,如图53C所示,第二目标块相对于第一目标块的运动向量为(x 2-x 1,y 2-y 1),则第二目标的运动向量为(x 2-x 1,y 2-y 1); Please refer to FIG. 53C, as shown in FIG. 53C, the motion vector of the second target block relative to the first target block is (x 2 -x 1 , y 2 -y 1 ), then the motion vector of the second target is (x 2 -x 1 , y 2 -y 1 );
s13:电子设备根据第四绘制结果中每个块对应的运动向量和第四绘制结果中每个块对应的位置坐标生成第六绘制结果中每个块对应的位置坐标,得到第六绘制结果;s13: The electronic device generates the position coordinates corresponding to each block in the sixth drawing result according to the motion vector corresponding to each block in the fourth drawing result and the position coordinates corresponding to each block in the fourth drawing result, and obtains the sixth drawing result;
请参阅图53D,第三目标块同样用于表示汽车上的第一区域;第三目标块的坐标为(x 3,y 3),第三目标块的坐标(x 3,y 3)由第二目标块的坐标(x 2,y 2)和运动向量(x 2-x 1,y 2-y 1)相加得到,即x 3=x 2+x 2-x 1;y 3=y 2+y 2-y 1Referring to FIG. 53D, the third target block is also used to represent the first area on the car; the coordinates of the third target block are (x 3 , y 3 ), and the coordinates (x 3 , y 3 ) of the third target block are determined by the The coordinates (x 2 , y 2 ) of the two target blocks and the motion vector (x 2 -x 1 , y 2 -y 1 ) are added together, that is, x 3 =x 2 +x 2 -x 1 ; y 3 =y 2 +y 2 -y 1 .
需要说明的是,图53B-图53D仅以表示汽车第一区域的目标块做示例性的说明,在实际生成第六绘制结果的过程中,电子设备可遍历第一绘制结果和第四绘制结果中的每个块,针对每个块执行上述根据第一目标块和第二目标块得到第三目标块的处理流程,最终得到第六 绘制结果中每个块的坐标,生成第六绘制结果。It should be noted that FIGS. 53B to 53D are only illustrative of the target block representing the first area of the car. In the process of actually generating the sixth drawing result, the electronic device may traverse the first drawing result and the fourth drawing result. For each block in , the above-mentioned processing flow of obtaining the third target block according to the first target block and the second target block is performed for each block, and finally the coordinates of each block in the sixth drawing result are obtained, and the sixth drawing result is generated.
可见,本示例中,电子设备每隔一帧图像帧复用一次绘制指令满足第二条件时的绘制结果,降低了电子设备的功耗;同时,在电子设备在生成待插入的第十图像帧时,无需根据第一图像帧和第九图像帧的全部数据进行计算,减小了电子设备在绘制过程中的数据处理量,降低了电子设备在生成图像帧时的功耗。It can be seen that in this example, the electronic device multiplexes the drawing result when the drawing instruction meets the second condition every other image frame, which reduces the power consumption of the electronic device; at the same time, when the electronic device is generating the tenth image frame to be inserted At the time of writing, it is not necessary to perform calculation according to all the data of the first image frame and the ninth image frame, which reduces the data processing amount of the electronic device during the drawing process, and reduces the power consumption of the electronic device when generating the image frame.
电子设备减少了本申请实施例中定义的UI图层的绘制次数,降低了电子设备的功耗;同时,电子设备可预测动态图层,并根据预测的动态图层和UI图层合成图像帧,实现插帧的效果,提高了电子设备根据图像帧播放显示画面时的帧率和流畅性;具体的,上述方案可应用于游戏场景中,即电子设备运行游戏应用程序时,电子设备可复用UI图层对应的数据,降低电子设备运行游戏应用程序时的功耗;同时,电子设备可根据两张根据游戏实际运行数据绘制得到的动态图层预测并生成下一张动态图层,进而根据预测的动态图层合成游戏应用程序的图像帧,实现游戏场景中的插帧处理,提升电子设备运行游戏应用程序时显示画面的刷新率。The electronic device reduces the number of times of drawing the UI layer defined in the embodiments of the present application, and reduces the power consumption of the electronic device; at the same time, the electronic device can predict the dynamic layer, and synthesize image frames according to the predicted dynamic layer and the UI layer , to achieve the effect of frame insertion, and improve the frame rate and fluency of the electronic device when playing the display screen according to the image frame; Use the data corresponding to the UI layer to reduce the power consumption of the electronic device when running the game application; at the same time, the electronic device can predict and generate the next dynamic layer according to the two dynamic layers drawn according to the actual running data of the game, and then The image frames of the game application are synthesized according to the predicted dynamic layer, the frame insertion processing in the game scene is realized, and the refresh rate of the display screen when the electronic device runs the game application is improved.
下面结合一个可能的示例针对图51A和图53A所示的流程进行解释说明。The flow shown in FIG. 51A and FIG. 53A is explained below with reference to a possible example.
请参阅图53E,图53E示意了生成十帧图像帧的示意图;图53E中第七图像帧,第八图像帧……等用数字,1,2,3,4,进行表示。Please refer to FIG. 53E, which is a schematic diagram of generating ten image frames; the seventh image frame, the eighth image frame, etc. in FIG. 53E are represented by numbers, 1, 2, 3, 4.
图53E示意了生成十帧图像帧的过程示意图;Figure 53E shows a schematic diagram of the process of generating ten image frames;
其中,第七图像帧和第八图像帧;第九图像帧和第十图像帧;可视为采用图51A所示的流程方法。图53E中,第一绘制结果,第三绘制结果,第四绘制结果,第六绘制结果,第七绘制结果,第十绘制结果,第十三绘制结果均为绘制指令满足第一条件时得到的绘制结果。第二绘制结果,第五绘制结果,第八绘制结果,第十一绘制结果和第十四绘制结果均为绘制指令满足第二条件时得到的绘制结果。其中,第四绘制结果和第七绘制结果生成第九绘制结果;第七绘制结果和第十绘制结果生成第十二绘制结果;第十绘制结果和第十三绘制结果生成第十五绘制结果。Among them, the seventh image frame and the eighth image frame; the ninth image frame and the tenth image frame; can be regarded as adopting the flow method shown in FIG. 51A . In FIG. 53E, the first drawing result, the third drawing result, the fourth drawing result, the sixth drawing result, the seventh drawing result, the tenth drawing result, and the thirteenth drawing result are all obtained when the drawing instruction satisfies the first condition Plot the result. The second drawing result, the fifth drawing result, the eighth drawing result, the eleventh drawing result and the fourteenth drawing result are all drawing results obtained when the drawing instruction satisfies the second condition. The fourth drawing result and the seventh drawing result generate the ninth drawing result; the seventh drawing result and the tenth drawing result generate the twelfth drawing result; and the tenth drawing result and the thirteenth drawing result generate the fifteenth drawing result.
下面结合另一个可能的示例针对图53A所示的流程进行解释说明。The flow shown in FIG. 53A will be explained below in conjunction with another possible example.
请参阅图53F,图53F示意了生成六帧图像帧的示意图;本示例中,第一绘制结果,第三绘制结果,第六绘制结果和第八绘制结果为绘制指令满足第一条件时得到的绘制结果;第二绘制结果,第四绘制结果,第七绘制结果和第九绘制结果为绘制指令满足第二条件时得到的绘制结果。其中,第一绘制结果和第三绘制结果生成第五绘制结果;第六绘制结果和第八绘制结果生成第十绘制结果。Please refer to FIG. 53F, which shows a schematic diagram of generating six image frames; in this example, the first drawing result, the third drawing result, the sixth drawing result and the eighth drawing result are obtained when the drawing instruction satisfies the first condition The drawing result; the second drawing result, the fourth drawing result, the seventh drawing result and the ninth drawing result are the drawing results obtained when the drawing instruction satisfies the second condition. Wherein, the first drawing result and the third drawing result generate the fifth drawing result; the sixth drawing result and the eighth drawing result generate the tenth drawing result.
在上述图53F所示的示例中,计数单元可以在第一数值,第二数值,第三数值三个数值间进行更新切换,更新切换的顺序按照第一数值至第二数值至第三数值的顺序进行切换;具体的,计数单元初始值为第一数值,当进入第一绘制周期时,更新数值为第二数值,进入下一绘制周期更新为第三数值,再进入下一周期更新为第一数值,……当计数单元的数值为第一数值时,绘制指令满足第二条件时不执行绘制操作;当计数单元的数值为第二数值或第三数值时,绘制指令满足第二条件时将绘制结果存入第八存储空间。具体的,第一数值可以为0;第二数值可以为1;第三数值可以为2。In the example shown in Figure 53F above, the counting unit can be updated and switched between the first value, the second value, and the third value, and the sequence of updating and switching is from the first value to the second value to the third value. Switch in sequence; specifically, the initial value of the counting unit is the first value, when entering the first drawing cycle, the updated value is the second value, entering the next drawing cycle and updating to the third value, and then entering the next cycle and updating to the first value A value, ... When the value of the counting unit is the first value, the drawing instruction does not execute the drawing operation when the second condition is met; when the value of the counting unit is the second value or the third value, the drawing instruction meets the second condition. The drawing result is stored in the eighth storage space. Specifically, the first value may be 0; the second value may be 1; and the third value may be 2.
请参阅图53G,图53G示意了一种绘制过程中可能的示意图。图53G中包括第七存储空 间5001,第八存储空间5002,第九存储空间5003,第十存储空间5004,第十一存储空间5005。在第一绘制周期中,根据目标应用程序的绘制指令,在绘制指令满足第一条件时将第一绘制结果存入第七存储空间5001中;根据目标应用程序的绘制指令,在绘制指令满足第二条件时将第二绘制结果存入第八存储空间5002中;在第九存储空间5003中根据第一绘制结果和第二绘制结果生成第七图像帧。在第二绘制周期中,根据目标应用程序的绘制指令,在绘制指令满足第一条件时将第三绘制结果存入第十存储空间5004中;根据目标应用程序的绘制指令,在绘制指令满足第二条件时不执行绘制;在第九存储空间5003中根据第三绘制结果和第二绘制结果生成第八图像帧。在第三绘制周期中,第七存储空间5001中的第一绘制结果和第十存储空间中的第三绘制结果存入第十一存储空间5005中;在第十一存储空间5005中根据第一绘制结果和第三绘制结果生成第四绘制结果;根据第四绘制结果和第二绘制结果生成第九图像帧。Please refer to FIG. 53G, which illustrates a possible schematic diagram during the drawing process. Figure 53G includes a seventh storage space 5001, an eighth storage space 5002, a ninth storage space 5003, a tenth storage space 5004, and an eleventh storage space 5005. In the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the first drawing result is stored in the seventh storage space 5001; according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition In the second condition, the second drawing result is stored in the eighth storage space 5002; the seventh image frame is generated in the ninth storage space 5003 according to the first drawing result and the second drawing result. In the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the third drawing result is stored in the tenth storage space 5004; according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition In the second condition, no drawing is performed; an eighth image frame is generated in the ninth storage space 5003 according to the third drawing result and the second drawing result. In the third drawing cycle, the first drawing result in the seventh storage space 5001 and the third drawing result in the tenth storage space are stored in the eleventh storage space 5005; The drawing result and the third drawing result generate a fourth drawing result; and a ninth image frame is generated according to the fourth drawing result and the second drawing result.
请参阅图53H,图53H示意了一种绘制过程中可能的示意图。图53H中包括第七存储空间5001,第八存储空间5002,第九存储空间5003,第十存储空间5004,第十一存储空间5005。在第一绘制周期中,根据目标应用程序的绘制指令,在绘制指令满足第一条件时将第一绘制结果存入第七存储空间5001中;根据目标应用程序的绘制指令,在绘制指令满足第二条件时将第二绘制结果存入第八存储空间5002中;在第九存储空间5003中根据第一绘制结果和第二绘制结果生成第七图像帧。在第二绘制周期中,根据目标应用程序的绘制指令,在绘制指令满足第一条件时将第一绘制结果存入第十存储空间5004中;根据目标应用程序的绘制指令,在绘制指令满足第二条件时将第四绘制结果存入第八存储空间5002中;在第九存储空间5003中根据第三绘制结果和第四绘制结果生成第八图像帧。在第三绘制周期中,将第七存储空间5001中的第一绘制结果和第十存储空间5004中的第三绘制结果存入第十一存储空间5005中;在第十一存储空间5005中根据第一绘制结果和第三绘制结果生成第五绘制结果;根据第八存储空间5002中的第四绘制结果和第十一存储空间5005中的第五绘制结果在第九存储空间5003中生成第九图像帧。Please refer to FIG. 53H, which shows a possible schematic diagram of a drawing process. FIG. 53H includes a seventh storage space 5001 , an eighth storage space 5002 , a ninth storage space 5003 , a tenth storage space 5004 , and an eleventh storage space 5005 . In the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the first drawing result is stored in the seventh storage space 5001; according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition In the second condition, the second drawing result is stored in the eighth storage space 5002; the seventh image frame is generated in the ninth storage space 5003 according to the first drawing result and the second drawing result. In the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the first drawing result is stored in the tenth storage space 5004; according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition In the second condition, the fourth drawing result is stored in the eighth storage space 5002; the eighth image frame is generated in the ninth storage space 5003 according to the third drawing result and the fourth drawing result. In the third drawing cycle, the first drawing result in the seventh storage space 5001 and the third drawing result in the tenth storage space 5004 are stored in the eleventh storage space 5005; The first drawing result and the third drawing result generate the fifth drawing result; the ninth drawing result is generated in the ninth storage space 5003 according to the fourth drawing result in the eighth storage space 5002 and the fifth drawing result in the eleventh storage space 5005 image frame.
请参阅图53I,图53I为图53A所示的流程的另一种可能的示例。图53I示意了生成八帧图像帧的示意图;图53I中第七图像帧,第八图像帧……等用数字,1,2,3,4,……8进行表示。Please refer to FIG. 53I, which is another possible example of the process shown in FIG. 53A. Fig. 53I shows a schematic diagram of generating eight image frames; in Fig. 53I, the seventh image frame, the eighth image frame, ... etc. are represented by numbers, 1, 2, 3, 4, ... 8.
图53I中,第一绘制结果,第三绘制结果,第四绘制结果,第七绘制结果,第十绘制结果均为绘制指令满足第一条件时得到的绘制结果。第二绘制结果,第五绘制结果,第八绘制结果和第十一绘制结果均为绘制指令满足第二条件时得到的绘制结果。其中,第一绘制结果和第四绘制结果生成第六绘制结果;第四绘制结果和第七绘制结果生成第九绘制结果;第七绘制结果和第十绘制结果生成第十二绘制结果。In FIG. 53I, the first drawing result, the third drawing result, the fourth drawing result, the seventh drawing result, and the tenth drawing result are all drawing results obtained when the drawing instruction satisfies the first condition. The second drawing result, the fifth drawing result, the eighth drawing result and the eleventh drawing result are all drawing results obtained when the drawing instruction satisfies the second condition. Wherein, the first drawing result and the fourth drawing result generate the sixth drawing result; the fourth drawing result and the seventh drawing result generate the ninth drawing result; and the seventh drawing result and the tenth drawing result generate the twelfth drawing result.
在本申请实施例中,电子设备用于显示在显示屏中的每一帧图像称为图像帧。在本申请实施例中,图像帧可以是某一应用的一帧图像,可以是电子设备根据该应用的绘制指令绘制出的绘制结果,也可以是根据已有绘制结果预测出来的预测结果。如图54A所示,电子设备(即平板电脑10)显示了用户界面5400。在T0时刻,用户界面10中显示了第N帧图像帧。第N帧图像帧为绘制帧。图54A中时序图5401示出了从T0时刻到Tn时刻电子设备可以显示的图像帧。In this embodiment of the present application, each frame of image that the electronic device uses to display on the display screen is referred to as an image frame. In this embodiment of the present application, an image frame may be a frame of an image of an application, a drawing result drawn by an electronic device according to a drawing instruction of the application, or a prediction result predicted based on an existing drawing result. As shown in Figure 54A, the electronic device (ie, tablet 10) displays a user interface 5400. At time T0, the Nth image frame is displayed in the user interface 10. The Nth image frame is a drawing frame. The timing diagram 5401 in FIG. 54A shows the image frames that the electronic device can display from time T0 to time Tn.
可以理解的是,图像帧的尺寸、绘制帧的尺寸以及预测帧的尺寸与所属应用的显示尺寸一致。举例来说,如图54A所示,图54A示出的第N帧图像帧所属的应用在平板电脑10的显示尺寸为:宽度为L、高度为H。那么第N帧图像帧的尺寸可以是:宽度为L、高度为H。又如图54B所示,图54B示出的图像帧5402所属的应用在平板电脑10的显示尺寸为:宽度为L0,高度为H。那么图像帧5402的尺寸可以是:宽度为L0,高度为H。又可以如图54C所示,图54C中示出了图像帧5403,以及控件栏5404。其中,控件栏540404中可以包括控件5405。控件栏5404可以由平板电脑10的系统绘制。图像帧5403所属的应用在平板电脑10的显示尺寸为:宽度为L1,高度为H0。那么图像帧5403的尺寸可以是:宽度为L1,高度为H0。It can be understood that the size of the image frame, the size of the drawing frame, and the size of the predicted frame are consistent with the display size of the application to which they belong. For example, as shown in FIG. 54A , the display size of the application to which the Nth image frame shown in FIG. 54A belongs on the tablet computer 10 is: the width is L and the height is H. Then the size of the Nth image frame may be: the width is L and the height is H. Also as shown in FIG. 54B , the display size of the application to which the image frame 5402 shown in FIG. 54B belongs on the tablet computer 10 is: the width is L0 and the height is H. Then the size of the image frame 5402 can be: the width is L0 and the height is H. Again, as shown in FIG. 54C, an image frame 5403 is shown, and a control bar 5404 is shown in FIG. 54C. Among them, the control bar 540404 may include the control 5405. The control bar 5404 may be drawn by the system of the tablet computer 10 . The display size of the application to which the image frame 5403 belongs on the tablet computer 10 is: the width is L1, and the height is H0. Then the size of the image frame 5403 can be: the width is L1 and the height is H0.
为了提升帧率,提高视频的流畅性,电子设备可以在应用的绘制帧之间插入预测帧。电子设备可以根据应用的绘制帧进行图像帧预测得到预测帧。如图54A所示,电子设备可以在每两个绘制帧之间插入一帧预测的图像帧。这样,电子设备显示的图像帧的帧率可以提高。In order to increase the frame rate and improve the smoothness of the video, the electronic device can insert the predicted frame between the drawn frames of the application. The electronic device may perform image frame prediction according to the drawn frame of the application to obtain the predicted frame. As shown in FIG. 54A, the electronic device may insert a predicted image frame between every two drawing frames. In this way, the frame rate of the image frame displayed by the electronic device can be increased.
可以理解的是,电子设备根据应用程序的绘制指令绘制得到的绘制结果,可以是电子设备根据相机拍摄到的一帧图像绘制渲染得到的图像帧。图像帧中的对象可以因为相机的移动,旋转等位置变换而发生移动。例如,图55A示例性地示出了相机200在不同位置对圆柱体5502、圆柱体5503以及长方体5504进行拍摄,相机5500的拍摄视野中拍摄到的一帧图像可以是图像帧。图55B示例性地示出了相机200的相机拍摄视野5501。如图55A所示,在位置1处时,相机5500的相机视野5505中拍摄到的一帧图像可以是图55A中的图像帧5508,即绘制帧A。在位置2处时,相机5500的相机视野5506中拍摄到的一帧图像可以是图55A中的图像帧5509,即绘制帧B。电子设备可以根据绘制帧A和绘制帧B来预测出相机5500在位置3处的图像帧5510,即预测帧5510。预测帧是根据绘制帧B和绘制帧A预测出的,预测帧中包含的对象和绘制帧B中包含的对象相同。绘制帧A中包含圆柱体5502和长方体204,绘制帧B中只包含长方体5504。所以预测帧中也只包含长方体5504。若正常绘制,在位置3处,电子设备绘制的绘制内容是相机5500的拍摄视野5507可以拍摄到的物体。在位置3处,相机200的拍摄视野5507中包括长方体5504的部分区域和圆柱体5503的部分区域。预测帧中无法预测出绘制帧B中不存在的圆柱体5503。这样,导致预测出的预测帧不准确。It can be understood that the drawing result drawn by the electronic device according to the drawing instruction of the application program may be an image frame drawn and rendered by the electronic device according to a frame of image captured by the camera. Objects in image frames can move due to camera movement, rotation, and other positional transformations. For example, FIG. 55A exemplarily shows that the camera 200 photographs the cylinder 5502 , the cylinder 5503 and the rectangular parallelepiped 5504 at different positions, and a frame of image photographed in the photographing field of view of the camera 5500 may be an image frame. FIG. 55B exemplarily shows the camera field of view 5501 of the camera 200 . As shown in FIG. 55A , at position 1, a frame of image captured in the camera field of view 5505 of the camera 5500 may be the image frame 5508 in FIG. 55A , that is, the drawing frame A. At position 2, a frame of image captured in the camera field of view 5506 of the camera 5500 may be the image frame 5509 in FIG. 55A, ie, the drawing frame B. The electronic device can predict the image frame 5510 of the camera 5500 at the position 3 according to the drawing frame A and the drawing frame B, that is, the predicted frame 5510 . The predicted frame is predicted according to the drawing frame B and the drawing frame A, and the objects contained in the predicted frame are the same as the objects contained in the drawing frame B. The drawing frame A includes the cylinder 5502 and the cuboid 204, and the drawing frame B only includes the cuboid 5504. Therefore, only the cuboid 5504 is included in the predicted frame. If the drawing is normal, at position 3, the drawing content drawn by the electronic device is the object that can be photographed by the photographing field of view 5507 of the camera 5500 . At position 3, the photographic field of view 5507 of the camera 200 includes a partial area of the rectangular parallelepiped 5504 and a partial area of the cylinder 5503. The cylinder 5503 that does not exist in the drawing frame B cannot be predicted in the predicted frame. In this way, the predicted prediction frame is inaccurate.
为了使预测出的图像帧更为准确,本申请实施例提供了一种图像帧预测的方法,该方法可以包括:在绘制第一应用的第二十一绘制帧时,电子设备将第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,第一绘制范围的尺寸大于第一应用的第一绘制帧的尺寸;在绘制第一应用的第二十二绘制帧时,电子设备将第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,第二十二内存空间的尺寸大于所述第二绘制帧的尺寸,其中,第二十一绘制帧的尺寸与第二十二绘制帧的尺寸相同;电子设备根据第二十一绘制结果和所述第二十二绘制结果,预测生成第一应用的第二十三预测帧,其中,第三预测帧的尺寸与第二十一绘制帧的尺寸相同。这样,电子设备在按照尺寸更大的绘制范围来绘制第二十一绘制帧、第二十二绘制帧,可以绘制出比电子设备显示的第二十一绘制帧和第二十二绘制帧多一些的绘制内容。这样,电子设备可以得到预测帧。在不增加绘制帧的情况下,可以提高电子设备的帧率。这样,在节约电子设备功耗的情况下,可以提高电子设备显示的视频界面流畅度。进一步地,电子设备预测出的预测帧中可以存在电子设备显示的第一绘制帧和第二绘制帧中没有的绘制内容。从而,电子设备预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄内容。因而,电子设备预测出的图像帧可以更为准确。In order to make the predicted image frame more accurate, an embodiment of the present application provides a method for image frame prediction, the method may include: when drawing the twenty-first drawing frame of the first application, the electronic device The drawing instruction of a drawing frame is drawn according to the first drawing range, and the twenty-first drawing result is obtained, and the size of the first drawing range is larger than the size of the first drawing frame of the first application; frame, the electronic device draws the drawing instruction of the twenty-second drawing frame according to the second drawing range, and obtains the twenty-second drawing result, and the size of the twenty-second memory space is larger than the size of the 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 the twenty-third predicted frame of the first application according to the twenty-first drawing result and the twenty-second drawing result , wherein the size of the third prediction frame is the same as the size of the twenty-first rendering frame. In this way, when the electronic device draws the twenty-first drawing frame and the twenty-second drawing frame according to the larger drawing range, it can draw more than the twenty-first drawing frame and the twenty-second drawing frame displayed by the electronic device. some drawing content. In this way, the electronic device can obtain the predicted frame. The frame rate of the electronic device can be increased without increasing the drawing frame. In this way, while saving the power consumption of the electronic device, the smoothness of the video interface displayed by the electronic device can be improved. Further, in the predicted frame predicted by the electronic device, there may be rendering content that is not in the first rendering frame and the second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
可以理解的是,第U绘制帧的绘制指令中可以包含绘制内容,当绘制范围比较小时,GPU绘制和渲染出的第U绘制帧可以只包含第U绘制帧的绘制指令包含的一部分绘制内容。当绘制范围比较大时,GPU可以绘制和渲染出第U绘制帧的绘制指令中包含的更多绘制内容。举例来说,若绘制范围为横坐标从50到100,纵坐标从50到100的区域,第U绘制帧的绘制指令中的一个绘制内容为横坐标从10到60,纵坐标从10到60的一个物体。那么该绘制内容只有横坐标从50到60,纵坐标从50到60的部分被绘制渲染到绘制范围中。若绘制范围扩大为横坐标从0到150,纵坐标从0到150的区域,那么该绘制内容可以全部被绘制渲染到绘制范围内。It can be understood that the drawing instruction of the U-th drawing frame may include drawing content. When the drawing range is relatively small, the U-th drawing frame drawn and rendered by the GPU may only contain a part of the drawing content included in the drawing instruction of the U-th drawing frame. When the drawing range is relatively large, the GPU can draw and render more drawing contents included in the drawing instruction of the U-th drawing frame. For example, if the drawing range is from 50 to 100 on the abscissa and from 50 to 100 on the ordinate, one of the drawing contents in the drawing instruction of the U-th drawing frame is from 10 to 60 on the abscissa and from 10 to 60 on the ordinate. of an object. Then the drawing content only has the horizontal coordinate from 50 to 60, and the vertical coordinate from 50 to 60 is drawn and rendered into the drawing range. If the drawing range is expanded to an area with the horizontal coordinate from 0 to 150 and the vertical coordinate from 0 to 150, then all the drawing content can be drawn and rendered into the drawing range.
在本申请实施例中,第U绘制帧可以称为第二十一绘制帧,第U+2绘制帧可以称为第二十二绘制帧,第U+3预测帧可以称为第二十三预测帧。In this embodiment of the present application, the U-th rendering frame may be referred to as the twenty-first rendering frame, the U+2-th rendering frame may be referred to as the twenty-second rendering frame, and the U+3-th predicted frame may be referred to as the twenty-third predicted frame.
下面将结合附图详细介绍本申请实施例提供的一种图像帧预测的方法。图56示出本申请实施例提供的一种图像帧预测的方法流程图。如图56所示,本申请实施例提供的一种图像帧预测的方法可以包括如下步骤: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. FIG. 56 shows a flowchart of an image frame prediction method provided by an embodiment of the present application. As shown in FIG. 56, an image frame prediction method provided by an embodiment of the present application may include the following steps:
S5601-S5602、电子设备开始执行图像帧预测方法。S5601-S5602, the electronic device starts to execute the image frame prediction method.
S5601、在目标应用开始绘制时,电子设备的CPU向GPU发送用于指示GPU创建内存空间的指令。S5601. 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.
目标应用程序为用户界面中具有动画效果的应用程序,例如游戏类应用。本申请实施例下文以目标应用为游戏应用为例进行阐述。当电子设备中安装的游戏应用运行时,电子设备的CPU向GPU发送用于指示GPU创建内存空间的指令。具体地,该指令中可以携带创建内存空间的数量以及尺寸信息。The target application is an application with animation effects in the user interface, such as a game application. The embodiments of the present application are described below by taking the target application as a game application as an example. When the game application installed in the electronic device runs, the CPU of the electronic device sends an instruction for instructing the GPU to create a memory space to the GPU. Specifically, the instruction can carry information on the number and size of the created memory space.
S5602、电子设备的GPU基于电子设备中的默认内存空间(FBO0)的尺寸在内存中创建尺寸比默认内存空间大的第二十一内存空间(FBO1)、第二十二内存空间(FBO2)以及第二十三内存空间(FBO3)。S5602, the GPU of the electronic device creates a twenty-first memory space (FBO1), a twenty-second memory space (FBO2) in the memory with a size larger than the default memory space based on the size of the default memory space (FBO0) in the electronic device, and The twenty-third memory space (FBO3).
响应于CPU发送的指令,GPU基于电子设备的默认内存空间的尺寸在内存中创建尺寸比默认内存空间大的第二十一内存空间(FBO1)、第二十二内存空间(FBO2)以及第二十三内存空间(FBO3)。在本申请实施例中,默认内存空间为电子设备的系统(例如渲染系统)提供的存储用于显示的图像帧的内存空间。该默认内存空间可以存储目标应用程序的用于显示的图像帧,也可以存储其他应用程序中用于显示的图像帧。如图57所示,默认内存空间中可以包括多个逻辑地址连续排列的附件(attachment)。例如,图57中示出的默认内存空间可以包括附件5701、附件5702、…、附件570n等n个内存。一般地,n小于或等于3。默认内存空间的n个附件中每个附件的宽度可以为L,高度可以为H。在本申请实施例中,默认内存空间的宽度可以称为第三尺寸,默认内存空间的高度可以称为第四尺寸。可以理解的是,默认内存空间的宽度是指默认内存空间中每个附件的宽度,默认内存空间的高度可以是指默认内存空间中每个附件的高度。In response to the instruction sent by the CPU, the GPU creates a twenty-first memory space (FBO1), a twenty-second memory space (FBO2), and a second memory space with a size larger than the default memory space in the memory based on the size of the default memory space of the electronic device. Thirteen memory spaces (FBO3). In this embodiment of the present application, the default memory space is a memory space provided by a system of an electronic device (for example, a rendering system) for storing image frames for display. The default memory space can store image frames for display of the target application, or image frames for display in other applications. As shown in FIG. 57 , the default memory space may include multiple attachments with consecutive logical addresses. For example, the default memory space shown in FIG. 57 may include n memories such as attachment 5701, attachment 5702, . . . , attachment 570n. Typically, n is less than or equal to three. Each of the n attachments in the default memory space can have a width of L and a height of H. In this embodiment of the present application, the width of the default memory space may be referred to as the third size, and the height of the default memory space may be referred to as the fourth size. It can be understood that the width of the default memory space refers to the width of each attachment in the default memory space, and the height of the default memory space may refer to the height of each attachment in the default memory space.
可选地,默认内存空间中的n个附件中可以为包括颜色附件(color attachment)和深度附件(depth attachment)。例如,附件5701可以是颜色附件。在本申请实施例中,颜色附件是一块内存,用于在电子设备根据绘制指令进行绘制时,存储绘制结果中的各像素点颜色数据(例如像素点的RGB值)。颜色附件可以作为FBO(frame buffer object)的一部分。在本申请实施例中,深度附件是一块内存,用于在电子设备根据绘制指令进行绘制时,存储绘制结果中 各像素点深度数据。颜色附件可以作为FBO的一部分。可以理解的,深度附件中深度值越小的像素点,离相机的距离越近。在合成图像帧时,对于两个颜色附件中坐标值相等的两个像素点,深度值小的一个像素点可以覆盖深度值大的另一个像素点。即最终显示屏像素点显示的颜色为两个颜色附件中深度值小的像素点的颜色。Optionally, the n attachments in the default memory space may include a color attachment (color attachment) and a depth attachment (depth attachment). For example, attachment 5701 may be a color attachment. In this embodiment of the present application, the color accessory is a piece of memory used to store color data (eg, RGB values of pixels) of each pixel in the drawing result when the electronic device draws according to the drawing instruction. Color attachments can be used as part of an FBO (frame buffer object). In the embodiment of the present application, the depth accessory is a piece of memory used to store the depth data of each pixel in the drawing result when the electronic device draws according to the drawing instruction. Color attachments are available as part of the FBO. Understandably, the smaller the depth value of the pixel in the depth attachment, the closer it is to the camera. When synthesizing an image frame, for two pixels with equal coordinate values in two color attachments, a pixel with a smaller depth value can cover another pixel with a larger depth value. That is, the color displayed by the final display pixel point is the color of the pixel point with the smaller depth value in the two color attachments.
第二十一内存空间的尺寸大于默认内存空间的尺寸。在一种可能的实现方式中,第二十一内存空间的宽度是默认内存空间的宽度的K1倍,第二十一内存空间的高度是默认内存空间的高度的K2倍。如图58示出的第二十一内存空间示意图,第二十一内存空间的逻辑地址可以是连续排列的。第二十一内存空间中可以包括多个逻辑地址连续排列的附件。例如,图58中示出的附件5801、附件5802、…、附件580n等n个内存。一般地,n可以小于或等于3。第二十一内存空间的n个附件中每个附件的宽度可以为L·K1,高度可以为H·K2。K1和K2均大于1。K1可以等于K2。K1和K2可以由电子设备的系统配置。可选地第二十一内存空间的n个附件中每个附件的宽度可以为L+Q1,高度可以为H+Q2。Q1和Q2均大于0。Q1和Q2可以相等。Q1和Q2可以由电子设备的系统配置。可选地,电子设备的系统配置的K1和K2均为固定值。即电子设备每次执行本申请实施例提供的图像帧预测方法时,K1和K2的值不变。The size of the twenty-first memory space is larger than the size of the default memory space. In a possible implementation manner, the width of the twenty-first memory space is K1 times the width of the default memory space, and the height of the twenty-first memory space is K2 times the height of the default memory space. As shown in the schematic diagram of the twenty-first memory space shown in FIG. 58 , the logical addresses of the twenty-first memory space may be arranged consecutively. The twenty-first memory space may include a plurality of accessories with consecutive logical addresses. For example, the attachment 5801, the attachment 5802, ..., the attachment 580n, etc. shown in FIG. 58 have n memories. In general, n may be less than or equal to three. The width of each of the n attachments in the twenty-first memory space may be L·K1, and the height may be H·K2. Both K1 and K2 are greater than 1. K1 may be equal to K2. K1 and K2 may be configured by a system of electronic devices. Optionally, the width of each of the n accessories in the twenty-first memory space may be L+Q1, and the height may be H+Q2. Both Q1 and Q2 are greater than 0. Q1 and Q2 may be equal. Q1 and Q2 may be configured by the system of the electronic device. Optionally, both K1 and K2 of the system configuration of the electronic device are fixed values. That is, the values of K1 and K2 remain unchanged each time the electronic device executes the image frame prediction method provided by the embodiment of the present application.
在本申请实施例中,第二十一内存空间的宽度可以称为第一尺寸,第二十一内存空间的高度可以称为第二尺寸。In this embodiment of the present application, the width of the twenty-first memory space may be referred to as the first size, and the height of the twenty-first memory space may be referred to as the second size.
在一种可能的实现方式中,K1和K2可以是浮点数,Q1和Q2可以是整数。In one possible implementation, K1 and K2 may be floating point numbers, and Q1 and Q2 may be integers.
第二十二内存空间的尺寸大于默认内存空间的尺寸。在一种可能的实现方式中,第二十二内存空间的宽度是默认内存空间的宽度的K1倍,第二十二内存空间的高度是默认内存空间的高度的K2倍。如图59示出的第二十二内存空间示意图,第二十二内存空间的逻辑地址可以是连续排列的。第二十二内存空间中可以包括多个逻辑地址连续排列的附件。例如,图59中示出的附件5901、附件5902、…、附件590n等n个附件。一般地,n可以小于或等于3。第二十二内存空间的n个附件中每个内存的宽度可以为L·K1,高度可以为H·K2。K1和K2均大于1。K1可以等于K2。K1和K2可以由电子设备的系统配置。可选地,第二十二内存空间的n个附件中每个附件的宽度可以为L+Q1,高度可以为H+Q2。Q1和Q2均大于0。Q1和Q2可以相等。Q1和Q2可以由电子设备的系统配置。The size of the twenty-second memory space is larger than the size of the default memory space. In a possible implementation manner, the width of the twenty-second memory space is K1 times the width of the default memory space, and the height of the twenty-second memory space is K2 times the height of the default memory space. As shown in the schematic diagram of the twenty-second memory space in FIG. 59, the logical addresses of the twenty-second memory space may be arranged consecutively. The twenty-second memory space may include multiple attachments with consecutive logical addresses. For example, n attachments such as attachment 5901, attachment 5902, . . . , attachment 590n, etc. shown in FIG. 59 . In general, n may be less than or equal to three. The width of each memory in the n attachments of the twenty-second memory space may be L·K1, and the height may be H·K2. Both K1 and K2 are greater than 1. K1 may be equal to K2. K1 and K2 may be configured by a system of electronic devices. Optionally, the width of each of the n accessories in the twenty-second memory space may be L+Q1, and the height may be H+Q2. Both Q1 and Q2 are greater than 0. Q1 and Q2 may be equal. Q1 and Q2 may be configured by the system of the electronic device.
在本申请实施例中,第二十二内存空间的宽度可以称为第五尺寸,第二十二内存空间的高度可以称为第六尺寸。In this embodiment of the present application, the width of the twenty-second memory space may be referred to as the fifth size, and the height of the twenty-second memory space may be referred to as the sixth size.
第二十三内存空间的尺寸大于默认内存空间的尺寸。在一种可能的实现方式中,第二十三内存空间的宽度是默认内存空间的宽度的K1倍,第二十三内存空间的高度是默认内存空间的高度的K2倍。如图60示出的第二十三内存空间示意图,第二十三内存空间的逻辑地址可以是连续排列的。第二十三内存空间中可以包括多个逻辑地址连续排列的附件。例如,图60中示出的附件6001、附件6002、…、附件600n等n个附件。第二十三内存空间的n个附件中每个附件的宽度可以为L·K1,高度可以为H·K2。K1和K2均大于1。K1可以等于K2。K1和K2可以由电子设备系统配置。可选地,第二十三内存空间的n个附件中每个附件的宽度可以为L+Q1,高度可以为H+Q2。Q1和Q2均大于0。Q1和Q2可以相等。Q1和Q2可以由电子设备的系统配置。可选地,电子设备的系统配置的Q1和Q2均为固定值。即电子设备每次执行本申请实施例提供的图像帧预测方法时,Q1和Q2的值不变。The size of the twenty-third memory space is larger than the size of the default memory space. In a possible implementation manner, the width of the twenty-third memory space is K1 times the width of the default memory space, and the height of the twenty-third memory space is K2 times the height of the default memory space. As shown in the schematic diagram of the twenty-third memory space shown in FIG. 60, the logical addresses of the twenty-third memory space may be arranged consecutively. The twenty-third memory space may include a plurality of accessories with consecutive logical addresses. For example, there are n accessories such as accessories 6001, accessories 6002, . . . , accessories 600n, etc. shown in FIG. 60 . The width of each of the n attachments in the twenty-third memory space may be L·K1, and the height may be H·K2. Both K1 and K2 are greater than 1. K1 may be equal to K2. K1 and K2 can be configured by the electronic equipment system. Optionally, the width of each of the n accessories in the twenty-third memory space may be L+Q1, and the height may be H+Q2. Both Q1 and Q2 are greater than 0. Q1 and Q2 may be equal. Q1 and Q2 may be configured by the system of the electronic device. Optionally, both Q1 and Q2 of the system configuration of the electronic device are fixed values. That is, the values of Q1 and Q2 remain unchanged each time the electronic device executes the image frame prediction method provided by the embodiment of the present application.
在本申请实施例中,第二十三内存空间的宽度可以称为第七尺寸,第二十三内存空间的 高度可以称为第八尺寸。In this embodiment of the present application, the width of the twenty-third memory space may be referred to as the seventh size, and the height of the twenty-third memory space may be referred to as the eighth size.
在一种可能的实现方式中,第二十一内存空间的尺寸与,第二十二内存空间的尺寸以及第二十三内存空间的尺寸相同。即,若第二十一内存空间的宽度为L·K1,高度为H·K2。则第二十二内存空间的宽度为L·K1,高度为H·K2。第二十三内存空间的宽度为L·K1,高度为H·K2。In a possible implementation manner, the size of the twenty-first memory space is the same as the size of the twenty-second memory space and the size of the twenty-third memory space. That is, if the width of the twenty-first memory space is L·K1, and the height is H·K2. Then the width of the twenty-second memory space is L·K1, and the height is H·K2. The width of the twenty-third memory space is L·K1, and the height is H·K2.
S5603-S5606、电子设备绘制第U绘制帧。S5603-S5606, the electronic device draws the U-th drawing frame.
S5603、电子设备获取第U绘制帧的绘制参数。S5603, the electronic device acquires the drawing parameters of the U-th drawing frame.
电子设备中的目标应用在进行绘制时,该目标应用可以调用绘制指令进行绘制。电子设备100的CPU可以通过三维图像处理库中的接口获取到应用程序的第U绘制帧的绘制参数。第U绘制帧的绘制参数用于绘制并渲染第U绘制帧。第U绘制帧的绘制参数可以包括第U绘制帧的绘制指令(例如draw call指令)中携带的信息,例如draw call指令的绘制内容中的每个顶点的坐标,颜色值,深度值等等信息。When the target application in the electronic device draws, the target application can call a drawing instruction to draw. The CPU of the electronic device 100 may acquire the drawing parameters of the U-th drawing frame of the application program through the interface in the three-dimensional image processing library. The drawing parameters of the U-th drawing frame are used to draw and render the U-th drawing frame. The drawing parameters of the U-th drawing frame may include information carried in the drawing instructions (such as the draw call instruction) of the U-th drawing frame, such as the coordinates, color values, depth values and other information of each vertex in the drawing content of the draw call instruction .
S5604、电子设备中的CPU向GPU发送用于指示GPU绘制第U绘制帧的绘制指令。S5604. The CPU in the electronic device sends a drawing instruction to the GPU for instructing the GPU to draw the U-th drawing frame.
电子设备的CPU可以根据第U绘制帧的绘制参数向GPU发送用于指示GPU绘制第U绘制帧的绘制指令。可以理解的是,CPU获取到的第U绘制帧的绘制参数中可以包括多个绘制指令的信息。这样,CPU可以依次地向GPU发送用于指示GPU绘制第U绘制帧的多个绘制指令。在本申请实施例中,绘制指令包括执行绘制(draw call)指令和绘制状态设置指令。The CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the U-th drawing frame to the GPU according to the drawing parameters of the U-th drawing frame. It can be understood that, the drawing parameters of the U-th drawing frame acquired by the CPU may include information of multiple drawing instructions. In this way, the CPU may sequentially send to the GPU multiple drawing instructions for instructing the GPU to draw the U-th drawing frame. In this embodiment of the present application, the drawing instruction includes an execution drawing (draw call) instruction and a drawing state setting instruction.
其中,执行绘制指令可以用于触发GPU针对当前绘制状态数据进行绘制渲染,并生成绘制结果,例如OpenGL中的glDrawElements指令。OpenGL是一种用于渲染2D、3D矢量图形的跨语言、跨平台的应用程序编程接口(API)。The execution of the drawing instruction may be used to trigger the GPU to perform drawing and rendering with respect to the current drawing state data, and generate a drawing result, 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.
绘制状态设置指令可以用于设置执行绘制指令所依赖的当前绘制状态数据,例如设置该状态数据包括绘制所依赖的顶点信息缓存索引的指令,例如在OpenGL中的glBindBuffer,其中顶点信息缓存索引用于指示一绘制对象的顶点信息数据,顶点信息数据是用于在绘制渲染流程中描述一个用于绘制的二维或三维矢量模型的顶点的一组坐标位置、颜色等数据。The drawing state setting instruction can be used to set the current drawing state data on which the drawing instruction is executed. For example, setting the state data includes the instruction of the vertex information buffer index that the drawing depends on, such as glBindBuffer in OpenGL, where the vertex information buffer index is used for Indicates vertex information data of a drawing object. The vertex information data is a set of coordinate position, color and other data used to describe the vertices of a two-dimensional or three-dimensional vector model for drawing in the drawing and rendering process.
绘制状态设置指令还可以包括设置绘制对象的顶点索引、纹理信息、空间位置等指令,例如在OpenGL中glActiveTexture、glBindBufferRange指令等。一个绘制对象可以是电子设备根据一个绘制指令中所包含的所有顶点以及顶点信息可绘制出的对象。The drawing state setting instruction may further include instructions such as setting the vertex index, texture information, and spatial position of the drawing object, for example, glActiveTexture and glBindBufferRange instructions in OpenGL. A drawing object may be an object that can be drawn by an electronic device according to all vertices and vertex information contained in a drawing instruction.
为了更形象的说明,以电子设备绘制图55A中的长方体5504以例,一种可能的OpenGL绘制指令按照执行顺序可以是如下示意:For a more vivid description, taking the electronic device to draw the cuboid 5504 in FIG. 55A as an example, a possible OpenGL drawing instruction according to the execution sequence may be as follows:
glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)//指示GPU修改部分绘制全局信息,例如图55A中长方体5504的位置;glBindBufferRange(target=GL_UNIFORM_BUFFER,index=1,buffer=738,offset=0,size=352)//Instruct the GPU to modify the part to draw global information, such as the position of the cuboid 5504 in Figure 55A;
glBindBuffer(target=GL_ARRAY_BUFFER,buffer=buffer0)//指示GPU将保存了长方体5504的顶点信息(例如顶点的位置、颜色等等信息)的buffer0索引信息存到GL_ARRAY_BUFFER中;glBindBuffer(target=GL_ARRAY_BUFFER, buffer=buffer0)//Instructs the GPU to store the buffer0 index information of the vertex information (such as vertex position, color, etc.) of the cuboid 5504 into GL_ARRAY_BUFFER;
glBindBuffer(target=GL_ELEMENT_ARRAY_BUFFER,buffer=buffer1)//指示GPU将保存了长方体5504的顶点索引信息(例如顶点的绘制顺序)的buffer1的索引保存到GL_ELEMENT_ARRAY_BUFFER中;glBindBuffer(target=GL_ELEMENT_ARRAY_BUFFER, buffer=buffer1)//Instructs the GPU to save the index of buffer1 that stores the vertex index information of the cuboid 5504 (for example, the drawing order of the vertices) into GL_ELEMENT_ARRAY_BUFFER;
glActiveTexture(texture=GL_TEXTURE0)glActiveTexture(texture=GL_TEXTURE0)
glBindTexture(target=GL_TEXTURE_2D,texture=texture1)//指示GPU将保存了长方体5504的纹理信息的texture1的索引保存到GL_TEXTURE0中;glBindTexture(target=GL_TEXTURE_2D, texture=texture1)//Instructs the GPU to save the index of texture1 that stores the texture information of the cuboid 5504 into GL_TEXTURE0;
glDrawElements(GLenummode,GLsizeicount,GLenumtype,const void*indices)//指示GPU执行长方体5504绘制。glDrawElements(GLenummode,GLsizeicount,GLenumtype,const void*indices)//Instructs the GPU to perform cuboid 5504 drawing.
S5605、在第二十一内存空间中,电子设备的GPU将第U绘制帧的绘制指令中的绘制内容绘制到第一绘制范围内,得到第二十一绘制结果,第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,大于默认内存空间的尺寸。S5605. In the twenty-first memory space, the GPU of the electronic device draws the drawing content in the drawing instruction of the U-th drawing frame into the first drawing range, and obtains the twenty-first drawing result, where the size of the first drawing range is less than or equal to the size of the twenty-first memory space, which is greater than the size of the default memory space.
电子设备的GPU可以将第U绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果。可选地,电子设备的GPU可以将第U绘制帧的绘制指令的绘制内容绘制到第二十一内存空间的第一绘制范围内,得到第二十一绘制结果。第一绘制范围的尺寸小于或等于第二十一内存空间的尺寸,大于默认内存空间的尺寸。可以理解的是,在本申请实施例中,第二十一内存空间中的任一个附件中的绘制范围均可以称为第一绘制范围。The GPU of the electronic device may draw the drawing content of the drawing instruction of the U-th drawing frame into the twenty-first memory space to obtain the twenty-first drawing result. Optionally, the GPU of the electronic device may draw the drawing content of the drawing instruction of the U-th 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 smaller than or equal to the size of the twenty-first memory space, and is larger than the size of the default memory space. It can be understood that, in this embodiment of the present application, the drawing range in any attachment in the twenty-first memory space may be referred to as the first drawing range.
在一种可能的实现方式中,第一绘制范围的尺寸由电子设备根据目标应用程序中的viewport参数确定。目标应用程序的viewport参数用于指定电子设备中绘制该目标应用程序的图像帧的绘制范围的宽度和高度。一般地,目标应用程序的viewport参数指定的绘制范围的宽度和电子设备中默认内存空间的宽度相同,viewport参数指定的绘制范围的高度和电子设备中默认内存空间的高度相同。电子设备可以通过hook技术修改目标应用程序的viewport参数来指定第一绘制范围的尺寸。例如,若目标应用程序的viewport规定的第U绘制帧的绘制范围的宽度为L,高度为H。那么电子设备可以通过hook技术修改目标应用程序的viewport参数将第一绘制范围的宽度指定为L·K3,高度指定为H·K4。K3和K4均大于1。可选地,K3和K4为大于1的浮点数。K3小于或等于K1,K4小于或等于K2。这里,第U绘制帧中的viewport参数可以是本申请实施例中的第一参数。In a possible implementation manner, the size of the first drawing range is determined by the electronic device according to the viewport parameter in the target application. The viewport parameter of the target application is used to specify the width and height of the drawing range in which the image frame of the target application is drawn in the electronic device. Generally, the width of the drawing range specified by the viewport parameter of the target application is the same as the width of the default memory space in the electronic device, and the height of the drawing range specified by the viewport parameter is the same as the height of the default memory space in the electronic device. The electronic device can modify the viewport parameter of the target application through the hook technology to specify the size of the first drawing range. For example, if the width of the drawing range of the U-th drawing frame specified by the viewport of the target application is L and the height is H. Then, the electronic device can modify the viewport parameter of the target application through the hook technology, and designate the width of the first drawing range as L·K3 and the height as H·K4. Both K3 and K4 are greater than 1. Optionally, K3 and K4 are floating point numbers greater than 1. K3 is less than or equal to K1, and K4 is less than or equal to K2. Here, the viewport parameter in the U-th drawing frame may be the first parameter in this embodiment of the present application.
可以理解的是,应用程序下发的绘制指令中的viewport参数用来指定绘制该应用程序的绘制指令中绘制内容的画布的尺寸。一般,电子设备会应用程序的每一帧的绘制指令中的绘制内容按照画布的尺寸进行绘制,然后将绘制完成的画布渲染到显示屏中。应用程序中viewport参数指定的画布尺寸可以跟电子设备的显示屏的尺寸相同,也可以小于电子设备显示屏的尺寸,此处不做限定。如图61中(a)图所示,图61中(a)图示出了第二十一内存空间中的一个附件6102以及第一绘制范围6101。内存802宽度为L·K1,高度为H·K2。第一绘制范围6101宽度为L·K3,高度为H·K4。下文以电子设备将第U绘制帧中绘制指令的绘制内容绘制到第一绘制范围6101为例进行阐述。It can be understood that the viewport parameter in the drawing instruction issued by the application is used to specify the size of the canvas on which the drawing content in the drawing instruction of the application is drawn. Generally, the electronic device draws the drawing content in the drawing instruction of each frame of the application program according to the size of the canvas, and then renders the drawn canvas to the display screen. The canvas size specified by the viewport parameter in the application can be the same as the size of the display screen of the electronic device, or it can be smaller than the size of the display screen of the electronic device, which is not limited here. As shown in (a) of FIG. 61 , (a) of FIG. 61 shows an attachment 6102 and a first drawing range 6101 in the twenty-first memory space. The memory 802 has a width of L·K1 and a height of H·K2. The first drawing range 6101 has a width of L·K3 and a height of H·K4. The following description will be given by taking the electronic device drawing the drawing content of the drawing instruction in the U-th drawing frame to the first drawing range 6101 as an example.
在一种可能的实现方式中,K3等于K1,为电子设备的系统配置的固定值。K4等于K2,为电子设备的系统配置的固定值。可以理解的是,即第一绘制范围的尺寸等于第二十一内存空间的尺寸。In one possible implementation, K3 is equal to K1, which is a fixed value for the system configuration of the electronic device. K4 is equal to K2, a fixed value for the system configuration of the electronic device. It can be understood that the size of the first drawing range is equal to the size of the twenty-first memory space.
在一种可能的实现方式中,K3和K4的值可以由第U绘制帧中的前一个绘制帧的绘制参数中包含相机的转角参数确定。若电子设备显示的图像帧如图54A所示,电子设备可以在每两个绘制帧中插入一个预测帧,那么第U绘制帧的前一个绘制帧为第U-2绘制帧。In a possible implementation manner, the values of K3 and K4 may be determined by including the camera's corner parameter in the drawing parameters of the previous drawing frame in the U-th drawing frame. If the image frame displayed by the electronic device is as shown in FIG. 54A, the electronic device can insert a prediction frame into every two rendering frames, then the rendering frame preceding the U-th rendering frame is the U-2-th rendering frame.
进一步地,电子设备确定K3的具体计算过程可以如下:Further, the specific calculation process for determining K3 by the electronic device may be as follows:
1、计算第N-2绘制帧和第U绘制帧之间的坐标转换矩阵T。1. Calculate the coordinate transformation matrix T between the N-2th drawing frame and the Uth drawing frame.
T=(P1V1) -1*(P2V2)  (公式1) T=(P1V1) -1 *(P2V2) (Formula 1)
其中,(P1V1) -1为(P1V1)的逆矩阵。V1为第U-2绘制帧的绘制参数中包含的观察矩阵(view matrix),P1为第U-2绘制帧的绘制参数中包含的投影矩阵(projection matrix)。V2为第U绘制帧的绘制参数中包含的观察矩阵,P2为第U绘制帧的绘制参数中包含的投影矩阵。 where (P1V1) -1 is the inverse of (P1V1). V1 is a view matrix (view matrix) included in the drawing parameters of the U-2th drawing frame, and P1 is a projection matrix (projection matrix) included in the drawing parameters of the U-2th drawing frame. V2 is the observation matrix included in the drawing parameters of the U-th drawing frame, and P2 is the projection matrix included in the drawing parameters of the U-th drawing frame.
在本申请实施例中,观察矩阵为世界空间(world space)与观察空间(camera space)之间的转换矩阵。例如,第U绘制帧的绘制指令中的顶点1的坐标可以通过观察矩阵从世界空间下的坐标转换为观察空间下的坐标。投影矩阵为观察空间与裁剪空间(clip space)之间的转换矩阵。例如,顶点1的坐标可以通过投影矩阵从观察空间下的坐标转换为裁剪空间下的坐标。世界空间是世界坐标下对应的空间。观察空间是以相机坐标系(以相机为坐标原点构建的坐标系)对应的空间。观察空间下描述的物体的位置,都是在相机坐标下的位置。裁剪空间中规定可以显示在电子设备的显示屏中的物体的坐标范围。In this embodiment of the present application, the observation matrix is a transformation matrix between the world space (world space) and the observation space (camera space). For example, the coordinates of the vertex 1 in the drawing instruction of the U-th drawing frame can be converted from the coordinates in the world space to the coordinates in the observation space through the observation matrix. The projection matrix is the transformation matrix between the viewing space and the clip space. For example, the coordinates of vertex 1 can be transformed from coordinates in view space to coordinates in clip space through a projection matrix. World space is the corresponding space in world coordinates. The observation space is the space corresponding to the camera coordinate system (the coordinate system constructed with the camera as the coordinate origin). The position of the object described in the observation space is the position in the camera coordinates. The clip space defines the coordinate range of the object that can be displayed on the display screen of the electronic device.
2、计算出第N帧中最右侧一列中所有像素点在第N帧到第N-2帧之间的位置偏移的X轴分量的最大值Z(Ai)’max。2. Calculate the maximum value Z(Ai)'max of the X-axis component of the position offset of all the pixels in the rightmost column of the Nth frame between the Nth frame and the N-2th frame.
若第N帧中最右侧一列中包括像素点A1、A2、A3、…、Ai、…、Ar等r个像素点。像素点Ai在第U帧到第U-2帧之间的位置偏移Z(Ai)为:If the rightmost column in the Nth frame includes r pixel points such as pixel points A1, A2, A3, ..., Ai, ..., Ar, etc. The position offset Z(Ai) of the pixel point Ai between the U-th frame and the U-2-th frame is:
Z(Ai)=Ai(xai,yai)-Aprev  (公式2)Z(Ai)=Ai(xai,yai)-Aprev (Formula 2)
其中Ai(xai,yai)为像素点Ai在第N帧中的像素空间的坐标;Aprev为像素点Ai在第U-2绘制帧的像素空间的坐标。电子设备以第U绘制帧的左下角为原点,向右为X轴,向上位Y轴建立一个坐标系。该坐标系对应的空间可以称为第N帧中的像素空间。同样地,电子设备以第U-2绘制帧的左下角为原点,向右为X轴,向上位Y轴建立一个坐标系。该坐标系对应的空间可以称为第U-2帧中的像素空间。where Ai(xai, yai) is the coordinate of the pixel point Ai in the pixel space of the Nth frame; Aprev is the coordinate of the pixel point Ai in the pixel space of the U-2th drawing frame. The electronic device establishes a coordinate system with the lower left corner of the U-th drawing frame as the origin, the X axis to the right, and the upper Y axis. The space corresponding to the coordinate system may be referred to as the pixel space in the Nth frame. Similarly, the electronic device establishes a coordinate system with the lower left corner of the U-2th drawing frame as the origin, the X axis to the right, and the upper Y axis. The space corresponding to this coordinate system may be referred to as the pixel space in the U-2th frame.
电子设备可以获取到第像素点Ai在第N帧中的像素空间的坐标Ai(xai,yai),电子设备获取第U帧的绘制范围的宽度为L0,高度为H0。像素点Ai的深度值为Dai,那么电子设备可以计算出像素点Ai在第N帧投影空间的坐标Ai_clip为:The electronic device can obtain the coordinates Ai(xai, yai) of the pixel space of the pixel point Ai in the Nth frame, and the width of the drawing range obtained by the electronic device in the Uth frame is L0 and the height is H0. The depth value of the pixel point Ai is Dai, then the electronic device can calculate the coordinate Ai_clip of the pixel point Ai in the Nth frame projection space as:
Ai_clip=(xai/L0,yai/H0,2*Dai-1,1)  (公式3)Ai_clip=(xai/L0,yai/H0,2*Dai-1,1) (Formula 3)
像素点Ai在第N-2帧裁剪空间的坐标Ai_clip_prev为:The coordinate Ai_clip_prev of the pixel point Ai in the N-2th frame clipping space is:
Ai_clip_prev=T*Ai_clip  (公式4)Ai_clip_prev=T*Ai_clip (Formula 4)
像素点Ai在第N-2帧像素空间的坐标Aprev为:The coordinate Aprev of the pixel point Ai in the pixel space of the N-2th frame is:
Aiprev=(Ai_clip_prev.x/Ai_clip_prev.w*L0,Ai_clip_prev.y/Ai_clip_prev.w*H0)  (公式5)Aiprev=(Ai_clip_prev.x/Ai_clip_prev.w*L0,Ai_clip_prev.y/Ai_clip_prev.w*H0) (Formula 5)
其中,Ai_clip_prev是一个1乘4的向量,其中Ai_clip_prev.x为Ai_clip_prev的第一元素,A_clip_prev.y为Ai_clip_prev的第二元素,Ai_clip_prev.w为Ai_clip_prev的第四个元素。Ai_clip_prev is a 1-by-4 vector, where Ai_clip_prev.x is the first element of Ai_clip_prev, A_clip_prev.y is the second element of Ai_clip_prev, and Ai_clip_prev.w is the fourth element of Ai_clip_prev.
如果Z(Ai).x>=0那么将Z(Ai)的值修改为(0,0),如果Z(Ai).x<0,那么将Z(Ai)中每一个值取绝对值,得到Z(Ai)’。If Z(Ai).x>=0, then modify the value of Z(Ai) to (0,0), if Z(Ai).x<0, then take the absolute value of each value in Z(Ai), to get Z(Ai)'.
电子设备按照公式2-公式5计算出像素点A1、A2、A3、…、Ai、…、Ar等r个像素点的在第N帧到第U-2帧之间的位置偏移。电子设备确定出像素点A1、A2、A3、…、Ai、…、Ar等r个像素点的在第U帧到第U-2帧之间的位置偏移的X轴分量的最大值Z(Ai)’max。The electronic device calculates the position offset of r pixel points such as pixel points A1, A2, A3, . . . , Ai, . The electronic device determines the maximum value Z( Ai)'max.
3、计算出第N帧中最左侧一列中所有像素点在第U帧到第U-2帧之间的位置偏移X轴 分量的最大值Z(Bi)’max。3. Calculate the maximum value Z(Bi)'max of the X-axis component of the position offset of all the pixels in the leftmost column of the Nth frame between the Uth frame and the U-2th frame.
若第N帧中最右侧一列中包括像素点B1、B2、B3、…、Bi、…、Br等r个像素点。像素点Bi在第U帧到第U-2帧之间的位置偏移Z(Bi)为:If the rightmost column in the Nth frame includes pixel points B1, B2, B3, ..., Bi, ..., Br, etc. r pixels. The position offset Z(Bi) of the pixel point Bi between the U-th frame and the U-2-th frame is:
Z(Bi)=Bi(xbi,ybi)-Biprev  (公式6)Z(Bi)=Bi(xbi,ybi)-Biprev (Equation 6)
其中Bi(xbi,ybi)为像素点Bi在第N帧中的像素空间的坐标;Biprev为像素点Bi在第U-2绘制帧的像素空间的坐标。Where Bi(xbi, ybi) is the coordinate of the pixel point Bi in the Nth frame in the pixel space; Biprev is the coordinate of the pixel point Bi in the pixel space of the U-2th drawing frame.
电子设备可以获取到第像素点Bi在第U帧中的像素空间的坐标Bi(xbi,ybi),电子设备获取第U帧的绘制范围的宽度为L0,高度为H0。像素点Bi的深度值为Dbi,那么电子设备可以计算出像素点Bi在第U帧裁剪空间的坐标Bi_clip为:The electronic device can obtain the coordinates Bi(xbi, ybi) in the pixel space of the pixel point Bi in the U-th frame, and the width of the drawing range obtained by the electronic device in the U-th frame is L0 and the height is H0. The depth value of the pixel point Bi is Dbi, then the electronic device can calculate the coordinate Bi_clip of the pixel point Bi in the U-th frame clipping space as:
Bi_clip=(xai/L0,yai/H0,2*Dbi-1,1)  (公式7)Bi_clip=(xai/L0,yai/H0,2*Dbi-1,1) (Formula 7)
像素点Bi在第U-2帧裁剪空间的坐标Bi_clip_prev为:The coordinate Bi_clip_prev of the pixel Bi in the U-2th frame clipping space is:
Bi_clip_prev=T*Bi_clip  (公式8)Bi_clip_prev=T*Bi_clip (Equation 8)
像素点Bi在第U-2帧像素空间的坐标Biprev为:The coordinate Biprev of the pixel point Bi in the pixel space of the U-2th frame is:
Biprev=(Bi_clip_prev.x/Bi_clip_prev.w*L0,Bi_clip_prev.y/Bi_clip_prev.w*H0)  (公式9)Biprev=(Bi_clip_prev.x/Bi_clip_prev.w*L0,Bi_clip_prev.y/Bi_clip_prev.w*H0) (Equation 9)
其中,Bi_clip_prev是一个1乘4的向量,其中Bi_clip_prev.x为Bi_clip_prev的第一元素,B_clip_prev.y为Bi_clip_prev的第二元素,Bi_clip_prev.w为Bi_clip_prev的第四个元素。Among them, Bi_clip_prev is a 1-by-4 vector, where Bi_clip_prev.x is the first element of Bi_clip_prev, B_clip_prev.y is the second element of Bi_clip_prev, and Bi_clip_prev.w is the fourth element of Bi_clip_prev.
如果Z(Bi).x>=0那么将Z(Bi)的值修改为(0,0),如果Z(Bi).x<0,那么将Z(Bi)的值取绝对值,得到最终的Z(Bi)’。If Z(Bi).x>=0, then modify the value of Z(Bi) to (0,0), if Z(Bi).x<0, then take the absolute value of Z(Bi) to get the final Z(Bi)'.
电子设备按照公式6-公式9计算出像素点B1、B2、B3、…、Bi、…、Br等r个像素点的在第U帧到第U-2帧之间的位置偏移。电子设备确定出像素点B1、B2、B3、…、Bi、…、Br等r个像素点的在第U帧到第U-2帧之间的位置偏移的X轴分量的最大值Z(Bi)’max。The electronic device calculates the position offset of r pixel points such as pixel points B1, B2, B3, . . . , Bi, . The electronic device determines the maximum value Z( Bi)'max.
4、根据位置偏移Z(Ai)’max和Z(Bi)’max计算出K3。4. Calculate K3 according to the position offset Z(Ai)'max and Z(Bi)'max.
K3=((Z(Ai)’max+Z(Bi)’max)/2+L)/L  (公式10)K3=((Z(Ai)’max+Z(Bi)’max)/2+L)/L (Equation 10)
可选地,若第一绘制范围的宽度为L+Q3,则Q3可以为:Optionally, if the width of the first drawing range is L+Q3, then Q3 can be:
Q3=(Z(Ai)’max+Z(Bi)’max)/2  (公式11)Q3=(Z(Ai)’max+Z(Bi)’max)/2 (Equation 11)
进一步地,电子设备确定K4的具体计算过程可以如下:Further, the specific calculation process for determining K4 by the electronic device may be as follows:
5、计算第U-2绘制帧和第U绘制帧之间的坐标转换矩阵T。5. Calculate the coordinate transformation matrix T between the U-2th drawing frame and the Uth drawing frame.
此处可以参考上述步骤1,此处不再赘述。Here, you can refer to the above step 1, which will not be repeated here.
6、计算出第U帧中最上侧一列中所有像素点在第U帧到第U-2帧之间的位置偏移的X轴分量的最大值Z(Ci)’max。6. Calculate the maximum value Z(Ci)'max of the X-axis component of the position offset of all the pixels in the uppermost column in the U-th frame between the U-th frame and the U-2-th frame.
这里Z(Ci)’max的计算过程可以参考上述公式2-公式5中计算Z(Ai)’max的过程,此处不再赘述。Here, the calculation process of Z(Ci)'max can refer to the process of calculating Z(Ai)'max in the above formula 2-formula 5, which will not be repeated here.
7、计算出第U帧中最下侧一列中所有像素点在第U帧到第U-2帧之间的位置偏移X轴分量的最大值Z(Di)’max。7. Calculate the maximum value Z(Di)'max of the position offset X-axis component of all the pixels in the lowermost column of the U-th frame between the U-th frame and the U-2-th frame.
这里Z(Di)’max的计算过程可以参考上述公式2-公式5中计算Z(Ai)’max的过程,此处不再赘述。Here, the calculation process of Z(Di)'max can refer to the process of calculating Z(Ai)'max in the above formula 2-formula 5, which will not be repeated here.
8、根据位置偏移Z(Ci)’max和Z(Di)’max计算出K4。8. Calculate K4 according to the position offset Z(Ci)'max and Z(Di)'max.
K4=((Z(Ci)’max+Z(Di)’max)/2+H)/H  (公式12)K4=((Z(Ci)’max+Z(Di)’max)/2+H)/H (Equation 12)
可选地,若第一绘制范围的高度为H+Q4,则Q4可以为:Optionally, if the height of the first drawing range is H+Q4, then Q4 can be:
Q4=(Z(Ci)’max+Z(Di)’max)/2  (公式13)Q4=(Z(Ci)’max+Z(Di)’max)/2 (Equation 13)
本申请实施例下文以第一绘制范围的尺寸小于第二十一内存空间的尺寸为例进行阐述。例如,如图61中的(a)图所示,第二十一内存空间的一个附件6102的宽度为L·K1,高度为H·K2。第一绘制范围的宽度为L·K3,高度为H·K4。附件6102可以是图58中示出的附件5701或附件5702、或附件570n。The embodiments of the present application are described below by taking an example that the size of the first drawing range is smaller than the size of the twenty-first memory space. For example, as shown in (a) of FIG. 61 , the width of one attachment 6102 in the twenty-first memory space is L·K1 and the height is H·K2. The width of the first drawing range is L·K3 and the height is H·K4. Accessory 6102 may be accessory 5701 or accessory 5702 shown in FIG. 58 , or accessory 570n.
电子设备可以将第U绘制帧的绘制指令的绘制内容绘制在第二十一内存空间的第一绘制范围内。第一绘制范围的尺寸大于目标应用程序的viewport参数指定的绘制范围的尺寸。由于第一绘制范围放大了,电子设备可以将更多的绘制内容绘制到第一绘制范围中。但是如果第U绘制帧的绘制内容也跟随绘制范围的放大比例一样,那么第一绘制范围内的绘制内容不会增加。电子设备需要是第U绘制帧中的绘制内容在相机坐标下,以相机坐标原点为中心点进行一个位似变换,这样绘制内容在相机坐标下都会向中间收缩,并变得更小。从而,电子设备可以在第一绘制范围内绘制更多的绘制内容。The electronic device may draw the drawing content of the drawing instruction of the U-th drawing frame within the first drawing range of the twenty-first memory space. The size of the first drawing range is larger than the size of the drawing range specified by the viewport parameter of the target application. Since the first drawing range is enlarged, the electronic device can draw more drawing content into the first drawing range. However, if the drawing content of the U-th drawing frame also follows the enlargement ratio of the drawing range, the drawing content in the first drawing range will not increase. The electronic device needs to perform a bitwise transformation with the camera coordinate origin as the center point of the drawing content in the U-th drawing frame, so that the drawing content will shrink to the middle and become smaller in the camera coordinate. Therefore, the electronic device can draw more drawing contents within the first drawing range.
电子设备可以通过修改第U绘制帧的绘制参数中的投影矩阵,使得第U绘制帧的绘制内容在第一绘制范围内绘制的更多。电子设备可以根据确定的K3和K4的值生成一个矩阵T1,投影矩阵P可以修改为P*T1。该矩阵T1可以为:The electronic device may modify the projection matrix in the drawing parameters of the U-th drawing frame, so that the drawing content of the U-th drawing frame is drawn more within the first drawing range. The electronic device can generate a matrix T1 according to the determined values of K3 and K4, and the projection matrix P can be modified to P*T1. The matrix T1 can be:
Figure PCTCN2021106928-appb-000017
Figure PCTCN2021106928-appb-000017
在本申请实施例中,矩阵T1可以称为第一转换矩阵。In this embodiment of the present application, the matrix T1 may be referred to as a first transformation matrix.
在一种可能的实现方式中,电子设备可以通过hookglBufferSubData函数来修改投影矩阵。glBufferSubData函数是:glBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void*data)。In one possible implementation, the electronic device can modify the projection matrix through the hookglBufferSubData function. The glBufferSubData function is: glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void*data).
glBufferSubData函数要用于将data里面所指向的大小为size的数据,写入target对应的buffer内存为offset的位置。电子设备hook这个函数后,根据target的值为GL_UNIFORM_BUFFER以及size的大小为2848判定这个data里面包含了投影矩阵P的信息。电子设备利用内存信息将data中的P取出,将P*T1写入data的指定位置。电子设备根据修改后的投影矩阵(即P*T1),将第U绘制帧的绘制内容绘制到第一绘制范围内,可以得到第二十一绘制结果。这样第二十一绘制结果中可以包括更多的绘制内容。举例来说,如第U绘制帧中绘制指令的绘制内容中存在一个大小为100*100的正方形。该绘制内容以修改后的投影矩阵(即P*T1),正方形的大小将变为(100*1/K3)*(100*1/K4)。由于电子设备将第一绘制范围的宽度扩大了K3倍,第一绘制范围的高度扩大了K4倍,这样该正方形在第一绘制范围内的大小即为(100*1/K3*K3)*(100*1/K4*K4)=(100*100)。这样,绘制范围变大了,但是绘制的绘制内容的大小没有变大,因此,变大的绘制范围中可以绘制更多的绘制内容了。The glBufferSubData function is used to write the data of size size pointed to in data into the buffer memory corresponding to the target at the offset position. After the electronic device hooks this function, it is determined that the data contains the information of the projection matrix P according to the value of the target as GL_UNIFORM_BUFFER and the size of the size as 2848. The electronic device uses the memory information to take out the P in the data, and write P*T1 into the specified location of the data. The electronic device draws the drawing content of the U-th drawing frame into the first drawing range according to the modified projection matrix (ie, P*T1), and can obtain the twenty-first drawing result. In this way, the twenty-first drawing result may include more drawing contents. For example, there is a square with a size of 100*100 in the drawing content of the drawing instruction in the U-th drawing frame. With the modified projection matrix (ie P*T1), the size of the square will become (100*1/K3)*(100*1/K4). Since the electronic device expands the width of the first drawing range by K3 times and the height of the first drawing range by K4 times, the size of the square in the first drawing range is (100*1/K3*K3)*( 100*1/K4*K4)=(100*100). In this way, the drawing range becomes larger, but the size of the drawn content does not increase. Therefore, more drawing content can be drawn in the enlarged drawing range.
第U绘制帧的第二十一绘制结果可以如图61中的(b)图中第二十一绘制结果6103所示。第二十一绘制结果6103中的宽度为L·K3,高度为H·K4。即第二十一绘制结果的尺寸可以与第一绘制范围的尺寸相同。可选地,第二十一绘制结果的尺寸可以与第二十一内存空间的尺寸相同。下文以第二十一绘制结果的尺寸与第一绘制范围的尺寸相同为例进行阐述。The twenty-first rendering result of the U-th rendering frame may be shown as the twenty-first rendering result 6103 in (b) of FIG. 61 . The width in the twenty-first drawing result 6103 is L·K3 and the height is H·K4. That is, the size of the twenty-first drawing result may be the same as the size of the first drawing range. Optionally, the size of the twenty-first drawing result may be the same as the size of the twenty-first memory space. The following description takes an example that the size of the twenty-first drawing result is the same as the size of the first drawing range.
S5606、在默认内存空间中,GPU将第二十一绘制结果的尺寸剪切到与默认内存空间的尺寸相同,得到第U绘制帧。S5606. In the default memory space, the GPU cuts the size of the twenty-first drawing result to be the same as the size of the default memory space to obtain the U-th drawing frame.
一般地,电子设备的显示屏的尺寸与默认内存空间的尺寸相同。因此目标应用程序的图像帧在显示之前,电子设备需要将图像帧的尺寸剪切到与默认内存空间的尺寸相同。在默认内存空间中,GPU可以将第二十一绘制结果的尺寸剪切到与默认内存空间的尺寸相同,得到第U绘制帧。第U绘制帧是用于电子设备显示的图像帧。第U绘制帧可以如图61中的(c)图示出的第U绘制帧6104所示。该第U绘制帧6104可以向左运动。Generally, the size of the display screen of the electronic device is the same as the size of the default memory space. Therefore, before the image frame of the target application is displayed, the electronic device needs to cut the size of the image frame to be the same as the size of the default memory space. In the default memory space, the GPU can cut the size of the twenty-first drawing result to be the same as the size of the default memory space to obtain the U-th drawing frame. The U-th rendering frame is an image frame for display by the electronic device. The U-th rendering frame may be shown as the U-th rendering frame 6104 illustrated in (c) of FIG. 61 . The U-th drawing frame 6104 may move to the left.
在一种可能的实现方式中,电子设备可以通过函数glBlitFramebuffer函数剪切第二十一绘制结果,得到第U绘制帧。In a possible implementation manner, the electronic device may clip the twenty-first drawing result through the function glBlitFramebuffer to obtain the U-th drawing frame.
glBlitFramebuffer函数可以是:The glBlitFramebuffer function can be:
void glBlitFramebuffervoid glBlitFramebuffer
GLint srcX0,//第二十一绘制结果中第一像素点的横坐标,srcX0=(K3–1)*L/2GLint srcX0,//The abscissa of the first pixel in the twenty-first drawing result, srcX0=(K3–1)*L/2
GLint srcY0,//第二十一绘制结果中第一像素点的纵坐标,srcY0=(K4–1)*L/2GLint srcY0,//The ordinate of the first pixel in the twenty-first drawing result, srcY0=(K4–1)*L/2
GLint srcX1,//第二十一绘制结果中第二像素点的横坐标,srcX1=srcX0+LGLint srcX1,//The abscissa of the second pixel in the twenty-first drawing result, srcX1=srcX0+L
GLint srcY1,//第二十一绘制结果中第二像素点的纵坐标,srcY1=srcY0+HGLint srcY1,//The ordinate of the second pixel in the twenty-first drawing result, srcY1=srcY0+H
GLint dstX0,//默认内存空间的左下角顶点的横坐标GLint dstX0,//The abscissa of the lower left corner vertex of the default memory space
GLint dstY0,//默认内存空间的左下角顶点的纵坐标GLint dstY0,//The ordinate of the lower left corner vertex of the default memory space
GLint dstX1,//默认内存空间的右上角顶点的横坐标GLint dstX1,//The abscissa of the upper right corner of the default memory space
GLint dstY1,//默认内存空间的右角顶点的纵坐标GLint dstY1,//The ordinate of the right corner vertex of the default memory space
GLbitfield mask,GLbitfield mask,
GLenum filter)。GLenum filter).
glBlitFramebuffer函数用于将第二十一绘制结果剪切到默认内存空间中。具体地,电子设备将第二十一绘制结果的尺寸剪成与默认内存空间的尺寸相同。然后电子设备将剪切后的第二十一绘制结果写入到默认内存空间中。第一像素点即为剪切后的第二十一绘制结果的左下角顶点位置的像素点。第二像素点即为剪切后的第二十一绘制结果的右上角顶点位置的像素点。The glBlitFramebuffer function is used to clip the twenty-first drawing result to the default memory space. Specifically, the electronic device cuts the size of the twenty-first drawing result to be the same as the size of the default memory space. Then the electronic device writes the cut twenty-first drawing result into the default memory space. The first pixel point is the pixel point at the vertex position of the lower left corner of the twenty-first clipped drawing result. The second pixel is the pixel at the vertex position of the upper right corner of the twenty-first cut drawing result.
S5607-S5610、电子设备绘制第U+2绘制帧。S5607-S5610, the electronic device draws the U+2th drawing frame.
S5607、电子设备的CPU获取第U+2绘制帧的绘制参数。S5607. The CPU of the electronic device acquires the drawing parameters of the U+2th drawing frame.
电子设备的CPU可以获取到第U+2绘制帧的绘制参数。具体地,电子设备100的CPU可以通过三维图像处理库中的接口获取到应用程序的第U+2绘制帧的绘制参数。第U+2绘制帧的绘制参数用于绘制并渲染第U+2绘制帧。第U+2绘制帧的绘制参数可以包括第U+2绘制帧的绘制指令(例如draw call指令)中携带的信息,例如draw call指令的绘制内容中的每个顶点的坐标,颜色值,深度值等等信息。The CPU of the electronic device may acquire the drawing parameters of the U+2th drawing frame. Specifically, the CPU of the electronic device 100 may acquire the drawing parameters of the U+2th drawing frame of the application program through the interface in the three-dimensional image processing library. The drawing parameters of the U+2th drawing frame are used to draw and render the U+2th drawing frame. The drawing parameters of the U+2th drawing frame may include the information carried in the drawing instructions (such as the draw call instruction) of the U+2th drawing frame, such as the coordinates, color value, depth of each vertex in the drawing content of the draw call instruction value, etc.
可以理解的是,电子设备在绘制第U+2绘制帧之前,电子设备显示第U+1帧。若第U+1 帧为绘制帧,电子设备可以按照步骤S5607-步骤S5610中绘制第U+2绘制帧的步骤来绘制第U+1帧。若第U+1帧为预测帧,则电子设备可以按照步骤S5611-S5615来预测第U+1预测帧。It can be understood that, before the electronic device draws the U+2 th drawing frame, the electronic device displays the U+1 th frame. If the U+1th frame is a drawing frame, the electronic device may draw the U+1th frame according to the steps of drawing the U+2th drawing frame in steps S5607 to S5610. If the U+1th frame is a predicted frame, the electronic device may predict the U+1th predicted frame according to steps S5611-S5615.
S5608、电子设备中的CPU向GPU发送用于指示GPU绘制第U+2绘制帧的绘制指令。S5608. The CPU in the electronic device sends a drawing instruction to the GPU for instructing the GPU to draw the U+2th drawing frame.
电子设备的CPU可以根据第U+2绘制帧的绘制参数向GPU发送用于指示GPU绘制第U+2绘制帧的绘制指令。可以理解的是,CPU获取到的第U+2绘制帧的绘制参数中可以包括多个绘制指令的信息。这样,CPU可以依次地向GPU发送用于指示GPU绘制第U+2绘制帧的多个绘制指令。这里,具体可以参考步骤S5604中的描述,此处不再赘述。The CPU of the electronic device may send a drawing instruction for instructing the GPU to draw the U+2 th drawing frame to the GPU according to the drawing parameters of the U+2 th drawing frame. It can be understood that the drawing parameters of the U+2th drawing frame acquired by the CPU may include information of multiple drawing instructions. In this way, the CPU may sequentially send to the GPU multiple drawing instructions for instructing the GPU to draw the U+2 th drawing frame. Here, specific reference may be made to the description in step S5604, which will not be repeated here.
S5609、在第二十二内存空间中,电子设备的GPU将第U+2绘制帧的绘制指令中的绘制内容绘制到第二绘制范围内,得到第二十二绘制结果,第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,大于默认内存空间的尺寸。S5609. In the twenty-second memory space, the GPU of the electronic device draws the drawing content in the drawing instruction of the U+2th drawing frame into the second drawing range, and obtains the twenty-second drawing result. The size is less than or equal to the size of the twenty-second memory space and greater than the size of the default memory space.
电子设备的GPU可以将第U+2绘制帧的绘制指令的绘制内容绘制到第二十二内存空间中,得到第二十二绘制结果。可选地,电子设备的GPU可以将第U+2绘制帧的绘制指令的绘制内容绘制到第二十二内存空间的第二绘制范围内,得到第二十二绘制结果。第二绘制范围的尺寸小于或等于第二十二内存空间的尺寸,大于默认内存空间的尺寸。可以理解的是,在本申请实施例中,第二十二内存空间中的任一个附件中的绘制范围均可以称为第二绘制范围。The GPU of the electronic device may draw the drawing content of the drawing instruction of the U+2th drawing frame into the twenty-second memory space to obtain the twenty-second drawing result. Optionally, the GPU of the electronic device may draw the drawing content of the drawing instruction of the U+2th drawing frame into the second drawing range of the twenty-second memory space to obtain the twenty-second drawing result. The size of the second drawing range is smaller than or equal to the size of the twenty-second memory space, and is larger than the size of the default memory space. It can be understood that, in this embodiment of the present application, the drawing range in any attachment in the twenty-second memory space may be referred to as the second drawing range.
在一种可能的实现方式中,第二绘制范围的尺寸由电子设备根据目标应用程序中的viewport参数确定。目标应用程序的viewport参数用于指定电子设备中绘制该目标应用程序的图像帧的绘制范围的宽度和高度。一般地,目标应用程序的viewport参数指定的绘制范围的宽度和电子设备中默认内存空间的宽度相同,viewport参数指定的绘制范围的高度和电子设备中默认内存空间的高度相同。电子设备可以通过hook技术修改目标应用程序的viewport参数来指定第二绘制范围的尺寸。例如,若目标应用程序的viewport规定的第U绘制帧的绘制范围的宽度为L,高度为H。那么电子设备可以通过hook技术修改目标应用程序的viewport参数将第二绘制范围的宽度指定为L·K5,高度指定为H·K6。K5和K6均大于1。可选地,K5和K6为大于1的浮点数。K5小于或等于K1,K6小于或等于K2。第U+2绘制帧的viewport参数可以是本申请实施例中的第二参数。In a possible implementation manner, the size of the second drawing range is determined by the electronic device according to the viewport parameter in the target application. The viewport parameter of the target application is used to specify the width and height of the drawing range in which the image frame of the target application is drawn in the electronic device. Generally, the width of the drawing range specified by the viewport parameter of the target application is the same as the width of the default memory space in the electronic device, and the height of the drawing range specified by the viewport parameter is the same as the height of the default memory space in the electronic device. The electronic device may modify the viewport parameter of the target application through the hook technology to specify the size of the second drawing range. For example, if the width of the drawing range of the U-th drawing frame specified by the viewport of the target application is L and the height is H. Then, the electronic device can modify the viewport parameter of the target application through the hook technology, and designate the width of the second drawing range as L·K5 and the height as H·K6. Both K5 and K6 are greater than 1. Optionally, K5 and K6 are floating point numbers greater than 1. K5 is less than or equal to K1, and K6 is less than or equal to K2. The viewport parameter of the U+2 th drawing frame may be the second parameter in this embodiment of the present application.
如图62中(a)图所示,图62中(a)图示出了第二十二内存空间中的一个附件6202以及第二绘制范围6201。附件6202宽度为L·K1,高度为H·K2。第二绘制范围6201宽度为L·K5,高度为H·K6。下文以电子设备将第U+2绘制帧中绘制指令的绘制内容绘制到第二绘制范围6201为例进行阐述。该附件6202可以是图59中示出的第二十二内存空间中的附件5901或者附件5902、或者附件590n。As shown in (a) of FIG. 62 , (a) of FIG. 62 shows an attachment 6202 and a second drawing range 6201 in the twenty-second memory space. Attachment 6202 has a width of L·K1 and a height of H·K2. The second drawing range 6201 has a width of L·K5 and a height of H·K6. The following description will be given by taking the electronic device drawing the drawing content of the drawing instruction in the U+2 th drawing frame to the second drawing range 6201 as an example. The accessory 6202 may be the accessory 5901 or the accessory 5902, or the accessory 590n in the twenty-second memory space shown in FIG. 59 .
在一种可能的实现方式中,K5等于K1,为电子设备的系统配置的固定值。K6等于K2,为电子设备的系统配置的固定值。可以理解的是,即第二绘制范围的尺寸等于第二十二内存空间的尺寸。In one possible implementation, K5 is equal to K1, which is a fixed value for the system configuration of the electronic device. K6 is equal to K2, a fixed value for the system configuration of the electronic device. It can be understood that the size of the second drawing range is equal to the size of the twenty-second memory space.
在一种可能的实现方式中,K5和K6的值可以由第U+2绘制帧中的前一个绘制帧的绘制参数中包含相机的转角参数确定。若电子设备显示的图像帧如图54A所示,电子设备可以在每两个绘制帧中插入一个预测帧,那么第U+2绘制帧的前一个绘制帧为第U绘制帧。K5和K6的计算过程可以参考上文描述的K3的计算过程,此处不再赘述。In a possible implementation manner, the values of K5 and K6 may be determined by including the camera's corner parameter in the drawing parameters of the previous drawing frame in the U+2th drawing frame. If the image frame displayed by the electronic device is as shown in FIG. 54A, the electronic device can insert a prediction frame into every two rendering frames, then the rendering frame preceding the U+2-th rendering frame is the U-th rendering frame. For the calculation process of K5 and K6, reference may be made to the calculation process of K3 described above, which will not be repeated here.
电子设备可以将第U+2绘制帧的绘制指令的绘制内容绘制在第二十二内存空间的第二绘 制范围内。第二绘制范围的尺寸大于目标应用程序的viewport参数指定的绘制范围的尺寸。由于第二绘制范围放大了,电子设备可以将更多的绘制内容绘制到第二绘制范围中。但是如果第U+2绘制帧的绘制内容也跟随绘制范围的放大比例一样,那么第二绘制范围内的绘制内容不会增加。电子设备需要是第U+2绘制帧中的绘制内容在相机坐标下,以相机坐标原点为中心点进行一个位似变换,这样绘制内容在相机坐标下都会想中间收缩,并变得更小。从而,电子设备可以在第一绘制范围内绘制更多的绘制内容。The electronic device may draw the drawing content of the drawing instruction of the U+2 drawing frame in the second drawing range of the twenty-second memory space. The size of the second drawing range is larger than the size of the drawing range specified by the viewport parameter of the target application. Since the second drawing range is enlarged, the electronic device can draw more drawing content into the second drawing range. However, if the drawing content of the U+2th drawing frame also follows the enlargement ratio of the drawing range, the drawing content in the second drawing range will not increase. The electronic device needs to make the drawing content in the U+2 drawing frame under the camera coordinates, and perform a bitwise transformation with the origin of the camera coordinates as the center point, so that the drawing content will shrink in the middle and become smaller under the camera coordinates. Therefore, the electronic device can draw more drawing contents within the first drawing range.
电子设备可以通过修改第U绘制帧的绘制参数中的投影矩阵,使得第U+2绘制帧的绘制内容在第一绘制范围内绘制的更多。电子设备可以根据确定的K5和K6的值生成一个矩阵T2,投影矩阵P可以修改为P*T2。该矩阵T2可以为:The electronic device may modify the projection matrix in the drawing parameters of the U-th drawing frame, so that the drawing content of the U+2-th drawing frame is drawn more within the first drawing range. The electronic device can generate a matrix T2 according to the determined values of K5 and K6, and the projection matrix P can be modified to P*T2. The matrix T2 can be:
Figure PCTCN2021106928-appb-000018
Figure PCTCN2021106928-appb-000018
在本申请实施例中,矩阵T2可以称为第二转换矩阵。In this embodiment of the present application, the matrix T2 may be referred to as a second transformation matrix.
在一种可能的实现方式中,电子设备可以通过hookglBufferSubData函数来修改投影矩阵。glBufferSubData函数是:glBufferSubData(GLenum target,GLintptr offset,GLsizeiptr size,const void*data)。In one possible implementation, the electronic device can modify the projection matrix through the hookglBufferSubData function. The glBufferSubData function is: glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void*data).
glBufferSubData函数要用于将data里面所指向的大小为size的数据,写入target对应的buffer内存为offset的位置。电子设备hook这个函数后,根据target的值为GL_UNIFORM_BUFFER以及size的大小为2848判定这个data里面包含了投影矩阵P的信息。电子设备利用内存信息将data中的P取出,将P*T2写入data的指定位置。电子设备根据修改后的投影矩阵(即P*T2),将第U+2绘制帧的绘制内容绘制到第二绘制范围内,可以得到第二十二绘制结果。第二十二绘制结果中可以包括第U+2绘制帧的绘制指令中的更多绘制内容。这里可以参考步骤S305中关于glBufferSubData函数的描述,此处不再赘述。The glBufferSubData function is used to write the data of size size pointed to in data into the buffer memory corresponding to the target at the offset position. After the electronic device hooks this function, it is determined that the data contains the information of the projection matrix P according to the value of the target as GL_UNIFORM_BUFFER and the size of the size as 2848. The electronic device uses the memory information to take out the P in the data, and write P*T2 into the specified location of the data. The electronic device draws the drawing content of the U+2th drawing frame into the second drawing range according to the modified projection matrix (ie, P*T2), and can obtain the twenty-second drawing result. The twenty-second drawing result may include more drawing contents in the drawing instruction of the U+2th drawing frame. Here, reference may be made to the description of the glBufferSubData function in step S305, which will not be repeated here.
第U+2绘制帧的第二十二绘制结果可以如图62中的(b)图中第二十二绘制结果6203所示。第二十二绘制结果6203中的宽度为L·K5,高度指定为H·K6。即第二十二绘制结果的尺寸可以与第二绘制范围的尺寸相同。可选地,第二十二绘制结果的尺寸可以与第二十二内存空间的尺寸相同。下文以第二十二绘制结果的尺寸与第二绘制范围的尺寸相同为例进行阐述。The twenty-second rendering result of the U+2-th rendering frame may be shown as the twenty-second rendering result 6203 in (b) of FIG. 62 . The width in the twenty-second drawing result 6203 is L·K5, and the height is designated as H·K6. That is, the size of the twenty-second drawing result may be the same as the size of the second drawing range. Optionally, the size of the twenty-second drawing result may be the same as the size of the twenty-second memory space. The following description takes an example that the size of the twenty-second drawing result is the same as the size of the second drawing range.
S5610、在默认内存空间中,电子设备的GPU将第二十二绘制结果的尺寸剪切到与默认内存空间的尺寸相同,得到第U+2绘制帧。S5610. In the default memory space, the GPU of the electronic device cuts the size of the twenty-second drawing result to the same size as the default memory space, and obtains the U+2th drawing frame.
一般地,电子设备的显示屏的尺寸与默认内存空间的尺寸相同。因此目标应用程序的图像帧在显示之前,电子设备需要将图像帧的尺寸剪切到与默认内存空间的尺寸相同。在默认内存空间中,GPU可以将第二十二绘制结果的尺寸剪切到与默认内存空间的尺寸相同,得到第U+2绘制帧。第U+2绘制帧是用于电子设备显示的图像帧。第U+2绘制帧可以如图62中的(c)图示出的第U+2绘制帧6204所示。该第U+2绘制帧6204可以向左运动。Generally, the size of the display screen of the electronic device is the same as the size of the default memory space. Therefore, before the image frame of the target application is displayed, the electronic device needs to cut the size of the image frame to be the same as the size of the default memory space. In the default memory space, the GPU can cut the size of the twenty-second drawing result to be the same as the size of the default memory space to obtain the U+2th drawing frame. The U+2th rendering frame is an image frame for display by the electronic device. The U+2 th drawing frame may be shown as the U+2 th drawing frame 6204 illustrated in (c) of FIG. 62 . The U+2-th rendering frame 6204 may be moved to the left.
在一种可能的实现方式中,电子设备可以通过函数glBlitFramebuffer函数剪切第二十二绘制结果,得到第U+2绘制帧。In a possible implementation manner, the electronic device may clip the twenty-second drawing result through the function glBlitFramebuffer to obtain the U+2th drawing frame.
glBlitFramebuffer函数可以是:The glBlitFramebuffer function can be:
void glBlitFramebuffer(void glBlitFramebuffer(
GLint srcX2,//第二十二绘制结果中第三像素点的横坐标,srcX2=(K5–1)*L/2GLint srcX2,//The abscissa of the third pixel in the twenty-second drawing result, srcX2=(K5–1)*L/2
GLint srcY2,//第二十二绘制结果中第三像素点的纵坐标,srcY2=(K6–1)*L/2GLint srcY2,//The ordinate of the third pixel in the twenty-second drawing result, srcY2=(K6–1)*L/2
GLint srcX3,//第二十二绘制结果中第四像素点的横坐标,srcX3=srcX2+LGLint srcX3,//The abscissa of the fourth pixel in the twenty-second drawing result, srcX3=srcX2+L
GLint srcY3,//第二十二绘制结果中第四像素点的纵坐标,srcY3=srcY2+HGLint srcY3,//The ordinate of the fourth pixel in the twenty-second drawing result, srcY3=srcY2+H
GLint dstX0,//默认内存空间的左下角顶点的横坐标GLint dstX0,//The abscissa of the lower left corner vertex of the default memory space
GLint dstY0,//默认内存空间的左下角顶点的纵坐标GLint dstY0,//The ordinate of the lower left corner vertex of the default memory space
GLint dstX1,//默认内存空间的右上角顶点的横坐标GLint dstX1,//The abscissa of the upper right corner of the default memory space
GLint dstY1,//默认内存空间的右上角顶点的纵坐标GLint dstY1,//The ordinate of the upper right corner vertex of the default memory space
GLbitfield mask,GLbitfield mask,
GLenum filter)。GLenum filter).
glBlitFramebuffer函数可以用于将第二十二绘制结果剪切到默认内存空间中。具体地,电子设备将第二十二绘制结果的尺寸剪成与默认内存空间的尺寸相同。然后电子设备将剪切后的第二十二绘制结果写入到默认内存空间中。第三像素点即为剪切后的第二十二绘制结果的左下角顶点位置的像素点。第四像素点即为剪切后的第二十二绘制结果的右上角顶点位置的像素点。The glBlitFramebuffer function can be used to clip the twenty-second drawing result to the default memory space. Specifically, the electronic device cuts the size of the twenty-second drawing result to be the same as the size of the default memory space. Then the electronic device writes the cut twenty-second drawing result into the default memory space. The third pixel point is the pixel point at the lower left corner vertex position of the twenty-second clipped drawing result. The fourth pixel is the pixel at the vertex position of the upper right corner of the twenty-second clipped drawing result.
S5611-S5615、电子设备预测第U+3预测帧。S5611-S5615, the electronic device predicts the U+3th prediction frame.
S5611、电子设备向GPU发送用于指示GPU计算运动向量的指令。S5611. The electronic device sends an instruction for instructing the GPU to calculate the motion vector to the GPU.
电子设备的CPU可以向GPU发送用于指示GPU计算运动向量的指令。该指令用于指示GPU中的shader计算运动向量。该指令可以是dispatch指令。本申请实施例对计算运动向量的指令的具体形式不做限定。The CPU of the electronic device may send an instruction to the GPU for instructing the GPU to calculate the motion vector. This instruction is used to instruct the shader in the GPU to calculate the motion vector. The directive can be a dispatch directive. The embodiment of the present application does not limit the specific form of the instruction for calculating the motion vector.
S5612、电子设备的GPU利用第二十一绘制结果和第二十二绘制结果,计算出第二十二绘制结果的运动向量S。S5612 , the GPU of the electronic device uses the twenty-first rendering result and the twenty-second rendering result to calculate the motion vector S of the twenty-second rendering result.
电子设备的GPU可以利用第二十一绘制结果和第二十二绘制结果,计算出第二十二绘制结果的运动向量。The GPU of the electronic device may use the twenty-first rendering result and the twenty-second rendering result to calculate the motion vector of the twenty-second rendering result.
在一种可能的实现方式中,电子设备的GPU利用第二十一绘制结果和第二十二绘制结果,计算出第二十二绘制结果的运动向量具体可以包括如下步骤:In a possible implementation manner, the GPU of the electronic device uses the twenty-first rendering result and the twenty-second rendering result to calculate the motion vector of the twenty-second rendering result, which may specifically include the following steps:
1、GPU可以将第二十二绘制结果6203划分成Q个像素块。每个像素块可以包含f*f(例如16*16)个像素点。第二十二绘制结果6203为第U+2绘制帧的绘制结果。如图63A中的(b)图所示。1. The GPU may divide the twenty-second rendering result 6203 into Q pixel blocks. Each pixel block may contain f*f (eg 16*16) pixel points. The twenty-second rendering result 6203 is the rendering result of the U+2th rendering frame. As shown in (b) of Fig. 63A.
2、GPU在第二十二绘制结果6203中取第一像素块(例如图63A中(b)图中的像素块6205),在第二十一绘制结果6103中查找与第一像素块匹配的匹配像素块,例如图63A中(a)图中的像素块6105。第二十一绘制结果6103为第U绘制帧的绘制结果。2. The GPU takes the first pixel block in the twenty-second rendering result 6203 (for example, the pixel block 6205 in (b) in FIG. 63A ), and searches the twenty-first rendering result 6103 for a pixel block that matches the first pixel block. Matching pixel blocks, such as pixel block 6105 in (a) of Figure 63A. The twenty-first rendering result 6103 is the rendering result of the U-th rendering frame.
在本申请实施例中,第二十一绘制结果中所有候选块中,与第一像素块的RGB值的绝对差最小的候选块,称为与第像素块匹配的匹配像素块。电子设备需要在第二十一绘制结果中找到与像素块匹配的匹配像素块6105。可选地,电子设备的GPU可以通过菱形搜索算法在第U绘制帧找到与第一像素块匹配的匹配像素块。如图63B所示,GPU可以通过菱形搜索算 法在(b)图的第U帧的绘制结果(即第二十一绘制结果6103)中与找到(a)图第U+2绘制帧的绘制结果(即第二十二绘制结果6203)中的像素块6205匹配的匹配像素块。电子设备可以利用像素块6205的左上角的像素点6211去进行菱形搜索。电子设备可以在第U绘制帧的绘制结果中找到以像素点6106为左上角的像素块6105与像素块6205相匹配。菱形搜索算法具体可以参考现有技术中的描述,此处不再赘述。In the embodiment of the present application, among all the candidate blocks in the twenty-first rendering result, the candidate block with the smallest absolute difference with the RGB value of the first pixel block is called a matching pixel block matching the th pixel block. The electronic device needs to find a matching pixel block 6105 that matches the pixel block in the twenty-first drawing result. Optionally, the GPU of the electronic device may find a matching pixel block that matches the first pixel block in the U-th drawing frame by using a diamond search algorithm. As shown in FIG. 63B , the GPU can use the diamond search algorithm to find the drawing result of the U+2th drawing frame of (a) in the drawing result of the U-th frame in (b) (ie, the twenty-first drawing result 6103 ) (ie, the pixel block 6205 in the twenty-second rendering result 6203) matches the matching pixel block. The electronic device can use the pixel point 6211 in the upper left corner of the pixel block 6205 to perform a diamond search. The electronic device may find that the pixel block 6105 with the pixel point 6106 as the upper left corner matches the pixel block 6205 in the drawing result of the U-th drawing frame. For details of the diamond search algorithm, reference may be made to the description in the prior art, which will not be repeated here.
如图63C所示,图63C的(a)图和(b)图示例性地示出了电子设备在第U绘制帧中找到与像素块6205的匹配像素块6105的示意图。如图63C的(a)图所示,电子设备对像素块6205的左上角像素点6211进行菱形搜索。如图63C的(b)图所示,在一种可实现的方式中,电子设备首先进行以第U绘制帧中像素点9012为中心点进行菱形搜索。像素点6211的坐标与像素点6212的坐标相同。电子设备可以计算出像素块6205分别于以左上角像素点为像素点6212的像素块,左上角像素点为像素点6301的像素块,左上角像素点为像素点6302的像素块,左上角像素点为像素点6303的像素块,左上角像素点为像素点6304的像素块,左上角像素点为像素点6305的像素块,左上角像素点为像素点6306的像素块,左上角像素点为像素点6307的像素块,左上角像素点为像素点6308的像素块的颜色值差。电子设备可以再以颜色值差最小的像素块中的左上角像素点为中心进行小菱形搜索。例如上述像素块中,左上角像素点为像素点6307的像素块与像素块6205的颜色值差值最小。那么电子设备可以以像素点6307为中心进行小菱形搜索。即电子设备可以计算出像素块6205分别于以左上角像素点为像素点6311的像素块,左上角像素点为像素点6312的像素块,左上角像素点为像素点6313的像素块,左上角像素点为像素点6314的像素块。最后,电子设备可以确定出左上角像素点为像素点6314的像素块(即图63B示出的像素块6105)与像素块6105的颜色值差最小。那么电子设备可以确定出第N帧中像素块6105为像素块6205的匹配像素块。As shown in FIG. 63C , (a) and (b) of FIG. 63C exemplarily show a schematic diagram of the electronic device finding a matching pixel block 6105 with the pixel block 6205 in the U-th rendering frame. As shown in (a) of FIG. 63C , the electronic device performs a diamond search on the upper left pixel point 6211 of the pixel block 6205 . As shown in (b) of FIG. 63C , in an achievable manner, the electronic device first performs a diamond search with the pixel point 9012 in the U-th drawing frame as the center point. The coordinates of the pixel point 6211 are the same as the coordinates of the pixel point 6212 . The electronic device can calculate that the pixel block 6205 is respectively in the pixel block with the upper left pixel point as the pixel point 6212, the upper left pixel point is the pixel block of the pixel point 6301, the upper left pixel point is the pixel block of the pixel point 6302, the upper left pixel point is the pixel block of the pixel point 6302, and the upper left pixel point is the pixel block of the pixel point 6302. The point is the pixel block of pixel point 6303, the upper left pixel point is the pixel block of pixel point 6304, the upper left pixel point is the pixel block of pixel point 6305, the upper left pixel point is the pixel block of pixel point 6306, and the upper left pixel point is the pixel block of pixel point 6306. For the pixel block of pixel point 6307, the upper left pixel point is the color value difference of the pixel block of pixel point 6308. The electronic device can then perform a small diamond search with the upper left pixel point in the pixel block with the smallest color value difference as the center. For example, in the above-mentioned pixel block, the pixel block whose upper left pixel point is the pixel point 6307 and the pixel block 6205 have the smallest color value difference. Then the electronic device can perform a small diamond search with the pixel point 6307 as the center. That is, the electronic device can calculate that the pixel block 6205 is respectively in the pixel block with the upper left pixel point as the pixel point 6311, the upper left pixel point is the pixel block with the pixel point 6312, the upper left pixel point is the pixel block with the pixel point 6313, and the upper left corner pixel point is the pixel block with the pixel point 6313. The pixel point is a pixel block of pixel point 6314. Finally, the electronic device can determine that the pixel block whose upper left pixel point is the pixel point 6314 (ie, the pixel block 6105 shown in FIG. 63B ) has the smallest difference in color value with the pixel block 6105 . Then the electronic device can determine that the pixel block 6105 in the Nth frame is a matching pixel block of the pixel block 6205 .
3、GPU计算出匹配像素块到第一像素块的第一位移,根据第一位移确定出第一像素块的运动向量A1。3. The GPU calculates the first displacement from the matched pixel block to the first pixel block, and determines the motion vector A1 of the first pixel block according to the first displacement.
例如,图63B所示,图63B中与像素块6205的匹配块为像素块6105。那么像素块6205的运动向量为图63B中(b)图示出的运动向量A1。For example, as shown in FIG. 63B , the matching block with the pixel block 6205 in FIG. 63B is the pixel block 6105 . Then the motion vector of the pixel block 6205 is the motion vector A1 illustrated in (b) of FIG. 63B .
4、GPU可以按照上述步骤1-步骤3计算出第二十二绘制结果6203中Q个像素块中每个像素块的运动向量,即为A1,A2,…,AQ。第二十二绘制结果的运动向量即为S=(A1,A2,…,AQ)。4. The GPU can calculate the motion vector of each pixel block in the Q pixel blocks in the twenty-second rendering result 6203 according to the above steps 1-3, namely A1, A2, . . . , AQ. The motion vector of the twenty-second rendering result is S=(A1, A2, . . . , AQ).
S5613、电子设备向GPU发送用于指示GPU绘制预测帧的指令。S5613: The electronic device sends an instruction to the GPU for instructing the GPU to draw the predicted frame.
电子设备的CPU可以在GPU计算出第二十二绘制结果的运动向量S之后,向GPU发送用于绘制第U+3预测帧的指令。The CPU of the electronic device may send an instruction for drawing the U+3 th predicted frame to the GPU after the GPU calculates the motion vector S of the twenty-second drawing result.
S5614、在第二十三内存空间中,电子设备的GPU根据运动向量S和第二十二绘制结果预测得到第二十三绘制结果,第二十三绘制结果的尺寸与第二十二绘制结果的尺寸相同。S5614. In the twenty-third memory space, the GPU of the electronic device predicts and obtains the twenty-third drawing result according to the motion vector S and the twenty-second drawing result, and the size of the twenty-third drawing result is the same as the twenty-second drawing result. are the same size.
第U+2绘制帧和第U+3预测帧中的对象相同,只是对象在第U+2绘制帧和第U+3预测帧中的位置不同。GPU可以利用第U+2绘制帧的第二十二绘制结果和第二十二绘制结果的运动向量可以生成第二十三绘制结果。具体地,GPU可以根据第二十二绘制结果运动向量S可以预测出第二十三绘制结果的运动向量V。运动向量V可以等于运动向量S的G倍。G小于1,G可以等于0.5。GPU可以根据第二十二绘制结果的每个像素点的颜色值以及每个像素点 在运动向量V下的位移生成第二十三绘制结果。The objects in the U+2th rendering frame and the U+3th prediction frame are the same, but the positions of the objects in the U+2th rendering frame and the U+3th prediction frame are different. The GPU may generate the twenty-third rendering result using the twenty-second rendering result of the U+2-th rendering frame and the motion vector of the twenty-second rendering result. Specifically, the GPU may predict the motion vector V of the twenty-third rendering result according to the motion vector S of the twenty-second rendering result. The motion vector V may be equal to G times the motion vector S. G is less than 1, and G may be equal to 0.5. The GPU may generate the twenty-third rendering result according to the color value of each pixel of the twenty-second rendering result and the displacement of each pixel under the motion vector V.
在一种可能的实现方式中,电子设备的GPU在第二十三内存空间中生成第二十三绘制结果。进一步地,GPU可以在第二十三内存空间中的第三绘制范围内生成第二十三绘制结果。第三绘制范围的尺寸小于或等于第二十三内存空间的尺寸,大于默认内存空间的尺寸。可以理解的是,在本申请实施例中,第二十三内存空间中的任一个附件中的绘制范围均可以称为第三绘制范围。In a possible implementation manner, the GPU of the electronic device generates the twenty-third drawing result in the twenty-third memory space. Further, the GPU may generate the twenty-third drawing result within the third drawing range in the twenty-third memory space. The size of the third drawing range is smaller than or equal to the size of the twenty-third memory space, and is larger than the size of the default memory space. It can be understood that, in this embodiment of the present application, the drawing range in any attachment in the twenty-third memory space may be referred to as the third drawing range.
在一种可能的实现方式中,第三绘制范围的尺寸由电子设备根据目标应用程序中的viewport参数确定。目标应用程序的viewport参数用于指定电子设备中绘制该目标应用程序的图像帧的绘制范围的宽度和高度。一般地,目标应用程序的viewport参数指定的绘制范围的宽度和电子设备中默认内存空间的宽度相同,viewport参数指定的绘制范围的高度和电子设备中默认内存空间的高度相同。电子设备可以通过hook技术修改目标应用程序的viewport参数来指定第三绘制范围的尺寸。例如,若目标应用程序的viewport规定的第U绘制帧的绘制范围的宽度为L,高度为H。那么电子设备可以通过hook技术修改目标应用程序的viewport参数将第三绘制范围的宽度指定为L·K7,高度指定为H·K8。K7和K8均大于1。可选地,K7和K8为大于1的浮点数。K7小于或等于K1,K8小于或等于K2。In a possible implementation manner, the size of the third drawing range is determined by the electronic device according to the viewport parameter in the target application. The viewport parameter of the target application is used to specify the width and height of the drawing range in which the image frame of the target application is drawn in the electronic device. Generally, the width of the drawing range specified by the viewport parameter of the target application is the same as the width of the default memory space in the electronic device, and the height of the drawing range specified by the viewport parameter is the same as the height of the default memory space in the electronic device. The electronic device may modify the viewport parameter of the target application through the hook technology to specify the size of the third drawing range. For example, if the width of the drawing range of the U-th drawing frame specified by the viewport of the target application is L and the height is H. Then, the electronic device can modify the viewport parameter of the target application through the hook technology, and designate the width of the third drawing range as L·K7 and the height as H·K8. Both K7 and K8 are greater than 1. Optionally, K7 and K8 are floating point numbers greater than 1. K7 is less than or equal to K1, and K8 is less than or equal to K2.
如图64中(a)图所示,图64中(a)图示出了第二十三内存空间中的一个附件6402以及第三绘制范围6401。附件6402宽度为L·K1,高度为H·K2。第三绘制范围6401宽度为L·K7,高度为H·K8。下文以电子设备将在第三绘制范围6401内生成第二十三绘制结果为例进行阐述。该附件6402可以是图60中示出的第二十三内存空间中的附件6001或者附件6002或者附件600n。As shown in (a) of FIG. 64 , (a) of FIG. 64 shows an attachment 6402 and a third drawing range 6401 in the twenty-third memory space. Attachment 6402 has a width of L·K1 and a height of H·K2. The third drawing range 6401 has a width of L·K7 and a height of H·K8. The following description will be given by taking the electronic device generating the twenty-third drawing result in the third drawing range 6401 as an example. The accessory 6402 may be the accessory 6001 or the accessory 6002 or the accessory 600n in the twenty-third memory space shown in FIG. 60 .
在一种可能的实现方式中,K7等于K1,为电子设备的系统配置的固定值。K8等于K2,为电子设备的系统配置的固定值。可以理解的是,即第三绘制范围的尺寸等于第二十三内存空间的尺寸。In one possible implementation, K7 is equal to K1, a fixed value for the system configuration of the electronic device. K8 is equal to K2, a fixed value for the system configuration of the electronic device. It can be understood that the size of the third drawing range is equal to the size of the twenty-third memory space.
在一种可能的实现方式中,K7和K8的值可以由第U绘制帧和第U+2绘制帧中的绘制参数中包含相机的转角参数确定。K7和K8的计算过程可以参考上文中对K3计算过程的描述,此处不再赘述。In a possible implementation manner, the values of K7 and K8 may be determined by including the camera's corner parameter in the drawing parameters in the U-th drawing frame and the U+2-th drawing frame. For the calculation process of K7 and K8, reference may be made to the description of the calculation process of K3 above, which will not be repeated here.
第U+3预测帧的第二十三绘制结果可以如图64中的(b)图中第二十三绘制结果6403所示。第二十三绘制结果6403中的宽度为L·K5,高度为H·K6。The twenty-third rendering result of the U+3-th prediction frame may be shown as the twenty-third rendering result 6403 in (b) of FIG. 64 . The width in the twenty-third drawing result 6403 is L·K5 and the height is H·K6.
可以理解的是,预测帧中的绘制范围的扩大倍数(例如K7和K8)可以根据生成预测帧的两帧绘制帧的绘制参数来确定。而绘制帧的绘制范围的扩大倍数(例如K3和K4)可以该绘制帧的绘制参数和该绘制帧的前一帧绘制帧的绘制参数来确定。若绘制帧为该图像帧预测方法开始执行的第一帧,那么电子设备的系统可以为该绘制帧的绘制范围的扩大倍数配置为固定值。It can be understood that the enlargement multiples (eg K7 and K8) of the drawing range in the predicted frame may be determined according to the drawing parameters of the two drawing frames in which the predicted frame is generated. The enlargement multiples of the drawing range of the drawing frame (for example, K3 and K4) can be determined by drawing parameters of the drawing frame and drawing parameters of the drawing frame preceding the drawing frame. If the drawing frame is the first frame in which the image frame prediction method starts to be executed, the system of the electronic device may configure a fixed value for the expansion multiple of the drawing range of the drawing frame.
S5615、在默认内存空间中,电子设备的GPU将第二十三绘制结果的尺寸剪切到与原始内存空间的尺寸相同,得到第U+3预测帧。S5615. In the default memory space, the GPU of the electronic device cuts the size of the twenty-third drawing result to be the same as the size of the original memory space to obtain the U+3th predicted frame.
一般地,电子设备的显示屏的尺寸与默认内存空间的尺寸相同。因此目标应用程序的图像帧在显示之前,电子设备需要将图像帧的尺寸剪切到与默认内存空间的尺寸相同。在默认内存空间中,GPU可以将第二十二绘制结果的尺寸剪切到与默认内存空间的尺寸相同,得到第U+3预测帧。第U+3预测帧是用于电子设备显示的图像帧。第U+3预测帧可以如图64中 的(c)图示出的第U+3预测帧6404所示。电子设备剪切第二十三绘制结果的具体实现方式可以参考上文中对电子设备剪切第二十一绘制结果和第二十二绘制结果的描述,此处不再赘述。Generally, the size of the display screen of the electronic device is the same as the size of the default memory space. Therefore, before the image frame of the target application is displayed, the electronic device needs to cut the size of the image frame to be the same as the size of the default memory space. In the default memory space, the GPU can cut the size of the twenty-second drawing result to be the same as the size of the default memory space to obtain the U+3th predicted frame. The U+3-th predicted frame is an image frame for display by the electronic device. The U+3-th predicted frame may be shown as the U+3-th predicted frame 6404 illustrated in (c) in FIG. 64 . For a specific implementation manner of clipping the twenty-third rendering result by the electronic device, reference may be made to the above description of clipping the twenty-first rendering result and the twenty-second rendering result by the electronic device, which will not be repeated here.
在本申请实施例中,第U绘制帧可以称为第一绘制帧。第U+2绘制帧可以称为第二绘制帧。第U+3预测帧可以称为第一预测帧。In this embodiment of the present application, the U-th drawing frame may be referred to as the first drawing frame. The U+2th drawing frame may be referred to as the second drawing frame. The U+3-th predicted frame may be referred to as the first predicted frame.
电子设备绘制出绘制帧的主要过程是GPU执行若干个drawcall指令。GPU将每一个drawcall指令的内容逐一的绘制到FBO上。然后每一个drawcall指令在GPU上都需要执行一次渲染管线的流程。该渲染管线的流程主要分为顶点着色器,曲面细分(非必须),几何作色器(非必须),图元组装(非必须),光栅化、片段作色器、测试混合阶段(非必须)。这样,GPU绘制一帧绘制帧的开销很大。另外,GPU执行每一个drawcall指令所需要的顶点信息,坐标信息等都需要GPU进行准备,这些准备工作对于cpu也是很高的计算量。The main process for the electronic device to draw the drawing frame is that the GPU executes several drawcall instructions. The GPU draws the contents of each drawcall instruction to the FBO one by one. Then each drawcall instruction needs to execute the rendering pipeline process once on the GPU. The process of the rendering pipeline is mainly divided into vertex shader, tessellation (not required), geometry shader (not required), primitive assembly (not required), rasterization, fragment shader, test mixing stage (not required) must). In this way, it is expensive for the GPU to draw a frame to draw a frame. In addition, the vertex information and coordinate information required by the GPU to execute each drawcall instruction need to be prepared by the GPU, and these preparations are also very computationally intensive for the CPU.
预测一帧图像帧的过程对于CPU来说几乎没有计算消耗,只需向GPU发送部分指令。对于GPU来说,只需要计算图像帧的运动向量。这些计算全部是并行的,且只需要计算一次,每个计算单元执行的都是少量的基本运算,可以减少GPU的计算,提升性能。The process of predicting an image frame has almost no computational consumption for the CPU, and only needs to send some instructions to the GPU. For the GPU, only the motion vector of the image frame needs to be calculated. These calculations are all parallel and only need to be calculated once. Each computing unit performs a small number of basic operations, which can reduce GPU calculations and improve performance.
可以理解的是,本申请实施例不限于电子设备通过第U绘制帧和第U+2绘制帧预测出第U+3预测帧。可选地,电子设备还可以通过第N帧和第N+1帧预测第U+2绘制帧。可选地,电子设备还可以通过第N帧和第N+3帧预测第N+4帧。本申请实施例对此不做限定。It can be understood that the embodiment of the present application is not limited to the electronic device predicting the U+3 th predicted frame by using the U th rendering frame and the U+2 th rendering frame. Optionally, the electronic device may also predict the U+2 th drawing frame by using the N th frame and the N+1 th frame. Optionally, the electronic device may also predict the N+4th frame by using the Nth frame and the N+3th frame. This embodiment of the present application does not limit this.
可以理解的是,电子设备在显示目标应用程序的视频界面的过程中,电子设备可以按照不同的策略来预测出预测帧。即电子设备在第一时间段按照第N帧和第U+2绘制帧预测第N+3帧的策略,在第二时间段按照第N帧和第N+1帧预测第U+2绘制帧的策略。例如,当GPU执行的任务比较多时,电子设备可以先按照第N帧和第U+2绘制帧预测第N+3帧。当GPU执行的任务比较少时,电子设备可以按照第N帧和第N+1帧预测第U+2绘制帧。本申请实施例对此不做限定。It can be understood that, when the electronic device displays the video interface of the target application, the electronic device can predict the predicted frame according to different strategies. That is, the electronic device predicts the N+3th frame according to the Nth frame and the U+2th drawing frame in the first time period, and predicts the U+2th drawing frame according to the Nth frame and the N+1th frame in the second time period. strategy. For example, when the GPU performs many tasks, the electronic device may first predict the N+3 th frame according to the N th frame and the U+2 th drawing frame. When the GPU performs few tasks, the electronic device may predict the U+2th drawing frame according to the Nth frame and the N+1th frame. This embodiment of the present application does not limit this.
在一种可能的实现方式中,本申请实施例中第二十一绘制结果和第二十二绘制结果至绘制目标应用程序的界面场景内容(例如游戏内容),不绘制目标应用程序中的UI控件。In a possible implementation manner, the twenty-first drawing result and the twenty-second drawing result in this embodiment of the present application are used to draw the interface scene content (for example, game content) of the target application, and the UI in the target application is not drawn. controls.
可以理解的是,本申请实施例中的第二十一绘制结果可以是绘制了第U绘制帧的绘制指令的绘制内容的第一绘制范围,例如,图61中(b)图示出的第二十一绘制结果6103。第二十一绘制结果可以是绘制了第U绘制帧的绘制指令的绘制内容的第二十一内存空间的一个附件。此时,第二十一绘制结果的尺寸等于第二十一内存空间中该附件的尺寸。即,第二十一绘制结果的宽度和第二十一内存空间的宽度相同,第二十一绘制结果的高度与第二十一内存空间的高度相同。同样地,本申请实施例中的第二十二绘制结果可以是绘制了第U+2绘制帧的绘制指令的绘制内容的第二绘制范围,例如,图62中(b)图示出的第二十二绘制结果6203。第二十二绘制结果可以是绘制了第U+2绘制帧的绘制指令的绘制内容的第二十二内存空间的一个附件。此时,第二十二绘制结果的尺寸等于第二十二内存空间中该附件的尺寸。即,第二十二绘制结果的宽度和第二十二内存空间的宽度相同,第二十二绘制结果的高度与第二十二内存空间的高度相同。It can be understood that the twenty-first drawing result in this embodiment of the present application may be the first drawing range in which the drawing content of the drawing instruction of the U-th drawing frame is drawn. Twenty-one drawing results 6103. The twenty-first drawing result may be an attachment to the twenty-first memory space in which the drawing content of the drawing instruction of the U-th drawing frame is drawn. At this time, the size of the twenty-first drawing result is equal to the size of the attachment in the twenty-first memory space. That is, the width of the twenty-first drawing result is the same as the width of the twenty-first memory space, and the height of the twenty-first drawing result is the same as the height of the twenty-first memory space. Likewise, the twenty-second drawing result in this embodiment of the present application may be the second drawing range in which the drawing content of the drawing instruction of the U+2th drawing frame is drawn. Twenty-two drawing results 6203. The twenty-second drawing result may be an attachment to the twenty-second memory space in which the drawing content of the drawing instruction of the U+2th drawing frame is drawn. At this time, the size of the twenty-second drawing result is equal to the size of the attachment in the twenty-second memory space. That is, the width of the twenty-second drawing result is the same as the width of the twenty-second memory space, and the height of the twenty-second drawing result is the same as the height of the twenty-second memory space.
通过本申请实施例提供的一种图像帧预测的方法,在绘制第一绘制帧时,电子设备将第一绘制帧的绘制指令的绘制内容绘制到第二十一内存空间中,得到第二十一绘制结果,第二十一内存空间的尺寸大于默认内存空间的尺寸,默认内存空间为电子设备系统提供的存储用于显示的图像帧的内存空间;在绘制第二绘制帧时,电子设备将第二绘制帧的绘制指令的绘制内容绘制到第二十二内存空间,得到第二十二绘制结果,第二十二内存空间的尺寸大于默 认内存空间的尺寸;电子设备根据第二十一绘制结果和第二十二绘制结果,在第二十三内存空间中生成第二十三绘制结果,第二十三内存空间的尺寸大于默认内存空间的尺寸;电子设备将第二十三绘制结果剪切成与默认内存空间的尺寸相同,得到第三预测帧。这样,电子设备在放大的内存空间中绘制第一绘制帧,第二绘制帧,可以绘制出比电子设备显示的第一绘制帧和第二绘制帧多一些的绘制内容。这样,电子设备预测出的预测帧中可以存在电子设备显示的第一绘制帧和第二绘制帧中没有的绘制内容。从而,电子设备预测的预测帧中的绘制内容更接近相机的拍摄视野中的拍摄内容。因而,电子设备预测出的图像帧可以更为准确。With the image frame prediction method provided by the embodiment of the present application, when drawing the first drawing frame, the electronic device draws the drawing content of the drawing instruction of the first drawing frame into the twenty-first memory space, and obtains the twenty-first As a result of drawing, the size of the twenty-first memory space is larger than the size of the default memory space, which is the memory space provided by the electronic device system for storing image frames for display; when drawing the second drawing frame, the electronic device will The drawing content of the drawing instruction of the second drawing frame is drawn into the twenty-second memory space, and the twenty-second drawing result is obtained. The size of the twenty-second memory space is larger than the size of the default memory space; the electronic device draws according to the twenty-first The result and the twenty-second drawing result, the twenty-third drawing result is generated in the twenty-third memory space, and the size of the twenty-third memory space is larger than the size of the default memory space; the electronic device cuts the twenty-third drawing result. Cut to the same size as the default memory space to get the third predicted frame. In this way, the electronic device draws the first drawing frame and the second drawing frame in the enlarged memory space, and can draw more drawing content than the first drawing frame and the second drawing frame displayed by the electronic device. In this way, in the predicted frame predicted by the electronic device, there may be rendering content that is not in the first rendering frame and the second rendering 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. Therefore, the image frame predicted by the electronic device can be more accurate.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.
上述实施例中所用,根据上下文,术语“当…时”可以被解释为意思是“如果…”或“在…后”或“响应于确定…”或“响应于检测到…”。类似地,根据上下文,短语“在确定…时”或“如果检测到(所陈述的条件或事件)”可以被解释为意思是“如果确定…”或“响应于确定…”或“在检测到(所陈述的条件或事件)时”或“响应于检测到(所陈述的条件或事件)”。As used in the above embodiments, the term "when" may be interpreted to mean "if" or "after" or "in response to determining..." or "in response to detecting..." depending on the context. Similarly, depending on the context, the phrases "in determining..." or "if detecting (the stated condition or event)" can be interpreted to mean "if determining..." or "in response to determining..." or "on detecting (the stated condition or event)" or "in response to the detection of (the stated condition or event)".
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server, or data center by wire (eg, coaxial cable, optical fiber, digital subscriber line) or wireless (eg, infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, DVDs), or semiconductor media (eg, solid state drives), and the like.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented. The process can be completed by instructing the relevant hardware by a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed , which may include the processes of the foregoing method embodiments. The aforementioned storage medium includes: ROM or random storage memory RAM, magnetic disk or optical disk and other mediums that can store program codes.

Claims (134)

  1. 一种图像帧预测的方法,其特征在于,包括:A method for image frame prediction, comprising:
    在绘制第一绘制帧时,电子设备根据第一绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定所述第二绘制对象的空间信息未发生变化,所述电子设备所述将第一绘制对象的颜色数据写入第一颜色附件,将所述第二绘制对象的颜色数据写入第二颜色附件;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. When a change occurs, 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 first drawing object has changed according to the drawing instruction of the third drawing object, and determines the space of the fourth drawing object according to the drawing instruction of the fourth drawing object The information does not change, and 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 of the first predicted frame according to the first color attachment and the third color attachment, and generates the first predicted frame according to the second color attachment and the fourth color attachment The sixth color attachment;
    所述电子设备将所述第五颜色附件和所述第六颜色附件合成为所述第一预测帧。The electronic device synthesizes the fifth color attachment and the sixth color attachment into the first predicted frame.
  2. 根据权利要求1所述的方法,其特征在于,所述电子设备根据所述第一颜色附件和所述第三颜色附件生成第一预测帧的第五颜色附件,包括:The method according to claim 1, wherein the electronic device generates a fifth color accessory of the first predicted frame according to the first color accessory and the third color accessory, comprising:
    所述电子设备根据所述第一颜色附件和所述第三颜色附件,确定第三颜色附件的第一运动向量;The electronic device determines a first motion vector of the third color accessory according to the first color accessory and the third color accessory;
    所述电子设备根据所述第三颜色附件和所述第一运动向量生成所述第一预测帧的第五颜色附件。The electronic device generates a fifth color accessory of the first predicted frame based on the third color accessory and the first motion vector.
  3. 根据权利要求2所述的方法,其特征在于,所述电子设备根据所述第一颜色附件和所述第三颜色附件,确定第三颜色附件的第一运动向量;具体包括:The method according to claim 2, wherein the electronic device determines the first motion vector of the third color accessory according to the first color accessory and the third color accessory; specifically comprising:
    所述电子设备将所述第三颜色附件分成Q个像素块,所述电子设备在所述第三颜色附件的Q个像素块中取出第一像素块;The electronic device divides the third color accessory into Q pixel blocks, and the electronic device takes out a first pixel block from the Q pixel blocks of the third color accessory;
    所述电子设备在所述第一颜色附件中确定出与所述第一像素块匹配的第二像素块;The electronic device determines, in the first color attachment, a second pixel block that matches the first pixel block;
    所述电子设备根据所述第二像素块到所述第一像素块的位移得到所述第一像素块的运动向量;obtaining, by the electronic device, a motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block;
    所述电子设备根据所述第一像素块的运动向量确定出所述第三颜色附件的第一运动向量。The electronic device determines a first motion vector of the third color accessory according to the motion vector of the first pixel block.
  4. 根据权利要求3所述的方法,其特征在于,所述电子设备在所述第一颜色附件中确定出与所述第一像素块匹配的第二像素块,具体包括:The method according to claim 3, wherein the electronic device determines, in the first color attachment, a second pixel block that matches the first pixel block, specifically comprising:
    所述电子设备通过所述第一像素块中的第一像素点在所述第一颜色附件中确定出多个候选像素块;The electronic device determines a plurality of candidate pixel blocks in the first color attachment by using the first pixel points in the first pixel block;
    所述电子设备分别计算出所述多个候选像素块与所述第一像素块的颜色值的差值;The electronic device respectively calculates the difference between the color values of the plurality of candidate pixel blocks and the first pixel block;
    所述电子设备根据所述多个候选像素块所述第一像素块的颜色值的差值确定出与所述第一像素块匹配的所述第二像素块,所述第二像素块为多个候选像素块中与所述第一像素块的颜色值的差值最小的候选像素块。The electronic device determines the second pixel block matching the first pixel block according to the difference between the color values of the first pixel block of the plurality of candidate pixel blocks, and the second pixel block is a multi-pixel block. The candidate pixel block with the smallest difference in color value from the first pixel block among the candidate pixel blocks.
  5. 根据权利要求1所述的方法,其特征在于,所述电子设备根据所述第二颜色附件和第 四颜色附件生成所述第一预测帧的第六颜色附件,具体包括:The method according to claim 1, wherein the electronic device generates a sixth color accessory of the first predicted frame according to the second color accessory and the fourth color accessory, which specifically includes:
    所述电子设备根据所述第二颜色附件和所述第四颜色附件确定出所述第四颜色附件的第二运动向量;The electronic device determines a second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory;
    所述电子设备根据所述第四颜色附件和所述第二运动向量生成所述第一预测帧的第六颜色附件。The electronic device generates a sixth color accessory of the first predicted frame based on the fourth color accessory and the second motion vector.
  6. 根据权利要求5所述的方法,其特征在于,所述电子设备根据所述第二颜色附件和所述第四颜色附件确定出所述第四颜色附件的第二运动向量,具体包括:The method according to claim 5, wherein the electronic device determines the second motion vector of the fourth color accessory according to the second color accessory and the fourth color accessory, and specifically includes:
    所述电子设备将所述第四颜色附件分成Q个像素块,所述电子设备在所述第四颜色附件中取出第三像素块;The electronic device divides the fourth color accessory into Q pixel blocks, and the electronic device takes out a 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 according to the first position and the second position of the third pixel block in the fourth color attachment;
    所述电子设备根据所述第三像素块的运动向量确定出所述第四颜色附件的第二运动向量。The electronic device determines a second motion vector of the fourth color accessory according to the motion vector of the third pixel block.
  7. 根据权利要求6所述的方法,其特征在于,所述电子设备计算出所述第三像素块在所述第二颜色附件中的第一位置,具体包括:The method according to claim 6, wherein the electronic device calculates the first position of the third pixel block in the second color attachment, which specifically includes:
    所述电子设备获取到所述第一绘制帧的绘制指令中的第一矩阵和所述第二绘制帧中的绘制指令的第二矩阵,所述第一矩阵用于记录所述第一绘制帧的相机位置的转角信息,所述第二矩阵用于记录所述第二绘制帧的相机位置的转角信息;The electronic device obtains a first matrix in the drawing instructions of the first drawing frame and a second matrix of the drawing instructions in the second drawing frame, where the first matrix is used to record the first drawing frame The corner information of the camera position of the second matrix is used to record the corner information of the camera position of the second drawing frame;
    所述电子设备根据所述第一矩阵和所述第二矩阵、以及所述第三像素块的深度值计算出所述第三像素块在所述第二颜色附件中的第一位置。The electronic device calculates 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.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述第一绘制对象的绘制指令包括所述第一绘制对象的执行绘制指令和所述第一绘制对象的绘制状态设备指令,其中,所述第一绘制对象的执行绘制指令用于触发所述电子设备针对所述第一绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果,所述第一绘制对象的绘制状态设备指令用于设置所述第一绘制对象的执行绘制指令所依赖的绘制状态数据,所述第一绘制对象的绘制状态数据包括所述第一绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引;The method according to any one of claims 1-7, wherein the drawing instruction of the first drawing object includes 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 draw and render the drawing state data of the first drawing object, and generate a drawing result, and the drawing state device of the first drawing object The instruction 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 includes vertex information data, vertex index, texture information, vertex information of the first drawing object Information cache index;
    所述第二绘制对象的绘制指令包括所述第二绘制对象的执行绘制指令和所述第二绘制对象的绘制状态设备指令,其中,所述第二绘制对象的执行绘制指令用于触发所述电子设备针对所述第二绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果,所述第二绘制对象的绘制状态设备指令用于设置所述第二绘制对象的执行绘制指令所依赖的绘制状态数据,所述第二绘制对象的绘制状态数据包括所述第二绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引;The drawing instruction of the second drawing object includes an execution drawing instruction of the second drawing object and a drawing state device instruction of the second drawing object, wherein the executing drawing instruction of the second drawing object is used to trigger the The electronic device draws and renders the drawing state data of the second drawing object, and generates a drawing result. The drawing state device instruction of the second drawing object is used to set the drawing on which the drawing instruction of the second drawing object depends. State data, the drawing state data of the second drawing object includes vertex information data, vertex index, texture information, and vertex information cache index of the second drawing object;
    所述第三绘制对象的绘制指令包括所述第三绘制对象的执行绘制指令和所述第三绘制对象的绘制状态设备指令,其中,所述第三绘制对象的执行绘制指令用于触发所述电子设备针对所述第三绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果,所述第三绘制对象的绘制状态设备指令用于设置所述第三绘制对象的执行绘制指令所依赖的绘制状态数据,所述第三绘制对象的绘制状态数据包括所述第三绘制对象的顶点信息数据、顶点索引、纹理信息、 顶点信息缓存索引;The drawing instruction of the third drawing object includes an execution drawing instruction of the third drawing object and a drawing state device instruction of the third drawing object, wherein the executing drawing instruction of the third drawing object is used to trigger the The electronic device draws and renders the drawing state data of the third drawing object, and generates a drawing result. The drawing state device instruction of the third drawing object is used to set the drawing on which the drawing instruction of the third drawing object depends. State data, the drawing state data of the third drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the third drawing object;
    所述第四绘制对象的绘制指令包括所述第四绘制对象的执行绘制指令和所述第四绘制对象的绘制状态设备指令,其中,所述第四绘制对象的执行绘制指令用于触发所述电子设备针对所述第四绘制对象的绘制状态数据进行绘制渲染,并生成绘制结果,所述第四绘制对象的绘制状态设备指令用于设置所述第四绘制对象的执行绘制指令所依赖的绘制状态数据,所述第四绘制对象的绘制状态数据包括所述第四绘制对象的顶点信息数据、顶点索引、纹理信息、顶点信息缓存索引。The drawing instruction of the fourth drawing object includes an executing drawing instruction of the fourth drawing object and a drawing state device instruction of the fourth drawing object, wherein the executing drawing instruction of the fourth drawing object is used to trigger the The electronic device draws and renders the drawing state data of the fourth drawing object, and generates a drawing result. The drawing state device instruction of the fourth drawing object is used to set the drawing on which the drawing instruction of the fourth drawing object depends. State data, the drawing state data of the fourth drawing object includes vertex information data, vertex index, texture information, and vertex information buffer index of the fourth drawing object.
  9. 根据权利要求1-8任一项所述的方法,其特征在于,所述电子设备根据第一绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,包括:所述电子设备确定所述第一绘制对象的绘制指令中存在转移矩阵参数、所述电子设备确定所述第一绘制对象的绘制指令中的存在的转移矩阵参数与对应的所述第一绘制对象的转移矩阵参数不同,所述转移矩阵用于描述绘制对象的局部坐标系到世界坐标系的映射关系;The method according to any one of claims 1-8, wherein determining, by the electronic device, according to a drawing instruction of the first drawing object, that the spatial information of the first drawing object has changed, comprising: determining, by the electronic device, that the spatial information of the first drawing object has changed There is a transition matrix parameter in the drawing instruction of the first drawing object, and the electronic device determines that the existing transition matrix parameter in the drawing instruction of the first drawing object is different from the corresponding transition matrix parameter of the first drawing object , the transition matrix is used to describe the mapping relationship from the local coordinate system of the drawing object to the world coordinate system;
    所述电子设备根据第二绘制对象的绘制指令确定所述第二绘制对象的空间信息未发生变化,包括:所述电子设备确定所述第二绘制对象的绘制指令中不存在转移矩阵参数、所述电子设备确定所述第二绘制对象的绘制指令中的存在的转移矩阵参数与对应的所述第二绘制对象的转移矩阵参数相同;Determining, by the electronic device, that the spatial information of the second drawing object has not changed according to the drawing instruction of the second drawing object, includes: determining, by the electronic device, 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;
    所述电子设备根据第三绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,包括:所述电子设备确定所述第三绘制对象的绘制指令中存在转移矩阵参数、所述电子设备确定所述第三绘制对象的绘制指令中的存在的转移矩阵参数与对应的所述第三绘制对象的转移矩阵参数不同;Determining, by the electronic device, that the spatial information of the first drawing object has changed according to the drawing instruction of the third drawing object, includes: determining, by the electronic device, that a transfer matrix parameter exists in the drawing instruction of the third drawing object, the electronic The device determines that the existing 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;
    所述电子设备根据第四绘制对象的绘制指令确定所述第四绘制对象的空间信息未发生变化,包括:所述电子设备确定所述第二绘制对象的绘制指令中不存在转移矩阵参数、所述电子设备确定所述第二绘制对象的绘制指令中的存在的转移矩阵参数与对应的第二绘制对象的转移矩阵参数相同。Determining, by the electronic device, that the spatial information of the fourth drawing object has not changed according to the drawing instruction of the fourth drawing object, includes: determining, by the electronic device, 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. 根据权利要求1-8任一项所述的方法,其特征在于,所述在绘制第一绘制帧时,电子设备根据第一绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,根据第二绘制对象的绘制指令确定所述第二绘制对象的空间信息未发生变化,所述电子设备所述将第一绘制对象的颜色数据写入第一颜色附件,将所述第二绘制对象的颜色数据写入第二颜色附件之前,所述方法还包括:The method according to any one of claims 1-8, wherein when the first drawing frame is drawn, the electronic device determines that the spatial information of the first drawing object changes according to a drawing instruction of the first drawing object , according to the drawing instruction of the second drawing object, it is determined that the spatial information of the second drawing object has not changed, and the electronic device writes the color data of the first drawing object into the first color attachment, and writes the second drawing object Before the color data of the object is written into 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 for The first color accessory is stored, the second memory space is used to store the second color accessory, the third memory space is used to store the third color accessory, and the fourth memory space is used to store the second color accessory. Four color attachments, 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.
  11. 根据权利要求10所述的方法,其特征在于,所述在绘制第一绘制帧时,电子设备根据第一绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,根据第二绘制对象 的绘制指令确定所述第二绘制对象的空间信息未发生变化,所述电子设备所述将第一绘制对象的颜色数据写入第一颜色附件,将所述第二绘制对象的颜色数据写入第二颜色附件之后,所述方法还包括:The method according to claim 10, wherein when the first 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 first drawing object, and according to the second drawing The drawing instruction of the object determines that the spatial information of the second drawing object has not changed, 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. After adding the second color accessory, 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. 根据权利要求10所述的方法,其特征在于,所述在绘制第二绘制帧时,所述电子设备根据第三绘制对象的绘制指令确定所述第一绘制对象的空间信息发生变化,根据第四绘制对象的绘制指令确定所述第四绘制对象的空间信息未发生变化,所述电子设备将第三绘制对象的颜色数据写入第三颜色附件,将第四绘制对象的颜色数据写入第四颜色附件之后,所述方法还包括:The method according to claim 10, wherein 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 according to the third drawing object The drawing instruction of the fourth drawing object determines that the spatial information of the fourth drawing object has not changed, and 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 third color attachment. After the four-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. 根据权利要求11所述的方法,其特征在于,所述电子设备在所述第七内存空间中将所述第一颜色附件和所述第二颜色附件合成为所述第一绘制帧,具体包括:The method according to claim 11, wherein the electronic device synthesizes the first color attachment and the second color attachment into the first drawing frame in the seventh memory space, specifically comprising: :
    所述电子设备根据第一深度附件和第二深度附件,在第七内存空间中将所述第一颜色附件和所述第二颜色附件合成为所述第一绘制帧,所述第一深度附件用于写入所述第一绘制对象的深度数据,所述第二深度附件用于写入所述第二绘制对象的第二颜色附件。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, and the first depth attachment The depth data of the first drawing object is written, and the second depth attachment is used for writing the second color attachment of the second drawing object.
  14. 根据权利要求12所述的方法,其特征在于,所述电子设备在所述第七内存空间中将所述第三颜色附件和所述第四颜色附件合成为所述第二绘制帧,具体包括:The method according to claim 12, wherein the electronic device synthesizes the third color attachment and the fourth color attachment into the second drawing frame in the seventh memory space, specifically comprising: :
    所述电子设备根据第三深度附件和第四深度附件,在第七内存空间中将所述第三颜色附件和所述第四颜色附件合成为所述第二绘制帧;所述第三深度附件用于写入所述第三绘制对象的深度数据,所述第四深度附件用于写入所述第四绘制对象的深度数据。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 The fourth depth attachment is used for writing the depth data of the third drawing object, and the fourth depth attachment is used for writing the depth data of the fourth drawing object.
  15. 一种图像帧预测的方法,其特征在于,包括:A method for image frame prediction, comprising:
    电子设备根据第十绘制指令在第十绘制帧中确定第十运动对象,根据第十一绘制指令在第十一绘制帧中确定第十一运动对象;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 moving object matches the eleventh moving object according to the attribute of the tenth moving object and the attribute of the eleventh moving object;
    所述电子设备根据所述第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果。The electronic device determines, according to the tenth moving object and the eleventh moving object, a drawing result of the twelfth moving object in the tenth prediction frame.
  16. 根据权利要求15所述的方法,其特征在于,所述第十绘制帧在所述第十一绘制帧之前显示在所述电子设备的显示屏中,所述第十预测帧在所述第十一绘制帧之后显示在所述电子设备的显示屏中。The method according to claim 15, wherein the tenth drawing frame is displayed on the display screen of the electronic device before the eleventh drawing frame, and the tenth predicted frame is displayed before the tenth drawing frame. A drawn frame is then displayed on the display screen of the electronic device.
  17. 根据权利要求15或16任一项所述的方法,其特征在于,所述第十绘制帧和所述第十一绘制帧之间间隔一帧图像帧,所述第十预测帧为所述第十一绘制帧相邻的后一帧图像帧。The method according to any one of claims 15 or 16, wherein an image frame is spaced between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is the first Eleven draw the frame adjacent to the next image frame.
  18. 根据权利要求15-17任一项所述的方法,其特征在于,所述电子设备根据所述第十运动对象的第一属性和所述第十一运动对象的第二属性确定所述第十运动对象和所述第十一运动对象相匹配,具体包括:The method according to any one of claims 15-17, wherein the electronic device determines the tenth moving object according to a first attribute of the tenth moving object and a second attribute of the eleventh moving object The moving object is matched with the eleventh moving object, and specifically includes:
    所述电子设备建立第一索引表,所述第一索引表用于保存所述第十绘制帧中的运动对象和运动对象的属性,所述第一索引表包括所述第十运动对象和所述第十运动对象的属性;The electronic device establishes a first index table, and the first index table is used to save the moving object and the attributes of the moving object in the tenth drawing frame, and the first index table includes the tenth moving object and all the moving objects. Describe the properties of the tenth moving object;
    所述电子设备建立第二索引表,所述第二索引表用于保存所述第十一绘制帧中的运动对象和运动对象的属性,所述第二索引表包括所述第十一运动对象和所述第十一运动对象的属性;The electronic device establishes a second index table, the second index table is used to save the motion object and the attributes of the motion object in the eleventh drawing frame, and the second index table includes the eleventh motion object and the properties of the eleventh moving object;
    所述电子设备从第二索引表中取出所述第十一运动对象,从所述第一索引表中确定出与所述第十一运动对象相匹配的所述第十运动对象。The electronic device retrieves the eleventh moving object from the second index table, and determines the tenth moving object matching the eleventh moving object from the first index table.
  19. 根据权利要求15-18任一项所述的方法,其特征在于,所述第十运动对象和所述第十一运动对象相匹配包括:所述第十运动对象的属性与所述第十一运动对象的属性相同。The method according to any one of claims 15-18, wherein the matching of the tenth moving object with the eleventh moving object comprises: the attribute of the tenth moving object is the same as that of the eleventh moving object. Motion objects have the same properties.
  20. 根据权利要求15所述的方法,其特征在于,所述电子设备根据所述第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果,具体包括:The method according to claim 15, wherein the electronic device determines, according to the tenth moving object and the eleventh moving object, a drawing result of the twelfth moving object in the tenth prediction frame, which specifically includes: :
    所述电子设备确定所述第十运动对象的第一点的第一坐标,确定所述第十一运动对象的第二点的第二坐标;The electronic device determines a first coordinate of a first point of the tenth moving object, and determines a second coordinate of a second point of the eleventh moving object;
    所述电子设备根据所述第一坐标到所述第二坐标的位移,确定所述第十运动对象到所述第十一运动对象的第十运动向量;The electronic device determines a tenth motion vector from the tenth moving object to the eleventh moving object according to the displacement from the first coordinate to the second coordinate;
    所述电子设备根据第十运动向量和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果。The electronic device determines a drawing result of the twelfth moving object in the tenth prediction frame according to the tenth motion vector and the eleventh moving object.
  21. 根据权利要求20所述的方法,其特征在于,所述电子设备确定所述第十运动对象的第一点的第一坐标,具体包括:The method according to claim 20, wherein determining, by the electronic device, the first coordinate of the first point of the tenth moving object specifically includes:
    所述电子设备根据所述第十运动对象的所有像素点的坐标确定出第一点的第一坐标;The electronic device determines the first coordinates of the first point according to the coordinates of all pixel points of the tenth moving object;
    所述电子设备确定所述第十一运动对象的第二点的第二坐标,具体包括:The electronic device determines the second coordinate of the second point of the eleventh moving object, specifically including:
    所述电子设备根据所述第十一运动对象的所有像素点的坐标确定出第二点的第二坐标。The electronic device determines the second coordinates of the second point according to the coordinates of all pixel points of the eleventh moving object.
  22. 根据权利要求20或21任一项所述的方法,其特征在于,所述第一点为所述第十运动对象的几何中心点,所述第二点为所述第十一运动对象的几何中心点。The method according to any one of claims 20 or 21, wherein the first point is a geometric center point of the tenth moving object, and the second point is a geometric center point of the eleventh moving object center point.
  23. 根据权利要求20所述的方法,其特征在于,所述电子设备根据第十运动向量和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果,具体包括:The method according to claim 20, wherein the electronic device determines the drawing result of the twelfth moving object in the tenth predicted frame according to the tenth motion vector and the eleventh moving object, and specifically includes:
    所述电子设备根据所述第十运动向量和所述第十一运动对象的第一像素点,确定出所述第十预测帧中第十二运动对象的第二像素点。The electronic device determines, according to the tenth motion vector and the first pixel point of the eleventh moving object, the second pixel point of the twelfth moving object in the tenth predicted frame.
  24. 根据权利要求23所述的方法,其特征在于,所述电子设备根据所述第十运动向量和所述第十一运动对象的第一像素点,确定出所述第十预测帧中第十二运动对象的第二像素点, 具体包括:The method according to claim 23, wherein the electronic device determines, according to the tenth motion vector and the first pixel point of the eleventh moving object, the twelfth in the tenth predicted frame The second pixel of the moving object, specifically including:
    所述电子设备根据所述第十运动向量确定所述第十一运动对象运动到所述第十二运动对象的第十一运动向量;The electronic device determines, according to the tenth motion vector, an eleventh motion vector from the eleventh moving object to the twelfth moving object;
    所述电子设备根据第十一运动向量和所述第十一运动对象的第一像素点,确定出所述第十预测帧中所述第十二运动对象的第二像素点,所述第二像素点为所述第一像素点按照所述第十一运动向量从所述第十一绘制帧中运动到所述第十预测帧中的像素点。The electronic device determines, according to the eleventh motion vector and the first pixel of the eleventh moving object, the second pixel of the twelfth moving object in the tenth predicted frame, and the second The pixel point is a pixel point that the first pixel point moves from the eleventh drawing frame to the tenth prediction frame according to the eleventh motion vector.
  25. 根据权利要求24所述的方法,其特征在于,所述第十一运动向量为所述第十运动向量的K倍,所述K大于0且小于1。The method according to claim 24, wherein the eleventh motion vector is K times the tenth motion vector, and the K is greater than 0 and less than 1.
  26. 根据权利要求25所述的方法,其特征在于,所述K等于0.5。The method of claim 25, wherein the K is equal to 0.5.
  27. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器CPU、图形处理器GPU、存储器和显示屏;所述存储器与所述一个或多个处理器耦合;所述CPU与所述GPU耦合;其中:An electronic device, characterized in that the electronic device comprises: one or more processors (CPU), a graphics processing unit (GPU), a memory, and a display screen; the memory is coupled to the one or more processors; the CPU coupled to the GPU; wherein:
    所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;the memory for storing computer program code, the computer program code comprising computer instructions;
    所述CPU用于根据第十绘制指令在第十绘制帧中确定第十运动对象,根据第二绘制指令在第十一绘制帧中确定第十一运动对象;The CPU is configured to determine the tenth moving object in the tenth drawing frame according to the tenth drawing instruction, and determine the eleventh moving object in the eleventh drawing frame according to the second drawing instruction;
    所述GPU用于根据所述第十运动对象的属性和所述第十一运动对象的属性确定所述第十运动对象和所述第十一运动对象相匹配;根据所述第十运动对象和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果;The GPU is configured to determine that the tenth moving object and the eleventh moving object are matched according to the attributes of the tenth moving object and the eleventh moving object; The eleventh moving object, determining the drawing result of the twelfth moving object in the tenth prediction frame;
    所述显示屏用于显示所述第十绘制帧、所述第十一绘制帧、所述第十预测帧。The display screen is configured to display the tenth drawing frame, the eleventh drawing frame, and the tenth prediction frame.
  28. 根据权利要求27所述的电子设备,其特征在于,所述第十绘制帧在所述第十一绘制帧之前显示在所述显示屏中,所述第十预测帧在所述第十一绘制帧之后显示在所述显示屏中。The electronic device according to claim 27, wherein the tenth drawing frame is displayed on the display screen before the eleventh drawing frame, and the tenth predicted frame is displayed before the eleventh drawing frame The frame is then displayed in the display.
  29. 根据权利要求27或28任一项所述的电子设备,其特征在于,所述第十绘制帧和所述第十一绘制帧之间间隔一帧图像帧,所述第十预测帧为所述第十一绘制帧相邻的后一帧图像帧。The electronic device according to any one of claims 27 or 28, wherein an image frame is spaced between the tenth drawing frame and the eleventh drawing frame, and the tenth predicted frame is the The eleventh drawing frame is adjacent to the next image frame.
  30. 根据权利要求27-29任一项所述的电子设备,其特征在于,所述CPU具体用于:The electronic device according to any one of claims 27-29, wherein the CPU is specifically used for:
    建立第一索引表,所述第一索引表用于保存所述第十绘制帧中的运动对象和运动对象的属性,所述第一索引表包括所述第十运动对象和所述第十运动对象的属性;establishing a first index table, the first index table is used to save the motion object and the attributes of the motion object in the tenth drawing frame, and the first index table includes the tenth motion object and the tenth motion properties of objects;
    建立第二索引表,所述第二索引表用于保存所述第十一绘制帧中的运动对象和运动对象的属性,所述第二索引表包括所述第十一运动对象和所述第十一运动对象的属性;A second index table is established, the second index table is used to save the motion object and the attributes of the motion object in the eleventh drawing frame, and the second index table includes the eleventh motion object and the first Eleven attributes of moving objects;
    所述GPU具体用于:The GPU is specifically used for:
    从第二索引表中取出所述第十一运动对象,从所述第一索引表中确定出与所述第十一运动对象相匹配的所述第十运动对象。The eleventh moving object is retrieved from the second index table, and the tenth moving object matching the eleventh moving object is determined from the first index table.
  31. 根据权利要求27-30任一项所述的电子设备,其特征在于,所述第十运动对象和所述 第十一运动对象相匹配包括:所述第十运动对象的属性与所述第十一运动对象的属性相同。The electronic device according to any one of claims 27-30, wherein the matching of the tenth moving object with the eleventh moving object comprises: an attribute of the tenth moving object is the same as that of the tenth moving object. A moving object has the same properties.
  32. 根据权利要求31所述的电子设备,其特征在于,所述GPU具体用于:The electronic device according to claim 31, wherein the GPU is specifically used for:
    确定所述第十运动对象的第一点的第一坐标,确定所述第十一运动对象的第二点的第二坐标;determining the first coordinate of the first point of the tenth moving object, and determining the second coordinate of the second point of the eleventh moving object;
    根据所述第一坐标到所述第二坐标的位移,确定所述第十运动对象到所述第十一运动对象的第十运动向量;determining a tenth motion vector from the tenth moving object to the eleventh moving object according to the displacement from the first coordinate to the second coordinate;
    根据第十运动向量和第十一运动对象,确定出第十预测帧中的第十二运动对象的绘制结果。According to the tenth motion vector and the eleventh moving object, a drawing result of the twelfth moving object in the tenth prediction frame is determined.
  33. 根据权利要求32所述的电子设备,其特征在于,所述GPU具体用于:The electronic device according to claim 32, wherein the GPU is specifically used for:
    根据所述第十运动对象的所有像素点的坐标确定出第一点的第一坐标;Determine the first coordinates of the first point according to the coordinates of all pixel points of the tenth moving object;
    根据所述第十一运动对象的所有像素点的坐标确定出第二点的第二坐标。The second coordinate of the second point is determined according to the coordinates of all pixel points of the eleventh moving object.
  34. 根据权利要求32或33所述的电子设备,其特征在于,所述第一点为所述第十运动对象的几何中心点,所述第二点为所述第十一运动对象的几何中心点。The electronic device according to claim 32 or 33, wherein the first point is a geometric center point of the tenth moving object, and the second point is a geometric center point of the eleventh moving object .
  35. 根据权利要求32所述的电子设备,其特征在于,所述GPU具体用于:The electronic device according to claim 32, wherein the GPU is specifically used for:
    根据第十运动向量和第十一运动对象的第一像素点,确定出第十预测帧中第十二运动对象的第二像素点。According to the tenth motion vector and the first pixel point of the eleventh moving object, the second pixel point of the twelfth moving object in the tenth prediction frame is determined.
  36. 根据权利要求35所述的电子设备,其特征在于,所述GPU具体用于:The electronic device according to claim 35, wherein the GPU is specifically used for:
    根据所述第十运动向量确定所述第十一运动对象运动到所述第十二运动对象的第十一运动向量;determining an eleventh motion vector from the eleventh moving object to the twelfth moving object according to the tenth motion vector;
    根据第十一运动向量和所述第十一运动对象的第一像素点,确定出所述第十预测帧中所述第十二运动对象的第二像素点,所述第二像素点为所述第一像素点按照所述第十一运动向量从所述第十一绘制帧中运动到所述第十预测帧中的像素点。According to the eleventh motion vector and the first pixel of the eleventh moving object, the second pixel of the twelfth moving object in the tenth prediction frame is determined, and the second pixel is the The first pixel is moved from the eleventh drawing frame to the pixel in the tenth prediction frame according to the eleventh motion vector.
  37. 根据权利要求36所述的电子设备,其特征在于,所述第十一运动向量为所述第十运动向量的K倍,所述K大于0且小于1。The electronic device according to claim 36, wherein the eleventh motion vector is K times the tenth motion vector, and the K is greater than 0 and less than 1.
  38. 根据权利要求37所述的电子设备,其特征在于,所述K等于0.5。The electronic device of claim 37, wherein the K is equal to 0.5.
  39. 一种帧预测方法,其特征在于,所述方法包括:A frame prediction method, characterized in that the method comprises:
    根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从所述目标参考帧到所述预测帧的预测运动向量,其中,所述第一顶点为所述第一块中的一个顶点,所述第一块为所述目标参考帧中的一个块,所述目标参考帧为根据所述预测帧相对于第一参考帧或第二参考帧的位置,从所述第一参考帧或所述第二参考帧中确定的一个帧,所述第一参考帧和所述第二参考帧为视频流中相邻的两个帧;Determine the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, wherein the first vertex is the first vertex A vertex in a block, the first block is a block in the target reference frame, and the target reference frame is based on the position of the predicted frame relative to the first reference frame or the second reference frame, from the A frame determined in 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;
    根据所述目标参考帧中的第一顶点的坐标和所述第一顶点的预测运动向量,确定所述第 一顶点在所述预测帧中的坐标;Determine the coordinates of the first vertex in the predicted frame according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex;
    根据所述第一块的顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标,确定所述第一块在所述预测帧中的像素块;According to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame, determine the pixel block of the first block in the predicted frame;
    显示所述预测帧,其中包括所述像素块。The predicted frame is displayed including the pixel block.
  40. 根据权利要求39所述的方法,其特征在于,所述根据所述第一块的顶点在所述预测帧中的坐标,确定所述第一块在所述预测帧中的像素块,包括:The method according to claim 39, wherein the determining the pixel block of the first block in the predicted frame according to the coordinates of the vertex of the first block in the predicted frame comprises:
    根据所述第一块的顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标,得到所述第一块的像素在所述预测帧中的坐标和在所述目标参考帧中的坐标的对应关系;According to the coordinates of the vertices of the first block in the predicted frame and the coordinates in the target reference frame, obtain the coordinates of the pixels of the first block in the predicted frame and the coordinates in the target reference frame The correspondence between the coordinates in ;
    根据所述第一块的像素在所述目标参考帧中的坐标和所述对应关系,确定所述第一块中的像素在所述预测帧中的坐标。According to the coordinates of the pixels of the first block in the target reference frame and the corresponding relationship, the coordinates of the pixels in the first block in the prediction frame are determined.
  41. 根据权利要求40所述的方法,其特征在于,所述根据所述第一块的顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标,得到所述第一块的像素在所述预测帧中的坐标和在所述目标参考帧中的坐标的对应关系,包括:The method according to claim 40, wherein the pixel of the first block is obtained according to the coordinates of the vertex of the first block in the prediction frame and the coordinates in the target reference frame The correspondence between the coordinates in the predicted frame and the coordinates in the target reference frame includes:
    将所述第一块的四个顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标分别输入单应性变换公式,得到单应性方程组,所述单应性方程组包括四个方程;The coordinates of the four vertices of the first block in the prediction frame and the coordinates in the target reference frame are respectively input into the homography transformation formula to obtain a homography equation system, the homography equation system including four equations;
    求解所述单应性方程组,得到所述第一块对应的单应性变换矩阵;Solving the homography equation system to obtain the homography transformation matrix corresponding to the first block;
    根据所述第一块对应的单应性变换矩阵,得到所述第一块对应的单应性变换公式,所述第一块对应的单应性变换公式用于表示所述第一块的像素在所述预测帧中的坐标和在所述目标参考帧中的坐标的对应关系。According to the homography transformation matrix corresponding to the first block, the homography transformation formula corresponding to the first block is obtained, and the homography transformation formula corresponding to the first block is used to represent the pixels of the first block The correspondence between the coordinates in the predicted frame and the coordinates in the target reference frame.
  42. 根据权利要求41所述的方法,其特征在于,所述根据所述第一块的像素在所述目标参考帧中的坐标和所述对应关系,确定所述第一块中的像素在所述预测帧中的坐标,包括:The method according to claim 41, wherein, according to the coordinates of the pixels of the first block in the target reference frame and the corresponding relationship, it is determined that the pixels in the first block are in the Coordinates in the predicted frame, including:
    将所述第一像素在所述目标参考帧中的坐标输入所述第一块对应的单应性变换公式,得到所述第一像素在所述预测帧中的坐标,所述第一像素为所述第一块的一个像素。Input 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, where the first pixel is one pixel of the first block.
  43. 根据权利要求42所述的方法,其特征在于,所述像素块的区域包括的坐标个数大于所述第一块的在预测帧中的坐标个数,所述像素块区域由所述第一块的顶点确定,所述根据所述第一块的像素在所述目标参考帧中的坐标和所述对应关系,确定所述第一块中的像素在所述预测帧中的坐标,还包括:The method according to claim 42, wherein the number of coordinates included in the area of the pixel block is greater than the number of coordinates of the first block in the predicted frame, and the pixel block area is composed of the first block. determining the vertices of the block, and determining the coordinates of the pixels in the first block in the predicted frame according to the coordinates of the pixels in the first block in the target reference frame and the corresponding relationship, further comprising: :
    在所述像素块的区域中的坐标中剔除所述第一块的像素在预测帧中的坐标,得到第一坐标;Eliminate the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates;
    将所述第一坐标输入所述第一块对应的单应性变换公式,得到所述第一坐标在所述目标参考帧中的像素。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.
  44. 根据权利要求43所述的方法,其特征在于,在根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从所述目标参考帧到所述预测帧的预测运动向量前,所述方法还包括:The method according to claim 43, wherein the prediction of the first vertex from the target reference frame to the predicted frame is determined according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame Before the motion vector, the method further includes:
    获取所述第一参考帧和所述第二参考帧;obtaining 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 the position of the frame to be predicted;
    按照第一大小的方形块,将所述目标参考帧划分为块;dividing the target reference frame into blocks according to square blocks of the first size;
    计算所述块从所述目标参考帧到所述预测帧的运动向量。A motion vector for the block from the target reference frame to the predicted frame is calculated.
  45. 根据权利要求44所述的方法,其特征在于,在所述目标参考帧为所述第一参考帧时,所述计算所述块从所述目标参考帧到所述预测帧的运动向量,包括:The method according to claim 44, wherein when the target reference frame is the first reference frame, the calculating the motion vector of the block from the target reference frame to the prediction frame comprises: :
    获取所述第一块从所述第一参考帧到所述第二参考帧的运动向量;obtaining the motion vector of the first block from the first reference frame to the second reference frame;
    将所述第一块从所述第一参考帧到所述第二参考帧的运动向量的一半确定为所述第一块从所述目标参考帧到所述预测帧的预测运动向量。A 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 prediction frame.
  46. 根据权利要求45所述的方法,其特征在于,在所述目标参考帧为所述第二参考帧时,所述计算所述第一块从所述目标参考帧到所述预测帧的运动向量,包括:The method according to claim 45, wherein when the target reference frame is the second reference frame, the calculating a motion vector of the first block from the target reference frame to the predicted frame ,include:
    获取所述第一块从所述第二参考帧到所述第一参考帧的运动向量;obtaining the motion vector of the first block from the second reference frame to the first reference frame;
    将所述第一块从所述第二参考帧到所述第一参考帧的运动向量的负值的一半确定为所述第一块从所述目标参考帧到所述预测帧的预测运动向量。determining the negative half 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 .
  47. 根据权利要求46所述的方法,其特征在于,所述根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从所述目标参考帧到所述预测帧的预测运动向量,包括:The method according to claim 46, wherein, according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, determining the first vertex from the target reference frame to the predicted frame Predicted motion vectors, including:
    将所述第一顶点四周的块从所述目标参考帧到所述预测帧的预测运动向量的平均值确定为所述第一顶点从所述目标参考帧到所述预测帧的预测运动向量。An average value of the predicted motion vectors of the blocks around the first vertex from the target reference frame to the predicted frame is determined as the predicted motion vector of the first vertex from the target reference frame to the predicted frame.
  48. 根据权利要求47所述的方法,其特征在于,所述根据所述目标参考帧中的第一顶点的坐标和所述第一顶点的预测运动向量,确定所述第一顶点在所述预测帧中的坐标,包括:The method according to claim 47, wherein, according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex, determining that the first vertex is in the predicted frame coordinates in , including:
    将所述目标参考帧中的第一顶点的坐标和所述第一顶点的预测运动向量相加,得到所述第一顶点在所述预测帧中的坐标。The coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex are added to obtain the coordinates of the first vertex in the predicted frame.
  49. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器、存储器和显示屏;An electronic device, characterized in that the electronic device comprises: one or more processors, a memory and a display screen;
    所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器用于调用所述计算机指令以使得所述电子设备执行:The memory is coupled to the one or more processors for storing computer program code comprising computer instructions for invoking the computer instructions by the one or more processors to cause all The electronic equipment described above performs:
    根据第一顶点四周的块从目标参考帧到预测帧的预测运动向量,确定第一顶点从所述目标参考帧到所述预测帧的预测运动向量,其中,所述第一顶点为所述第一块中的一个顶点,所述第一块为所述目标参考帧中的一个块,所述目标参考帧为根据所述预测帧相对于第一参考帧或第二参考帧的位置,从所述第一参考帧或所述第二参考帧中确定的一个帧,所述第一参考帧和所述第二参考帧为视频流中相邻的两个帧;Determine the predicted motion vector of the first vertex from the target reference frame to the predicted frame according to the predicted motion vector of the blocks around the first vertex from the target reference frame to the predicted frame, wherein the first vertex is the first vertex A vertex in a block, the first block is a block in the target reference frame, and the target reference frame is based on the position of the predicted frame relative to the first reference frame or the second reference frame, from the A frame determined in 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;
    根据所述目标参考帧中的第一顶点的坐标和所述第一顶点的预测运动向量,确定所述第一顶点在所述预测帧中的坐标;Determine the coordinates of the first vertex in the predicted frame according to the coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex;
    根据所述第一块的顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标,确定所述 第一块在所述预测帧中的像素块;According to the coordinates of the vertex of the first block in the predicted frame and the coordinates in the target reference frame, determine the pixel block of the first block in the predicted frame;
    显示所述预测帧,其中包括所述像素块。The predicted frame is displayed including the pixel block.
  50. 根据权利要求49所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 49, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    根据所述第一块的顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标,得到所述第一块的像素在所述预测帧中的坐标和在所述目标参考帧中的坐标的对应关系;According to the coordinates of the vertices of the first block in the predicted frame and the coordinates in the target reference frame, obtain the coordinates of the pixels of the first block in the predicted frame and the coordinates in the target reference frame The correspondence between the coordinates in ;
    根据所述第一块的像素在所述目标参考帧中的坐标和所述对应关系,确定所述第一块中的像素在所述预测帧中的坐标。According to the coordinates of the pixels of the first block in the target reference frame and the corresponding relationship, the coordinates of the pixels in the first block in the prediction frame are determined.
  51. 根据权利要求50所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 50, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    将所述第一块的四个顶点在所述预测帧中的坐标和在所述目标参考帧中的坐标分别输入单应性变换公式,得到单应性方程组,所述单应性方程组包括四个方程;The coordinates of the four vertices of the first block in the prediction frame and the coordinates in the target reference frame are respectively input into the homography transformation formula to obtain a homography equation system, the homography equation system including four equations;
    求解所述单应性方程组,得到所述第一块对应的单应性变换矩阵;Solving the homography equation system to obtain the homography transformation matrix corresponding to the first block;
    根据所述第一块对应的单应性变换矩阵,得到所述第一块对应的单应性变换公式,所述第一块对应的单应性变换公式用于表示所述第一块的像素在所述预测帧中的坐标和在所述目标参考帧中的坐标的对应关系。According to the homography transformation matrix corresponding to the first block, the homography transformation formula corresponding to the first block is obtained, and the homography transformation formula corresponding to the first block is used to represent the pixels of the first block The correspondence between the coordinates in the predicted frame and the coordinates in the target reference frame.
  52. 根据权利要求51所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 51, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    将所述第一像素在所述目标参考帧中的坐标输入所述第一块对应的单应性变换公式,得到所述第一像素在所述预测帧中的坐标,所述第一像素为所述第一块的一个像素。Input 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, where the first pixel is one pixel of the first block.
  53. 根据权利要求52所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 52, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    在所述像素块的区域中的坐标中剔除所述第一块的像素在预测帧中的坐标,得到第一坐标;Eliminate the coordinates of the pixels of the first block in the predicted frame from the coordinates in the area of the pixel block to obtain the first coordinates;
    将所述第一坐标输入所述第一块对应的单应性变换公式,得到所述第一坐标在所述目标参考帧中的像素。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.
  54. 根据权利要求49所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 49, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    获取所述第一参考帧和所述第二参考帧;obtaining 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 the position of the frame to be predicted;
    按照第一大小的方形块,将所述目标参考帧划分为块;dividing the target reference frame into blocks according to square blocks of the first size;
    计算所述块从所述目标参考帧到所述预测帧的运动向量。A motion vector for the block from the target reference frame to the predicted frame is calculated.
  55. 根据权利要求54所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 54, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    获取所述第一块从所述第一参考帧到所述第二参考帧的运动向量;obtaining the motion vector of the first block from the first reference frame to the second reference frame;
    将所述第一块从所述第一参考帧到所述第二参考帧的运动向量的一半确定为所述第一块从所述目标参考帧到所述预测帧的预测运动向量。A 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 prediction frame.
  56. 根据权利要求54所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 54, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    获取所述第一块从所述第二参考帧到所述第一参考帧的运动向量;obtaining the motion vector of the first block from the second reference frame to the first reference frame;
    将所述第一块从所述第二参考帧到所述第一参考帧的运动向量的负值的一半确定为所述第一块从所述目标参考帧到所述预测帧的预测运动向量。determining the negative half 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 .
  57. 根据权利要求49所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 49, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    将所述第一顶点四周的块从所述目标参考帧到所述预测帧的预测运动向量的平均值确定为所述第一顶点从所述目标参考帧到所述预测帧的预测运动向量。An average value of the predicted motion vectors of the blocks around the first vertex from the target reference frame to the predicted frame is determined as the predicted motion vector of the first vertex from the target reference frame to the predicted frame.
  58. 根据权利要求49所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device of claim 49, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    将所述目标参考帧中的第一顶点的坐标和所述第一顶点的预测运动向量相加,得到所述第一顶点在所述预测帧中的坐标。The coordinates of the first vertex in the target reference frame and the predicted motion vector of the first vertex are added to obtain the coordinates of the first vertex in the predicted frame.
  59. 一种图像帧生成方法,其特征在于,所述方法包括:An image frame generation method, characterized in that the method comprises:
    根据第十一块和第十二块的深度值、所述第十一块和所述第十二块在图像帧中位置坐标,确定预测块的第十一顶点在预测图像帧中的第十位置坐标;Determine the tenth position 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 Position coordinates;
    其中,所述第十一块为第一图像帧中的一个块;所述第十二块为第二图像帧中根据匹配算法确定出的与所述第十一块匹配的块;Wherein, the eleventh block is a block in the first image frame; the twelfth block is a block in the second image frame determined according to a matching algorithm that matches the eleventh block;
    根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块;generating a prediction block according to the color data of the reference block and the tenth position coordinate, where the reference block is one of the eleventh block or the twelfth block;
    生成所述预测图像帧,所述预测图像帧包括所述预测块。The predicted image frame is generated, the predicted image frame including the predicted block.
  60. 根据权利要求59所述的方法,其特征在于,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述第一坐标系是二维坐标系,所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标,包括:The method according to claim 59, wherein the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system, and the determining the tenth position of the prediction block The tenth position coordinate of a vertex in the predicted image frame, including:
    根据所述第十一块的第一深度值和所述第十一块在所述第一坐标系下的第十二位置坐标,计算得到第二坐标系下的第十三位置坐标,所述第二坐标系为三维坐标系;According to 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 and obtained, and the The second coordinate system is a three-dimensional coordinate system;
    根据所述第十二块的第二深度值和所述第十二块在所述第一坐标系下的第十四位置坐标,计算得到所述第二坐标系下的第十五位置坐标;According to the second depth value of the twelfth block and the fourteenth position coordinate of the twelfth block under the first coordinate system, the fifteenth position coordinate under the second coordinate system is obtained by calculating;
    根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标;According to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates under the second coordinate system are obtained by calculation;
    根据所述第十六位置坐标,计算得到在所述第一坐标系下的所述第十位置坐标。According to the sixteenth position coordinate, the tenth position coordinate in the first coordinate system is obtained by calculation.
  61. 根据权利要求59或60所述的方法,其特征在于,所述生成预测块之前,所述方法还包括:The method according to claim 59 or 60, wherein before the generating the prediction block, the method further comprises:
    根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标;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, it is determined that the twelfth vertex of the predicted block is in the predicted image frame The seventeenth position coordinate in ;
    其中,所述第十三块是与所述第十一块相邻的一个块,所述第十四块是与所述第十二块相邻的一个块,所述第十三块和所述第十四块是根据所述匹配算法确定出的相互匹配的块;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 all The fourteenth block is a mutually matched block determined according to the matching algorithm;
    根据第十五块和第十六块的深度值、所述第十五块和所述第十六块在图像帧中位置坐标,确定所述预测块的第十三顶点在所述预测图像帧中的第十八位置坐标;According to the depth values of the fifteenth block and the sixteenth block, and the position coordinates of the fifteenth block and the sixteenth block in the image frame, it is determined that the thirteenth vertex of the predicted block is in the predicted image frame The eighteenth position coordinate in ;
    其中,所述第十五块是与所述第十三块相邻的一个块,所述第十六块是与所述第十四块相邻的一个块,所述第十五块和所述第十六块是根据所述匹配算法确定出的相互匹配的块;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 all The sixteenth block is a mutually matched block determined according to the matching algorithm;
    根据第十七块和第十八块的深度值、所述第十七块和所述第十八块在图像帧中位置坐标,确定所述预测块的第十四顶点在所述预测图像帧中的第十九位置坐标;According to the depth values of the seventeenth block and the eighteenth block, and the position coordinates of the seventeenth block and the eighteenth block in the image frame, it is determined that the fourteenth vertex of the predicted block is in the predicted image frame The nineteenth position coordinates in ;
    其中,所述第十七块是与所述第十一块和所述第十五块均相邻的一个块,所述第十八块是与所述第十二块和所述第十六块均相邻的一个块,所述第十七块和所述第十八块是根据所述匹配算法确定出的相互匹配的块。The seventeenth block is a block adjacent to the eleventh block and the fifteenth block, and the eighteenth block is adjacent to the twelfth block and the sixteenth block. The blocks are all adjacent blocks, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.
  62. 根据权利要求61所述的方法,其特征在于,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标,包括:The method according to claim 61, wherein the position coordinates in the image frame are the position coordinates in the first coordinate system, the depth values of the thirteenth block and the fourteenth block, the tenth The position coordinates of the three blocks and the fourteenth block in the image frame, and determining the seventeenth position coordinates of the twelfth vertex of the predicted block in the predicted image frame, including:
    根据所述第十三块的第三深度值和所述第十三块在所述第一坐标系下的第二十位置坐标,计算得到第二坐标系下的第二十一位置坐标,所述第二坐标系为三维坐标系;According to the third depth value of the thirteenth block and the twentieth position coordinate of the thirteenth block under the first coordinate system, the twenty-first position coordinate under the second coordinate system is calculated, so The second coordinate system is a three-dimensional coordinate system;
    根据所述第十四块的第二深度值和所述第十四块在所述第一坐标系下的第第二十二位置坐标,计算得到所述第二坐标系下的第二十三位置坐标;According to the second depth value of the fourteenth block and the twenty-second position coordinate of the fourteenth block in the first coordinate system, the twenty-third position in the second coordinate system is obtained by calculation Position coordinates;
    根据所述第二十一位置坐标和所述第二十三位置坐标,计算得到在所述第二坐标系下的第二十四位置坐标;According to the twenty-first position coordinate and the twenty-third position coordinate, calculate the twenty-fourth position coordinate under the second coordinate system;
    根据所述第二十四位置坐标,计算得到在所述第一坐标系下的所述第十七位置坐标。According to the twenty-fourth position coordinate, the seventeenth position coordinate in the first coordinate system is obtained by calculation.
  63. 根据权利要求61或62所述的方法,其特征在于,所述根据参考块的颜色数据和所述第十位置坐标,生成预测块,包括:The method according to claim 61 or 62, wherein the generating the prediction block according to the color data of the reference block and the tenth position coordinate comprises:
    确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系;determining the correspondence between the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate and the position coordinates of the four vertices in the reference block respectively;
    根据所述对应关系和所述参考块的所述颜色数据生成所述预测块。The prediction block is generated according to the correspondence and the color data of the reference block.
  64. 根据权利要求63所述的方法,其特征在于,所述颜色数据中包括所述参考块中每个像素的颜色数据,所述根据所述对应关系和所述参考块的所述颜色数据生成所述预测块,包括:The method according to claim 63, wherein the color data includes color data of each pixel in the reference block, and the generated color data is generated according to the corresponding relationship and the color data of the reference block. The prediction block described above includes:
    根据所述对应关系生成单应性变换公式;generating a homography transformation formula according to the corresponding relationship;
    根据所述单应性变换公式和所述每个像素在所述参考图像帧中的位置坐标,确定出所述每个像素在所述预测图像帧中的位置坐标;According to the homography transformation formula and the position coordinates of each pixel in the reference image frame, determine the position coordinates of each pixel in the predicted image frame;
    根据所述每个像素的颜色数据和所述每个限速在所述预测图像帧中的位置坐标生成所述 预测块。The prediction block is generated based on the color data of each pixel and the position coordinates of each speed limit in the predicted image frame.
  65. 根据权利要求63或64所述的方法,其特征在于,所述参考块包括:第十五顶点,第十六顶点,第十七顶点和第十八顶点,所述确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系,包括:The method according to claim 63 or 64, wherein the reference block comprises: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and the determining the tenth position coordinate , the correspondence between the seventeenth position coordinates, the eighteenth position coordinates and the nineteenth position coordinates respectively and the position coordinates of the four vertices in the reference block, including:
    确定所述第十位置坐标与所述第十五顶点的位置坐标为一组对应的位置坐标;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 coordinates and the position coordinates of the sixteenth vertex are a set of corresponding position vertices;
    确定所述第十八位置坐标与所述第十七顶点的位置坐标为一组对应的位置坐标;determining that the eighteenth position coordinates and the position coordinates of the seventeenth vertex are a set of corresponding position coordinates;
    确定所述第十九位置坐标与所述第十八顶点的位置坐标为一组对应的位置坐标;determining that the nineteenth position coordinates and the position coordinates of the eighteenth vertex are a set of corresponding position coordinates;
    其中,所述参考块为四边形,所述第十五顶点相对于所述参考块的中心点的位置方向与所述第十一块相对于所述第十五块的位置方向相同;所述第十六顶点相对于所述参考块的中心点的位置方向与所述第十三块相对于所述第十七块的位置方向相同;所述第十七顶点相对于所述参考块的中心点的位置方向与所述第十五块相对于所述第十一块的位置方向相同;所述第十八顶点相对于所述参考块的中心点的位置方向与所述第十七块相对于所述第十三块的位置方向相同。The reference block is a quadrilateral, and 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 sixteen vertices 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 seventeenth vertex relative to the center point of the reference block The position direction is the same as the position direction of the fifteenth block relative to the eleventh block; the position direction of the eighteenth vertex relative to the center point of the reference block is the same as that of the seventeenth block relative to The positions and directions of the thirteenth blocks are the same.
  66. 根据权利要求60所述的方法,其特征在于,所述根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标,包括:The method according to claim 60, wherein, calculating the sixteenth position coordinates in the second coordinate system according to the thirteenth position coordinates and the fifteenth position coordinates, comprising: :
    计算所述第十三位置坐标至所述第十五位置坐标的位移向量,得到第一位移向量;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 according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale.
  67. 根据权利要求66所述的方法,其特征在于,所述第一比例等于预设置的数值。The method of claim 66, wherein the first ratio is equal to a preset value.
  68. 根据权利要求66所述的方法,其特征在于,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述计算得到所述第十六位置坐标之前,所述方法还包括:The method according to claim 66, wherein the image frame where the reference block is located is a reference image frame, the first image frame is located before the second image frame in the data stream, and the calculated Before the sixteenth position coordinates, the method further includes:
    确定所述第一比例等于第一时间差值的绝对值与第二时间差值的绝对值的比值;determining that the first ratio is equal to the ratio of the absolute value of the first time difference to the absolute value of the second time difference;
    所述第一时间差值等于所述预测图像帧在数据流中的时间点与参考帧在所述数据流中的时间点之间的差值;The first time difference value 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 value 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.
  69. 根据权利要求66所述的方法,其特征在于,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述计算得到所述第十六位置坐标之前,所述方法还包括:The method according to claim 66, wherein the image frame where the reference block is located is a reference image frame, the first image frame is located before the second image frame in the data stream, and the calculated Before the sixteenth position coordinates, the method further includes:
    确定所述第一比例等于第一数值与第二数值的比值;determining that the first ratio is equal to the ratio of the first numerical value to the second numerical value;
    所述第一数值等于第一数量加一;所述第二数值等于第二数量加一;The first value is equal to the first amount plus one; the second value is equal to the second amount plus one;
    所述第一数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧 的数量;所述第二数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量。the first number is equal to the number of image frames spaced between the reference image frame and the predicted image frame in the data stream; the second number is equal to the reference image frame and the predicted image frame in the data stream The number of image frames spaced between the predicted image frames.
  70. 根据权利要求68或69所述的方法,其特征在于,所述根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标,包括:The method according to claim 68 or 69, wherein the first displacement vector is calculated according to the thirteenth position coordinate or the fifteenth position coordinate and the first displacement vector of a first scale to obtain the first Sixteen location coordinates, including:
    若所述参考图像帧为所述第一图像帧,则根据所述第十三位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标;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 scale;
    若所述参考图像帧为所述第二图像帧,则根据所述第十五位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标。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 scale.
  71. 根据权利要求59-70任一项所述的方法,其特征在于,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标之前,所述方法还包括:The method according to any one of claims 59-70, wherein the image frame where the reference block is located is a reference image frame, and the first image frame is located before the second image frame in the data stream, The determining that the eleventh vertex of the predicted block is before the tenth position coordinate in the predicted 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 another image frame other than the reference image frame in the first image frame and the second image frame is a matching image frame;
    针对所述参考图像帧进行块的划分,得到所述参考块;Perform block division for the reference image frame to obtain the reference block;
    根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块;其中,若所述参考块为所述第十一块,则所述匹配块为所述第十二块;若所述参考块为所述第十二块,则所述匹配块为所述第十一块。It is determined according to the matching algorithm that the block matched with the reference block in the matched image frame is the matching block; wherein, if the reference block is the eleventh block, the matching block is the twelfth block block; if the reference block is the twelfth block, the matching block is the eleventh block.
  72. 根据权利要求71所述的方法,其特征在于,所述根据所述匹配算法确定所述匹配图像帧中与所述参考块匹配的块为匹配块,包括:The method according to claim 71, wherein the determining according to the matching algorithm that the block matched with the reference block in the matching image frame is a matching block, comprising:
    确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块;所述第一区域是所述匹配图像帧中以参考位置坐标为中心,第一面积的预设形状的区域,所述参考位置坐标是所述参考块在所述参考图像帧中的位置坐标。Determine the block with the highest similarity with the reference block in the first area of the matching image frame as the matching block; the first area is the first area in the matching image frame with the reference position coordinate as the center, the first area An area with a preset shape, and the reference position coordinates are the position coordinates of the reference block in the reference image frame.
  73. 根据权利要求72所述的方法,其特征在于,所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述方法还包括:The method according to claim 72, wherein, before the determining that the block with the highest similarity to the reference block in the first region of the matching image frame is the matching block, the method further comprises:
    根据所述参考块的参考深度值计算得到所述第一面积,其中,所述参考深度值越大,计算得到的所述第一面积越小。The first area is obtained by calculation according to the reference depth value of the reference block, wherein the larger the reference depth value is, the smaller the first area obtained by calculation is.
  74. 根据权利要求72所述的方法,其特征在于,所述确定所述匹配图像帧的第一区域内与所述参考块相似度最高的块为所述匹配块之前,所述方法还包括:The method according to claim 72, wherein, before the determining that the block with the highest similarity to the reference block in the first region of the matching image frame is the matching block, the method further comprises:
    若所述参考块的参考深度值大于等于第一阈值,确定所述第一面积等于第一预设面积;If the reference depth value of the reference block is greater than or equal to a first threshold, determining that the first area is equal to a first preset area;
    若所述参考深度值大于第二阈值且小于所述第一阈值,根据所述参考深度值计算得到所述第一面积,其中,所述参考深度值越大,所述第一面积越小;If the reference depth value is greater than the second threshold value and smaller than the first threshold value, the first area is calculated according to the reference depth value, wherein the larger 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, determining that the first area is equal to a second preset area;
    其中,所述第一阈值大于所述第二阈值,所述第二预设面积大于所述第一预设面积。The first threshold is greater than the second threshold, and the second preset area is greater than the first preset area.
  75. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:An electronic device, characterized in that the electronic device comprises: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used for storing computer program codes, the The computer program code includes computer instructions invoked by the one or more processors to cause the electronic device to perform:
    根据第十一块和第十二块的深度值、所述第十一块和所述第十二块在图像帧中位置坐标,确定预测块的第十一顶点在预测图像帧中的第十位置坐标;Determine the tenth position 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 Position coordinates;
    其中,所述第十一块为第一图像帧中的一个块;所述第十二块为第二图像帧中根据匹配算法确定出的与所述第十一块匹配的块;Wherein, the eleventh block is a block in the first image frame; the twelfth block is a block in the second image frame determined according to a matching algorithm that matches the eleventh block;
    根据参考块的颜色数据和所述第十位置坐标,生成预测块,所述参考块为所述第十一块或所述第十二块中的一个块;generating a prediction block according to the color data of the reference block and the tenth position coordinate, where the reference block is one of the eleventh block or the twelfth block;
    生成所述预测图像帧,所述预测图像帧包括所述预测块。The predicted image frame is generated, the predicted image frame including the predicted block.
  76. 根据权利要求75所述的电子设备,其特征在于,图像帧中的位置坐标为在第一坐标系下的位置坐标,所述第一坐标系是二维坐标系,在所述确定预测块的第十一顶点在预测图像帧中的第十位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 75, wherein the position coordinates in the image frame are the position coordinates in a first coordinate system, and the first coordinate system is a two-dimensional coordinate system, and the position coordinates in the determined prediction block are In terms of predicting the tenth position coordinate of the eleventh vertex in the image frame, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute:
    根据所述第十一块的第一深度值和所述第十一块在所述第一坐标系下的第十二位置坐标,计算得到第二坐标系下的第十三位置坐标,所述第二坐标系为三维坐标系;According to 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 and obtained, and the The second coordinate system is a three-dimensional coordinate system;
    根据所述第十二块的第二深度值和所述第十二块在所述第一坐标系下的第十四位置坐标,计算得到所述第二坐标系下的第十五位置坐标;According to the second depth value of the twelfth block and the fourteenth position coordinate of the twelfth block under the first coordinate system, the fifteenth position coordinate under the second coordinate system is obtained by calculating;
    根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标;According to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates under the second coordinate system are obtained by calculation;
    根据所述第十六位置坐标,计算得到在所述第一坐标系下的所述第十位置坐标。According to the sixteenth position coordinate, the tenth position coordinate in the first coordinate system is obtained by calculation.
  77. 根据权利要求75或76所述的电子设备,其特征在于,在所述生成预测块之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 75 or 76, wherein before the generating the prediction block, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标;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, it is determined that the twelfth vertex of the predicted block is in the predicted image frame The seventeenth position coordinate in ;
    其中,所述第十三块是与所述第十一块相邻的一个块,所述第十四块是与所述第十二块相邻的一个块,所述第十三块和所述第十四块是根据所述匹配算法确定出的相互匹配的块;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 all The fourteenth block is a mutually matched block determined according to the matching algorithm;
    根据第十五块和第十六块的深度值、所述第十五块和所述第十六块在图像帧中位置坐标,确定所述预测块的第十三顶点在所述预测图像帧中的第十八位置坐标;According to the depth values of the fifteenth block and the sixteenth block, and the position coordinates of the fifteenth block and the sixteenth block in the image frame, it is determined that the thirteenth vertex of the predicted block is in the predicted image frame The eighteenth position coordinate in ;
    其中,所述第十五块是与所述第十三块相邻的一个块,所述第十六块是与所述第十四块相邻的一个块,所述第十五块和所述第十六块是根据所述匹配算法确定出的相互匹配的块;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 all The sixteenth block is a mutually matched block determined according to the matching algorithm;
    根据第十七块和第十八块的深度值、所述第十七块和所述第十八块在图像帧中位置坐标,确定所述预测块的第十四顶点在所述预测图像帧中的第十九位置坐标;According to the depth values of the seventeenth block and the eighteenth block, and the position coordinates of the seventeenth block and the eighteenth block in the image frame, it is determined that the fourteenth vertex of the predicted block is in the predicted image frame The nineteenth position coordinates in ;
    其中,所述第十七块是与所述第十一块和所述第十五块均相邻的一个块,所述第十八块是与所述第十二块和所述第十六块均相邻的一个块,所述第十七块和所述第十八块是根据所述匹配算法确定出的相互匹配的块。The seventeenth block is a block adjacent to the eleventh block and the fifteenth block, and the eighteenth block is adjacent to the twelfth block and the sixteenth block. The blocks are all adjacent blocks, and the seventeenth block and the eighteenth block are mutually matched blocks determined according to the matching algorithm.
  78. 根据权利要求77所述的电子设备,其特征在于,图像帧中的位置坐标为在第一坐标系下的位置坐标,在所述根据第十三块和第十四块的深度值、所述第十三块和所述第十四块在图像帧中位置坐标,确定所述预测块的第十二顶点在所述预测图像帧中的第十七位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 77, wherein the position coordinates in the image frame are the position coordinates in the first coordinate system, and in the depth value according to the thirteenth block and the fourteenth block, the The location coordinates of the thirteenth block and the fourteenth block in the image frame, determining the seventeenth location coordinates of the twelfth vertex of the predicted block in the predicted image frame, the one or more processing a device, specifically for invoking the computer instructions to cause the electronic device to execute:
    根据所述第十三块的第三深度值和所述第十三块在所述第一坐标系下的第二十位置坐标,计算得到第二坐标系下的第二十一位置坐标,所述第二坐标系为三维坐标系;According to the third depth value of the thirteenth block and the twentieth position coordinate of the thirteenth block under the first coordinate system, the twenty-first position coordinate under the second coordinate system is calculated, so The second coordinate system is a three-dimensional coordinate system;
    根据所述第十四块的第二深度值和所述第十四块在所述第一坐标系下的第第二十二位置坐标,计算得到所述第二坐标系下的第二十三位置坐标;According to the second depth value of the fourteenth block and the twenty-second position coordinate of the fourteenth block in the first coordinate system, the twenty-third position in the second coordinate system is obtained by calculation Position coordinates;
    根据所述第二十一位置坐标和所述第二十三位置坐标,计算得到在所述第二坐标系下的第二十四位置坐标;According to the twenty-first position coordinate and the twenty-third position coordinate, calculate the twenty-fourth position coordinate under the second coordinate system;
    根据所述第二十四位置坐标,计算得到在所述第一坐标系下的所述第十七位置坐标。According to the twenty-fourth position coordinate, the seventeenth position coordinate in the first coordinate system is obtained by calculation.
  79. 根据权利要求77或78所述的电子设备,其特征在于,在所述根据参考块的颜色数据和所述第十位置坐标,生成预测块方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 77 or 78, wherein, 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 The computer instructions are invoked to cause the electronic device to perform:
    确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系;determining the correspondence between the tenth position coordinate, the seventeenth position coordinate, the eighteenth position coordinate and the nineteenth position coordinate and the position coordinates of the four vertices in the reference block respectively;
    根据所述对应关系和所述参考块的所述颜色数据生成所述预测块。The prediction block is generated according to the correspondence and the color data of the reference block.
  80. 根据权利要求79所述的电子设备,其特征在于,在所述颜色数据中包括所述参考块中每个像素的颜色数据,所述根据所述对应关系和所述参考块的所述颜色数据生成所述预测块方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 79, wherein the color data includes color data of each pixel in the reference block, the color data according to the corresponding relationship and the color data of the reference block In terms of generating the prediction block, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute:
    根据所述对应关系生成单应性变换公式;generating a homography transformation formula according to the corresponding relationship;
    根据所述单应性变换公式和所述每个像素在所述参考图像帧中的位置坐标,确定出所述每个像素在所述预测图像帧中的位置坐标;According to the homography transformation formula and the position coordinates of each pixel in the reference image frame, determine the position coordinates of each pixel in the predicted image frame;
    根据所述每个像素的颜色数据和所述每个限速在所述预测图像帧中的位置坐标生成所述预测块。The prediction block is generated according to the color data of each pixel and the position coordinates of each speed limit in the predicted image frame.
  81. 根据权利要求79或80所述的电子设备,其特征在于,所述参考块包括:第十五顶点,第十六顶点,第十七顶点和第十八顶点,在所述确定所述第十位置坐标、所述第十七位置坐标、所述第十八位置坐标和所述第十九位置坐标分别与参考块中四个顶点的位置坐标的对应关系方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 79 or 80, wherein the reference block comprises: a fifteenth vertex, a sixteenth vertex, a seventeenth vertex and an eighteenth vertex, and in the determining of the tenth vertex In terms of the correspondence between the position coordinates, the seventeenth position coordinates, the eighteenth position coordinates, and the nineteenth position coordinates, respectively, and the position coordinates of the four vertices in the reference block, the one or more processors , specifically for invoking the computer instructions to cause the electronic device to execute:
    确定所述第十位置坐标与所述第十五顶点的位置坐标为一组对应的位置坐标;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 coordinates and the position coordinates of the sixteenth vertex are a set of corresponding position vertices;
    确定所述第十八位置坐标与所述第十七顶点的位置坐标为一组对应的位置坐标;determining that the eighteenth position coordinates and the position coordinates of the seventeenth vertex are a set of corresponding position coordinates;
    确定所述第十九位置坐标与所述第十八顶点的位置坐标为一组对应的位置坐标;determining that the nineteenth position coordinates and the position coordinates of the eighteenth vertex are a set of corresponding position coordinates;
    其中,所述参考块为四边形,所述第十五顶点相对于所述参考块的中心点的位置方向与所述第十一块相对于所述第十五块的位置方向相同;所述第十六顶点相对于所述参考块的中心点的位置方向与所述第十三块相对于所述第十七块的位置方向相同;所述第十七顶点相对于所述参考块的中心点的位置方向与所述第十五块相对于所述第十一块的位置方向相同;所 述第十八顶点相对于所述参考块的中心点的位置方向与所述第十七块相对于所述第十三块的位置方向相同。The reference block is a quadrilateral, and 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 sixteen vertices 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 seventeenth vertex relative to the center point of the reference block The position direction is the same as the position direction of the fifteenth block relative to the eleventh block; the position direction of the eighteenth vertex relative to the center point of the reference block is the same as that of the seventeenth block relative to The positions and directions of the thirteenth blocks are the same.
  82. 根据权利要求76所述的电子设备,其特征在于,在所述根据所述第十三位置坐标和所述第十五位置坐标,计算得到在所述第二坐标系下的第十六位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 76, wherein, in the calculation according to the thirteenth position coordinates and the fifteenth position coordinates, the sixteenth position coordinates in the second coordinate system are obtained by calculation In one aspect, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute:
    计算所述第十三位置坐标至所述第十五位置坐标的位移向量,得到第一位移向量;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 according to the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale.
  83. 根据权利要求82所述的电子设备,其特征在于,所述第一比例等于预设置的数值。The electronic device according to claim 82, wherein the first ratio is equal to a preset value.
  84. 根据权利要求82所述的电子设备,其特征在于,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,在所述计算得到所述第十六位置坐标之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 82, wherein 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 the data stream, and before the calculation Before obtaining the sixteenth position coordinates, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    确定所述第一比例等于第一时间差值的绝对值与第二时间差值的绝对值的比值;determining that the first ratio is equal to the ratio of the absolute value of the first time difference to the absolute value of the second time difference;
    所述第一时间差值等于所述预测图像帧在数据流中的时间点与参考帧在所述数据流中的时间点之间的差值;The first time difference value 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 value 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.
  85. 根据权利要求82所述的电子设备,其特征在于,所述参考块所在的图像帧为参考图像帧,所述第一图像帧在数据流中位于所述第二图像帧之前,在所述计算得到所述第十六位置坐标之前,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 82, wherein 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 the data stream, and before the calculation Before obtaining the sixteenth position coordinates, the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    确定所述第一比例等于第一数值与第二数值的比值;determining that the first ratio is equal to the ratio of the first numerical value to the second numerical value;
    所述第一数值等于第一数量加一;所述第二数值等于第二数量加一;The first value is equal to the first amount plus one; the second value is equal to the second amount plus one;
    所述第一数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量;所述第二数量等于在所述数据流中所述参考图像帧和所述预测图像帧之间间隔的图像帧的数量。the first number is equal to the number of image frames spaced between the reference image frame and the predicted image frame in the data stream; the second number is equal to the reference image frame and the predicted image frame in the data stream The number of image frames spaced between the predicted image frames.
  86. 根据权利要求81或82所述的电子设备,其特征在于,在所述根据所述第十三位置坐标或所述第十五位置坐标,和第一比例的所述第一位移向量计算得到所述第十六位置坐标方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 81 or 82, characterized in that, in the calculation based on the thirteenth position coordinate or the fifteenth position coordinate, and the first displacement vector of the first scale, the obtained In the sixteenth position coordinate aspect, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute:
    若所述参考图像帧为所述第一图像帧,则根据所述第十三位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标;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 scale;
    若所述参考图像帧为所述第二图像帧,则根据所述第十五位置坐标和所述第一比例的所述第一位移向量计算得到所述第十六位置坐标。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 scale.
  87. 一种图像帧的生成方法,其特征在于,应用于电子设备,所述方法包括:A method for generating an image frame, characterized in that, applied to an electronic device, the method comprising:
    在第一绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当所述绘制指令满足第二条件时,将所 述绘制结果存入第八存储空间,作为第二绘制结果;During the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the first drawing result, and when the drawing instruction satisfies the second condition When conditions are met, the drawing result is stored in the eighth storage space as the second drawing result;
    根据所述第一绘制结果和所述第二绘制结果生成第七图像帧;generating a seventh image frame according to the first rendering result and the second rendering result;
    在第二绘制周期时,根据所述目标应用程序的绘制指令,当所述绘制指令满足所述第一条件时,将绘制结果存入所述第七存储空间,作为第三绘制结果,当所述绘制指令满足所述第二条件时,不进行绘制;During the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the third drawing result. When the drawing instruction satisfies the second condition, no drawing is performed;
    根据所述第三绘制结果和所述第二绘制结果生成第八图像帧。An eighth image frame is generated according to the third rendering result and the second rendering result.
  88. 根据权利要求87所述的方法,其特征在于,所述方法还包括:The method of claim 87, wherein the method further comprises:
    在第三绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入所述第七存储空间中,作为第四绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入所述第八存储空间,作为第五绘制结果,所述第三绘制周期位于所述第一绘制周期之后;In the third drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the fourth drawing result, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space. When the second condition is met, the drawing result is stored in the eighth storage space as a fifth drawing result, and the third drawing cycle is located after the first drawing cycle;
    根据所述第四绘制结果和所述第五绘制结果生成第九图像帧;generating a ninth image frame according to the fourth rendering result and the fifth rendering result;
    在第四绘制周期时,根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果;During the fourth drawing cycle, generating a sixth drawing result according to the first drawing result and the fourth drawing result;
    根据第六绘制结果和所述第七绘制结果生成第十图像帧;所述第七绘制结果为在第五绘制周期中,所述目标应用程序的绘制指令满足所述第二条件时得到的绘制结果,所述第五绘制周期在所述第四绘制周期之前。The tenth image frame is generated according to the sixth drawing result and the seventh drawing result; the seventh drawing result is the drawing obtained when the drawing instruction of the target application satisfies the second condition in the fifth drawing cycle As a result, the fifth drawing cycle precedes the fourth drawing cycle.
  89. 根据权利要求88所述的方法,其特征在于,所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧,包括:The method according to claim 88, wherein the generating a seventh image frame according to the first rendering result and the second rendering result comprises:
    将所述第一绘制结果和所述第二绘制结果存入第九存储空间中;The first drawing result and the second drawing result are stored in the ninth storage space;
    在所述第九存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。The seventh image frame is generated in the ninth storage space according to the first rendering result and the second rendering result.
  90. 根据权利要求89所述的方法,其特征在于,所述根据所述第四绘制结果和所述第五绘制结果生成第九图像帧,包括:The method according to claim 89, wherein the generating a ninth image frame according to the fourth rendering result and the fifth rendering result comprises:
    将所述第四绘制结果和所述第五绘制结果存入所述第九存储空间;storing the fourth drawing result and the fifth drawing result into the ninth storage space;
    在所述第九存储空间中根据所述第四绘制结果和所述第五绘制结果生成所述第九图像帧。The ninth image frame is generated in the ninth storage space according to the fourth rendering result and the fifth rendering result.
  91. 根据权利要求88或89所述的方法,其特征在于,所述根据第六绘制结果和所述第七绘制结果生成第十图像帧,包括:The method according to claim 88 or 89, wherein the generating the tenth image frame according to the sixth drawing result and the seventh drawing result comprises:
    将所述第六绘制结果和所述第七绘制结果存入所述第九存储空间;storing the sixth drawing result and the seventh drawing result into the ninth storage space;
    在所述第九存储空间中根据所述第六绘制结果和所述第七绘制结果生成所述第十图像帧。The tenth image frame is generated in the ninth storage space according to the sixth rendering result and the seventh rendering result.
  92. 根据权利要求88-91任一项所述的方法,其特征在于,所述第七存储空间由第十存储空间和第十一存储空间构成,所述第一绘制结果存储在所述第十存储空间中,所述第四绘制结果存储在所述第十一存储空间中,所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果,包括:The method according to any one of claims 88 to 91, wherein the seventh storage space is composed of a tenth storage space and an eleventh storage space, and the first drawing result is stored in the tenth storage space space, the fourth drawing result is stored in the eleventh storage space, and the generating a sixth drawing result according to the first drawing result and the fourth drawing result includes:
    将所述第一绘制结果存入所述第十一存储空间中;storing the first drawing result in the eleventh storage space;
    在所述第十一存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。The sixth drawing result is generated in the eleventh storage space according to the first drawing result and the fourth drawing result.
  93. 根据权利要求88-91任一项所述的方法,其特征在于,所述第七存储空间由至少三个存储空间构成,所述至少三个存储空间包括第十存储空间,第十一存储空间和第十二存储空间;所述第一绘制结果存储在第十存储空间中,所述第四绘制结果存储在第十一存储空间中,所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果,包括:The method according to any one of claims 88 to 91, wherein the seventh storage space is composed of at least three storage spaces, and the at least three storage spaces include a tenth storage space and an eleventh storage space and the 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 first drawing result and the fourth drawing result are stored in the eleventh storage space. The drawing result generates a sixth drawing result, including:
    将所述第一绘制结果和所述第四绘制结果存入第十二存储空间;storing the first drawing result and the fourth drawing result in the twelfth storage space;
    在所述第十二存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。The sixth drawing result is generated in the twelfth storage space according to the first drawing result and the fourth drawing result.
  94. 根据权利要求88-93任一项所述的方法,其特征在于,所述第三绘制周期与所述第四绘制周期相邻;所述第五绘制周期与所述第三绘制周期为同一绘制周期,所述第五绘制结果和所述第七绘制结果为同一绘制结果。The method according to any one of claims 88 to 93, wherein the third drawing period is adjacent to the fourth drawing period; the fifth drawing period and the third drawing period are the same drawing period period, the fifth drawing result and the seventh drawing result are the same drawing result.
  95. 根据权利要求87所述的方法,其特征在于,所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧,包括:The method according to claim 87, wherein the generating a seventh image frame according to the first rendering result and the second rendering result comprises:
    将所述第二绘制结果存入所述第七存储空间中;storing the second drawing result in the seventh storage space;
    在所述第七存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。The seventh image frame is generated in the seventh storage space according to the first rendering result and the second rendering result.
  96. 根据权利要求88-95任一项所述的方法,其特征在于,所述电子设备包括计数单元;所述计数单元的初始化数值为第一数值,所述计数单元的数值每更新一次在第一数值和第二数值之间切换一次;所述计数单元在绘制周期开始的时刻进行更新;The method according to any one of claims 88-95, wherein the electronic device comprises a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated at the first value every time Switch between the numerical value and the second numerical value once; the counting unit is updated at the moment when the drawing cycle starts;
    在一个绘制周期中,During a drawing cycle,
    若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;If the updated value of the counting unit is the second value, the eighth storage space is emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing result is stored in the first Eight storage spaces;
    若更新后的所述计数单元的数值为第一数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。If the updated value of the counting unit is the first value, the second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed.
  97. 根据权利要求87所述的方法,其特征在于,所述方法还包括:The method of claim 87, wherein the method further comprises:
    在第三绘制周期时,根据所述第一绘制结果和所述第三绘制结果生成第四绘制结果;During the third drawing cycle, generating a fourth drawing result according to the first drawing result and the third drawing result;
    根据所述第二绘制结果和所述第四绘制结果生成第九图像帧。A ninth image frame is generated according to the second rendering result and the fourth rendering result.
  98. 根据权利要求97所述的方法,其特征在于,所述电子设备包括计数单元,所述计数单元的初始化数值为第一数值,所述计数单元按照第一数值,第二数值,第三数值的顺序在三个数值间进行重复的更新切换,所述计数单元在绘制周期开始的时刻进行更新,The method according to claim 97, wherein the electronic device comprises a counting unit, the initialization value of the counting unit is a first value, and the counting unit is based on the first value, the second value, and the third value. The sequence performs repeated update switching among the three values, and the counting unit is updated at the moment when the drawing cycle starts,
    在一个绘制周期中,During a drawing cycle,
    若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;If the updated value of the counting unit is the second value, the eighth storage space is emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing result is stored in the first Eight storage spaces;
    若更新后的所述计数单元的数值为第一数值或第三数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。If the updated value of the counting unit is the first value or the third value, the second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not executed .
  99. 根据权利要求87-98任一项所述的方法,其特征在于,所述第九存储空间由至少两个存储空间构成,所述至少两个存储空间在目标应用程序运行时根据所述目标应用程序的第一指令在第一状态和第二状态之间进行轮换;在同一时间点,所述至少两个存储空间中仅有一个存储空间处于所述第一状态,其余的所述存储空间处于所述第二状态;所述至少两个存储空间处于所述第一状态时,所述至少两个存储空间中的图像帧可传输至显示设备显示;所述至少两个存储空间处于所述第二状态时,所述电子设备可在所述至少两个存储空间中进行绘制;相邻的两个绘制周期生成的两帧图像帧分别存储在所述第九存储空间中的两个不同的存储空间中。The method according to any one of claims 87 to 98, wherein the ninth storage space is composed of at least two storage spaces, and the at least two storage spaces are based on the target application when the target application is running. The first instruction of the program alternates between the first state and the second state; 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 first state. 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 a display device for display; the at least two storage spaces are in the first state; In two states, the electronic device can draw in the at least two storage spaces; two image frames generated in two adjacent drawing cycles are stored in two different storage spaces in the ninth storage space, respectively. in space.
  100. 根据权利要求86-99任一项所述的方法,其特征在于,The method according to any one of claims 86-99, wherein,
    所述第一条件为:绘制指令中包含启用深度测试的指令;The first condition is: the drawing instruction includes an instruction for enabling depth testing;
    所述第二条件为:绘制指令中包含关闭深度测试的指令。The second condition is: the drawing instruction includes an instruction to close the depth test.
  101. 根据权利要求86-100任一项所述的方法,其特征在于,任意两个相邻的绘制周期的时间节点为所述目标应用程序调用第二指令的时间点。The method according to any one of claims 86-100, wherein the time node of any two adjacent drawing cycles is the time point when the target application invokes the second instruction.
  102. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;An electronic device, characterized in that the electronic device comprises: one or more processors and a memory;
    所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行:The memory is coupled to the one or more processors for storing computer program code, the computer program code comprising computer instructions that the one or more processors invoke to cause the Electronic equipment performs:
    在第一绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入第七存储空间,作为第一绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入第八存储空间,作为第二绘制结果;During the first drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the first drawing result, and when the drawing instruction satisfies the second condition When conditions are met, the drawing result is stored in the eighth storage space as the second drawing result;
    根据所述第一绘制结果和所述第二绘制结果生成第七图像帧;generating a seventh image frame according to the first rendering result and the second rendering result;
    在第二绘制周期时,根据所述目标应用程序的绘制指令,当所述绘制指令满足所述第一条件时,将绘制结果存入所述第七存储空间,作为第三绘制结果,当所述绘制指令满足所述第二条件时,不进行绘制;During the second drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the third drawing result. When the drawing instruction satisfies the second condition, no drawing is performed;
    根据所述第三绘制结果和所述第二绘制结果生成第八图像帧。An eighth image frame is generated according to the third rendering result and the second rendering result.
  103. 根据权利要求102所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 102, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    在第三绘制周期时,根据目标应用程序的绘制指令,当所述绘制指令满足第一条件时,将绘制结果存入所述第七存储空间中,作为第四绘制结果,当所述绘制指令满足第二条件时,将所述绘制结果存入所述第八存储空间,作为第五绘制结果,所述第三绘制周期位于所述第一绘制周期之后;In the third drawing cycle, according to the drawing instruction of the target application, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space as the fourth drawing result, when the drawing instruction satisfies the first condition, the drawing result is stored in the seventh storage space. When the second condition is met, the drawing result is stored in the eighth storage space as a fifth drawing result, and the third drawing cycle is located after the first drawing cycle;
    根据所述第四绘制结果和所述第五绘制结果生成第九图像帧;generating a ninth image frame according to the fourth rendering result and the fifth rendering result;
    在第四绘制周期时,根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果;During the fourth drawing cycle, generating a sixth drawing result according to the first drawing result and the fourth drawing result;
    根据第六绘制结果和所述第七绘制结果生成第十图像帧;所述第七绘制结果为在第五绘制周期中,所述目标应用程序的绘制指令满足所述第二条件时得到的绘制结果,所述第五绘 制周期在所述第四绘制周期之前。The tenth image frame is generated according to the sixth drawing result and the seventh drawing result; the seventh drawing result is the drawing obtained when the drawing instruction of the target application satisfies the second condition in the fifth drawing cycle As a result, the fifth drawing cycle precedes the fourth drawing cycle.
  104. 根据权利要求103所述的电子设备,其特征在于,在所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 103, wherein, in the aspect of generating the seventh image frame according to the first rendering result and the second rendering result, the one or more processors are specifically configured to The computer instructions are invoked to cause the electronic device to perform:
    将所述第一绘制结果和所述第二绘制结果存入第九存储空间中;The first drawing result and the second drawing result are stored in the ninth storage space;
    在所述第九存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。The seventh image frame is generated in the ninth storage space according to the first rendering result and the second rendering result.
  105. 根据权利要求104所述的电子设备,其特征在于,在所述根据所述第四绘制结果和所述第五绘制结果生成第九图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 104, wherein in the aspect of generating the ninth image frame according to the fourth rendering result and the fifth rendering result, the one or more processors are specifically configured to The computer instructions are invoked to cause the electronic device to perform:
    将所述第四绘制结果和所述第五绘制结果存入所述第九存储空间;storing the fourth drawing result and the fifth drawing result into the ninth storage space;
    在所述第九存储空间中根据所述第四绘制结果和所述第五绘制结果生成所述第九图像帧。The ninth image frame is generated in the ninth storage space according to the fourth rendering result and the fifth rendering result.
  106. 根据权利要求104或105所述的电子设备,其特征在于,在所述根据第六绘制结果和所述第七绘制结果生成第十图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 104 or 105, wherein in the aspect of generating the tenth image frame according to the sixth rendering result and the seventh rendering result, the one or more processors are specifically configured to The computer instructions are invoked to cause the electronic device to perform:
    将所述第六绘制结果和所述第七绘制结果存入所述第九存储空间;storing the sixth drawing result and the seventh drawing result into the ninth storage space;
    在所述第九存储空间中根据所述第六绘制结果和所述第七绘制结果生成所述第十图像帧。The tenth image frame is generated in the ninth storage space according to the sixth rendering result and the seventh rendering result.
  107. 根据权利要求103-106任一项所述的电子设备,其特征在于,所述第七存储空间由第十存储空间和第十一存储空间构成,所述第一绘制结果存储在所述第十存储空间中,所述第四绘制结果存储在所述第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to any one of claims 103 to 106, wherein the seventh storage space is composed of a tenth storage space and an eleventh storage space, and the first drawing result is stored in the tenth storage space. In the storage space, the fourth drawing result is stored in the eleventh storage space, and in the aspect of generating the sixth drawing result according to the first drawing result and the fourth drawing result, the one or more drawing results are a processor, specifically configured to invoke the computer instructions to cause the electronic device to execute:
    将所述第一绘制结果存入所述第十一存储空间中;storing the first drawing result in the eleventh storage space;
    在所述第十一存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。The sixth drawing result is generated in the eleventh storage space according to the first drawing result and the fourth drawing result.
  108. 根据权利要求103-106任一项所述的电子设备,其特征在于,所述第七存储空间由至少三个存储空间构成,所述至少三个存储空间包括第十存储空间,第十一存储空间和第十二存储空间;所述第一绘制结果存储在第十存储空间中,所述第四绘制结果存储在第十一存储空间中,在所述根据所述第一绘制结果和所述第四绘制结果生成第六绘制结果方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to any one of claims 103 to 106, wherein the seventh storage space is composed of at least three storage spaces, and the at least three storage spaces include a tenth storage space and an eleventh storage space. space and the 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 from the fourth drawing result, the one or more processors are specifically configured to invoke the computer instructions to cause the electronic device to execute:
    将所述第一绘制结果和所述第四绘制结果存入第十二存储空间;storing the first drawing result and the fourth drawing result in the twelfth storage space;
    在所述第十二存储空间中根据所述第一绘制结果和所述第四绘制结果生成所述第六绘制结果。The sixth drawing result is generated in the twelfth storage space according to the first drawing result and the fourth drawing result.
  109. 根据权利要求103-108任一项所述的电子设备,其特征在于,所述第三绘制周期与所述第四绘制周期相邻;所述第五绘制周期与所述第三绘制周期为同一绘制周期,所述第五绘 制结果和所述第七绘制结果为同一绘制结果。The electronic device according to any one of claims 103 to 108, wherein the third drawing period is adjacent to the fourth drawing period; the fifth drawing period and the third drawing period are the same In a drawing cycle, the fifth drawing result and the seventh drawing result are the same drawing result.
  110. 根据权利要求102所述的电子设备,其特征在于,在所述根据所述第一绘制结果和所述第二绘制结果生成第七图像帧方面,所述一个或多个处理器,具体用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 102, wherein, in the aspect of generating the seventh image frame according to the first rendering result and the second rendering result, the one or more processors are specifically configured to The computer instructions are invoked to cause the electronic device to perform:
    将所述第二绘制结果存入所述第七存储空间中;storing the second drawing result in the seventh storage space;
    在所述第七存储空间中根据所述第一绘制结果和所述第二绘制结果生成所述第七图像帧。The seventh image frame is generated in the seventh storage space according to the first rendering result and the second rendering result.
  111. 根据权利要求103-110任一项所述的电子设备,其特征在于,所述电子设备包括计数单元;所述计数单元的初始化数值为第一数值,所述计数单元的数值每更新一次在第一数值和第二数值之间切换一次;所述计数单元在绘制周期开始的时刻进行更新;The electronic device according to any one of claims 103-110, wherein the electronic device comprises a counting unit; the initialization value of the counting unit is a first value, and the value of the counting unit is updated every time at the first value. Switch between a value and a second value once; the counting unit is updated at the moment when the drawing cycle starts;
    在一个绘制周期中,During a drawing cycle,
    若更新后的所述计数单元的数值为第二数值,则在绘制周期开始的时刻清空所述第八存储空间;并在绘制指令满足所述第二条件时,将绘制结果存入所述第八存储空间;If the updated value of the counting unit is the second value, the eighth storage space is emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing result is stored in the first Eight storage spaces;
    若更新后的所述计数单元的数值为第一数值,则在绘制周期开始的时刻不清空所述第二存储单元;并在绘制指令满足所述第二条件时,不执行绘制。If the updated value of the counting unit is the first value, the second storage unit is not emptied when the drawing cycle starts; and when the drawing instruction satisfies the second condition, the drawing is not performed.
  112. 根据权利要求102所述的电子设备,其特征在于,所述一个或多个处理器,还用于调用所述计算机指令以使得所述电子设备执行:The electronic device according to claim 102, wherein the one or more processors are further configured to invoke the computer instructions to cause the electronic device to execute:
    在第三绘制周期时,根据所述第一绘制结果和所述第三绘制结果生成第四绘制结果;During the third drawing cycle, generating a fourth drawing result according to the first drawing result and the third drawing result;
    根据所述第二绘制结果和所述第四绘制结果生成第九图像帧。A ninth image frame is generated according to the second rendering result and the fourth rendering result.
  113. 根据权利要求102-112任一项所述的电子设备,其特征在于,The electronic device according to any one of claims 102-112, wherein,
    所述第一条件为:绘制指令中包含启用深度测试的指令;The first condition is: the drawing instruction includes an instruction for enabling depth testing;
    所述第二条件为:绘制指令中包含关闭深度测试的指令。The second condition is: the drawing instruction includes an instruction to close the depth test.
  114. 一种图像帧预测的方法,应用于电子设备,其特征在于,包括:A method for image frame prediction, applied to electronic equipment, is characterized in that, comprising:
    在绘制第一应用的第二十一绘制帧时,所述电子设备将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,所述第一绘制范围的尺寸大于所述第一应用的第二十一绘制帧的尺寸;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, and obtains a twenty-first drawing result. the size of the range is greater 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 instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result. The size of the twenty-two 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;
    所述电子设备根据所述第二十一绘制结果和所述第二十二绘制结果,预测生成所述第一应用的第二十三预测帧,其中,所述第二十三预测帧的尺寸与第二十一绘制帧的尺寸相同。The electronic device predicts and generates a twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result, wherein the size of the twenty-third predicted frame is The same size as the twenty-first drawing frame.
  115. 根据权利要求114所述的方法,其特征在于,所述电子设备将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:The method according to claim 114, wherein 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, which specifically includes:
    所述电子设备将所述第一应用下发的第二十一绘制帧的第一绘制指令中第一参数修改为第一绘制范围;所述第一参数用于设置第二十一绘制帧的绘制范围尺寸;The electronic device modifies the 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 value of the twenty-first drawing frame. drawing range size;
    所述电子设备将修改后的第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果。The electronic device draws the modified drawing instruction of the twenty-first drawing frame according to the first drawing range to obtain a twenty-first drawing result.
  116. 根据权利要求115所述的方法,其特征在于,所述第一绘制范围的尺寸大于所述第一应用的第二十一绘制帧的尺寸,具体包括:The method according to claim 115, wherein the size of the first drawing range is larger than the size of the twenty-first drawing frame of the first application, and specifically comprises:
    所述第一绘制范围的宽度为所述第二十一绘制帧的宽度的K3倍,所述第一绘制范围的高度为所述第二十一绘制帧的高度的K4倍,所述K3.所述K4大于1。The width of the first drawing range is K3 times the width of the twenty-first drawing frame, the height of the first drawing range is K4 times the height of the twenty-first drawing frame, and the K3. The K4 is greater than 1.
  117. 根据权利要求116所述的方法,其特征在于,所述K3.所述K4由所述电子设备的系统配置的固定值,或由所述电子设备根据所述第二十一绘制帧的绘制指令中包含的绘制参数确定。The method according to claim 116, wherein the K3 and the K4 are fixed values configured by a system of the electronic device, or a drawing instruction of the electronic device according to the twenty-first drawing frame The drawing parameters contained in are determined.
  118. 根据权利要求117所述的方法,其特征在于,所述电子设备将所述修改后第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:The method according to claim 117, wherein the electronic device draws the drawing instruction of the modified twenty-first drawing frame according to the first drawing range to obtain the twenty-first drawing result, which specifically includes:
    所述电子设备根据所述K3.所述K4生成第一转换矩阵,所述电子设备将修改后的第二十一绘制帧的绘制指令中的绘制内容的大小根据第一转换矩阵调整后绘制到第一绘制范围中,得到第二十一绘制结果。The electronic device generates a first conversion matrix according to the K3 and the K4, and the electronic device draws the size of the drawing content in the drawing instruction of the modified twenty-first drawing frame to the first conversion matrix after adjustment. In the first drawing range, the twenty-first drawing result is obtained.
  119. 根据权利要求114所述的方法,其特征在于,所述电子设备将所述第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十一绘制结果,具体包括:The method according to claim 114, wherein 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, which specifically includes:
    所述电子设备将所述第一应用下发的第二十二绘制帧的第二绘制指令中第二参数修改为第二绘制范围;所述第二参数用于设置第二十二绘制帧的绘制范围尺寸;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 second drawing range of the twenty-second drawing frame. drawing range size;
    所述电子设备将修改后的第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果。The electronic device draws the modified drawing instruction of the twenty-second drawing frame according to the second drawing range to obtain a twenty-second drawing result.
  120. 根据权利要求119所述的方法,其特征在于,所述第二绘制范围的尺寸大于所述第一应用的第二十二绘制帧的尺寸,具体包括:The method according to claim 119, wherein the size of the second drawing range is larger than the size of the twenty-second drawing frame of the first application, and specifically comprises:
    所述第二绘制范围的宽度为所述第二十二绘制帧的宽度的K5倍,所述第二绘制范围的高度为所述第二十二绘制帧的高度的K6倍,所述K5.所述K6大于1。The width of the second drawing range is K5 times the width of the twenty-second drawing frame, the height of the second drawing range is K6 times the height of the twenty-second drawing frame, and the K5. The K6 is greater than 1.
  121. 根据权利要求120所述的方法,其特征在于,所述K5.所述K6由所述电子设备的系统配置的固定值,或由所述电子设备根据所述第二十一绘制帧的绘制指令中包含的绘制参数确定。The method according to claim 120, wherein the K5 and the K6 are fixed values configured by a system of the electronic device, or a drawing instruction of the electronic device according to the twenty-first drawing frame The drawing parameters contained in are determined.
  122. 根据权利要求121所述的方法,其特征在于,所述电子设备将所述修改后的第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,具体包括:The method according to claim 121, wherein 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, which specifically includes:
    所述电子设备根据所述K5.所述K6生成第二转换矩阵,所述电子设备将修改后的第二十二绘制帧的绘制指令中的绘制内容的大小根据第二转换矩阵调整后绘制到第二绘制范围中,得到第二十一绘制结果。The electronic device generates a second conversion matrix according to the K5 and the K6, and the electronic device draws the size of the drawing content in the drawing instruction of the modified twenty-second drawing frame to the second conversion matrix after adjustment. In the second drawing range, the twenty-first drawing result is obtained.
  123. 根据权利要求114所述的方法,其特征在于,所述电子设备根据所述第二十一绘制结果和所述第二十二绘制结果,预测生成所述第一应用的第二十三预测帧,具体包括:The method according to claim 114, wherein the electronic device predicts and generates a twenty-third predicted frame of the first application according to the twenty-first rendering result and the twenty-second rendering result , including:
    所述现在设备根据所述第二十一绘制结果和所述第二十二绘制结果,预测生成所述第二十三预测帧的第二十三绘制结果;The current device predicts and generates a twenty-third drawing result of the twenty-third predicted frame according to the twenty-first drawing result and the twenty-second drawing result;
    所述电子设备将所述第二十三绘制结果剪切为所述第二十三预测帧。The electronic device clips the twenty-third rendering result into the twenty-third predicted frame.
  124. 根据权利要求123所述的方法,其特征在于,所述电子设备根据所述第二十一绘制结果和所述第二十二绘制结果,预测生成所述第二十三预测帧的第二十三绘制结果,具体包括:The method according to claim 123, wherein the electronic device predicts and generates the twentieth frame of the twenty-third predicted frame according to the twenty-first rendering result and the twenty-second rendering result Three drawing results, including:
    所述电子设备根据所述第二十一绘制结果和所述第二十二绘制结果,确定所述第二十二绘制结果的第一运动向量;The electronic device determines, according to the twenty-first rendering result and the twenty-second rendering result, a first motion vector of the twenty-second rendering result;
    所述电子设备根据所述第二十二绘制结果和所述第一运动向量,预测生成所述第二十三预测帧的第二十三绘制结果。The electronic device predicts and generates a twenty-third rendering result of the twenty-third predicted frame according to the twenty-second rendering result and the first motion vector.
  125. 根据权利要求124所述的方法,其特征在于,所述电子设备根据所述第二十一绘制结果和所述第二十二绘制结果,确定所述第二十二绘制结果的第一运动向量,具体包括:The method of claim 124, wherein the electronic device determines the first motion vector of the twenty-second rendering result according to the twenty-first rendering result and the twenty-second rendering result , including:
    所述电子设备将所述第二十二绘制结果分成Q个像素块,所述电子设备在所述第二十二绘制结果的Q个像素块中取出第一像素块;The electronic device divides the twenty-second rendering result into Q pixel blocks, and the electronic device takes out a first pixel block from the Q pixel blocks of the twenty-second rendering result;
    所述电子设备在所述第二十一绘制结果中确定出与所述第一像素块匹配的第二像素块;The electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block;
    所述电子设备根据所述第二像素块到所述第一像素块的位移得到所述第一像素块的运动向量;obtaining, by the electronic device, a motion vector of the first pixel block according to the displacement of the second pixel block to the first pixel block;
    所述电子设备根据所述第一像素块的运动向量确定所述第二十二绘制结果的第一运动向量。The electronic device determines a first motion vector of the twenty-second rendering result according to the motion vector of the first pixel block.
  126. 根据权利要求125所述的方法,其特征在于,所述电子设备在所述第二十一绘制结果中确定出与所述第一像素块匹配的第二像素块,具体包括:The method according to claim 125, wherein the electronic device determines, in the twenty-first drawing result, a second pixel block that matches the first pixel block, specifically comprising:
    所述电子设备通过所述第一像素块中的第一像素点在所述第二十一绘制结果中确定出多个候选像素块;The electronic device determines a plurality of candidate pixel blocks in the twenty-first drawing result by using the first pixel points in the first pixel block;
    所述电子设备分别计算出所述多个候选像素块与所述第一像素块的颜色值的差值;The electronic device respectively calculates the difference between the color values of the plurality of candidate pixel blocks and the first pixel block;
    所述电子设备根据所述多个候选像素块所述第一像素块的颜色值的差值确定出与所述第一像素块匹配的所述第二像素块,所述第二像素块为多个候选像素块中与所述第一像素块的颜色值的差值最小的候选像素块。The electronic device determines the second pixel block matching the first pixel block according to the difference between the color values of the first pixel block of the plurality of candidate pixel blocks, and the second pixel block is a multi-pixel block. The candidate pixel block with the smallest difference in color value from the first pixel block among the candidate pixel blocks.
  127. 根据权利要求114-126任一项所述的方法,其特征在于,所述在绘制第一应用的第二十一绘制帧时,所述电子设备将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,具体包括:The method according to any one of claims 114-126, wherein, when the twenty-first drawing frame of the first application is drawn, the electronic device converts the drawing instruction of the twenty-first drawing frame to the drawing instruction of the twenty-first drawing frame. Drawing according to the first drawing range, the twenty-first drawing result is obtained, which specifically includes:
    在绘制第一应用的第二十一绘制帧时,所述电子设备在第二十一内存空间中将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果,所述第二十一内存空间的尺寸大于或等于所述第一绘制范围的尺寸。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 As a result of drawing, the size of the twenty-first memory space is greater than or equal to the size of the first drawing range.
  128. 根据权利要求114-127任一项所述的方法,其特征在于,所述在绘制所述第一应用的第二十二绘制帧时,所述电子设备将所述第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,具体包括:The method according to any one of claims 114 to 127, wherein, when drawing the 22nd drawing frame of the first application, the electronic device converts the 22nd drawing frame The drawing instruction is drawn according to the second drawing range, and the twenty-second drawing result is obtained, which specifically includes:
    在绘制所述第一应用的第二十二绘制帧时,所述电子设备在第二十二内存空间中将所述第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果,所述第二十二内存空间的尺寸大于或等于所述第二绘制范围的尺寸。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 second drawing range. Twelve drawing results, the size of the twenty-second memory space is greater than or equal to the size of the second drawing range.
  129. 根据权利要求125所述的方法,其特征在于,所述电子设备根据所述第二十二绘制结果和所述第一运动向量,预测生成所述第二十三预测帧的第二十三绘制结果,具体包括:The method of claim 125, wherein the electronic device predicts and generates a twenty-third rendering of the twenty-third predicted frame according to the twenty-second rendering result and the first motion vector Results, including:
    所述电子设备根据所述第二十二绘制结果和所述第一运动向量,按照第三绘制范围预测生成第二十三绘制结果;其中,所述第三绘制范围的尺寸大于所述第二十三预测帧的尺寸。The electronic device predicts and generates a twenty-third drawing result according to the third drawing range according to the twenty-second drawing result and the first motion vector; wherein the size of the third drawing range is larger than that of the second drawing range Thirteen predicted frame sizes.
  130. 根据权利要求114-129任一项所述的方法,其特征在于,所述在绘制第一应用的第二十一绘制帧时,所述电子设备将所述第二十一绘制帧的绘制指令按照第一绘制范围绘制,得到第二十一绘制结果之后,所述方法还包括:The method according to any one of claims 114-129, wherein, when the twenty-first drawing frame of the first application is drawn, the electronic device converts the drawing instruction of the twenty-first drawing frame to the drawing instruction of the twenty-first drawing frame. After drawing according to the first drawing range and obtaining the twenty-first drawing result, the method further includes:
    所述电子设备将所述第二十一绘制结果剪切成所述第二十一绘制帧。The electronic device cuts the twenty-first rendering result into the twenty-first rendering frame.
  131. 根据权利要求114-130任一项所述的方法,其特征在于,所述在绘制所述第一应用的第二十二绘制帧时,所述电子设备将所述第二十二绘制帧的绘制指令按照第二绘制范围绘制,得到第二十二绘制结果之后,所述方法还包括:The method according to any one of claims 114-130, wherein, when drawing the 22nd drawing frame of the first application, the electronic device converts the 22nd drawing frame After the drawing instruction is drawn according to the second drawing range, and the twenty-second drawing result is obtained, the method further includes:
    所述电子设备将所述第二十二绘制结果剪切成所述第二十二绘制帧。The electronic device cuts the twenty-second rendering result into the twenty-second rendering frame.
  132. 一种电子设备,其特征在于,所述电子设备包括:一个或多个处理器和存储器;所述存储器与所述一个或多个处理器耦合,所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,所述一个或多个处理器调用所述计算机指令以使得所述电子设备执行如权利要求1至26、39至49、59至70、87至101、114至131任一项所述的方法。An electronic device, characterized in that the electronic device comprises: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used for storing computer program codes, the Computer program code comprising computer instructions invoked by the one or more processors to cause the electronic device to perform any of claims 1 to 26, 39 to 49, 59 to 70, 87 to 101, 114 to 131 one of the methods described.
  133. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求1至26、39至49、59至70、87至101、114至131任一项所述的方法。A computer program product comprising instructions, characterized in that, when the computer program product is run on an electronic device, the electronic device is made to perform the operations of claims 1 to 26, 39 to 49, 59 to 70, and 87 to 101 , the method of any one of 114 to 131.
  134. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1至26、39至49、59至70、87至101、114至131任一项所述的方法。A computer-readable storage medium, comprising instructions, characterized in that, when the instructions are executed on an electronic device, the electronic device is made to perform the operations described in claims 1 to 26, 39 to 49, 59 to 70, and 87 to 101 , the method of any one of 114 to 131.
PCT/CN2021/106928 2020-09-30 2021-07-16 Image frame prediction method and electronic device WO2022068326A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202180026284.XA CN115398907A (en) 2020-09-30 2021-07-16 Image frame prediction method and electronic equipment

Applications Claiming Priority (14)

Application Number Priority Date Filing Date Title
CN202011069443.8 2020-09-30
CN202011063375.4 2020-09-30
CN202011069443 2020-09-30
CN202011063375 2020-09-30
CN202011197968 2020-10-31
CN202011197968.X 2020-10-31
CN202011377306.0 2020-11-30
CN202011377449.1 2020-11-30
CN202011377449 2020-11-30
CN202011377306 2020-11-30
CN202011493948.7A CN114708289A (en) 2020-12-16 2020-12-16 Image frame prediction method and electronic equipment
CN202011493948.7 2020-12-16
CN202011629171.2 2020-12-30
CN202011629171 2020-12-30

Publications (1)

Publication Number Publication Date
WO2022068326A1 true WO2022068326A1 (en) 2022-04-07

Family

ID=80949634

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/106928 WO2022068326A1 (en) 2020-09-30 2021-07-16 Image frame prediction method and electronic device

Country Status (2)

Country Link
CN (1) CN115398907A (en)
WO (1) WO2022068326A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116095221A (en) * 2022-08-10 2023-05-09 荣耀终端有限公司 Frame rate adjusting method in game and related device
CN117292039A (en) * 2023-11-27 2023-12-26 芯瞳半导体技术(山东)有限公司 Vertex coordinate generation method, vertex coordinate generation device, electronic equipment and computer storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116433464B (en) * 2023-06-14 2023-11-17 北京象帝先计算技术有限公司 Storage address offset calculating device and method, electronic component and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101116112A (en) * 2005-01-04 2008-01-30 新世代株式会社 Plotting device and plotting method
CN102111613A (en) * 2009-12-28 2011-06-29 中国移动通信集团公司 Image processing method and device
CN102970527A (en) * 2012-10-18 2013-03-13 北京航空航天大学 Video object extraction method based on hexagon search under five-frame-background aligned dynamic background
CN110378259A (en) * 2019-07-05 2019-10-25 桂林电子科技大学 A kind of multiple target Activity recognition method and system towards monitor video
WO2020007093A1 (en) * 2018-07-02 2020-01-09 华为技术有限公司 Image prediction method and apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101116112A (en) * 2005-01-04 2008-01-30 新世代株式会社 Plotting device and plotting method
CN102111613A (en) * 2009-12-28 2011-06-29 中国移动通信集团公司 Image processing method and device
CN102970527A (en) * 2012-10-18 2013-03-13 北京航空航天大学 Video object extraction method based on hexagon search under five-frame-background aligned dynamic background
WO2020007093A1 (en) * 2018-07-02 2020-01-09 华为技术有限公司 Image prediction method and apparatus
CN110378259A (en) * 2019-07-05 2019-10-25 桂林电子科技大学 A kind of multiple target Activity recognition method and system towards monitor video

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116095221A (en) * 2022-08-10 2023-05-09 荣耀终端有限公司 Frame rate adjusting method in game and related device
CN116095221B (en) * 2022-08-10 2023-11-21 荣耀终端有限公司 Frame rate adjusting method in game and related device
CN117292039A (en) * 2023-11-27 2023-12-26 芯瞳半导体技术(山东)有限公司 Vertex coordinate generation method, vertex coordinate generation device, electronic equipment and computer storage medium
CN117292039B (en) * 2023-11-27 2024-02-13 芯瞳半导体技术(山东)有限公司 Vertex coordinate generation method, vertex coordinate generation device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN115398907A (en) 2022-11-25

Similar Documents

Publication Publication Date Title
WO2022068326A1 (en) Image frame prediction method and electronic device
JP7190042B2 (en) Shadow rendering method, apparatus, computer device and computer program
US20200320777A1 (en) Neural rerendering from 3d models
KR102624635B1 (en) 3D data generation in messaging systems
CN112004041B (en) Video recording method, device, terminal and storage medium
CN115689963B (en) Image processing method and electronic equipment
CN117078509B (en) Model training method, photo generation method and related equipment
WO2022247630A1 (en) Image processing method and apparatus, electronic device and storage medium
WO2022166624A1 (en) Screen display method and related apparatus
CN110673944A (en) Method and device for executing task
US10911687B2 (en) Electronic device and method for controlling display of images
CN114979457B (en) Image processing method and related device
CN116166256A (en) Interface generation method and electronic equipment
CN116166259A (en) Interface generation method and electronic equipment
CN113709355B (en) Sliding zoom shooting method and electronic equipment
CN115908120B (en) Image processing method and electronic device
CN114708289A (en) Image frame prediction method and electronic equipment
US20210303824A1 (en) Face detection in spherical images using overcapture
CN116263971A (en) Image frame prediction method, electronic device, and computer-readable storage medium
CN116166255A (en) Interface generation method and electronic equipment
CN114693538A (en) Image processing method and device
CN116708931B (en) Image processing method and electronic equipment
CN112351213B (en) System dynamic allocation on chip resources for efficient signal processing
CN116664375B (en) Image prediction method, device, equipment and storage medium
WO2024002164A1 (en) Display method and related apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21873988

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21873988

Country of ref document: EP

Kind code of ref document: A1