Motion estimation method, device, computer equipment and hardware encoder

By determining the search center point and search area in video encoding, calculating the absolute error sum, and obtaining the minimum matching block, the problem of insufficient fractional pixel search points is solved and the encoding efficiency and quality are improved.

CN116208775BActive Publication Date: 2024-09-06GLENFLY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310200462.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-03
Publication Date
2024-09-06
Estimated Expiration
2043-03-03

AI Technical Summary

Technical Problem

Existing video coding methods have insufficient fractional pixel search points in motion estimation, resulting in low coding efficiency and inability to effectively search for the global optimal point.

Method used

By determining the search center point in the block to be encoded and the reference frame in the frame to be encoded, using integer pixels and fractional pixels to determine the search area respectively, calculating the absolute error sum, obtaining the minimum matching block as the target matching block, and increasing the fractional pixel motion estimation Matching points increase the probability of searching for the global optimal point.

Benefits of technology

The coding efficiency is improved, the number of matching points for fractional pixel motion estimation search is increased, the coding quality is enhanced, and the consumption of hardware resources is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116208775B
    Figure CN116208775B
Patent Text Reader

Abstract

The present application relates to a motion estimation method, device, computer equipment and hardware encoder. Two search center points are determined in a reference frame corresponding to a frame to be encoded; the first side length is determined in units of integer pixels, a first search area is determined according to the two search center points and the first side length, and multiple first matching blocks corresponding to the block to be encoded are determined according to each integer pixel in the first search area; the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum are used as two new search center points; the second side length is determined in units of 1 / 4 pixels, a second search area is determined according to the two new search center points and the second side length, and multiple second matching blocks corresponding to the block to be encoded are determined according to each fractional pixel in the second search area; the target matching block with the smallest absolute error sum is taken from the first matching block and the second matching block. The present method can increase the number of matching points searched for fractional pixel motion estimation, thereby improving encoding efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video coding technology, and in particular to a motion estimation method, apparatus, computer equipment, storage medium, computer program product and hardware encoder. Background Art

[0002] In the design of the encoder, the motion estimation module is one of the most important modules. Motion estimation is also an extremely important link in the video encoding process. Its function is to obtain the optimal matching block of the current block. The higher the matching degree, the better the encoding quality. Therefore, the quality of motion estimation determines the basic trend of encoding quality. Motion estimation is divided into integer pixel motion estimation and fractional pixel motion estimation. Among them, the reference pixels of integer pixel motion estimation are all integer pixels, and the reference pixels of fractional pixel motion estimation are all fractional pixels. Fractional pixels are obtained by linear interpolation of integer pixels. This involves a large number of pixel interpolation, absolute error sum (usually called SAD) calculation, SAD comparison and other operations. Pixel interpolation and SAD calculation require a considerable amount of calculation. It can be said that they are the two parts with the largest amount of calculation in the entire motion estimation module. Therefore, the motion estimation module is the most time-consuming and hardware-resource-intensive module in the entire encoder. Therefore, it is necessary to weigh factors such as encoding quality, encoding speed, and hardware resources to formulate a reasonable motion estimation algorithm.

[0003] However, the existing encoding methods often use too few points for fractional pixel search in order to balance factors such as encoding quality, encoding speed, and hardware resources, resulting in an insufficient probability of searching for the global optimal point, which in turn leads to poor encoding efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a motion estimation method, apparatus, computer device, computer-readable storage medium and computer program product that can improve coding efficiency in response to the above technical problems.

[0005] In a first aspect, the present application provides a motion estimation method. The method comprises:

[0006] Determine a block to be encoded in the frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded;

[0007] Determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0008] Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0009] Determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded;

[0010] A matching block with the smallest sum of absolute errors is obtained from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0011] In one of the embodiments, determining two search center points in a reference frame corresponding to the frame to be encoded includes:

[0012] Perform an integer pixel motion estimation on the block to be coded to obtain two initial matching blocks corresponding to the block to be coded;

[0013] According to the upper left vertex pixel of each initial matching block, two search center points are determined.

[0014] In one embodiment, determining a first search area in a reference frame according to two search center points and a first side length includes:

[0015] Determine the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point respectively according to the first side length; the first side length includes at least one boundary length parameter;

[0016] According to the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point, a sub-search area corresponding to each search center point is determined to obtain two sub-search areas;

[0017] The first search area is determined according to the overlap degree of the two sub-search areas.

[0018] In one embodiment, determining the first search area according to the overlap degree of the two sub-search areas includes:

[0019] If there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the first search area;

[0020] If there is an overlapping area between the two sub-search areas, a minimum rectangular area including the two sub-search areas is obtained, and the minimum rectangular area is used as the first search area.

[0021] In one of the embodiments, determining a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area includes:

[0022] Get the number of pixels of the block to be encoded;

[0023] Each integer pixel in the first search area is used as an upper left vertex pixel of a matching block to construct a plurality of first matching blocks; wherein the number of the first matching blocks is the same as the number of pixels.

[0024] In one embodiment, calculating the absolute error sum of each second matching block relative to the block to be encoded includes:

[0025] Recording interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes interpolation calculation results of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel;

[0026] Comparing the fractional pixels in the next second matching block with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels;

[0027] For the interpolated fractional pixels in the next second matching block, the interpolation calculation results corresponding to the interpolated fractional pixels are obtained from the currently recorded interpolated data, and for the non-interpolated fractional pixels in the next second matching block, interpolation calculations are performed to obtain interpolation calculation results, and the interpolated data are updated according to the interpolation calculation results of the non-interpolated fractional pixels.

[0028] In one embodiment, after obtaining a matching block with the smallest absolute error as a target matching block of the block to be encoded, the method further includes:

[0029] According to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded, a motion vector between the target matching block and the block to be encoded is obtained as a motion estimation result of the block to be encoded.

[0030] In a second aspect, the present application further provides a hardware encoder. The hardware encoder comprises:

[0031] A first integer pixel motion estimation unit is used to determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, and determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area; obtain two first matching blocks with the smallest sum of absolute errors, and determine two new search center points according to upper left vertex pixels of the two first matching blocks with the smallest sum of absolute errors;

[0032] a fractional pixel motion estimation unit, configured to determine a second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, and determine a plurality of second matching blocks corresponding to the to-be-encoded block according to each fractional pixel in the second search area;

