(19)
(11)EP 3 764 648 A1

(12)EUROPEAN PATENT APPLICATION
published in accordance with Art. 153(4) EPC

(43)Date of publication:
13.01.2021 Bulletin 2021/02

(21)Application number: 19764644.1

(22)Date of filing:  20.02.2019
(51)International Patent Classification (IPC): 
H04N 19/51(2014.01)
(86)International application number:
PCT/CN2019/075548
(87)International publication number:
WO 2019/169997 (12.09.2019 Gazette  2019/37)
(84)Designated Contracting States:
AL AT BE BG CH CY CZ DE DK EE ES FI FR GB GR HR HU IE IS IT LI LT LU LV MC MK MT NL NO PL PT RO RS SE SI SK SM TR
Designated Extension States:
BA ME
Designated Validation States:
KH MA MD TN

(30)Priority: 07.03.2018 CN 201810188556

(71)Applicant: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Shenzhen, Guangdong 518057 (CN)

(72)Inventor:
  • ZHANG, Hongshun
    Shenzhen, Guangdong 518057 (CN)

(74)Representative: Gunzelmann, Rainer 
Wuesthoff & Wuesthoff Patentanwälte PartG mbB Schweigerstraße 2
81541 München
81541 München (DE)

  


(54)MOTION ESTIMATION METHOD AND DEVICE FOR VIDEO, TERMINAL AND STORAGE MEDIUM


(57) A video motion estimation method is provided, including the following operations: dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit; obtaining a motion vector of the first type prediction unit according to a first search algorithm; obtaining a motion vector of the second type prediction unit according to a second search algorithm; and performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.




Description

RELATED APPLICATION



[0001] This application claims priority to Chinese patent application No. 201810188556.6, filed with the Chinese Patent Office on March 7, 2018 entitled "VIDEO MOTION ESTIMATION METHOD AND APPARATUS, AND STORAGE MEDIUM", which is incorporated herein by reference in its entirety.

FIELD OF THE TECHNOLOGY



[0002] This disclosure relates to the technical field of video compression, and in particular, to a video motion estimation method and apparatus, a terminal, and a storage medium.

BACKGROUND OF THE DISCLOSURE



[0003] In the process of encoding a video, it is generally necessary to perform inter-frame prediction on each frame of image in the video. The inter-frame prediction is mainly to predict a pixel of the current image by using correlation of time domain of the video and using a pixel of an adjacent encoded image, so that the time domain of the video is not redundant. At present, the inter-frame prediction part of video encoding mainly uses a block-based motion compensation technology. A principle is to find an optimal matching block in the previously encoded image for each pixel block (that is, a prediction unit) of the current image. This process is referred to as motion estimation (ME). An image used for prediction is referred to as a reference image, and displacement of a reference block in the reference image to the current pixel block in the current image is referred to as a motion vector (MV).

[0004] In the related art, in the process of performing motion estimation on image frames in the video, the image frames are first divided into prediction units of modes such as 2N × 2N, 2N × N, N × 2N, 2N × nU, 2N × nD, nL × 2N, nR × 2N, or the like through an inter-frame prediction unit (PU). Then, a unified processing method is adopted for all prediction units. After a starting search point of each prediction unit is determined, the starting search point is used as the center, and a point with minimum rate-distortion cost is found within the search range. Finally, a location of the point with the minimum rate-distortion cost of each prediction unit is used as a motion vector corresponding to each prediction unit, and subsequent operations such as sub-pixel motion compensation are performed on the image frame according to the motion vector corresponding to each prediction unit.

[0005] During the research and practice of the related art, the inventor of this disclosure found that, because the same processing method is uniformly used for all prediction units in the related art, a new independent search is performed on each prediction unit. For example, for all the prediction units, the search method with the same complexity is used, causing an inflexible process of performing motion estimation on the video and low efficiency of motion estimation.

SUMMARY



[0006] According to various embodiments provided in this disclosure, a video motion estimation method is provided.

[0007] A video motion estimation method, including:

dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit;

obtaining a motion vector of the first type prediction unit according to a first search algorithm;

obtaining a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.



[0008] A video motion estimation apparatus, including:

a dividing unit configured to divide image frames in a video into a plurality of prediction units, and divide the plurality of prediction units into a first type prediction unit and a second type prediction unit;

a first obtaining unit configured to obtain a motion vector of the first type prediction unit according to a first search algorithm;

a second obtaining unit configured to obtain a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

a motion estimation unit configured to perform sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.



[0009] A terminal, including a memory and one or more processors, the memory storing a computer-readable instruction, the computer-readable instruction, when executed by the processor, causing the one or more processors to perform the following operations:

dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit;

obtaining a motion vector of the first type prediction unit according to a first search algorithm;

obtaining a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

one or more non-volatile storage media storing the computer-readable instruction, the computer-readable instruction, when executed by one or more processors, causing the one or more processors to perform the following operations:

dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit;

obtaining a motion vector of the first type prediction unit according to a first search algorithm;

obtaining a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.


BRIEF DESCRIPTION OF THE DRAWINGS



[0010] To describe the technical solutions of the embodiments of this disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. Apparently, the accompanying drawings in the following description show only some embodiments of this disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.

FIG. 1 is a schematic diagram of a scenario of a video motion estimation system according to an embodiment of this disclosure.

FIG. 2 is a schematic flowchart of a video motion estimation method according to an embodiment of this disclosure.

FIG. 3 is a schematic diagram of a prediction unit obtained by dividing an image frame according to an embodiment of this disclosure.

FIG. 4 is a schematic diagram of a diamond search template according to an embodiment of this disclosure.

FIG. 5 is a schematic diagram of performing a two-point search around an undetermined point according to an embodiment of this disclosure.

FIG. 6 is a schematic diagram of performing searching according to a preset interval step size according to an embodiment of this disclosure.

FIG. 7 is a schematic diagram of moving a quadrilateral model according to an embodiment of this disclosure.

FIG. 8 is a schematic diagram of moving a hexagonal model according to an embodiment of this disclosure.

FIG. 9 is a schematic diagram of a motion vector search sequence of different prediction units according to an embodiment of this disclosure.

FIG. 10 is a schematic flowchart of searching for a motion vector of a first type prediction unit according to an embodiment of this disclosure.

FIG. 11 is a schematic flowchart of searching for a motion vector of a second type prediction unit according to an embodiment of this disclosure.

FIG. 12 is a schematic structural diagram of a video motion estimation apparatus according to an embodiment of this disclosure.

FIG. 13 is another schematic structural diagram of a video motion estimation apparatus according to an embodiment of this disclosure.

FIG. 14 is another schematic structural diagram of a video motion estimation apparatus according to an embodiment of this disclosure.

FIG. 15 is a schematic structural diagram of a terminal according to an embodiment of this disclosure.


DESCRIPTION OF EMBODIMENTS



[0011] Hereinafter, the technical solutions of the embodiments of the present disclosure will be described in a clearly and fully understandable way in connection with the drawings in the embodiments of the present disclosure. It is obvious that the described embodiments are just a part but not all of the embodiments of the present disclosure. All other embodiments obtained by a person skilled in the art based on the embodiments of this application without creative efforts shall fall within the protection scope of this application.

[0012] Embodiments of this disclosure provide a video motion estimation method, apparatus, and system.

[0013] FIG. 1 is a schematic diagram of a scenario of a video motion estimation system according to an embodiment of this disclosure. The video motion estimation system may include a video motion estimation apparatus. The video motion estimation apparatus may be specifically integrated into a terminal such as a tablet computer, a mobile phone, a notebook computer, a desktop computer, a television, or the like that has a storage unit, is equipped with a microprocessor, and has computing capability, which is mainly configured to divide image frames in a video into a plurality of prediction units, and divide the plurality of prediction units into a first type prediction unit and a second type prediction unit. The video may be obtained locally from the terminal or downloaded from a server. The prediction unit may include a plurality of prediction units such as a prediction unit A, a prediction unit B, a prediction unit C, a prediction unit D, a prediction unit E, a prediction unit F, and the like. The first type prediction unit may include a plurality of prediction units such as a prediction unit A, a prediction unit B, a prediction unit C, and the like. The second type prediction unit may include a plurality of prediction units such as a prediction unit D, a prediction unit E, a prediction unit F, and the like. A motion vector of the first type prediction unit is obtained according to a first search algorithm, and a motion vector of the second type prediction unit is obtained according to a second search algorithm. In the process of obtaining the motion vector of the second type prediction unit according to the second search algorithm, a polygonal model may be obtained, and a current motion vector of the second type prediction unit may be obtained by moving the polygonal model. The polygonal model may be a diamond model or a hexagonal model. After a motion vector a of the first type prediction unit and a motion vector b of the second type prediction unit are obtained, a motion vector of the searched prediction unit in an image frame may be obtained, and the current motion vector may be corrected according to the motion vector of the searched prediction unit, to obtain a motion vector of the second type prediction unit. The searched prediction unit may include the second type prediction unit and at least one prediction unit of the second type prediction unit. Then, sub-pixel motion estimation is performed on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit, to obtain a motion estimation result, and so on.

[0014] In addition, the video motion estimation system may further include a server, and the video motion estimation apparatus may download the video from the server. For example, the video motion estimation apparatus may send a video obtaining request to the server, and receive a video file about the video fed back by the server based on the video obtaining request.

[0015] The schematic diagram of the scenario of the video motion estimation system shown in FIG. 1 is only an example. The video motion estimation system and scenario described in the embodiments of this disclosure are intended to describe the technical solutions in the embodiments of this disclosure more clearly, and do not constitute a limitation on the technical solutions provided in the embodiments of this disclosure. A person skilled in the art may know that, with the evolution of the video motion estimation system and emergence of new business scenarios, the technical solutions provided in the embodiments of this disclosure are also applicable to similar technical problems.

[0016] Detailed description is given below.

[0017] In this embodiment, a video motion estimation apparatus is to be described. The video motion estimation apparatus may be specifically integrated in a terminal such as a computer, a mobile phone, a television, or the like that has a storage unit, is equipped with a microprocessor, and has computing capability.

[0018] A video motion estimation method, including: dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit; obtaining a motion vector of the first type prediction unit according to a first search algorithm, and obtaining a motion vector of the second type prediction unit according to a second search algorithm; and performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

[0019] FIG. 2 is a schematic flowchart of a video motion estimation method according to a first embodiment of this disclosure. The video motion estimation method may include the following operations.

[0020] In step S101, image frames in a video are divided into a plurality of prediction units, and the plurality of prediction units are divided into a first type prediction unit and a second type prediction unit.

[0021] The video motion estimation apparatus may obtain a video from the local or the server. When the video needs to be edited, inter-frame prediction encoding needs to be performed on the video. In the process of inter-frame prediction encoding, motion estimation needs to be performed on each image frame in the video. During motion estimation on the image frame, the image frame in the video may be divided into a plurality of prediction units such as 2N × 2N, 2N × N, N × 2N, 2N × nU, 2N × nD, nL × 2N, and nR × 2N by using an inter-frame prediction unit PU. As shown in FIG. 3, 2N × 2N, 2N × N, and N × 2N are prediction units in a symmetric mode. For example, the 2N × N prediction unit includes a dividing block with an index of 0 and an index of 1 divided by a ratio of 1:1 up and down. 2N × nU, 2N × nD, nL × 2N, and nR × 2N are prediction units in an asymmetric mode. For example, the 2N × nD prediction unit includes a dividing block with an index of 0 and an index of 1 divided by a ratio of 3:1 up and down.

[0022] Since the prediction units of different modes are different, in order to prevent the prediction units of different modes all using the same processing method, for example, the prediction unit of the asymmetric mode adopts a search method with the same complexity as the prediction unit of the symmetric mode, therefore, in order to improve flexibility and efficiency of performing motion estimation on the video, after a plurality of prediction units are obtained, the plurality of prediction units may be divided into a first type prediction unit and a second type prediction unit. For example, the first type prediction unit may include prediction units such as 2N × 2N, 2N × N, N × 2N, and the like in the symmetric mode, and the second type prediction unit may include prediction units such as 2N × nU, 2N × nD, nL × 2N, nR × 2N, and the like in the asymmetric mode.

[0023] The method for dividing the prediction unit and the method for dividing the first type prediction unit and the second type prediction unit may be flexibly set according to actual needs, and specific content is not limited herein.

[0024] The terms "first" and "second" used in the embodiments of this disclosure are merely for the purpose of description and cannot be construed as indicating or implying importance. For example, the first type prediction unit and the second type prediction unit both are prediction units. The first type prediction unit corresponds to one type of prediction unit, and the second type prediction unit corresponds to another type of prediction unit. It does not indicate that the first type prediction unit is more important than the second type prediction unit, and the like.

[0025] In step S 102, a motion vector of the first type prediction unit is obtained according to a first search algorithm.