[0033] An absolute error sum calculation unit, used to calculate the absolute error sum of each first matching block relative to the block to be encoded, and to calculate the absolute error sum of each second matching block relative to the block to be encoded; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0034] The absolute error sum comparison unit is used to obtain a matching block with the smallest absolute error sum from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0035] In one embodiment, the hardware encoder further comprises:

[0036] The second integer pixel motion estimation unit is used to perform an integer pixel motion estimation on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and determine two search center points according to the upper left vertex pixel of each initial matching block.

[0037] In a third aspect, the present application further provides a motion estimation device. The device comprises:

[0038] A first positioning module is used to determine a block to be encoded in a frame to be encoded, and to determine two search center points in a reference frame corresponding to the frame to be encoded;

[0039] A first estimation module is used to determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0040] The second positioning module is used to obtain the two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the prediction error size of the matching block relative to the encoding block;

[0041] A second estimation module is used to determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate a sum of absolute errors of each second matching block relative to the block to be encoded;

[0042] The comparison and matching module is used to obtain a matching block with the smallest absolute error from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0043] In a fourth aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0044] Determine a block to be encoded in the frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded;

[0045] Determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0046] Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0047] Determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded;

[0048] A matching block with the smallest sum of absolute errors is obtained from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0049] In a fifth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0050] Determine a block to be encoded in the frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded;

[0051] Determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0052] Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0053] Determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded;

[0054] A matching block with the smallest sum of absolute errors is obtained from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0055] In a sixth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0056] Determine a block to be encoded in the frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded;

[0057] Determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0058] Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0059] Determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded;

[0060] A matching block with the smallest sum of absolute errors is obtained from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0061] The motion estimation method, apparatus, computer device, storage medium, computer program product and hardware encoder first determine the block to be encoded in the frame to be encoded, and determine two search center points in the reference frame corresponding to the frame to be encoded; then determine the first side length in units of integer pixels, determine the first search area in the reference frame according to the two search center points and the first side length, determine multiple first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate the absolute error sum of each first matching block relative to the block to be encoded; in this way, two first matching blocks with the smallest absolute error sum can be obtained, and two new search center points are determined according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; then determine the second side length in units of 1 / 4 pixels, determine the second search area in the reference frame according to the two new search center points and the second side length, determine multiple second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded; in this way, a matching block with the smallest absolute error sum can be obtained from the first matching block and the second matching block as the target matching block of the block to be encoded. The number of matching points searched by fractional pixel motion estimation can be increased, and the probability of searching for the global optimal point is increased, thereby improving the coding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] Figure 1 is a schematic flow chart of a motion estimation method in one embodiment;

[0063] Figure 2 is a schematic diagram of absolute error and calculation in one embodiment;

[0064] Figure 3 A schematic diagram of a pixel in an embodiment;

[0065] Figure 4 A schematic diagram of a scanning order of a second search area in one embodiment;

[0066] Figure 5 A schematic diagram of scanning from R00 to R10 in one embodiment;

[0067] Figure 6 A schematic diagram of scanning from R70 to R71 in one embodiment;

[0068] Figure 7 A schematic diagram of scanning from R71 to R61 in one embodiment;

[0069] Figure 8 A schematic diagram of a module of a hardware encoder in one embodiment;

[0070] Fig. 9 A schematic diagram of the algorithm flow of FIME and FME in one embodiment;

[0071] Fig.10 is a schematic diagram of two non-overlapping search areas in one embodiment;

[0072] Fig.11 A schematic diagram of a search area finally determined in one embodiment;

[0073] Fig.12 A schematic diagram of two overlapping search areas in one embodiment;

[0074] Fig.13 A schematic diagram of a search area finally determined in one embodiment;

[0075] Fig.14 A schematic diagram of a first hardware solution of FIME and FME in an embodiment;

[0076] Fig.15 is a pipeline schematic diagram of a first hardware solution in an embodiment;

[0077] Fig.16 A schematic diagram of a second hardware solution of FIME and FME in one embodiment;

[0078] Fig.17 is a pipeline schematic diagram of a second hardware solution in an embodiment;

[0079] Fig.18 A schematic diagram of the workflow of FIME and FME hardware in one embodiment;

[0080] Fig.19 Schematic diagram of the hardware of a SAD calculation module in one embodiment;

[0081] Fig. 20 A schematic diagram of a process of calculating SAD by a SAD calculation module in one embodiment;

[0082] Fig.21 is a structural block diagram of a motion estimation device in one embodiment;

[0083] Fig. 22 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0084] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0085] In one embodiment, Figure 1As shown, a motion estimation method is provided. This embodiment uses the method applied to a computer device as an example. It can be understood that the computer device can specifically be a terminal or a server. Among them, the terminal can be but is not limited to various personal computers, laptops, smart phones, tablets, Internet of Things devices, portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart medical devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server can be implemented as an independent server or a server cluster composed of multiple servers. In this embodiment, the method includes the following steps:

[0086] Step 102: determine a block to be encoded in the frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded.

[0087] The search center point is also called the search starting point. Usually, the motion estimation pixel search for video coding needs to first determine a search starting point on the reference frame, and then perform block matching search within the set search area with this search starting point as the center to obtain the best motion vector.

[0088] Step 104, determining the first side length in units of integer pixels, determining a first search area in the reference frame according to the two search center points and the first side length, determining a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculating the sum of absolute errors of each first matching block relative to the block to be encoded.

[0089] Each integer pixel in the first search area can be called a reference pixel, and the matching block can also be called a reference block or a prediction block. The sum of absolute differences is usually called SAD. After obtaining the reference pixel, a reference block, or a matching block, can be determined with the pixel as the upper left vertex. By calculating and comparing the SAD between the current block and the matching block, the final optimal matching block can be obtained. Figure 2 As shown in the figure, assuming that the size of the current block to be coded CB is MxN, and RB0 and RB1 are two candidate matching blocks, then the SAD between CB and RB0 and RB1 is calculated respectively. The smaller the SAD, the better the matching block. The calculation formula of SAD is as follows:

[0090]

[0091]

[0092] Optionally, the first side length can be set to 8 integer pixels. Then, for each search center point, 4 integer pixels are extended upward, downward, left, and right respectively, and two 8×8 search areas can be obtained. Each search area contains 64 integer pixels, and the two 8×8 search areas are combined to obtain the first search area. For any integer pixel in the first search area, a first matching block with the same number of pixels as the block to be encoded can be determined by taking the selected integer pixel as the upper left vertex. Therefore, a first matching block with the same number of integer pixels can be obtained in the first search area.

[0093] Step 106, obtain the two first matching blocks with the smallest sum of absolute errors, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest sum of absolute errors; the sum of absolute errors is used to represent the size of the prediction error of the matching block relative to the block to be encoded.

[0094] Optionally, a first matching block with the smallest sum of absolute errors and a first matching block with the second smallest sum of absolute errors are obtained, and the upper left vertex pixels of the two first matching blocks are used as two new search center points.

[0095] Step 108, determine the second side length in units of 1 / 4 pixel, determine a second search area in the reference frame according to the two new search center points and the second side length, determine multiple second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate the absolute error sum of each second matching block relative to the block to be encoded.

[0096] Each fractional pixel (i.e., 1 / 4 pixel) in the second search area can be called a reference pixel. Integer pixels are actual pixels in the image, while fractional pixels are virtual pixels that are obtained by linear interpolation of integer pixels. After interpolation of the reference pixel, the SAD needs to be calculated and compared. The pixel diagram is shown in the figure. Figure 3 As shown in the figure, the pixels of the dotted background are integer pixels, which do not require pixel interpolation and can be directly obtained by reading the pixels in the reference frame; the pixels of the oblique striped background are 1 / 2 precision pixels, which require pixel interpolation; the pixels of the horizontal and vertical striped backgrounds are 1 / 4 precision pixels, which require interpolation. The so-called pixel interpolation is actually filtering several adjacent pixels to obtain a filtered fractional pixel. Fractional pixels at different positions have different filtering coefficients, as shown in the following table.

[0097] Fractional pixel position Filter Name Filter tap coefficients Horizontal stripes pixels Filter14 {-1,4,-10,58,17,-5,1,} Diagonal striped pixels Filter24 {-1,4,-11,40,40,-11,4,1} Vertical stripes pixels Filter34 {1,-5,17,58,-10,4,-1}

[0098] Each integer pixel corresponds to 3 2 / 4 pixels, 5 1 / 4 pixels, and 8 3 / 4 pixels, as shown in the pixels inside the dotted box in the figure above. The interpolation formula for all fractional pixels corresponding to A0,0 is as follows:

[0099]

[0100]

[0101]

[0102]

[0103]

[0104]

[0105]

[0106]

[0107]

[0108]

[0109]

[0110]

[0111]

[0112]

[0113]

[0114] Optionally, the second side length can be set to 8 1 / 4 pixels. Then, for each search center point, 4 1 / 4 pixels are extended upward, downward, left, and right, respectively, to obtain two 8×8 search areas, each of which contains 64 1 / 4 pixels. The second search area is obtained by combining the two 8×8 search areas. For any 1 / 4 pixel in the second search area, a second matching block with the same number of pixels as the block to be encoded can be determined by taking the selected 1 / 4 pixel as the upper left vertex. Therefore, a second matching block with the same number of 1 / 4 pixels can be obtained in the second search area.

[0115] In step 110, a matching block with the smallest sum of absolute errors among the first matching block and the second matching block is obtained as a target matching block of the block to be encoded.

[0116] Optionally, the SAD of each first matching block and second matching block is compared, and a matching block with the smallest SAD (either the first matching block or the second matching block) is selected as the target matching block of the block to be encoded.

[0117] In one embodiment, two search center points are determined in a reference frame corresponding to a frame to be encoded, including: performing an integer pixel motion estimation on a block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and determining two search center points based on the upper left vertex pixel of each initial matching block.

[0118] Optionally, a rough integer pixel motion estimation can be performed on the block to be encoded first, and a larger search area can be selected. A smaller number of integer pixels can be selected as reference pixels in the larger search area at preset intervals. A small number of matching blocks can be obtained based on a small number of reference pixels, and the SAD of each matching block can be calculated. The two matching blocks with the smallest SAD are used as initial matching blocks, and the upper left vertex pixels of the two initial matching blocks are used as two search center points.

[0119] In this embodiment, an integer pixel motion estimation is performed on the block to be coded to obtain two initial matching blocks corresponding to the block to be coded; two search center points are determined according to the upper left vertex pixel of each initial matching block. The number of matching points searched by fractional pixel motion estimation can be increased, and the probability of searching for the global optimal point is increased, thereby improving coding efficiency.

[0120] In one embodiment, a first search area is determined in a reference frame according to two search center points and a first side length, including: determining upper boundary pixels, lower boundary pixels, left boundary pixels, and right boundary pixels corresponding to each search center point according to the first side length; the first side length includes at least one boundary length parameter; determining a sub-search area corresponding to each search center point according to the upper boundary pixels, lower boundary pixels, left boundary pixels, and right boundary pixels corresponding to each search center point, and obtaining two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the first search area; if there is an overlapping area between the two sub-search areas, obtaining a minimum rectangular area containing the two sub-search areas, and using the minimum rectangular area as the first search area.

[0121] Furthermore, multiple first matching blocks corresponding to the block to be encoded are determined according to each integer pixel in the first search area, including: obtaining the number of pixels of the block to be encoded; taking each integer pixel in the first search area as the upper left vertex pixel of a matching block to construct multiple first matching blocks; wherein the number of first matching blocks is the same as the number of pixels.

[0122] Optionally, the first side length may be a parameter N, where N represents N integer pixels, and each sub-search area is an N×N rectangle containing N×N integer pixels; the first side length may be two parameters, M and N, where M represents M integer pixels, and N represents N integer pixels, and M and N are not equal, and each sub-search area is an M×N rectangle containing M×N integer pixels.

[0123] Correspondingly, a second search area is determined in a reference frame according to two new search center points and a second side length, including: determining the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point according to the second side length; the second side length includes at least one boundary length parameter; determining a sub-search area corresponding to each new search center point according to the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point, and obtaining two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the second search area; if there is an overlapping area between the two sub-search areas, obtaining a minimum rectangular area containing the two sub-search areas, and using the minimum rectangular area as the second search area.

[0124] Furthermore, multiple second matching blocks corresponding to the block to be encoded are determined according to each fractional pixel in the second search area, including: obtaining the number of pixels of the block to be encoded; taking each 1 / 4 pixel in the second search area as the upper left vertex pixel of a second matching block to construct multiple second matching blocks; wherein the number of second matching blocks is the same as the number of pixels.