[0026] For the first type prediction unit and the second type prediction unit, the video motion estimation apparatus may respectively use different search algorithms to search the motion vector of the prediction unit. For example, for the first type prediction unit, the motion vector of the first type prediction unit may be obtained according to the first search algorithm. For the second type prediction unit, a motion vector of the second type prediction unit is obtained according to a second search algorithm. The first search algorithm is inconsistent with the second search algorithm, which are to be described in detail below.

[0027] In some implementations, the operation of obtaining a motion vector of the first type prediction unit according to a first search algorithm may include:
  1. (1) obtaining a second candidate starting search point corresponding to the first type prediction unit, calculating rate-distortion cost of each second candidate starting search point, and setting a second candidate starting search point with the minimum rate-distortion cost as a second starting search point;
  2. (2) obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point;
  3. (3) obtaining a second supplementary point not searched around each point corresponding to the second preset step size, and calculating rate-distortion cost of the second supplementary point in a case that the search step size corresponding to the second undetermined point is a second preset step size;
  4. (4) setting a location of the second undetermined point as the motion vector of the first type prediction unit in a case that a point with minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point; and
  5. (5) setting a location of the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point.


[0028] Specifically, first, the video motion estimation apparatus determines a starting search point (that is, the second starting search point) in the following manner.

[0029] The video motion estimation apparatus may obtain the second candidate starting search point corresponding to the first type prediction unit through advanced motion vector prediction (AMVP). The AMVP technology is mainly to use the correlation between motion vectors in space domain and time domain to establish a list of candidate prediction MVs for the current prediction unit. There is a plurality of candidate prediction MVs in the list, and the video motion estimation apparatus may select the second candidate starting search point from the list of the plurality of candidate prediction MVs. Alternatively, the video motion estimation apparatus may also obtain a second candidate starting search point corresponding to the first type prediction unit by using a Merge mode.

[0030] After the second candidate starting search point is obtained, the video motion estimation apparatus may calculate rate-distortion cost of each second candidate starting search point, and set a second candidate starting search point with the minimum rate-distortion cost as the second starting search point, that is, the second starting search point is a finally determined starting search point corresponding to the first type prediction unit. The formula for calculating the rate-distortion cost may be: rdcost = sad + lamdabit, where rdcost represents the rate-distortion cost, sad represents a residual error, that is, a motion compensation prediction error, lamda represents a constant coefficient, which may be a Lagrangian factor, and bit represents a code rate, that is, a quantity of encoded bits of motion vector related information. Each rate-distortion cost below may be calculated by referring to the formula.

[0031] Secondly, the video motion estimation apparatus specifically searches an undetermined point (that is, a second undetermined point) within the search window range in the following manner.

[0032] The video motion estimation apparatus may perform searching by using a diamond template, a square template, or the like. As shown in FIG. 4, the diamond template is used as an example, and the second starting search point is used as a center of the diamond template. From a search step size of 1, according to the diamond template shown in FIG. 4, a plurality of second candidate points are obtained, according to a second preset increasing step size, within a search window range centered on the second starting search point. The second preset increasing step size may be a step size increasing by an integer power of 2, that is, from the search step size of 1, and searching is performed with the search step sizes of 2, 4, and 8 in turn, to obtain a plurality of second candidate points. The second candidate points may be vertexes of the diamond template corresponding to each search step size, a midpoint between the two vertexes, and the like, for example, a location of a five-pointed star marked in FIG. 4. When a maximum search step size is set to 8, a corresponding search window range is an inner ring region of the diamond template corresponding to the search step size 8. When a maximum search step size is set to 16, a corresponding search window range is an inner ring region of the diamond template corresponding to the search step size 16, and so on. Then, the rate-distortion cost of each second candidate point is calculated, the point with the minimum rate-distortion cost is selected from the plurality of second candidate points, and the point with the minimum rate-distortion cost in the plurality of second candidate points is set as the second undetermined point.

[0033] Then, when the search step size corresponding to the second undetermined point is the second preset step size, two-point searching is performed around the undetermined point, which may be performed specifically as follows.

[0034] After the second undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the second undetermined point is the second preset step size, and the second preset step size may be flexibly set according to actual needs. For example, the second preset step size may be set to 1, that is, when the search step size corresponding to the second undetermined point is 1, a second supplementary point not searched around each point corresponding to the second preset step size may be obtained, and the second supplementary point may include one or more points, as shown in FIG. 5.

[0035] For example, in FIG. 5, when the search template for searching the second undetermined point is a diamond template, vertexes corresponding to the diamond with the search step size of 1 are four points of 2, 4, 5, and 7 if the search step size corresponding to the obtained second undetermined point is 1. In this case, if the obtained second undetermined point with the minimum rate-distortion cost is a location of 2, then two points of A and B are supplemented at the location of 2, and the two points of A and B may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 4, then two points of C and E are supplemented at the location of 4, and the two points of C and E may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 5, then two points of D and F are supplemented at the location of 5, and the two points of D and F may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 7, then two points of G and H are supplemented at the location of 7, and the two points of G and H may be set as second supplementary points.

[0036] Finally, the point with the minimum rate-distortion cost may be selected from the second supplementary point and the second undetermined point in a specific manner as follows.

[0037] After the second supplementary point is obtained, the video motion estimation apparatus may calculate rate-distortion cost of each second supplementary point, compare the rate-distortion cost of the second supplementary point with the rate-distortion cost of the second undetermined point, and determine whether the point with the minimum rate-distortion cost in the second supplementary point and the second undetermined point is the second undetermined point. A location of the second undetermined point is set as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point.

[0038] The location of the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is set as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point.

[0039] Optionally, the operation of setting a location of the second undetermined point as the motion vector of the first type prediction unit may include:
  1. (a) obtaining a motion vector of a searched prediction unit in the image frame, and calculating second target rate-distortion cost of a corresponding location of the first type prediction unit according to the motion vector of the searched prediction unit;
  2. (b) comparing rate-distortion cost of the second undetermined point with the second target rate-distortion cost;
  3. (c) setting the motion vector of the searched prediction unit as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is greater than the second target rate-distortion cost; and
  4. (d) setting the location of the second undetermined point as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is less than or equal to the second target rate-distortion cost.


[0040] When determining the motion vector of the first type prediction unit, the video motion estimation apparatus may correct the motion vector of the currently searched first type prediction unit according to the motion vector of the searched prediction unit in the image frame. Specifically, in the process of searching the motion vector of each prediction unit, the video motion estimation apparatus may store the motion vector of the searched prediction unit, and may generate a mapping relationship between a prediction unit identifier and the motion vector.

[0041] In the process of correcting the motion vector of the currently searched first type prediction unit, the video motion estimation apparatus may obtain a mapping relationship corresponding to the searched prediction unit identifier, obtain the motion vector of the searched prediction unit in the image frame according to the mapping relationship, and calculate the second target rate-distortion cost of the corresponding location of the first type prediction unit according to the motion vector of the searched prediction unit. For example, a corresponding location may be determined according to the motion vector of the searched prediction unit, the rate-distortion cost of the corresponding location is calculated, and the rate-distortion cost of the corresponding location obtained through calculation is set as the second target rate-distortion cost. Then, the rate-distortion cost of the second undetermined point may be compared with the second target rate-distortion cost.

[0042] In a case that the rate-distortion cost of the second undetermined point is greater than the second target rate-distortion cost, the motion vector of the searched prediction unit is set as the motion vector of the first type prediction unit, that is, the motion vector of the first type prediction unit is corrected to the motion vector of the searched prediction unit. The location of the second undetermined point is set as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is less than or equal to the second target rate-distortion cost.

[0043] The searched prediction unit may include one or more prediction units, which may include one or more prediction units of the first type prediction unit in the image frame, or may include one or more prediction units of the second type prediction unit in the image frame, or may include both one or more prediction units of the first type prediction unit in the image frame and one or more prediction units of the second type prediction unit in the image frame, and so on. The searched prediction unit may also include one or more motion vectors.

[0044] For example, if the video motion estimation apparatus has searched for motion vectors of a 2N × 2N prediction unit and a 2N × N prediction unit, then during current searching of a motion vector of an N × 2N prediction unit, the motion vector of the N × 2N prediction unit may be corrected by using the motion vectors of the 2N × 2N prediction unit and the 2N × N prediction unit.

[0045] Optionally, the second type prediction unit includes a third dividing block and a fourth dividing block, and the operation of obtaining a second candidate starting search point corresponding to the first type prediction unit, calculating rate-distortion cost of each second candidate starting search point, and setting the second candidate starting search point with the minimum rate-distortion cost as a second starting search point may include:

obtaining at least one second candidate starting search point corresponding to the fourth dividing block in the first type prediction unit through advanced motion vector prediction;

obtaining a prediction result of the third dividing block, calculating rate-distortion cost of each second candidate starting search point, and calculating rate-distortion cost of a location of the third dividing block according to the prediction result of the third dividing block in a case that the third dividing block in the first type prediction unit is predicted; and

setting the point with the minimum rate-distortion cost in the at least one second candidate starting search point and the third dividing block as the starting search point of the fourth dividing block in the first type prediction unit, and setting the starting search point of the fourth dividing block as the second starting search point.



[0046] The first type prediction unit may include a third dividing block with an index of 0 and a fourth dividing block with an index of 1. The video motion estimation apparatus may separately search for the motion vectors of the third dividing block and the fourth dividing block in the first type prediction unit. When the starting search point of the fourth dividing block in the first type prediction unit is determined, the motion vector of the searched third dividing block may be used for instructing the search process of the current fourth dividing block, that is, a location corresponding to the motion vector of the searched third dividing block may be used as one of the candidate starting search points of the current fourth dividing block. Alternatively, a location corresponding to the motion vector of the searched fourth dividing block is used as one of the candidate starting search points of the current third dividing block, and the location corresponding to the motion vector of the searched third dividing block is to be used as one of the starting search points of the current fourth dividing block, for example.

[0047] Specifically, in the process of searching for the fourth dividing block in the first type prediction unit, the video motion estimation apparatus may obtain at least one second candidate starting search point corresponding to the fourth dividing block in the first type prediction unit through the AMVP technology, and determine whether the third dividing block in the first type prediction unit has been searched, that is, determine whether the third dividing block in the first type prediction unit has been predicted. When the third dividing block in the first type prediction unit is predicted, a prediction result of the third dividing block is obtained. The prediction result may be the motion vector of the third dividing block. In this case, rate-distortion cost of the location of the third dividing block may be calculated according to the prediction result of the third dividing block, that is, the rate-distortion cost of the location of the third dividing block may be calculated according to the motion vector of the third dividing block. For example, a corresponding location may be determined according to the motion vector of the third dividing block, the rate-distortion cost of the corresponding location is calculated, and the rate-distortion cost of the corresponding location obtained through calculation is set as the rate-distortion cost of the location of the third dividing block. In addition, the rate-distortion cost of each second candidate starting search point is calculated, the point with the minimum rate-distortion cost in at least one second candidate starting search point and the third dividing block is set as a starting search point of the fourth dividing block in the first type prediction unit, and the starting search point of the fourth dividing block is set as the second starting search point, so as to perform the operation of obtaining, according to a second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating rate-distortion cost of each second candidate point, and selecting a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point.

[0048] For example, the 2N × N prediction unit is used as an example. Assuming that a dividing block with the index of 0 in the 2N × N prediction unit has been predicted, in this case, when a dividing block with the index of 1 in the 2N × N prediction unit is predicted, a location of the motion vector in the prediction result corresponding to the dividing block with the index of 0 may be used as one of locations of the candidate starting search point of the dividing block with the index of 1, so that the point with the minimum rate-distortion cost may be selected as the starting search point from the candidate starting search points. In this way, the starting search point is closer to an optimal location for motion estimation, and may exit the search process faster.

[0049] In some implementations, after the operation of selecting a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point, the video motion estimation method may further include:

performing searching, according to a preset interval step size, within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range, to obtain a plurality of search points, and calculating rate-distortion cost of each search point; and

using the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points as the second starting search point, and performing the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point.



[0050] Specifically, after the second undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the second undetermined point is within a third preset step size threshold range, where the third preset step size threshold range may be flexibly set according to actual needs. Alternatively, a distance from the point with the minimum rate-distortion cost to a center of the search window range may be obtained to determine whether the distance is within the first preset distance threshold range. The preset distance threshold range may be flexibly set according to actual needs. For example, the first preset distance threshold range may be greater than or equal to 5, and less than or equal to 8. Searching is performed according to a preset interval step size within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range (or the distance from the point with the minimum rate-distortion cost to the center of the search window range is within the first preset distance threshold range), to obtain a plurality of search points. The preset range and the preset interval step size may be flexibly set according to actual needs, and a specific value is not limited herein. For example, the preset interval step size may be set to 5 steps for each row and column. As shown in FIG. 6, within the search window range centered on the second undetermined point, all points are scanned every 5 rows and 5 columns by raster scanning, to obtain a plurality of search points. FIG. 6 is merely a partial schematic diagram of searching within the search window range according to the preset interval step size. The search window range may be flexibly set according to actual needs, for example, may be set to 128 rows 128 columns.