[0125] Optionally, the second side length can be a parameter N, where N represents N 1 / 4 pixels, then each sub-search area is an N×N rectangle, containing N×N 1 / 4 pixels, or containing N×N 1 / 2 pixels; the second side length can be two parameters M and N, where M represents M 1 / 4 pixels, and N represents N 1 / 4 pixels, and M and N are not equal, then each sub-search area is an M×N rectangle, containing M×N 1 / 4 pixels, or containing N×N 1 / 2 pixels.

[0126] In a feasible implementation, determining multiple second matching blocks corresponding to the block to be encoded based on each fractional pixel in the second search area also includes: obtaining the number of pixels of the block to be encoded; taking each 1 / 2 pixel in the second search area as the upper left vertex pixel of a second matching block to construct multiple second matching blocks; wherein the number of second matching blocks is the same as the number of pixels.

[0127] Optionally, the second side length can be a parameter N, where N represents N 1 / 2 pixels, and each sub-search area is an N×N rectangle containing N×N 1 / 2 pixels; the second side length can be two parameters M and N, where M represents M 1 / 2 pixels and N represents N 1 / 2 pixels, and M and N are not equal, and each sub-search area is an M×N rectangle containing N×N 1 / 2 pixels.

[0128] In this embodiment, since a search center point is added, the range of the search area can be expanded, and each pixel in the search area is used as a reference pixel, the number of matching points searched by fractional pixel motion estimation is increased, which increases the probability of searching for the global optimal point, thereby improving the coding efficiency.

[0129] In one embodiment, the sum of absolute errors of each second matching block relative to the block to be encoded is calculated, including: recording interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation results of each fractional pixel in the current second matching block, and the fractional pixels include 1 / 2 pixels and 1 / 4 pixels; comparing the fractional pixels in the next second matching block with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, obtaining the interpolation calculation results corresponding to the interpolated fractional pixels from the currently recorded interpolated data, performing interpolation calculations on the non-interpolated fractional pixels in the next second matching block to obtain the interpolation calculation results, and updating the interpolated data according to the interpolation calculation results of the non-interpolated fractional pixels.

[0130] Optionally, since the second search area is an area defined in units of fractional pixels, the second search area contains continuous 1 / 2 pixel points or 1 / 4 pixel points, and therefore, the following method may be used to increase the encoding speed:

[0131] First, the second search area is scanned in the following scanning mode: forward → reverse → forward → ... Taking the 8x8 second search area as an example, the scanning order of the reference points is as follows: Figure 4 shown.

[0132] The situation of scanning from R00 to R10 is as follows Figure 5 As shown in the figure, the left picture shows the matching block corresponding to the R00 reference pixel. After scanning to R10, the pixels of the dotted background are reusable. We only need to discard the pixels of the leftmost column of horizontal stripes and re-interpolate the pixels of the rightmost column of vertical stripes to get the matching block corresponding to the R10 reference pixel. This can avoid repeated interpolation of pixels in the dotted area.

[0133] The scanning from R70 to R71 is as follows Figure 6 As shown in the figure, the left picture shows the matching block corresponding to the R70 reference pixel. After scanning to R71, the pixels in the dot-shaped area are reusable parts. We only need to discard the top row of horizontal stripe area pixels and re-interpolate the bottom row of vertical stripe area pixels to get the matching block corresponding to the R71 reference pixel. This can avoid repeated interpolation of the dot-shaped area.

[0134] The scanning from R71 to R61 is as follows Figure 7As shown in the figure, the left picture shows the matching block corresponding to the R71 reference pixel. After scanning R61, the pixels in the dot-shaped area are reusable. We only need to discard the pixels in the rightmost column of horizontal stripes and re-interpolate the pixels in the leftmost column of vertical stripes to get the matching block corresponding to the R61 reference pixel. This can avoid repeated interpolation of the dot-shaped area.

[0135] In this embodiment, by recording the fractional pixels that have been interpolated and directly reusing the interpolated pixels in the subsequent interpolation calculation process, multiple interpolation calculations on the same fractional pixel can be avoided, thereby improving the encoding efficiency, reducing the consumption of hardware resources, and improving the overall performance of the encoder.

[0136] In one embodiment, after obtaining a matching block with the smallest sum of absolute errors as a target matching block of the block to be encoded, the method further includes: obtaining a motion vector between the target matching block and the block to be encoded according to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded as a motion estimation result of the block to be encoded.

[0137] The motion vector, also known as MV, is used to represent the relative displacement between the matching block and the block to be encoded. The target matching block is the optimal matching block for motion estimation of the block to be encoded.

[0138] Optionally, comparing SAD is to combine and compare the calculated SADs of all matching blocks (the first matching block and the second matching block) to obtain an optimal matching block with the smallest SAD, and then calculate the MV between the optimal matching block and the block to be encoded based on the upper left vertex pixel of the optimal matching block and the upper left vertex pixel of the block to be encoded, and use the optimal matching block and the MV as the motion estimation result of the block to be encoded.

[0139] In this embodiment, according to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded, the motion vector between the target matching block and the block to be encoded is obtained as the motion estimation result of the block to be encoded. The motion vector between the optimal matching block and the block to be encoded is calculated according to the optimal matching block, which can improve the encoding effect.

[0140] In one embodiment, a motion estimation method includes:

[0141] A block to be encoded is determined in a frame to be encoded, and integer pixel motion estimation is performed on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and two search center points are determined according to the upper left vertex pixel of each initial matching block.

[0142] Determine the first side length in units of integer pixels, and determine the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each search center point according to the first side length; the first side length includes at least one boundary length parameter; determine a sub-search area corresponding to each search center point according to the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each search center point, and obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, use the two sub-search areas as the first search area; if there is an overlapping area between the two sub-search areas, obtain the minimum rectangular area containing the two sub-search areas, and use the minimum rectangular area as the first search area. Obtain the number of pixels of the block to be encoded; use each integer pixel in the first search area as the upper left vertex pixel of a matching block to construct multiple first matching blocks; wherein the number of first matching blocks is the same as the number of pixels. Calculate the absolute error sum of each first matching block relative to the block to be encoded.

[0143] The two first matching blocks with the smallest absolute error sum are obtained, and two new search center points are determined according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the prediction error size of the matching block relative to the encoding block.

[0144] Determine the second side length in units of 1 / 4 pixels, and determine the upper boundary pixels, lower boundary pixels, left boundary pixels, and right boundary pixels corresponding to each new search center point according to the second side length; the second side length includes at least one boundary length parameter; determine a sub-search area corresponding to each new search center point according to the upper boundary pixels, lower boundary pixels, left boundary pixels, and right boundary pixels corresponding to each new search center point, and obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, use the two sub-search areas as the second search area; if there is an overlapping area between the two sub-search areas, obtain the minimum rectangular area containing the two sub-search areas, and use the minimum rectangular area as the second search area. Obtain the number of pixels of the block to be encoded; use each 1 / 4 pixel in the second search area as the upper left vertex pixel of a second matching block to construct multiple second matching blocks; wherein the number of second matching blocks is the same as the number of pixels. Calculate the absolute error sum of each second matching block relative to the block to be encoded; record the interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation result of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel; compare the fractional pixels in the next second matching block with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, obtain the interpolation calculation result corresponding to the interpolated fractional pixel from the currently recorded interpolated data, perform interpolation calculation for the non-interpolated fractional pixels in the next second matching block to obtain the interpolation calculation result, and update the interpolated data according to the interpolation calculation result of the non-interpolated fractional pixel.

[0145] From the first matching block and the second matching block, a matching block with the smallest sum of absolute errors is obtained as the target matching block of the block to be encoded. According to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded, a motion vector between the target matching block and the block to be encoded is obtained as the motion estimation result of the block to be encoded.

[0146] In one embodiment, a motion estimation method is applied to a hardware encoder as an example, and the hardware encoder includes:

[0147] The second integer pixel motion estimation unit is used to perform an integer pixel motion estimation on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and determine two search center points according to the upper left vertex pixel of each initial matching block.

[0148] The first integer pixel motion estimation unit is used to determine the first side length in units of integer pixels, and determine the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each search center point according to the first side length; the first side length includes at least one boundary length parameter; according to the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each search center point, determine a sub-search area corresponding to each search center point to obtain two sub-search areas; if there is no overlap between the two sub-search areas, the two sub-search areas are used as the first search area; if there is an overlap between the two sub-search areas, obtain the minimum rectangular area containing the two sub-search areas, and use the minimum rectangular area as the first search area. Obtain the number of pixels of the block to be encoded; take each integer pixel in the first search area as the upper left vertex pixel of a matching block respectively, so as to construct multiple first matching blocks; wherein the number of first matching blocks is the same as the number of pixels. Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the prediction error size of the matching block relative to the block to be encoded.

[0149] The fractional pixel motion estimation unit is used to determine the second side length in units of 1 / 4 pixels, and determine the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point according to the second side length; the second side length includes at least one boundary length parameter; according to the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point, a sub-search area corresponding to each new search center point is determined to obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the second search area; if there is an overlapping area between the two sub-search areas, the minimum rectangular area containing the two sub-search areas is obtained, and the minimum rectangular area is used as the second search area. The number of pixels of the block to be encoded is obtained; each 1 / 4 pixel in the second search area is used as the upper left vertex pixel of a second matching block to construct multiple second matching blocks; wherein the number of second matching blocks is the same as the number of pixels.

[0150] The absolute error sum calculation unit is used to calculate the absolute error sum of each first matching block relative to the block to be encoded; it is also used to calculate the absolute error sum of each second matching block relative to the block to be encoded; the interpolated data is recorded according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation results of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel; the fractional pixels in the next second matching block are compared with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, the interpolation calculation results corresponding to the interpolated fractional pixels are obtained from the currently recorded interpolated data, for the non-interpolated fractional pixels in the next second matching block, the interpolation calculation results are obtained, and the interpolated data is updated according to the interpolation calculation results of the non-interpolated fractional pixels. The absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0151] The absolute error sum comparison unit is used to obtain a matching block with the smallest absolute error sum from the first matching block and the second matching block as the target matching block of the block to be encoded. According to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded, the motion vector between the target matching block and the block to be encoded is obtained as the motion estimation result of the block to be encoded.

[0152] In a feasible implementation, a schematic diagram of a module for performing motion estimation of a hardware encoder is as follows: Figure 8 As shown. First, the original pixels and reference pixels are read from the memory. Intra-frame prediction and inter-frame prediction are performed on the original pixels respectively. The inter-frame prediction includes a coarse integer pixel motion estimation unit (CIME, Coarse Integer Motion Estimation), a fine integer pixel motion estimation unit (FIME, Fine Integer Motion Estimation), and a fractional pixel motion estimation unit (FME, Fraction Motion Estimation). Then the results of the intra-frame prediction and inter-frame prediction are judged to obtain the final motion estimation result. Finally, the entropy coding module encodes the final motion estimation result to obtain the final encoded bitstream. The hardware structure of FIME is unified with that of FME, while CIME is not limited. Among them, CIME is equivalent to the second integer pixel motion estimation unit, FIME is equivalent to the first integer pixel motion estimation unit, and FME is equivalent to the fractional pixel motion estimation unit. The algorithm flow of FIME and FME is basically the same, as shown Fig. 9 shown.

[0153] Specifically, the workflow for FIME or FME to determine the search scope is as follows:

[0154] After CIME is completed, two search center points will be determined for FIME of a certain coding unit (usually referred to as CU). In order to achieve the purpose of unifying the hardware structure of FME and FIME, after FIME is completed, the same method is used to determine two search center points for FME. Regardless of FIME or FME, the first search center point is recorded as C0 and the second search center point is recorded as C1. In addition, in order to facilitate the hardware encoder to read pixels according to a certain alignment, C0 and C1 are both algin to 4 integer pixels. After determining the two search center points, it is necessary to determine the search area. For C0, take this point as the center and expand 4 pixels upward, downward, left and right respectively to obtain a square search area. For C1, do the same operation to obtain the search area corresponding to the center point. In order to unify the hardware structure of FME and FIME, here FME and FIME's C0 and C1 are expanded by 4 pixels upward, downward, left and right respectively. The only difference is that FIME expands 4 integers upward, downward, left and right respectively in units of integer pixels, while FME expands 4 pixels upward, downward, left and right respectively in units of 1 / 4 pixels.

[0155] After two search areas are determined, there are two possibilities for the positional relationship between the two search areas. One possibility is that the two areas do not overlap.

[0156] like Fig.10 The figure shows a situation where there is no overlap, the horizontal stripe area is the search area determined by C0, and the vertical stripe area is the search area determined by C1, and there is no overlap between the two. In this case, the two search areas are regarded as independent search areas, and this search mode is called 8x8 search mode.