[0051] Then, rate-distortion cost of each search point is calculated, the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points is used as the second starting search point, and the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point is performed.

[0052] In some implementations, after the operation of selecting a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point, the video motion estimation method may further include:
using the second undetermined point as the second starting search point, and performing the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point in a case that a search step size corresponding to the second undetermined point is within a fourth preset step size threshold range.

[0053] Specifically, after the second undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the second undetermined point is within the fourth step size threshold range, where the fourth preset step size threshold range may be flexibly set according to actual needs. Alternatively, a distance from the point with the minimum rate-distortion cost to a center of the search window range may be obtained to determine whether the distance is within a second preset distance threshold range. The second preset distance threshold range may be flexibly set according to actual needs, for example, may be greater than 1 and less than 5. The second undetermined point is used as the second starting search point, and the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point is performed in a case that a search step size corresponding to the second undetermined point is within the fourth preset step size threshold range (or a distance from the point with the minimum rate-distortion cost to the center of the search window range is within the first preset distance threshold range).

[0054] In step S103, a motion vector of the second type prediction unit is obtained according to a second search algorithm.

[0055] For the second type prediction unit, the video motion estimation apparatus may obtain the motion vector of the second type prediction unit by using the second search algorithm.

[0056] In some implementations, the operation of obtaining a motion vector of the second type prediction unit according to a second search algorithm may include: obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model; and obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0057] In some implementations, the operation of obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model may include:
  1. (1) obtaining a first undetermined point in the second type prediction unit according to the second search algorithm;
  2. (2) obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range;
  3. (3) moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and
  4. (4) setting a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.


[0058] Specifically, the video motion estimation apparatus may obtain a first candidate starting search point corresponding to the second type prediction unit through the AMVP technology, select a first starting search point from the first candidate starting search point, then perform searching with the first starting search point as the center of a diamond template or a square template to obtain a plurality of first candidate points, and select a first undetermined point from the plurality of first candidate points.

[0059] After the first undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the first undetermined point is within the first preset step size threshold range, where the first preset step size threshold range may be flexibly set according to actual needs. When a search step size of the first undetermined point is within the first preset step size threshold range, a polygonal model is obtained, where the polygonal model may be quadrilateral, hexagonal, or the like.

[0060] After the polygonal model is obtained, the video motion estimation apparatus may obtain the first target point according to the polygonal model. For example, the video motion estimation apparatus may calculate rate-distortion cost of locations of the center of the polygonal model and each vertex, and set the point with the minimum rate-distortion cost in the center of the polygonal model and each vertex as the first target point.

[0061] After the first target point is obtained, the video motion estimation apparatus may determine whether the first target point is consistent with the first undetermined point. When the first target point is inconsistent with the first undetermined point, it indicates that the obtained first target point may not be the optimal point, and there may be an optimal point with the rate-distortion cost less than that of the first target point around the first target point. In this case, the polygonal model is moved, and the optimal point is obtained according to the moved polygonal model. The optimal point may be the point with the minimum rate-distortion cost in the moved polygonal model.
optionally, the operation of moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point may include: moving a center of the polygonal model to a location of the first target point in a case that the first target point is inconsistent with the first undetermined point; and selecting a point with the minimum rate-distortion cost from the center of the moved polygonal model and each vertex, to obtain the optimal point.

[0062] An original shape of the moved polygonal model remains unchanged. For example, the center of the polygonal model may be moved to the location of the first target point. Then the rate-distortion cost of locations of the center of the moved polygonal model and each vertex is calculated, and the point with the minimum rate-distortion cost in the center of the moved polygonal model and each vertex is set as the optimal point.

[0063] After the optimal point is obtained, the video motion estimation apparatus may determine whether the optimal point is consistent with the first target point. A location of the optimal point is set as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.

[0064] Optionally, after the operation of obtaining the first target point according to the polygonal model, the video motion estimation method may further include: setting a location of the first target point as the current motion vector of the second type prediction unit in a case that the first target point is consistent with the first undetermined point.

[0065] For example, as shown in FIG. 7, when the polygonal model is a diamond model, the center of the diamond model is moved to the location of the right vertex if the point (that is, the optimal point) with the minimum rate-distortion cost obtained through calculation of rate distortion cost of the center of the diamond model and upper, lower, left, and right vertexes in FIG. 7 (a) is a location of the right vertex of the diamond model, as shown in FIG. 7 (b). In this case, the rate-distortion cost of the center of the moved diamond model and the upper, lower, left, and right vertexes is calculated. If the obtained point with the minimum rate-distortion cost is a location of the lower vertex of the diamond model, then the center of the diamond model is moved to the location of the lower vertex, as shown in FIG. 7 (c). In this case, the rate-distortion cost of the center of the moved diamond model and the upper, lower, left, and right vertexes is calculated. If the obtained point with the minimum rate-distortion cost is a location of the lower vertex of the diamond model, then the center of the diamond model is moved to the location of the lower vertex, as shown in FIG. 7 (d). In this case, the rate-distortion cost of the center of the moved diamond model and the upper, lower, left, and right vertexes is calculated. If the obtained point with the minimum rate-distortion cost is a location of the center of the diamond model, that is, the optimal point is the location of the center of the diamond model, then the diamond model is no longer moved, and the location (that is, the location of the optimal point) of the center of the diamond model is set as a current motion vector of the second type prediction unit.

[0066] In some implementations, the operation of obtaining a first undetermined point in the second type prediction unit according to the second search algorithm, obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range may include:
  1. (a) obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point;
  2. (b) obtaining a polygonal model centered on the first undetermined point in a case that a search step size corresponding to the first undetermined point is within a first preset step size threshold range; and
  3. (c) selecting a point with the minimum rate-distortion cost from a midpoint of the polygonal model and each vertex, to obtain the first target point.


[0067] Specifically, the video motion estimation apparatus may obtain a first candidate starting search point corresponding to the second type prediction unit through the AMVP technology, calculate rate-distortion cost of the first candidate starting search point, set the point with the minimum rate-distortion cost as a first starting search point, and then perform searching with the first starting search point as the center of a diamond template or a square template, to obtain a plurality of first candidate points. Rate-distortion cost of each first candidate point is calculated, and the point with the minimum rate-distortion cost is selected from the plurality of first candidate points and set as a first undetermined point.

[0068] After the first undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the first undetermined point is within the first preset step size threshold range, where the first preset step size threshold range may be flexibly set according to actual needs. A polygonal model such as a quadrilateral model or a hexagonal model centered on the first undetermined point is obtained in a case that a search step size of the first undetermined point is within a first preset step size threshold range.

[0069] After the polygonal model is obtained, the video motion estimation apparatus may calculate rate-distortion cost of locations of the center of the polygonal model and each vertex, and set the point with the minimum rate-distortion cost in the center of the polygonal model and each vertex as the first target point. The video motion estimation apparatus may further calculate rate-distortion cost of the center of the polygonal model, each vertex, and a location (or a location of a trisection point of each side) of a midpoint of each side, and set the point with the minimum rate-distortion cost as the first target point.

[0070] Optionally, the operation of obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point may include:

obtaining a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm;

calculating rate-distortion cost of each first candidate starting search point, and setting the first candidate starting search point with the minimum rate-distortion cost as a first starting search point;

obtaining, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point; and

selecting a point with minimum rate-distortion cost from the plurality of first candidate points, to obtain the first undetermined point.



[0071] Specifically, the video motion estimation apparatus may obtain the first candidate starting search point corresponding to the second type prediction unit through the AMVP technology or the Merge mode, then calculate rate distortion cost of each first candidate starting search point, and set the first candidate starting search point with the minimum rate-distortion cost as a first starting search point, that is, the first starting search point is a finally determined starting search point corresponding to the second type prediction unit.

[0072] After the first starting search point is obtained, the video motion estimation apparatus may search for, according to the first preset increasing step size, a plurality of first candidate points within the search window range centered on the first starting search point. The search window range may be a search range of the diamond template or the square template. For example, the search window range may be an inner ring region corresponding to a maximum search step size of the diamond template or the square template. For example, when the maximum search step size of the diamond template is set to 8, the corresponding search window range is the inner ring region of the diamond template corresponding to a search step size of 8. The first preset increasing step size may be a step size that increases by an integer power of 2, or may be flexibly set according to actual needs.

[0073] The diamond template is used as an example. As shown in FIG. 4, the first starting search point is used as the center of the diamond template. From a search step size of 1, searching is performed according to the step size increasing by an integer power of 2, to obtain a plurality of first candidate points. The first candidate point may be a vertex of the diamond template corresponding to each search step size, a midpoint between the two vertexes, and the like, for example, a location of a five-pointed star as marked in FIG. 4. Then, the rate-distortion cost of each first candidate point is calculated, the point with the minimum rate-distortion cost is selected from the plurality of first candidate points, and the point with the minimum rate-distortion cost in the plurality of first candidate points is set as the first undetermined point.

[0074] In some implementations, the second type prediction unit includes a first dividing block and a second dividing block, and the operation of obtaining a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm, calculating rate-distortion cost of each first candidate starting search point, and setting the first candidate starting search point with the minimum rate-distortion cost as a first starting search point may include:

obtaining at least one first candidate starting search point corresponding to the second dividing block in the second type prediction unit through advanced motion vector prediction according to the second search algorithm;

obtaining a prediction result of the first dividing block, calculating rate-distortion cost of each first candidate starting search point, and calculating rate-distortion cost of a location of the first dividing block according to the prediction result of the first dividing block in a case that the first dividing block in the second type prediction unit is predicted;

obtaining the point with the minimum rate-distortion cost from the least one first candidate starting search point and the first dividing block; and

setting the obtained point with the minimum rate-distortion cost as the starting search point of the second dividing block in the second type prediction unit, and setting the starting search point of the second dividing block as the first starting search point.



[0075] The second type prediction unit may include a first dividing block with an index of 0 and a second dividing block with an index of 1. The video motion estimation apparatus may separately search for the motion vectors of the first dividing block and the second dividing block in the second type prediction unit. When the starting search point of the second dividing block in the second type prediction unit is determined, the motion vector of the searched first dividing block may be used for instructing the search process of the current second dividing block, that is, a location corresponding to the motion vector of the searched first dividing block may be used as one of starting search points of the current second dividing block. Alternatively, a location corresponding to the motion vector of the searched second dividing block is used as one of candidate starting search points of the current first dividing block, and a location corresponding to the motion vector of the searched first dividing block is to be used as one of the starting search points of the current second dividing block, for example.

[0076] Specifically, in the process of searching for the second dividing block in the second type prediction unit, the video motion estimation apparatus may obtain at least one first candidate starting search point corresponding to the second dividing block in the second type prediction unit through the AMVP technology, and determine whether the first dividing block in the second type prediction unit has been searched, that is, determine whether the first dividing block in the second type prediction unit has been predicted. When the first dividing block in the second type prediction unit is predicted, a prediction result of the first dividing block is obtained. The prediction result may be the motion vector of the first dividing block obtained through prediction. Rate-distortion cost of the location of the first dividing block may be calculated according to the prediction result of the first dividing block, that is, the rate-distortion cost of the location of the first dividing block may be calculated according to the motion vector of the first dividing block. For example, a corresponding location may be determined according to the motion vector of the first dividing block, the rate-distortion cost of the corresponding location is calculated, and the rate-distortion cost of the corresponding location obtained through calculation is set as the rate-distortion cost of the location of the first dividing block. In addition, the rate-distortion cost of each first candidate starting search point is calculated, the point with the minimum rate-distortion cost in at least one first candidate starting search point and the first dividing block is set as a starting search point of the second dividing block in the second type prediction unit, and the starting search point of the second dividing block is set as the second starting search point, so as to perform the operation of searching for, according to a first preset increasing step size, a plurality of first candidate points within the search window range centered on the first starting search point, and calculating rate-distortion cost of each first candidate point.

[0077] For example, the nR × 2N prediction unit is used as an example. Assuming that a dividing block with the index of 0 in the nR × 2N prediction unit has been predicted, in this case, when a dividing block with the index of 1 in the nR × 2N prediction unit is predicted, a location of the motion vector in the prediction result corresponding to the dividing block with the index of 0 may be used as one of locations of the candidate starting search point of the dividing block with the index of 1, so that the point with the minimum rate-distortion cost may be selected as the starting search point from the candidate starting search points. In this way, the starting search point is closer to an optimal location for motion estimation, and may exit the search process faster.

[0078] In some implementations, after the operation of obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point, the video motion estimation method may further include:

obtaining a first supplementary point not searched around each point corresponding to the first preset step size, and calculating rate-distortion cost of the first supplementary point in a case that the search step size corresponding to the first undetermined point is a first preset step size;

setting a location of the first undetermined point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point; and

setting a location of the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is not the first undetermined point.



[0079] Specifically, after the first undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the first undetermined point is the first preset step size. The first preset step size may be flexibly set according to actual needs. For example, the first preset step size may be set to 1, that is, when the search step size corresponding to the first undetermined point is 1, a second supplementary point not searched around each point corresponding to the first preset step size may be obtained, and the second supplementary point may include one or more points, as shown in FIG. 5.

[0080] For example, in FIG. 5, when the search template for searching the second undetermined point is a diamond template, vertexes corresponding to the diamond with the search step size of 1 are four points of 2, 4, 5, and 7 if the search step size corresponding to the obtained second undetermined point is 1. In this case, if the obtained second undetermined point with the minimum rate-distortion cost is a location of 2, then two points of A and B are supplemented at the location of 2, and the two points of A and B may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 5, then two points of D and F are supplemented at the location of 5, and the two points of D and F may be set as second supplementary points. and so on.

[0081] After the first supplementary point is obtained, the video motion estimation apparatus may calculate rate-distortion cost of the first supplementary point, compare the rate-distortion cost of the first supplementary point with the rate-distortion cost of the first undetermined point, and determine whether the point with the minimum rate-distortion cost in the first supplementary point and the first undetermined point is the first undetermined point. A location of the first undetermined point is set as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point. A location of the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is set as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is not the first undetermined point.

[0082] In some implementations, after the operation of obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point, the video motion estimation method may further include:
setting the first undetermined point as a first starting search point, and performing the operation of searching for, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point in a case that the search step size corresponding to the first undetermined point is within a second preset step size threshold range.

[0083] Specifically, after the first undetermined point is obtained, the video motion estimation apparatus may determine whether the search step size corresponding to the first undetermined point is within the second preset step size threshold range, where the second preset step size threshold range may be flexibly set according to actual needs. When the search step size corresponding to the first undetermined point is within the second preset step size threshold range, the first undetermined point is set as a first starting search point, and the operation of searching for, according to the first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point, and calculating rate-distortion cost of each first candidate point is performed.

[0084] After the current motion vector of the second type prediction unit is obtained, the video motion estimation apparatus may obtain a motion vector of a searched prediction unit in an image frame, and correct the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit. Details may be described as follows.

[0085] After the current motion vector of the second type prediction unit is obtained, the video motion estimation apparatus may obtain a motion vector of a searched prediction unit in an image frame. The searched prediction unit may include one or more prediction units, may include one or more prediction units of the first type prediction unit in the image frame, or may include one or more prediction units of the second type prediction unit in the image frame, or may include both one or more prediction units of the first type prediction unit in the image frame and one or more prediction units of the second type prediction unit in the image frame. Then the current motion vector is corrected according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0086] In some implementations, the operation of obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit may include:

obtaining a motion vector of a searched prediction unit in the image frame, and calculating first target rate-distortion cost of a corresponding location of the second type prediction unit according to the motion vector of the searched prediction unit;

determining current rate-distortion cost of the second type prediction unit according to the current motion vector of the second type prediction unit;

comparing the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost;

setting the motion vector of the searched prediction unit as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost; and

setting a location of a point corresponding to the current rate-distortion cost as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost.



[0087] Specifically, when determining the motion vector of the second type prediction unit, the video motion estimation apparatus may correct the current motion vector of the currently searched second type prediction unit according to the motion vector of the searched prediction unit in the image frame. Specifically, in the process of searching the motion vector of each prediction unit, the video motion estimation apparatus may store the motion vector of the searched prediction unit, and may generate a mapping relationship between a prediction unit identifier and the motion vector.

[0088] In the process of correcting the motion vector of the currently searched second type prediction unit, the video motion estimation apparatus may obtain a mapping relationship corresponding to the searched prediction unit identifier, obtain the motion vector of the searched prediction unit in the image frame according to the mapping relationship, and calculate the first target rate-distortion cost of the corresponding location of the second type prediction unit according to the motion vector of the searched prediction unit. For example, a corresponding location may be determined according to the motion vector of the searched prediction unit, the rate-distortion cost of the corresponding location is calculated, and the rate-distortion cost of the corresponding location obtained through calculation is set as the first target rate-distortion cost.

[0089] Then, the video motion estimation apparatus may compare the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost. If the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost, the motion vector of the searched prediction unit is set as the motion vector of the second type prediction unit. If the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost, a location of a point corresponding to the current rate-distortion cost is set as the motion vector of the second type prediction unit.

[0090] For example, as shown in FIG. 9, if the video motion estimation apparatus searches for a motion vector corresponding to each prediction unit in the order of a 2N × 2N prediction unit, a 2N × N prediction unit, an N × 2N prediction unit, a 2N × nU prediction unit, a 2N × nD prediction unit, an nL × 2N prediction unit, and an nR × 2N prediction unit, motion vectors of the previously searched 2N × 2N prediction unit, 2N × N prediction unit, N × 2N prediction unit, 2N × nU prediction unit, and the like may be used for correcting the motion vector of the currently searched 2N × nD prediction unit when the 2N × nD prediction unit is currently searched.

[0091] In step S104, sub-pixel motion estimation is performed on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

[0092] After the motion vector of the first type prediction unit and the motion vector of the second type prediction unit are obtained, the video motion estimation apparatus may perform sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit. The process of obtaining the motion vector of the first type prediction unit and the motion vector of the second type prediction unit is mainly obtaining an integer-pixel motion vector by performing integer-pixel motion prediction (that is, integer-pixel search) on the image frame. For example, when performing sub-pixel motion estimation on the image frame, the video motion estimation apparatus may perform a half-pixel search and a quarter-pixel precision search according to the motion vector obtained through integer-pixel motion prediction, to obtain a precision motion vector. Motion compensation processing is performed on the precision motion vector, for example, processing such as discrete cosine transform (DCT) quantization, and the like is performed on the obtained precision motion vector to obtain a residual coefficient. Then, the obtained residual coefficient is sent to an entropy encoding module to output a code stream. In addition, after the residual coefficient is inversely quantized and inversely transformed, a residual value of a reconstructed image is obtained, and the reconstructed image is obtained according to the residual value. The reconstructed image enters a reference frame queue after in-loop filtering, and is used as the reference image of the next frame, so that encoding is performed backward frame by frame.

[0093] It may be learned from the foregoing that, image frames in a video may be divided into a plurality of prediction units, and the plurality of prediction units is classified. For example, the plurality of prediction units is divided into a first type prediction unit and a second type prediction unit. For different types of prediction units, motion vectors of different types of prediction units are obtained by using different search algorithms. For example, a motion vector of the first type prediction unit is obtained according to a first search algorithm, and a motion vector of the second type prediction unit is obtained according to a second search algorithm. Subsequently, sub-pixel motion estimation may be performed on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit. According to this solution, a plurality of prediction units may be classified, and the motion vectors of different types of prediction units are obtained by using different search algorithms, which leads to relatively high search efficiency. Therefore, in comparison to the same processing method used for different prediction units in the related art, efficiency and flexibility of performing motion estimation on the video are improved.

[0094] According to the method described in the foregoing embodiment, detailed description is to be given by using examples below.

[0095] The foregoing video motion estimation apparatus is to be described. The video motion estimation apparatus may be integrated in a terminal such as a computer, a mobile phone, a television, or the like that has a storage unit, is equipped with a microprocessor, and has computing capability as a computer. Description is to be given from the perspective of the terminal.

[0096] The terminal may obtain the video from the local or a server, and divide the image frame in the video into a plurality of prediction units such as a 2N × 2N prediction unit, a 2N × N prediction unit, an N × 2N prediction unit, a 2N × nU prediction unit, a 2N × nD prediction unit, an nL × 2N prediction unit, an nR × 2N prediction unit, and the like by using an inter-frame prediction unit PU.

[0097] As shown in FIG. 3, the 2N × N prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 1:1 up and down, and the N × 2N prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 1:1 left and right, the 2N × nU prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 1:3 up and down, the 2N × nD prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 3:1 up and down, the nL × 2N prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 1:3 left and right, and the nR × 2N prediction unit includes a dividing block with an index of 0 and a dividing block with an index of 1 divided at a ratio of 3:1 left and right.

[0098] Then, the terminal may divide the obtained plurality of prediction units into a first type prediction unit and a second type prediction unit symmetrically. The first type prediction unit may include prediction units such as 2N × 2N, 2N × N, N × 2N, and the like in the symmetric mode, and the second type prediction unit may include prediction units such as 2N × nU, 2N × nD, nL × 2N, nR × 2N, and the like in the asymmetric mode.

[0099] For the first type prediction unit and the second type prediction unit, the terminal may respectively use different search algorithms to search for the motion vector of the prediction unit. Details are to be described below.

[0100] For the first type prediction unit, FIG. 10 is a schematic flowchart of searching for a motion vector of a first type prediction unit according to an embodiment of this disclosure. The method process may include:

[0101] S201: A terminal obtains a second candidate starting search point corresponding to a first type prediction unit, and sets a second candidate starting search point with the minimum rate-distortion cost as a second starting search point.

[0102] The terminal may obtain one or more second candidate starting search points through the AMVP technology or the Merge mode, calculate rate distortion cost of each second candidate starting search point, and set the second candidate starting search point with the minimum rate-distortion cost as a second starting search point, that is, the second starting search point is a finally determined starting search point corresponding to the first type prediction unit.

[0103] The formula for calculating the rate-distortion cost may be: rdcost = sad + lamdabit, where rdcost represents the rate-distortion cost, sad represents a residual error, that is, a motion compensation prediction error, lamda represents a constant coefficient, which may be a Lagrangian factor, and bit represents a code rate, that is, a quantity of encoded bits of motion vector related information.

[0104] The first type prediction unit may include a third dividing block with an index of 0 and a fourth dividing block with an index of 1. The terminal may separately search for motion vectors of the third dividing block and the fourth dividing block in the first type prediction unit. When the starting search point of the fourth dividing block in the first type prediction unit is determined, a location corresponding to the motion vector of the searched third dividing block may be used as one of candidate starting search points of the current fourth dividing block. Specifically, in the process of searching for the fourth dividing block in the first type prediction unit, the terminal may obtain at least one second candidate starting search point corresponding to the fourth dividing block in the first type prediction unit through the AMVP technology, and determine whether the third dividing block in the first type prediction unit has been predicted. When the third dividing block in the first type prediction unit has been predicted, a motion vector of the third dividing block obtained through prediction is obtained, a prediction point corresponding to the motion vector of the third dividing block obtained through prediction is determined, and rate-distortion cost of each second candidate starting search point and the third dividing block is calculated. The point with the minimum rate-distortion cost in the at least one second candidate starting search point and the third dividing block is set as the starting search point of the fourth dividing block in the first type prediction unit, and the starting search point of the fourth dividing block is set as the second starting search point, to perform step S202.

[0105] For example, a 2N × N prediction unit is used as an example. Assuming that a dividing block with the index of 0 in the 2N × N prediction unit has been predicted, in this case, when a dividing block with the index of 1 in the 2N × N prediction unit is predicted, a location corresponding to the motion vector in the prediction result corresponding to the dividing block with the index of 0 may be used as one of locations of the candidate starting search point of the dividing block with the index of 1, so that the point with the minimum rate-distortion cost may be selected as the starting search point from the candidate starting search points. In this way, the starting search point is closer to an optimal location for motion estimation, and may exit the search process faster.

[0106] S202: The terminal obtains, according to a second preset increasing step size, a plurality of second candidate points within a search window range centered on the second starting search point, and selects a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point.

[0107] After the second undetermined point is obtained, the terminal may perform searching, according to the second preset increasing step size by using a diamond template, a square template, or the like, within the search window range centered on the second starting search point, to obtain the plurality of second candidate points.

[0108] For example, the square template is used as an example, and the second starting search point is used as a center of the square template. From a search step size of 1, a plurality of second candidate points are obtained, according to the second preset increasing step size, within the search window range centered on the second starting search point. The second preset increasing step size may increase by an integer power of 2, that is, from the search step size of 1, searching is performed with the search step sizes of 2, 4, and 8 in turn, to obtain a plurality of second candidate points. The second candidate points may be vertexes of the square template corresponding to each search step size, a point corresponding to a quarter between two vertexes, and the like. When a maximum search step size is set to 8, a corresponding search window range is an inner ring region of the square template corresponding to the search step size 8. When a maximum search step size is set to 16, a corresponding search window range is an inner ring region of the square template corresponding to the search step size 16, and so on.

[0109] Then, the rate-distortion cost of each second candidate point is calculated, the point with the minimum rate-distortion cost is selected from the plurality of second candidate points, and the point with the minimum rate-distortion cost in the plurality of second candidate points is set as the second undetermined point.

[0110] S203: The terminal obtains a second supplementary point not searched around each point corresponding to the second preset step size in a case that the search step size corresponding to the second undetermined point is a second preset step size.

[0111] After the second undetermined point is obtained, the terminal may determine whether the search step size corresponding to the second undetermined point is a second preset step size. The second preset step size may be flexibly set according to actual needs, for example, the second preset step size may be set to 1, 2, or the like.

[0112] The terminal obtains a second supplementary point not searched around each point corresponding to the second preset step size in a case that the search step size corresponding to the second undetermined point is a second preset step size.