[0157] For FIME, each 8x8 search area contains 64 integer pixels, such as Fig.11 As shown in the figure below, all the dot-like background pixels are shown; for FME, each 8x8 search area also contains 64 pixels, as shown in the black thick line box in the figure below, these pixels include 4 integer pixels, 12 1 / 2 pixels, and 48 1 / 4 pixels. Looking at the two 8x8 areas together, it is equivalent to FIME searching for a total of 128 integer pixels; FME searches for a total of 8 integer pixels, 24 1 / 2 pixels, and 96 1 / 4 pixels.

[0158] like Fig.12 The figure shows an overlapping situation. The horizontal stripe area is the search area determined by C0, the vertical stripe area is the search area determined by C1, and the dot area is the overlapping area of ​​the two. In this case, if the two search areas are still used as independent search areas, the dot area will be searched twice, which not only wastes the computing power of the hardware, but also does not improve the coding efficiency.

[0159] In order to solve the above problem, two 8x8 pixel search areas are merged into a 12x12 pixel search area, and this search mode is called 12x12 search mode, which can avoid the problem of repeated search.

[0160] For FIME, the 12x12 search area contains 144 integer pixels, as shown in the following figure for all the dotted background pixels; for FME, the pattern also contains 144 pixels, as shown in Fig.13 As shown in the thick black frame in , these pixels include 9 integer pixels, 27 1 / 2 pixels, and 108 1 / 4 pixels.

[0161] After determining the search range, it is necessary to calculate the SAD for the reference pixels within the search range. Since FIME and FME have similar structures and algorithms, there are two main differences between the two: the reference pixel search step of FIME is 1 pixel, or the distance between two adjacent reference pixels is 1 pixel; the reference pixel search step of FME is 1 / 4 pixel, or the distance between two adjacent reference pixels is 1 / 4 pixel; FIME does not include fractional reference pixels, while FME includes fractional reference pixels, so fractional pixel interpolation is required.

[0162] In view of the above differences, in order to achieve the purpose of sharing the same hardware structure between the two, an IsFME flag is added to distinguish between FIME and FME: IsFME = 0 indicates that the current ME is FIME; IsFME = 1 indicates that the current ME is FME.

[0163] Since FIME and FME have similar hardware structures, there are two implementation options:

[0164] The first implementation will cost more hardware resources, but will also bring faster encoding speed. That is, the hardware resources of FIME and FME are separate. The hardware diagram is as follows: Fig.14 As shown. Among them, FIME / FME sends SAD calculation requests, namely SAD Request, to the SAD calculation module respectively. The SAD calculated by the SAD calculation module is stored in the SAD SRAM. The SAD comparison module receives the candidate MV and prediction mode information sent by FIME / FME, reads the corresponding SAD value from the SAD SRAM, and compares the size of the SAD value, and finally obtains the optimal MV and prediction mode. The corresponding pipeline diagram is shown as follows Fig.15 As shown in the figure, since the hardware resources of FIME and FME are separate, the two can perform parallel encoding at the CU level.

[0165] Another implementation scheme will consume less hardware resources, but the encoding speed will also be affected. That is, FIME and FME share the same hardware resources. The hardware diagram is as follows: Fig.16 As shown in the figure. The functions of each module in the figure are the same as those of the first implementation scheme, and will not be repeated here. The pipeline diagram is as follows Fig.17 As shown in the figure, since the hardware resources of FIME and FME are shared, the FIME and FME of the same CU can be started only after the FIME and FME of the same CU are completed.

[0166] The workflow of the above two hardware structures is as follows: Fig.18 As shown. First of all, from the processing order, the FIME of a certain CU is performed first, and then the FME of the CU is performed. After determining the search area and search mode, the number of SAD calculation requests to be sent to the SAD calculation module is determined according to the search mode. If it is 8x8 MV mode, 2 SAD requests are sent to the SAD calculation module. If it is 12x12MV mode, 1 SAD request is sent to the SAD calculation module. The SAD request contains IsFMEflag. If IsFME=0, the SAD calculation module directly calculates SAD. If IsFME=1, the SAD calculation module first performs pixel interpolation and then calculates SAD. Since the processing speed of SAD calculation and SAD comparison is different, the settlement result of the SAD calculation module is first stored in the SAD SRAM. The SAD comparison module reads the SAD value from the SAD SRAM and compares it to obtain the final optimal matching block and MV.

[0167] Specifically, the hardware diagram of the SAD calculation module Fig.19 As shown. Among them: the reference pixel cache is used to store the reference pixels of several consecutive CTUs. The reference pixels of any CU within these CTUs can definitely be obtained in this cache. The original pixel SRAM is used to store the original pixels of several consecutive CTUs. The pixel interpolation module is used to interpolate the reference pixels to obtain the corresponding fractional pixels. Interpolation is only required when IsFME flag=1. The reference pixel SRAM is used to cache the reference pixels of the current CU. The SAD calculation module is used to calculate the difference between the reference pixel and the original pixel, and sum them to obtain the SAD value corresponding to a certain MV of the CU.

[0168] like Fig. 20 As shown, the specific process of calculating SAD is as follows:

[0169] (1) First, load the following M columns of reference pixels into the reference pixel SRAM (if R is a fractional pixel, it must be interpolated before being stored in the reference pixel SRAM)

[0170] R0,0~R0,M-1

[0171] R1,0~R1,M-1

[0172] …

[0173] RM-1,0~RM-1,M-1

[0174] Then the SAD value corresponding to point R0,0

[0175] (2) Load a column of reference pixels RM,0 to RM,M-1 into the reference pixel SRAM, then the SAD value corresponding to the reference point R1,0 is

[0176] …

[0177] (3) Load a column of reference pixels RM+6,0 to RM+6,M-1 into the reference pixel SRAM, then the SAD value corresponding to the reference point R7,0 is

[0178] (4) A row of reference pixels R7,M~RM+6,M is loaded into the reference pixel SRAM. Then the SAD value corresponding to the reference point R7,1 is

[0179] (5) Load a column of reference pixels R6,1 to R6,M into the reference pixel SRAM. Then the SAD value corresponding to the reference point R7,1 is

[0180] …

[0181] (6) Load a column of reference pixels R0,1 to R0,M into the reference pixel SRAM. Then the SAD value corresponding to the reference point R0,1 is