[0113] For example, in a case that the search template for searching for the second undetermined point is a square template and the search step size corresponding to the obtained second undetermined point is 1, vertexes corresponding to the square with the search step size of 1 are four points of 1, 3, 6, and 8, and 2, 4, 5, and 7 are midpoints of each side of the square. In this case, if the obtained second undetermined point with the minimum rate-distortion cost is a location of 1, then two points of A and C are supplemented at the location of 1, and the two points of A and C may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 2, then two points of A and B are supplemented at the location of 2, and the two points of A and B may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 3, then two points of B and D are supplemented at the location of 3, and the two points of B and D may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 4, then two points of C and E are supplemented at the location of 4, and the two points of C and E may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 5, then two points of D and F are supplemented at the location of 5, and the two points of D and F may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 6, then two points of E and G are supplemented at the location of 6, and the two points of E and G may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 7, then two points of G and H are supplemented at the location of 7, and the two points of G and H may be set as second supplementary points. If the obtained second undetermined point with the minimum rate-distortion cost is a location of 8, then two points of F and H are supplemented at the location of 8, and the two points of F and H may be set as second supplementary points.

[0114] S204: The terminal determines whether a point with minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point; if yes, performs step S205; and if not, performs step S206.

[0115] After the second supplementary point is obtained, the terminal may calculate rate-distortion cost of each second supplementary point, compare the rate-distortion cost of the second supplementary point with the rate-distortion cost of the second undetermined point, and determine whether the point with the minimum rate-distortion cost in the second supplementary point and the second undetermined point is the second undetermined point.

[0116] S205: The terminal sets a location of the second undetermined point as a motion vector of the first type prediction unit, and corrects the motion vector.

[0117] S206: A location of the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is set as a motion vector of a first type image block, and the motion vector is corrected.

[0118] The terminal sets the location of the second undetermined point as a motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point. The terminal sets the location of a point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point as the motion vector of the first type image block in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point.

[0119] In this case, the terminal may correct the motion vector of the first type prediction unit. Specifically, in the process of searching for the motion vector of each prediction unit, the terminal may store the motion vector of the searched prediction unit, and may generate a mapping relationship between a prediction unit identifier and the motion vector.

[0120] In the process of correcting the motion vector of the currently searched first type prediction unit, the terminal may obtain a mapping relationship corresponding to the searched prediction unit identifier, obtain the motion vector of the searched prediction unit in the image frame according to the mapping relationship, and calculate second target rate-distortion cost of the first type prediction unit according to the motion vector of the searched prediction unit. Then, the rate-distortion cost of the second undetermined point may be compared with the second target rate-distortion cost.

[0121] In a case that rate-distortion cost cost best of the second undetermined point is greater than second target rate-distortion cost cost ref, a motion vector mv ref of the searched prediction unit is set as a motion vector mv best of the first type prediction unit, that is, the motion vector mv best of the first type prediction unit is corrected to the motion vector mv ref of the searched prediction unit: mv best = mv ref. The location of the second undetermined point is set as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is less than or equal to the second target rate-distortion cost.

[0122] For example, the motion vector of each prediction unit may be named in advance, and a naming algorithm may be: mv_best_prediction unit type_prediction unit index, for example, mv_best_2N × N_PU1 indicates a motion vector of a dividing block with an index of 1 in the 2N × N prediction unit. Assuming that the terminal has searched for motion vectors of a 2N × 2N prediction unit and the 2N × N prediction unit, then during current searching of a motion vector of an N × 2N prediction unit, the motion vector of the N × 2N prediction unit may be corrected by using the motion vectors of the 2N × 2N prediction unit and the 2N × N prediction unit. For example, for motion vectors of a dividing block PU0 with an index of 0 and a dividing block PU1 with an index of 1 in the N × 2N prediction unit, reference may be made to the motion vectors of the 2N × 2N prediction unit and the 2N × N prediction unit = {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1}.

[0123] S207: The terminal performs searching, according to a preset interval step size, within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range, to obtain a plurality of search points, uses the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points as a second starting search point, and performs step S202.

[0124] After the second undetermined point is obtained, the terminal may determine whether the search step size corresponding to the second undetermined point is within a third preset step size threshold range, where the third preset step size threshold range may be flexibly set according to actual needs, and a specific value is not limited herein.

[0125] Searching is performed according to a preset interval step size within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range, to obtain a plurality of search points. The preset range and the preset interval step size may be flexibly set according to actual needs, and a specific value is not limited herein. For example, as shown in FIG. 6, within the search window range centered on the second undetermined point, all points are scanned every 5 rows and 5 columns by raster scanning, to obtain a plurality of search points.

[0126] Then, rate-distortion cost of each search point is calculated, the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points is used as the second starting search point, and the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point is performed.

[0127] S208: When the search step size corresponding to the second undetermined point is within a fourth preset step size threshold range, the terminal uses the second undetermined point as a second starting search point, and performs step S202.

[0128] After the second undetermined point is obtained, the terminal may determine whether the search step size corresponding to the second undetermined point is within the fourth step size threshold range, where the fourth preset step size threshold range may be flexibly set according to actual needs, and the specific content is not limited herein. When a search step size corresponding to the second undetermined point is within a fourth preset step size threshold range, the second undetermined point is used as the second starting search point, and the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point is performed.

[0129] For a second type prediction unit, FIG. 11 is a schematic flowchart of searching for a motion vector of a second type prediction unit according to an embodiment of this disclosure. The method process may include:

[0130] S301: A terminal obtains a first candidate starting search point corresponding to a second type prediction unit, and sets a first candidate starting search point with the minimum rate-distortion cost as a first starting search point. The terminal may obtain the first candidate starting search point corresponding to the second type prediction unit through the AMVP technology or the Merge mode, then calculate rate distortion cost of each first candidate starting search point, and set the first candidate starting search point with the minimum rate-distortion cost as a first starting search point, that is, the first starting search point is a finally determined starting search point corresponding to the second type prediction unit.

[0131] The second type prediction unit may include a first dividing block with an index of 0 and a second dividing block with an index of 1. The terminal may separately search for motion vectors of the first dividing block and the second dividing block in the second type prediction unit. When the starting search point of the second dividing block in the second type prediction unit is determined, a location corresponding to the motion vector of the searched first dividing block may be used as one of starting search points of the current second dividing block. Specifically, in the process of searching for the second dividing block in the second type prediction unit, the terminal may obtain at least one first candidate starting search point corresponding to the second dividing block in the second type prediction unit through the AMVP technology, and determine whether the first dividing block in the second type prediction unit has been searched, that is, determine whether the first dividing block in the second type prediction unit has been predicted. When the first dividing block in the second type prediction unit has been predicted, a motion vector of the first dividing block obtained through prediction is obtained, a prediction point corresponding to the motion vector of the first dividing block obtained through prediction is determined, and rate-distortion cost of each first candidate starting search point and the first dividing block is calculated. The point with the minimum rate-distortion cost in the at least one first candidate starting search point and the first dividing block is set as the starting search point of the second dividing block in the second type prediction unit, and the starting search point of the second dividing block is set as the second starting search point, to perform step S302.

[0132] For example, a 2N × nD prediction unit is used as an example. If a dividing block with the index of 0 in the 2N × nD prediction unit has been predicted, in this case, when a dividing block with the index of 1 in the 2N × nD prediction unit is predicted, a location of the motion vector corresponding to the dividing block with the index of 0 may be used as one of locations of the candidate starting search point of the dividing block with the index of 1, so that the point with the minimum rate-distortion cost may be selected as the starting search point from the candidate starting search points. In this way, the starting search point is closer to an optimal location for motion estimation, and may exit the search process faster.

[0133] S302: The terminal obtains, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point, and selects a point with the minimum rate-distortion cost from the plurality of first candidate points, to obtain a first undetermined point.

[0134] After the first starting search point is obtained, the terminal may search for, according to the first preset increasing step size, a plurality of first candidate points within the search window range centered on the first starting search point. The search window range may be a search range of a diamond template or a square template. For example, the search window range may be an inner ring region corresponding to a maximum search step size of the diamond template or the square template. For example, when the maximum search step size of the diamond template is set to 8, the corresponding search window range is the inner ring region of the diamond template corresponding to a search step size of 8. The first preset increasing step size may be a step size that increases by an integer power of 2, or may be flexibly set according to actual needs.

[0135] For example, the square template is used as an example, and the first starting search point is used as a center of the square template. From a search step size of 1, a plurality of first candidate points are searched, according to a search step size increasing by an integer power of 2, within the search window range centered on the first starting search point, to obtain a plurality of first candidate points. The first candidate points may be vertexes of the square template corresponding to each search step size, a point corresponding to a quarter between two vertexes, and the like.

[0136] Then, the rate-distortion cost of each first candidate point is calculated, the point with the minimum rate-distortion cost is selected from the plurality of first candidate points, and the point with the minimum rate-distortion cost in the plurality of first candidate points is set as the first undetermined point.

[0137] S303: When a search step size of the first undetermined point is within a first preset step size threshold range, the terminal obtains a polygonal model centered on the first undetermined point, and selects a point with the minimum rate-distortion cost from a midpoint of the polygonal model and each vertex, to obtain a first target point.

[0138] After the first undetermined point is obtained, the terminal may determine whether the search step size corresponding to the first undetermined point is within a first preset step size threshold range, where the first preset step size threshold range may be flexibly set according to actual needs, and a specific value is not limited herein.

[0139] When a search step size of the first undetermined point is within the first preset step size threshold range, the terminal obtains a polygonal model centered on the first undetermined point, and the polygonal model may be quadrilateral, hexagonal, or the like.

[0140] After the polygonal model is obtained, the terminal may calculate rate-distortion cost of locations of the center of the polygonal model and each vertex, and set a point with the minimum rate-distortion cost in the center of the polygonal model and each vertex as the first target point.

[0141] S304: When the first target point is consistent with the first undetermined point, the terminal sets a location of the first target point as a current motion vector of the second type prediction unit, and corrects the current motion vector, to obtain a motion vector of the second type prediction unit.

[0142] After the first target point is obtained, the terminal may determine whether the first target point is consistent with the first undetermined point. When the first target point is consistent with the first undetermined point, the terminal may set the location of the first target point as the current motion vector of the second type prediction unit.

[0143] After the current motion vector of the second type prediction unit is obtained, the terminal may obtain a motion vector of a searched prediction unit in an image frame. The searched prediction unit may include one or more prediction units, and correct the current motion vector of the second prediction unit according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0144] Specifically, in the process of searching the motion vector of each prediction unit, the terminal may store the motion vector of the searched prediction unit, and may generate a mapping relationship between a prediction unit identifier and the motion vector. In the process of correcting the motion vector of the currently searched second type prediction unit, the terminal may obtain a mapping relationship corresponding to the searched prediction unit identifier, obtain the motion vector of the searched prediction unit in the image frame according to the mapping relationship, and calculate first target rate-distortion cost of the second type prediction unit according to the motion vector of the searched prediction unit.

[0145] Then, the terminal may compare the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost. If the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost, the motion vector of the searched prediction unit is set as the motion vector of the second type prediction unit. If the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost, a location of a point corresponding to the current rate-distortion cost is set as the motion vector of the second type prediction unit.

[0146] For example, the motion vector of each prediction unit may be named in advance, and a naming algorithm may be: mv_best_prediction unit type_prediction unit index, for example, mv_best_2N×N_PU1 indicates a motion vector of a dividing block with an index of 1 in a 2N × N prediction unit. For the 2N × N prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1}.

[0147] For an N × 2N prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1}.

[0148] For a 2N × nU prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1, mv_best_N × 2N_PU0, mv_best_N × 2N_PU1}.

[0149] For a 2N × nD prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1, mv_best_N × 2N_PU0, mv_best_N × 2N_PU1, mv_best_2N × nU_PU0, mv_best_2N × nU_PU1}.

[0150] For an nL × 2N prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1, mv_best_N × 2N_PU0, mv_best_N × 2N_PU1, mv_best_2N × nU_PU0, mv_best_2N × nU_PU1, mv_best_2N × nD_PU0, mv_best_2N × nD_PU1}.

[0151] For an nR × 2N prediction unit, the motion vector of the searched prediction unit in the image frame may include: {mv_best_2N × 2N_PU0, mv_best_2N × 2N_PU1, mv_best_2N × N_PU0, mv_best_2N × N_PU1, mv_best_N × 2N_PU0, mv_best_N × 2N_PU1, mv_best_2N × nU_PU0, mv_best_2N × nU_PU1, mv_best_2N × nD_PU0, mv_best_2N × nD_PU1, mv_best_nL × 2N_PU0, mv_best_nL × 2N_PU1}.

[0152] S305: When the first target point is inconsistent with the first undetermined point, the terminal moves a center of the polygonal model to a location of the first target point, and selects a point with the minimum rate-distortion cost from the center of the moved polygonal model and each vertex, to obtain an optimal point.

[0153] When the first target point is inconsistent with the first undetermined point, the terminal may move a center of the polygonal model to a location of the first target point, and an original shape remains unchanged after the polygonal model is moved. Then the rate-distortion cost of locations of the center of the moved polygonal model and each vertex is calculated, and the point with the minimum rate-distortion cost in the center of the moved polygonal model and each vertex is set as the optimal point.

[0154] For example, as shown in FIG. 8, in a case that the polygonal model is a hexagonal model and the point (that is, the optimal point) with the minimum rate-distortion cost obtained by calculating rate-distortion cost of a center of the hexagonal model and each vertex in FIG. 8 (a) is a location of a right vertex of the hexagonal model, the center of the hexagonal model is moved to the location of the right vertex, as shown in FIG. 8 (b). In this case, the rate-distortion cost of a center of the moved hexagonal model and each vertex is calculated. If the obtained point with the minimum rate-distortion cost is a location of a top right vertex of the hexagonal model, the center of the hexagonal model is moved to the location of the top right vertex, as shown in FIG. 8(c). In this case, the rate-distortion cost of the center and each vertex of the moved hexagonal model is calculated. If the obtained point with the minimum rate-distortion cost is a location of a top left vertex of the hexagonal model, the center of the hexagonal model is moved to the location of the top left vertex, as shown in FIG. 8(d). In this case, the rate-distortion cost of the center and each vertex of the moved hexagonal model is calculated. If the obtained point with the minimum rate-distortion cost is a location of the center of the hexagonal model, that is, the optimal point is the location of the center of the hexagonal model, then the hexagonal model is no longer moved, and the location (that is, the location of the optimal point) of the center of the hexagonal model is set as the current motion vector of the second type prediction unit.

[0155] S306: The terminal determines whether the optimal point is consistent with the first target point; if yes, performs step S307; and if not, performs step S308.

[0156] After the optimal point is obtained, the terminal may determine whether the optimal point is consistent with the first target point.

[0157] S307: The terminal sets a location of the optimal point as a current motion vector of the second type prediction unit, and corrects the current motion vector, to obtain a motion vector of the second type prediction unit.

[0158] If the optimal point is consistent with the first target point, the terminal may set a location of the optimal point as the current motion vector of the second type prediction unit. In addition, the terminal may correct the obtained current motion vector of the second type prediction unit according to the method of correcting the current motion vector of the second type prediction unit.

[0159] S308: The terminal sets the optimal point as the first starting search point, and performs step S302.

[0160] If the optimal point is inconsistent with the first target point, the terminal sets the optimal point as the first starting search point, and performs the operation of searching, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point, and selecting the point with the minimum rate-distortion cost from the plurality of first candidate points, to obtain the first undetermined point.

[0161] S309: The terminal obtains a first supplementary point not searched around each point corresponding to the first preset step size in a case that the search step size corresponding to the first undetermined point is a first preset step size.

[0162] After the first undetermined point is obtained, the terminal may determine whether the search step size corresponding to the first undetermined point is the first preset step size, where the first preset step size threshold range may be flexibly set according to actual needs, and a specific value is not limited herein. The terminal may obtain a first supplementary point not searched around each point corresponding to the first preset step size in a case that the search step size corresponding to the first undetermined point is the first preset step size.

[0163] For example, in a case that the search template for searching for the first undetermined point is a square template and the search step size corresponding to the obtained first undetermined point is 1, vertexes corresponding to the square with the search step size of 1 are four points of 1, 3, 6, and 8, and 2, 4, 5, and 7 are midpoints of each side of the square. In this case, if the obtained first undetermined point with the minimum rate-distortion cost is a location of 1, then two points of A and C are supplemented at the location of 1, and the two points of A and C may be set as first supplementary points. If the obtained first undetermined point with the minimum rate-distortion cost is a location of 3, then two points of B and D are supplemented at the location of 3, and the two points of B and D may be set as first supplementary points. If the obtained first undetermined point with the minimum rate-distortion cost is a location of 6, then two points of E and G are supplemented at the location of 6, and the two points of E and G may be set as first supplementary points. If the obtained first undetermined point with the minimum rate-distortion cost is a location of 8, then two points of F and H are supplemented at the location of 8, and the two points of F and H may be set as first supplementary points.

[0164] S310: The terminal determines whether the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point; if yes, performs step S311; and if not, performs step S312.

[0165] After the first supplementary point is obtained, the terminal may calculate rate-distortion cost of the first supplementary point, compare the rate-distortion cost of the first supplementary point with the rate-distortion cost of the first undetermined point, and determine whether the point with the minimum rate-distortion cost in the first supplementary point and the first undetermined point is the first undetermined point.

[0166] S311: The terminal sets a location of the first undetermined point as a current motion vector of the second type prediction unit, and corrects the current motion vector, to obtain a motion vector of the second type prediction unit.

[0167] A location of the first undetermined point is set as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point. In addition, the terminal may correct the obtained current motion vector of the second type prediction unit according to the method of correcting the current motion vector of the second type prediction unit, to obtain a motion vector of a second type image block.

[0168] S312: The terminal sets a location of a point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point as a current motion vector of the second type image block, and corrects the current motion vector, to obtain the motion vector of the second type image block.

[0169] The terminal may set the location of a point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point as the current motion vector of the second type image block in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is not the first undetermined point. In addition, the terminal may correct the obtained current motion vector of the second type prediction unit according to the method of correcting the current motion vector of the second type prediction unit, to obtain the motion vector of the second type image block.

[0170] S313: When the search step size corresponding to the first undetermined point is within a second preset step size threshold range, the terminal sets the first undetermined point as the first starting search point, and performs step S302.

[0171] After the first undetermined point is obtained, the terminal may determine whether the search step size corresponding to the first undetermined point is within a second preset step size threshold range, where the second preset step size threshold range may be flexibly set according to actual needs, and a specific value is not limited herein.

[0172] When the search step size corresponding to the first undetermined point is within the second preset step size threshold range, the first undetermined point is set as the first starting search point, and the operation of searching for, according to the first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point, and selecting a point with the minimum rate-distortion cost from the plurality of first candidate points, to obtain the first undetermined point is performed.

[0173] After the motion vector of the first type prediction unit and the motion vector of the second type prediction unit are obtained, the terminal may perform sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit. For example, the terminal may perform processing such as discrete cosine transform and quantization according to the obtained motion vector, to obtain a residual coefficient. Then, the obtained residual coefficient is sent to an entropy encoding module to output a code stream. In addition, after the residual coefficient is inversely quantized and inversely transformed, a residual value of a reconstructed image is obtained, and the reconstructed image is obtained according to the residual value. The reconstructed image enters a reference frame queue after in-loop filtering, and is used as the reference image of the next frame, so that encoding is performed backward frame by frame.

[0174] In the embodiments of this disclosure, the image frame in a video may be divided into a plurality of prediction units, and the plurality of prediction units are divided into a first type prediction unit and a second type prediction unit. For the first type prediction unit, a more complex search algorithm may be used for searching, and for the second type prediction unit, a fast search algorithm may be used for searching, thereby accelerating the process of motion estimation. In addition, when there are two dividing blocks in one prediction unit, for the dividing block searched later, reference may be made to the final search result of the searched dividing block, thereby accelerating the process of motion estimation. Moreover, some results that a partial optimal location may be searched are corrected by using a correction strategy to avoid a search error, so that an encoding speed is greatly increased, and a compression ratio loss is less.

[0175] To facilitate better implementation of the video motion estimation method provided in the embodiments of this disclosure, an embodiment of this disclosure further provides an apparatus based on the foregoing video motion estimation method. The meaning of the noun is the same as that in the foregoing video motion estimation method. For specific implementation details, refer to the description in the method embodiment.

[0176] FIG. 12 is a schematic structural diagram of a video motion estimation apparatus according to an embodiment of this disclosure. The video motion estimation apparatus may include a dividing unit 401, a first obtaining unit 402, a second obtaining unit 403, and a motion estimation unit 404.

[0177] The dividing unit 401 is configured to divide image frames in a video into a plurality of prediction units, and divide the plurality of prediction units into a first type prediction unit and a second type prediction unit.

[0178] For specific implementation of the dividing unit 401, reference may be made to the embodiment described for step S101.

[0179] The first obtaining unit 402 is configured to obtain a motion vector of the first type prediction unit according to a first search algorithm.

[0180] For specific implementation of the first obtaining unit 402, reference may be made to the embodiment described for step S102.

[0181] In some implementations, as shown in FIG. 14, the first obtaining unit 402 may include a second obtaining subunit 4021, a calculation subunit 4022, a third obtaining subunit 4023, a third setting subunit 4024, a fourth setting subunit 4025, and the like, which may be specifically described below.

[0182] The second obtaining subunit 4021 is configured to obtain a second candidate starting search point corresponding to the first type prediction unit, calculate rate-distortion cost of each second candidate starting search point, and set a second candidate starting search point with the minimum rate-distortion cost as a second starting search point.

[0183] The calculation subunit 4022 is configured to obtain, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculate rate-distortion cost of each second candidate point, and select a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point.

[0184] The third obtaining subunit 4023 is configured to obtain a second supplementary point not searched around each point corresponding to the second preset step size, and calculate rate-distortion cost of the second supplementary point in a case that the search step size corresponding to the second undetermined point is a second preset step size.

[0185] The third setting subunit 4024 is configured to set a location of the second undetermined point as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point.

[0186] The fourth setting subunit 4025 is configured to set the second undetermined point as the second starting search point when the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point, and the calculation subunit performs the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain the second undetermined point.

[0187] For specific implementation of the second obtaining subunit 4021, the calculation subunit 4022, the third obtaining subunit 4023, the third setting subunit 4024, and the fourth setting subunit 4025, reference may be made to the embodiment described for the operation of obtaining the motion vector of the first type prediction unit according to the first search algorithm.

[0188] Optionally, the third setting subunit 4024 is specifically configured to:

obtain a motion vector of a searched prediction unit in the image frame, and calculate second target rate-distortion cost of a corresponding location of the first type prediction unit according to the motion vector of the searched prediction unit;

compare rate-distortion cost of the second undetermined point with the second target rate-distortion cost;

set the motion vector of the searched prediction unit as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is greater than the second target rate-distortion cost; and

set the location of the second undetermined point as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is less than or equal to the second target rate-distortion cost.



[0189] For specific implementation of the third setting subunit 4024, reference may be made to the embodiment described for the operation of setting the location of the second undetermined point as the motion vector of the first type prediction unit.

[0190] Optionally, the second type prediction unit includes a third dividing block and a fourth dividing block. The second obtaining subunit 4021 is specifically configured to:

obtain at least one second candidate starting search point corresponding to the fourth dividing block in the first type prediction unit through advanced motion vector prediction;

obtain a prediction result of the third dividing block, calculate rate-distortion cost of each second candidate starting search point, and calculate rate-distortion cost of a location of the third dividing block according to the prediction result of the third dividing block in a case that the third dividing block in the first type prediction unit is predicted; and

set the point with the minimum rate-distortion cost in the at least one second candidate starting search point and the third dividing block as the starting search point of the fourth dividing block in the first type prediction unit, and set the starting search point of the fourth dividing block as the second starting search point.



[0191] For specific implementation of the second obtaining subunit 4021, reference may be made to the embodiment described for the operation of obtaining a second candidate starting search point corresponding to the first type prediction unit, calculating rate-distortion cost of each second candidate starting search point, and setting a second candidate starting search point with the minimum rate-distortion cost as a second starting search point.

[0192] In some implementations, the first obtaining unit 402 may further include:

a search subunit configured to perform searching, according to a preset interval step size, within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range, to obtain a plurality of search points, and calculate rate-distortion cost of each search point; and

a first execution subunit configured to use the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points as the second starting search point, a calculation subunit performing the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point. For specific implementation of the search subunit and the first execution subunit, reference may be made to the embodiment described when the search step size corresponding to the second undetermined point is within the third preset step size threshold range.



[0193] In some implementations, the first obtaining unit 402 may further include:
a second execution subunit configured to use the second undetermined point as the second starting search point, a calculation subunit performing the operation of obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point in a case that a search step size corresponding to the second undetermined point is within a fourth preset step size threshold range.

[0194] For specific implementation of the second execution subunit, reference may be made to the embodiment described when the search step size corresponding to the second undetermined point is within the fourth preset step size threshold range.

[0195] The second obtaining unit 403 is configured to obtain a motion vector of the second type prediction unit according to a second search algorithm.

[0196] In some implementations, as shown in FIG. 13, the second obtaining unit 403 may include a first obtaining subunit 4031 and a correction subunit 4032, and the like, which may be specifically described below.

[0197] The first obtaining subunit 4031 is configured to obtain a polygonal model according to the second search algorithm, and obtain a current motion vector of the second type prediction unit by moving the polygonal model.

[0198] The correction subunit 4032 is configured to obtain a motion vector of a searched prediction unit in an image frame, and correct the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0199] For specific implementation of the second obtaining unit 403, reference may be made to the embodiment described for step S103.