[0182] (7) Load a row of reference pixels R0,M+1 to RM-1,M+1 into the reference pixel SRAM, then the SAD value corresponding to the reference point R0,2 is

[0183] (8) Repeat the above rules until the SAD values ​​of all matching points are calculated.

[0184] In this embodiment, since the number of points searched by fractional pixels is greatly increased, the coding efficiency is significantly improved. If the coding speed is not sensitive, FIME and FME can reuse the same hardware resources to save hardware resources. If the coding speed is sensitive, FIME and FME can instantiate similar hardware resources in two copies, thereby saving hardware design time. This embodiment is applicable to both H264 and HEVC encoders, except that different video coding standards differ in detail processing.

[0185] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0186] Based on the same inventive concept, the embodiment of the present application also provides a motion estimation device for implementing the motion estimation method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more motion estimation device embodiments provided below can refer to the limitations on the motion estimation method above, and will not be repeated here.

[0187] In one embodiment, Fig.21 As shown, a motion estimation device 2100 is provided, comprising: a first positioning module 2101, a first estimation module 2102, a second positioning module 2103, a second estimation module 2104 and a comparison and matching module 2105, wherein:

[0188] A first positioning module 2101 is used to determine a block to be encoded in a frame to be encoded, and to determine two search center points in a reference frame corresponding to the frame to be encoded;

[0189] A first estimation module 2102 is used to determine a first side length in units of integer pixels, determine a first search area in a reference frame according to two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded;

[0190] The second positioning module 2103 is used to obtain the two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded;

[0191] A second estimation module 2104 is used to determine the second side length in units of 1 / 4 pixels, determine a second search area in the reference frame according to the two new search center points and the second side length, determine a plurality of second matching blocks corresponding to the block to be encoded according to each fractional pixel in the second search area, and calculate a sum of absolute errors of each second matching block relative to the block to be encoded;

[0192] The comparison and matching module 2105 is used to obtain a matching block with the smallest absolute error from the first matching block and the second matching block as a target matching block of the block to be encoded.

[0193] In one embodiment, the first positioning module 2101 is further used to perform integer pixel motion estimation on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and determine two search center points according to the upper left vertex pixel of each initial matching block.

[0194] In one embodiment, the first estimation module 2102 is also used to determine the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each search center point according to the first side length; the first side length includes at least one boundary length parameter; according to the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each search center point, a sub-search area corresponding to each search center point is determined to obtain two sub-search areas; according to the degree of overlap of the two sub-search areas, the first search area is determined.

[0195] In one embodiment, the first estimation module 2102 is further used to use the two sub-search areas as the first search area if there is no overlapping area between the two sub-search areas; if there is an overlapping area between the two sub-search areas, obtain the minimum rectangular area containing the two sub-search areas, and use the minimum rectangular area as the first search area.

[0196] In one embodiment, the first estimation module 2102 is further used to obtain the number of pixels of the block to be encoded; each integer pixel in the first search area is used as the upper left vertex pixel of a matching block to construct multiple first matching blocks; wherein the number of first matching blocks is the same as the number of pixels.

[0197] In one embodiment, the second estimation module 2104 is further used to record interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation results of each fractional pixel in the current second matching block, and the fractional pixels include 1 / 2 pixels and 1 / 4 pixels; the fractional pixels in the next second matching block are compared with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, the interpolation calculation results corresponding to the interpolated fractional pixels are obtained from the currently recorded interpolated data, for the non-interpolated fractional pixels in the next second matching block, interpolation calculations are performed to obtain interpolation calculation results, and the interpolated data is updated according to the interpolation calculation results of the non-interpolated fractional pixels.

[0198] In one embodiment, the comparison and matching module 2105 is further used to obtain a motion vector between the target matching block and the block to be encoded according to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded as a motion estimation result of the block to be encoded.

[0199] Each module in the above motion estimation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0200] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig. 22As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a motion estimation method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0201] Those skilled in the art will understand that Fig. 22 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0202] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0203] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0204] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0205] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0206] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0207] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0208] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A motion estimation method, characterized in that: The method comprises: Determine a block to be encoded in a frame to be encoded, and determine two search center points in a reference frame corresponding to the frame to be encoded; Determine a first side length in units of integer pixels, determine a first search area in the reference frame according to the two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate a sum of absolute errors of each first matching block relative to the block to be encoded; Wherein, determining the first search area in the reference frame according to the two search center points and the first side length includes: determining the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point according to the first side length; the first side length includes at least one boundary length parameter; determining a sub-search area corresponding to each search center point according to the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point, and obtaining two sub-search areas; determining the first search area according to the overlap degree of the two sub-search areas; Obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded; The second side length is determined in units of 1 / 4 pixels, and the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point are determined according to the second side length; the second side length includes at least one boundary length parameter; according to the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point, a sub-search area corresponding to each new search center point is determined to obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the second search area; if there is an overlapping area between the two sub-search areas, a minimum rectangular area containing the two sub-search areas is obtained, and the minimum rectangular area is used as the second search area; the number of pixels of the block to be encoded is obtained; each 1 / 4 pixel in the second search area is used as the upper left vertex pixel of a second matching block to construct a plurality of second matching blocks; wherein the number of the second matching blocks is the same as the number of pixels; Recording interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes interpolation calculation results of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel; Comparing the fractional pixels in the next second matching block with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; For the interpolated fractional pixels in the next second matching block, an interpolation calculation result corresponding to the interpolated fractional pixels is obtained from the currently recorded interpolated data, and for the non-interpolated fractional pixels in the next second matching block, an interpolation calculation is performed to obtain an interpolation calculation result, and the interpolated data is updated according to the interpolation calculation result of the non-interpolated fractional pixels, so as to obtain a sum of absolute errors of each second matching block relative to the block to be encoded; A matching block with the smallest sum of absolute errors is obtained from the first matching block and the second matching block as a target matching block of the block to be encoded.

2. The method according to claim 1, characterized in that: The step of determining two search center points in a reference frame corresponding to the frame to be encoded includes: Performing integer pixel motion estimation on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; According to the upper left vertex pixel of each initial matching block, two search center points are determined.

3. The method according to claim 1, characterized in that The determining the first search area according to the overlap degree of the two sub-search areas includes: If there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the first search area; If there is an overlapping area between the two sub-search areas, a minimum rectangular area including the two sub-search areas is obtained, and the minimum rectangular area is used as the first search area.