[0200] In some implementations, the first obtaining subunit 4031 may include:

a search module configured to obtain a first undetermined point in the second type prediction unit according to the second search algorithm;

an obtaining module configured to obtain a polygonal model centered on the first undetermined point, and obtain a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range;

a mobile module configured to move the polygonal model, and obtain an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and

a first setting module configured to set a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.



[0201] For specific implementation of the search module, the obtaining module, and the mobile module, reference may be made to the embodiment described for the operation of obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model.

[0202] Optionally, the mobile module may be specifically configured to:

move a center of the polygonal model to a location of the first target point in a case that the first target point is inconsistent with the first undetermined point; and

select a point with the minimum rate-distortion cost from the center of the moved polygonal model and each vertex, to obtain an optimal point.



[0203] For specific implementation of the mobile module, reference may be made to the embodiment described for the operation of moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point.

[0204] Optionally, the first obtaining subunit 4031 may further include:
a second setting module configured to set a location of the first target point as the current motion vector of the second type prediction unit in a case that the first target point is consistent with the first undetermined point.

[0205] In some implementations, the search module may include:
a search submodule configured to obtain a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point.

[0206] The obtaining module is specifically configured to:

obtain a polygonal model centered on the first undetermined point in a case that a search step size corresponding to the first undetermined point is within a first preset step size threshold range; and

select a point with the minimum rate-distortion cost from a midpoint of the polygonal model and each vertex, to obtain the first target point.



[0207] For specific implementation of the search module and the obtaining module, reference may be made to the embodiment described for the operation of obtaining a first undetermined point in the second type prediction unit according to the second search algorithm, obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range.

[0208] Optionally, the search submodule may be specifically configured to:

obtain a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm;

calculate rate-distortion cost of each first candidate starting search point, and set the first candidate starting search point with the minimum rate-distortion cost as a first starting search point;

obtain, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point; and

select a point with minimum rate-distortion cost from the plurality of first candidate points, to obtain the first undetermined point.



[0209] For specific implementation of the search submodule, reference may be made to the embodiment described for the operation of obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point.

[0210] In some implementations, the second type prediction unit includes a first dividing block and a second dividing block. The search submodule is specifically configured to:

obtain at least one first candidate starting search point corresponding to the second dividing block in the second type prediction unit through advanced motion vector prediction according to the second search algorithm;

obtain a prediction result of the first dividing block, calculate rate-distortion cost of each first candidate starting search point, and calculate rate-distortion cost of a location of the first dividing block according to the prediction result of the first dividing block in a case that the first dividing block in the second type prediction unit is predicted;

obtain the point with the minimum rate-distortion cost from the least one first candidate starting search point and the first dividing block; and

set the obtained point with the minimum rate-distortion cost as a starting search point of the second dividing block in the second type prediction unit, and set the starting search point of the second dividing block as the first starting search point.



[0211] For specific implementation of the first dividing block, the second dividing block, and the search submodule, reference may be made to the embodiment described for the operation of obtaining a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm, calculating rate-distortion cost of each first candidate starting search point, and setting a first candidate starting search point with the minimum rate-distortion cost as a first starting search point.

[0212] In some implementations, the obtaining module may be specifically configured to:

obtain a first supplementary point not searched around each point corresponding to the first preset step size, and calculate rate-distortion cost of the first supplementary point in a case that the search step size corresponding to the first undetermined point is a first preset step size;

set a location of the first undetermined point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point; and

set a location of the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is not the first undetermined point.



[0213] For specific implementation of the obtaining module, reference may be made to the embodiment described after the operation of obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point.

[0214] In some implementations, the obtaining module may be specifically configured to:
set the first undetermined point as a first starting search point, and perform the operation of obtaining, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point in a case that the search step size corresponding to the first undetermined point is within a second preset step size threshold range.

[0215] In some implementations, the correction subunit 4032 is specifically configured to:

obtain a motion vector of a searched prediction unit in the image frame, and calculate first target rate-distortion cost of a corresponding location of the second type prediction unit according to the motion vector of the searched prediction unit;

determine current rate-distortion cost of the second type prediction unit according to the current motion vector of the second type prediction unit;

compare the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost;

set the motion vector of the searched prediction unit as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost; and

set a location of a point corresponding to the current rate-distortion cost as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost.



[0216] For specific implementation of the correction subunit 4032, reference may be made to the embodiment described for the operation of obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0217] The motion estimation unit 404 is configured to perform sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

[0218] For specific implementation of the motion estimation unit 404, reference may be made to the embodiment described for step S104.

[0219] Correspondingly, an embodiment of this disclosure further provides a terminal. As shown in FIG. 15, the terminal may include components such as a radio frequency (RF) circuit 601, a memory 602 including one or more computer readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless fidelity (WiFi) module 607, a processor 608 including one or more processing cores, a power supply 609, and the like. A person skilled in the art may understand that the terminal structure shown in FIG. 15 does not constitute a limitation on the terminal, and may include more or fewer components than shown, or combine some components, or have different component arrangements.

[0220] The RF circuit 601 may be configured to receive and send a signal during the sending and receiving of information or during a call. In particular, downlink information of a base station is processed by one or more processors 608 after being received. In addition, uplink data is sent to the base station. Generally, the RF circuit 601 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), duplexer, and the like. In addition, the RF circuit 601 may further communicate with other devices via wireless communication and a network. The wireless communication may use any communication standard or protocol, including but not limited to the Global System of Mobile Communication (GSM), general packet radio service (GPRS), and Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, short messaging service (SMS), and the like.

[0221] The memory 602 may be configured to store a computer readable instruction and a module, and the processor 608 executes various function applications and performs data processing by running the computer readable instruction and the module that are stored in the memory 602. The memory 602 may mainly include a computer readable instruction storage area and a data storage area, where the computer readable instruction storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, and the like), and the like. The data storage area may store data (such as audio data, a phone book, and the like) created according to the use of the terminal, and the like. In addition, the memory 602 may include a high speed random access memory, and may further include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device or other non-volatile solid state storage devices. Accordingly, the memory 602 may further include a memory controller to provide access to the memory 602 by the processor 608 and the input unit 603.

[0222] The input unit 603 may be configured to receive information about an input number or character, and generate input of a keyboard, a mouse, a joystick, an optical or trackball signal that are related to user settings and function control. Specifically, in a specific embodiment, the input unit 603 may include a touch-sensitive surface and other input devices. The touch-sensitive surface is also referred to as a touch screen or a touchpad, which may collect a touch operation (for example, an operation on the touch-sensitive surface or near the touch-sensitive surface by a user by using any suitable object or accessory such as a finger, a stylus, and the like) on the touch-sensitive surface or near the touch-sensitive surface, and drive a corresponding connection apparatus according to a preset program. Optionally, the touch-sensitive surface may include a touch detection apparatus and a touch controller. The touch detection apparatus detects a touch orientation of the user, detects a signal brought by the touch operation, and transmits the signal to the touch controller. The touch controller receives touch information from the touch detection apparatus, converts the touch information into a contact coordinate, then sends the contact coordinate to the processor 608, receives and executes a command sent by the processor 608. In addition, a variety of types such as resistive, capacitive, infrared, and surface acoustic waves may be used for implementing the touch-sensitive surface. Except the touch-sensitive surface, the input unit 603 may further include other input devices. Specifically, other input devices may include but are not limited to one or more of a physical keyboard, a function key (such as a volume control key, a switch key, and the like), a trackball, a mouse, a joystick, and the like.

[0223] The display unit 604 may be configured to display information input by the user or provided to the user, and various graphical user interfaces of the terminal. These graphical user interfaces may be composed of graphics, text, icons, videos, and any combination thereof. The display unit 604 may include a display panel. Alternatively, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch-sensitive surface may cover the display panel. After the touch-sensitive surface detects a touch operation on the touch-sensitive surface or near the touch-sensitive surface, the touch operation is transmitted to the processor 608 to determine a type of a touch event, and then the processor 608 provides corresponding visual output on the display panel according to the type of the touch event. Although in FIG. 15, the touch-sensitive surface and the display panel are used as two independent components to implement the input and input functions, but in some embodiments, the touch-sensitive surface and the display panel may be integrated to implement the input and output functions.

[0224] The terminal may further include at least one sensor 605, such as an optical sensor, a motion sensor, and other sensors. Specifically, the optical sensor may include an ambient light sensor and a proximity sensor, where the ambient light sensor may adjust brightness of the display panel according to brightness of the ambient light, and the proximity sensor may turn off the display panel and/or backlight when the terminal moves to an ear. As one type of the motion sensor, a gravity acceleration sensor may detect a magnitude of acceleration in various directions (generally three axes), and may detect a magnitude and a direction of gravity when static, which may be configured to recognize application of mobile phone gestures (such as horizontal and vertical screen switching, related games, and magnetometer posture calibration), vibration recognition related functions (such as pedometer and tap), and the like. For other sensors such as a gyro, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like that may further be configured on the terminal, details are not described herein again.

[0225] The audio circuit 606, a speaker, and a microphone may provide an audio interface between the user and the terminal. The audio circuit 606 may transmit, to the speaker, an electrical signal obtained through conversion of the received audio data, and the speaker converts the electrical signal into a sound signal to be output. According to another aspect, the microphone converts the collected sound signal into an electrical signal, the electrical signal is converted into audio data after received by the audio circuit 606, and the audio data is sent to another terminal via the RF circuit 601 after being output to the processor 608 for processing, or the audio data is output to the memory 602 for further processing. The audio circuit 606 may further include an earplug jack to provide communication between a peripheral headset and the terminal.

[0226] WiFi is a short-range wireless transmission technology. The terminal may help users send and receive an email, browse a webpage, and access streaming media through the WiFi module 607, which provides users with access to the wireless broadband Internet. Although FIG. 15 shows the WiFi module 607, it may be understood that the WiFi module 607 does not belong to mandatory configuration of the terminal, and may be omitted as needed without changing the scope of the essence of this application.

[0227] The processor 608 is a control center of the terminal, which connects various parts of the entire mobile phone by using various interfaces and lines, perform various functions of the terminal and process data by running or executing the computer readable instruction and/or modules stored in the memory 602, and calling data stored in the memory 602, thereby performing overall monitoring on the mobile phone. Optionally, the processor 608 may include one or more processing cores. Preferably, the processor 608 may integrate an application processor and a modem processor, where the application processor mainly processes an operating system, a user interface, an application program, and the like, and the modem processor mainly processes wireless communication. It may be understood that the foregoing modem processor may not be integrated into the processor 608.

[0228] The terminal further includes a power supply 609 (such as a battery) that supplies power to various components. Preferably, the power supply may be logically connected to the processor 608 through a power management system, so that functions such as charging, discharging, and power management may be managed through the power management system. The power supply 609 may further include any component such as one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.

[0229] Although not shown, the terminal may further include a camera, a Bluetooth module, and the like, and details are not described herein again. Specifically, in this embodiment, the processor 608 in the terminal loads executable files corresponding to processes of one or more application programs into the memory 602 according to the following computer readable instruction, and the processor 608 runs the application programs stored in the memory 602, thereby implementing various functions:
dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit; obtaining a motion vector of the first type prediction unit according to a first search algorithm; obtaining a motion vector of the second type prediction unit according to a second search algorithm; and performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

[0230] Optionally, the operation of obtaining a motion vector of the second type prediction unit according to a second search algorithm may include: obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model; and obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0231] Optionally, the operation of obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model may include:
obtaining a first undetermined point in the second type prediction unit according to the second search algorithm; obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range; moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and setting a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.

[0232] Optionally, the operation of obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit may include:
obtaining a motion vector of a searched prediction unit in the image frame, and calculating first target rate-distortion cost of a corresponding location of the second type prediction unit according to the motion vector of the searched prediction unit; determining current rate-distortion cost of the second type prediction unit according to the current motion vector of the second type prediction unit; comparing the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost; setting the motion vector of the searched prediction unit as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost; and setting a location of a point corresponding to the current rate-distortion cost as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost.

[0233] For specific implementation of the foregoing operations, reference may be made to the previous embodiments, and details are not described herein again.

[0234] It may be learned from the foregoing that, image frames in a video may be divided into a plurality of prediction units, and the plurality of prediction units are classified. For example, the plurality of prediction units are divided into a first type prediction unit and a second type prediction unit. For different types of prediction units, motion vectors of different types of prediction units are obtained by using different search algorithms. For example, a motion vector of the first type prediction unit is obtained according to a first search algorithm, and a motion vector of the second type prediction unit is obtained according to a second search algorithm. Subsequently, sub-pixel motion estimation may be performed on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit. According to this solution, a plurality of prediction units may be classified, and the motion vectors of different types of prediction units are obtained by using different search algorithms, which leads to relatively high search efficiency. Therefore, in comparison to the same processing method used for different prediction units in the related art, efficiency and flexibility of performing motion estimation on the video are improved.