4. The method according to claim 1, characterized in that: The determining, according to each integer pixel in the first search area, a plurality of first matching blocks corresponding to the block to be encoded comprises: Obtaining the number of pixels of the block to be encoded; Each integer pixel in the first search area is used as an upper left vertex pixel of a matching block to construct a plurality of first matching blocks; wherein the number of the first matching blocks is the same as the number of the pixels.

5. The method according to claim 1, characterized in that After obtaining a matching block with the smallest absolute error as the target matching block of the block to be encoded, the method further includes: According to the upper left vertex pixel of the target matching block and the upper left vertex pixel of the block to be encoded, a motion vector between the target matching block and the block to be encoded is obtained as a motion estimation result of the block to be encoded.

6. A hardware encoder, characterized in that: The hardware encoder includes: A first integer pixel motion estimation unit is configured to determine a first side length in units of integer pixels, determine a first search area in the reference frame according to the two search center points and the first side length, and determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area; obtain two first matching blocks with the smallest sum of absolute errors, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest sum of absolute errors; wherein the determining the first search area in the reference frame according to the two search center points and the first side length comprises: determining the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point respectively according to the first side length; the first side length comprises at least one boundary length parameter; determining a sub-search area corresponding to each search center point according to the upper boundary pixel, the lower boundary pixel, the left boundary pixel and the right boundary pixel corresponding to each search center point, and obtaining two sub-search areas; and determining the first search area according to the overlap degree of the two sub-search areas; A fractional pixel motion estimation unit is used to determine the second side length in units of 1 / 4 pixels, and determine the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each new search center point according to the second side length; the second side length includes at least one boundary length parameter; according to the upper boundary pixel, lower boundary pixel, left boundary pixel and right boundary pixel corresponding to each new search center point, a sub-search area corresponding to each new search center point is determined to obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the second search area; if there is an overlapping area between the two sub-search areas, a minimum rectangular area containing the two sub-search areas is obtained, and the minimum rectangular area is used as the second search area; the number of pixels of the block to be encoded is obtained; each 1 / 4 pixel in the second search area is used as the upper left vertex pixel of a second matching block to construct a plurality of second matching blocks; wherein the number of the second matching blocks is the same as the number of pixels; An absolute error sum calculation unit, used to calculate the absolute error sum of each first matching block relative to the block to be encoded, and to calculate the absolute error sum of each second matching block relative to the block to be encoded; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded; wherein the calculation of the absolute error sum of each second matching block relative to the block to be encoded includes: recording interpolated data according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation result of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel; comparing the fractional pixels in the next second matching block with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, obtaining the interpolation calculation result corresponding to the interpolated fractional pixels from the currently recorded interpolated data, performing interpolation calculation for the non-interpolated fractional pixels in the next second matching block to obtain the interpolation calculation result, and updating the interpolated data according to the interpolation calculation result of the non-interpolated fractional pixels; The absolute error sum comparison unit is used to obtain a matching block with the smallest absolute error sum from the first matching block and the second matching block as a target matching block of the block to be encoded.

7. The hardware encoder according to claim 6, characterized in that: The hardware encoder also includes: The second integer pixel motion estimation unit is used to perform an integer pixel motion estimation on the block to be encoded to obtain two initial matching blocks corresponding to the block to be encoded; and determine two search center points according to the upper left vertex pixel of each initial matching block.

8. A motion estimation device, characterized in that: The device comprises: A first positioning module, used to determine a block to be encoded in a frame to be encoded, and to determine two search center points in a reference frame corresponding to the frame to be encoded; A first estimation module is used to determine a first side length in units of integer pixels, determine a first search area in the reference frame according to the two search center points and the first side length, determine a plurality of first matching blocks corresponding to the block to be encoded according to each integer pixel in the first search area, and calculate the absolute error sum of each first matching block relative to the block to be encoded; wherein, determining the first search area in the reference frame according to the two search center points and the first side length comprises: determining an upper boundary pixel, a lower boundary pixel, a left boundary pixel, and a right boundary pixel corresponding to each search center point according to the first side length; the first side length comprises at least one boundary length parameter; determining a sub-search area corresponding to each search center point according to the upper boundary pixel, the lower boundary pixel, the left boundary pixel, and the right boundary pixel corresponding to each search center point, and obtaining two sub-search areas; determining the first search area according to the overlap degree of the two sub-search areas; A second positioning module is used to obtain two first matching blocks with the smallest absolute error sum, and determine two new search center points according to the upper left vertex pixels of the two first matching blocks with the smallest absolute error sum; the absolute error sum is used to represent the size of the prediction error of the matching block relative to the block to be encoded; The second estimation module is used to determine the second side length in units of 1 / 4 pixels, and determine the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point according to the second side length; the second side length includes at least one boundary length parameter; according to the upper boundary pixels, lower boundary pixels, left boundary pixels and right boundary pixels corresponding to each new search center point, a sub-search area corresponding to each new search center point is determined to obtain two sub-search areas; if there is no overlapping area between the two sub-search areas, the two sub-search areas are used as the second search area; if there is an overlapping area between the two sub-search areas, a minimum rectangular area containing the two sub-search areas is obtained, and the minimum rectangular area is used as the second search area; the number of pixels of the block to be encoded is obtained; each 1 / 4 pixel in the second search area is used as the upper left vertex pixel of a second matching block to construct a plurality of second matching blocks; matching blocks; wherein the number of second matching blocks is the same as the number of pixels; interpolated data is recorded according to each fractional pixel in the current second matching block; the interpolated data includes the interpolation calculation result of each fractional pixel in the current second matching block, and the fractional pixel includes 1 / 2 pixel and 1 / 4 pixel; the fractional pixels in the next second matching block are compared with the fractional pixels in the interpolated data to distinguish the fractional pixels in the next second matching block into interpolated fractional pixels and non-interpolated fractional pixels; for the interpolated fractional pixels in the next second matching block, the interpolation calculation result corresponding to the interpolated fractional pixels is obtained from the currently recorded interpolated data, for the non-interpolated fractional pixels in the next second matching block, the interpolation calculation result is obtained by interpolation, and the interpolation data is updated according to the interpolation calculation result of the non-interpolated fractional pixels to obtain the absolute error sum of each second matching block relative to the block to be encoded; The comparison and matching module is used to obtain a matching block with the smallest absolute error from the first matching block and the second matching block as a target matching block of the block to be encoded.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.