[0235] A person skilled in the art may understand that all or part of the steps in the various methods of the foregoing embodiments may be completed by using the computer readable instruction or completed by using the computer readable instruction to control related hardware. The computer readable instruction may be stored in a computer readable storage medium, loaded and executed by the processor.

[0236] To this end, an embodiment of this disclosure provides a computer readable storage medium storing a plurality of computer readable instructions, and the computer readable instructions can be loaded by a processor to perform the operations in any one of the video motion estimation methods according to the embodiments of this disclosure. For example, the computer readable instruction may perform the following steps:
dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit; obtaining a motion vector of the first type prediction unit according to a first search algorithm; obtaining a motion vector of the second type prediction unit according to a second search algorithm; and performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.

[0237] Optionally, the operation of obtaining a motion vector of the second type prediction unit according to a second search algorithm may include: obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model; and obtaining a motion vector of a searched prediction unit in an image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.

[0238] Optionally, the operation of obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model may include:
obtaining a first undetermined point in the second type prediction unit according to the second search algorithm; obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range; moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and setting a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.

[0239] For specific implementation of the foregoing operations, reference may be made to the previous embodiments, and details are not described herein again.

[0240] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk, an optical disc, or the like.

[0241] Since the computer readable instructions stored in the storage medium may perform the steps of any video motion estimation method in the embodiments of this disclosure, the instructions can implement advantageous effects that may be implemented by any video motion estimation method in the embodiments of this disclosure. The foregoing embodiments may be referred to for details. Details are not further described herein.

[0242] The video motion estimation method, the apparatus, and the system provided in the embodiments of this disclosure are described above in detail. Although the principles and implementations of this disclosure are described by using specific examples in this specification, the descriptions of the foregoing embodiments are merely intended to help understand the method and the core idea of the method of this disclosure. Meanwhile, a person skilled in the art may make modifications to the specific implementations and application range according to the idea of this disclosure. In conclusion, the content of this specification is not to be construed as a limitation to this disclosure.


Claims

1. A video motion estimation method, performed by a terminal, the method comprising:

Dividing image frames in a video into a plurality of prediction units, and dividing the plurality of prediction units into a first type prediction unit and a second type prediction unit;

obtaining a motion vector of the first type prediction unit according to a first search algorithm;

obtaining a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

performing sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.


 
2. The video motion estimation method according to claim 1, the obtaining a motion vector of the second type prediction unit according to a second search algorithm comprising:

obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model; and

obtaining a motion vector of a searched prediction unit in the image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.


 
3. The video motion estimation method according to claim 2, the obtaining a polygonal model according to the second search algorithm, and obtaining a current motion vector of the second type prediction unit by moving the polygonal model comprising:

obtaining a first undetermined point in the second type prediction unit according to the second search algorithm;

obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range;

setting a location of the first target point as the current motion vector of the second type prediction unit in a case that the first target point is consistent with the first undetermined point; and

moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and setting a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.


 
4. The video motion estimation method according to claim 3, the moving the polygonal model, and obtaining an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point comprising:

moving a center of the polygonal model to a location of the first target point in a case that the first target point is inconsistent with the first undetermined point; and

selecting a point with minimum rate-distortion cost from the center of the moved polygonal model and each vertex, to obtain the optimal point.


 
5. The video motion estimation method according to claim 3, the obtaining a first undetermined point in the second type prediction unit according to the second search algorithm, obtaining a polygonal model centered on the first undetermined point, and obtaining a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range comprising:

obtaining a point the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point;

obtaining the polygonal model centered on the first undetermined point in a case that a search step size corresponding to the first undetermined point is within the first preset step size threshold range; and

selecting a point with the minimum rate-distortion cost from a midpoint of the polygonal model and each vertex, to obtain the first target point.


 
6. The video motion estimation method according to claim 5, the obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point comprising:

obtaining a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm;

calculating rate-distortion cost of each first candidate starting search point, and setting the first candidate starting search point with the minimum rate-distortion cost as a first starting search point;

obtaining, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point; and

selecting a point with minimum rate-distortion cost from the plurality of first candidate points, to obtain the first undetermined point.


 
7. The video motion estimation method according to claim 6, the second type prediction unit comprising a first dividing block and a second dividing block, and the obtaining a first candidate starting search point corresponding to the second type prediction unit according to the second search algorithm, calculating rate-distortion cost of each first candidate starting search point, and setting the first candidate starting search point with the minimum rate-distortion cost as a first starting search point comprising:

obtaining a first candidate starting search point corresponding to the second dividing block in the second type prediction unit through advanced motion vector prediction according to the second search algorithm;

obtaining a prediction result of the first dividing block, calculating rate-distortion cost of each first candidate starting search point, and calculating rate-distortion cost of a location of the first dividing block according to the prediction result of the first dividing block in a case that the first dividing block in the second type prediction unit is predicted;

obtaining the point with the minimum rate-distortion cost from the first candidate starting search point and the first dividing block; and

setting the obtained point with the minimum rate-distortion cost as the starting search point of the second dividing block in the second type prediction unit, and setting the starting search point of the second dividing block as the first starting search point.


 
8. The video motion estimation method according to claim 5, after the obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point, the method further comprising:

obtaining a first supplementary point not searched around each point corresponding to the first preset step size, and calculating rate-distortion cost of the first supplementary point in a case that the search step size corresponding to the first undetermined point is a first preset step size;

setting a location of the first undetermined point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is the first undetermined point; and

setting a location of the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point as a current motion vector of the second type prediction unit in a case that the point with the minimum rate-distortion cost in the first undetermined point and the first supplementary point is not the first undetermined point.


 
9. The video motion estimation method according to claim 5, after the obtaining a point with the minimum rate-distortion cost in the second type prediction unit according to the second search algorithm, to obtain the first undetermined point, the method further comprising:
setting the first undetermined point as a first starting search point, and performing the operation of obtaining, according to a first preset increasing step size, a plurality of first candidate points within a search window range centered on the first starting search point in a case that the search step size corresponding to the first undetermined point is within a second preset step size threshold range.
 
10. The video motion estimation method according to claim 2, the obtaining a motion vector of a searched prediction unit in the image frame, and correcting the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit comprising:

obtaining the motion vector of the searched prediction unit in the image frame, and calculating first target rate-distortion cost of a corresponding location of the second type prediction unit according to the motion vector of the searched prediction unit;

determining current rate-distortion cost of the second type prediction unit according to the current motion vector of the second type prediction unit;

comparing the current rate-distortion cost of the second type prediction unit with the first target rate-distortion cost;

setting the motion vector of the searched prediction unit as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is greater than the first target rate-distortion cost; and

setting a location of a point corresponding to the current rate-distortion cost as the motion vector of the second type prediction unit in a case that the current rate-distortion cost of the second type prediction unit is less than or equal to the first target rate-distortion cost.


 
11. The video motion estimation method according to any one of claims 1 to 10, the operation of obtaining a motion vector of the first type prediction unit according to a first search algorithm comprising:

obtaining a second candidate starting search point corresponding to the first type prediction unit, calculating rate-distortion cost of each second candidate starting search point, and setting a second candidate starting search point with the minimum rate-distortion cost as a second starting search point;

obtaining, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculating the rate-distortion cost of each second candidate point, and selecting the point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point;

obtaining a second supplementary point not searched around each point corresponding to the second preset step size, and calculating rate-distortion cost of the second supplementary point in a case that the search step size corresponding to the second undetermined point is a second preset step size;

setting a location of the second undetermined point as the motion vector of the first type prediction unit in a case that a point with minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point; and

setting a location of the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point.


 
12. The video motion estimation method according to claim 11, the operation of setting a location of the second undetermined point as the motion vector of the first type prediction unit comprising:

obtaining the motion vector of the searched prediction unit in the image frame, and calculating second target rate-distortion cost of a corresponding location of the first type prediction unit according to the motion vector of the searched prediction unit;

comparing rate-distortion cost of the second undetermined point with the second target rate-distortion cost;

setting the motion vector of the searched prediction unit as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is greater than the second target rate-distortion cost; and

setting the location of the second undetermined point as the motion vector of the first type prediction unit in a case that the rate-distortion cost of the second undetermined point is less than or equal to the second target rate-distortion cost.


 
13. The video motion estimation method according to claim 11, the second type prediction unit comprising a third dividing block and a fourth dividing block, and the operation of obtaining a second candidate starting search point corresponding to the first type prediction unit, calculating rate-distortion cost of each second candidate starting search point, and setting the second candidate starting search point with the minimum rate-distortion cost as a second starting search point comprising:

obtaining a second candidate starting search point corresponding to the fourth dividing block in the first type prediction unit through advanced motion vector prediction;

obtaining a prediction result of the third dividing block, calculating rate-distortion cost of each second candidate starting search point, and calculating rate-distortion cost of a location of the third dividing block according to the prediction result of the third dividing block in a case that the third dividing block in the first type prediction unit is predicted; and

setting the point with the minimum rate-distortion cost as the starting search point of the fourth dividing block in the first type prediction unit from the second candidate starting search point and the third dividing block, and setting the starting search point of the fourth dividing block as the second starting search point.


 
14. A video motion estimation apparatus, comprising:

a dividing unit configured to divide image frames in a video into a plurality of prediction units, and divide the plurality of prediction units into a first type prediction unit and a second type prediction unit;

a first obtaining unit configured to obtain a motion vector of the first type prediction unit according to a first search algorithm;

a second obtaining unit configured to obtain a motion vector of the second type prediction unit according to a second search algorithm, the second search algorithm being different from the first search algorithm; and

a motion estimation unit configured to perform sub-pixel motion estimation on the image frame according to the motion vector of the first type prediction unit and the motion vector of the second type prediction unit.


 
15. The video motion estimation apparatus according to claim 14, the second obtaining unit comprising:

a first obtaining subunit configured to obtain a polygonal model according to the second search algorithm, and obtain a current motion vector of the second type prediction unit by moving the polygonal model; and

a correction subunit configured to obtain a motion vector of a searched prediction unit in the image frame, and correct the current motion vector according to the motion vector of the searched prediction unit, to obtain the motion vector of the second type prediction unit.


 
16. The video motion estimation apparatus according to claim 15, the first obtaining subunit comprising:

a search module configured to obtain a first undetermined point in the second type prediction unit according to the second search algorithm;

an obtaining module configured to obtain a polygonal model centered on the first undetermined point, and obtain a first target point according to the polygonal model in a case that a search step size of the first undetermined point is within a first preset step size threshold range;

a mobile module configured to move the polygonal model, and obtain an optimal point according to the moved polygonal model in a case that the first target point is inconsistent with the first undetermined point; and

a first setting module configured to set a location of the optimal point as the current motion vector of the second type prediction unit in a case that the optimal point is consistent with the first target point.


 
17. The video motion estimation apparatus according to claim 14, the first obtaining unit comprising:

a second obtaining subunit configured to obtain a second candidate starting search point corresponding to the first type prediction unit, calculate rate-distortion cost of each second candidate starting search point, and set a second candidate starting search point with the minimum rate-distortion cost as a second starting search point;

a calculation subunit configured to obtain, according to the second preset increasing step size, a plurality of second candidate points within the search window range centered on the second starting search point, calculate rate-distortion cost of each second candidate point, and select a point with the minimum rate-distortion cost from the plurality of second candidate points, to obtain a second undetermined point;

a third obtaining subunit configured to obtain a second supplementary point not searched around each point corresponding to the second preset step size, and calculate rate-distortion cost of the second supplementary point in a case that the search step size corresponding to the second undetermined point is a second preset step size;

a third setting subunit configured to set a location of the second undetermined point as the motion vector of the first type prediction unit in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is the second undetermined point; and

a fourth setting subunit configured to set the second undetermined point as the second starting search point in a case that the point with the minimum rate-distortion cost in the second undetermined point and the second supplementary point is not the second undetermined point.


 
18. The video motion estimation apparatus according to claim 17, the first obtaining unit comprising:

a search subunit configured to perform searching, according to a preset interval step size, within a preset range centered on the second undetermined point in a case that the search step size corresponding to the second undetermined point is within a third preset step size threshold range, to obtain a plurality of search points, and calculate rate-distortion cost of each search point; and

a first execution subunit configured to use the point with the minimum rate-distortion cost in the second undetermined point and the plurality of search points as the second starting search point.


 
19. A terminal comprising a memory and a processor, the memory storing a computer readable instruction, the computer readable instruction, when executed by one or more processors, causing the one or more processors to perform the operations in the video motion estimation method according to any one of claims 1 to 13.
 
20. A non-volatile computer readable storage medium, storing a plurality of instructions, the computer readable instruction, when executed by one or more processors, causing the one or more processors to perform the operations in the video motion estimation method according to any one of claims 1 to 13.
 




Drawing





































Search report










Cited references

REFERENCES CITED IN THE DESCRIPTION



This list of references cited by the applicant is for the reader's convenience only. It does not form part of the European patent document. Even though great care has been taken in compiling the references, errors or omissions cannot be excluded and the EPO disclaims all liability in this regard.

Patent documents cited in the description