CN104113756A - Integer pixel motion estimation method suitable for H.264 video encoding and decoding - Google Patents
Integer pixel motion estimation method suitable for H.264 video encoding and decoding Download PDFInfo
- Publication number
- CN104113756A CN104113756A CN201310138420.1A CN201310138420A CN104113756A CN 104113756 A CN104113756 A CN 104113756A CN 201310138420 A CN201310138420 A CN 201310138420A CN 104113756 A CN104113756 A CN 104113756A
- Authority
- CN
- China
- Prior art keywords
- motion vector
- macro block
- macro
- frame
- prediction
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Abstract
The invention discloses an integer pixel motion estimation method suitable for H.264 video encoding and decoding. The algorithm includes the following steps that: a. boundary filling is performed on a reference frame; B. scene detection is performed; c. sum of absolute differences is calculated parallelly; d. candidate motion vectors are calculated; e. prediction motion vectors are calculated; f. an optimal prediction motion vector is calculated; and g. an optimal matching block is calculated. With the integer pixel motion estimation method of the invention adopted, the accuracy of motion search can be improved, and data quantity of residual blocks in video encoding can be reduced, and the quality of the H.264 video encoding can be effectively improved.
Description
Technical field
The invention belongs to video coding and decoding technology field, relate in particular to a kind of H.264 whole pixel motion estimating method of coding and decoding video that is applicable to.
Background technology
H.264 the video encoding and decoding standard MPEG1/2/4 before, H.261, H.263 compare, has higher data compression ratio, better network adaptability.Under the condition of equal picture quality, compression ratio is H.264 the more than 2 times of MPEG-2, is 1.5~2 times of MPEG-4.H.264 the improvement of performance is the result of many technological improvements.H.264 on the basis of the overall encoding and decoding frame structure before continuing to use, many new technology have been adopted, for example: many macroblock partition mode, multi-frame prediction, sub-pixel precision estimation.
Estimation based on piece coupling is most important part in video encoding standard, and Algorithm for Block Matching Motion Estimation, will greatly reduce temporal correlation and the redundancy of food sequence, thereby bring high compression ratio accurately and efficiently.So-called estimation is exactly while predicting between conducting frame, is the search procedure of determining that in present frame, carry out the position of macroblock to be encoded in reference frame.In block-based estimation, former frame will, to being divided into some pixel square, be exactly the concept of said macro block and piece, and the object of estimation is exactly according to predefined deviation standard, finds the best matching blocks of current macro in reference frame.After estimation finishes, for current block, as long as be motion vector encoder by the residual block of current block and match block and movable information, thereby reduce the required data volume of encoding.Especially for the little image of amount of exercise, the difference of front and back image is little, can effectively improve compression ratio by estimation.Therefore, provide a more accurate motion estimation algorithm, in Video coding, seem quite important.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of matching accuracy that improves estimation, has reduced the amount of coded data of residual block, has improved the H.264 whole pixel motion algorithm for estimating of the quality of Video coding.
The technical solution adopted for the present invention to solve the technical problems is: a kind of H.264 whole pixel motion estimating method of coding and decoding video that is applicable to, comprises that method of the present invention realizes by following concrete steps:
One, find best initial predicted point:
Existing motion estimation algorithm, easily be absorbed in local smallest point, the integrality showing in when motion due to object, make time domain and spatial domain adjacent block there is correlation, we can utilize the correlation of time domain and spatial domain adjacent block motion vector, find the initial predicted point nearest apart from optimal match point, the method for finding initial predicted point is as follows:
1, reference frame is carried out to Boundary filling:
Before carrying out interframe movement estimation, first carry out the Boundary filling of reference frame.Make reference frame meet the size of 16*16 multiple.
2, scene detection:
Scene detection is determines whether present frame is a new picture, and scene detection can be used to definite present frame motion vector prediction types, and it is variable type_pred that present frame motion vector prediction types is set.If it is new picture that scene detection goes out this frame, this frame is made as to I frame, the macro block of this frame only carries out infra-frame prediction in the time carrying out motion-vector prediction, does not carry out inter prediction.If frame per second is less than 5, or current scene approaches very much previous I frame, do not carry out scene detection, and while not carrying out scene detection, present frame motion vector prediction types is 2, i.e. type_pred=2.
3, parallel computation absolute error and SAD:
In the time carrying out estimation with BMA, weigh whether the match point searching is Optimum Matching point in reference frame, the matching criterior of using mostly is SAD (sum of absolute differences), as follows:
Wherein, Orig (x, y) is the original value of macroblock to be encoded pixel, and Pred (x, y) is the predicted value of macroblock to be encoded pixel, and PE (x, y) is the prediction residual value of macroblock to be encoded pixel.
For accelerating computational speed, the macro block of 16*16 is carried out to estimation at every turn, and adopts SIMD (single-instruction multiple-data) technology to calculate, by displacement, with or etc. operation, the at every turn multiple pixels of parallel computation.
4, macro block estimation:
(1) obtain five candidate motion vectors of macro block:
The candidate motion vector of macro block is according to the motion vector of the adjacent block in macro block time and space, the motion vector of the current block of obtaining, on time, being left neighbours' macro block of the corresponding macro block of same coordinate in reference frame, right neighbours' macro block, top macro block, bottom macro block, upper left quarter and upper right quarter macro block, is neighbours' macro block of current macro in present frame on space.According to the type of prediction of macro block, select the motion vector of different adjacent macroblocks as the candidate motion vector of current macro, candidate motion vector is defaulted as 0.
(2) obtain the motion vectors (cmvx, cmvy) of macro block:
Obtained the motion vectors of macro block by neighbours' macro block of current macro, if when current macro exists left neighbours not have neighbours and upper right neighbours' macro block simultaneously, motion vectors is the motion vector of left neighbours' macro block.Exist if current macro does not meet left neighbours, when upper neighbours and the non-existent condition of upper right neighbours, motion vectors is the intermediate value of left neighbours' macro block, upper neighbours' macro block, upper right neighbours' macroblock motion vector.
(3) obtain the optimum prediction motion vector of macro block
Obtained the coupling macro block position of 5 predictions of current macro by 5 candidate motion vectors, by the pixel value of coupling macro block and current macro Corresponding matching point, obtain absolute error and SAD, calculate respectively again the difference MV_COST of 5 candidate motion vectors and motion vectors, the motion vector of selecting SAD+MV_COST minimum is optimum prediction motion vector, thereby obtains optimum prediction point.
Two, search best matching blocks.
Start to search for best matching blocks from current best initial predicted point, step-size in search is 8.The method that searching method adopts little rhombus and hexagon search to combine is carried out, if cost function smallest point is at search center, stops search.Owing to having adopted hexagon search, expand hunting zone, avoid being absorbed in local smallest point.
A kind of H.264 beneficial effect main manifestations of the whole pixel motion estimating method of coding and decoding video that is applicable to of the present invention is: by the relatively sad value of 5 adjacent macroblocks and the difference of motion vector and, obtain optimum prediction motion vector, greatly improve the accuracy of macro block estimation, thereby while having reduced coding, the data volume of residual block, has improved the H.264 quality of Video coding.
Brief description of the drawings
Fig. 1 is a kind of H.264 schematic flow sheet of the whole pixel motion estimating method of coding and decoding video that is applicable to of the present invention.
Fig. 2 is adjacent block position view.
Embodiment
Below in conjunction with drawings and Examples, the specific embodiment of the invention is described:
1, as shown in Figure 1-2, as a kind of H.264 preferred forms of the whole pixel motion estimating method of coding and decoding video that is applicable to of the present invention, it carries out Boundary filling to reference frame:
If reference frame size is width*height, fill respectively up and down 16*width, 16*16 is filled respectively in upper left and upper right, and height*16 is filled respectively in left and right.
2, scene detection:
The half macro block of scanning present frame, every a macro block run-down.While scanning for the first time, if the predictive mode of macro block is inter prediction, pred_type=0, proceed to (4) this macro block is carried out to estimation, the minimum SAD that access step 3 is obtained this macro block is min_cost, if the average SAD of this macro block the first row and first row infra-frame prediction is less than min_cost, intra-frame macro block scanning number adds a NumIntraSearch++, if the predictive mode of certain macro block is infra-frame prediction, macro block scanning number directly adds a NumIntraSearch++.If macro block is boundary macroblocks, NumIntraSearch++.
When the end of scan, judge whether NumIntraSearch*99 > 48*totalMB sets up for the first time, if set up, this frame is a new scene, scans no longer for the second time.If be false, this frame does not have scene change, makes pred_type=1, scans for the second time, scans remaining macro block.
3, parallel computation absolute error and SAD:
For accelerating computational speed, the macro block of 16*16 is carried out to estimation at every turn, and adopts SIMD (single-instruction multiple-data) technology to calculate, by displacement, with or etc. operation, the at every turn multiple pixels of parallel computation.If ref is the pointer that points to reference frame respective pixel, judge whether formula (uint32) ref & 0x3 equals zero.
(1) if (uint32) ref & 0x3 equals zero, illustrate that ref data pointed are word alignment, once take out a word, four pixels operate, as four pixels of taking out current ref pointer indication deposit in without symbol shaping x11, x11=* ((uint32*) (ref+4)).
(2), if (uint32) ref & 0x3 is not equal to zero, first pointer ref is moved to left behind (uint32) ref & 0x3 position and operated.Because data if not word alignment is got a word and compared getting of a byte of a byte simultaneously, can't be accelerated execution speed in internal memory.
The parallel absolute error of simultaneously calculating in present frame 4 pixels and corresponding 4 pixels in reference frame calculates two absolute values without the difference of symbol shaping number correspondence byte simultaneously, and result deposits the 3rd in without symbol shaping number.
4, ask macro block candidate motion vector:
Equal 0 if I current macro type of prediction is spatio-temporal prediction and pred_tpye, candidate motion vector is respectively:
The motion vector of the macro block identical with current macro coordinate in a reference frame.
Macro block left neighbours identical with current macro coordinate or right neighbours' motion vector in b reference frame.
The macro block top identical with current macro coordinate or bottom neighbours' motion vector in c reference frame.
The motion vector of the macro block upper left quarter macro block identical with current macro coordinate in d reference frame.
The motion vector of the macro block upper right quarter macro block identical with current macro coordinate in e reference frame.
Equal 1 if II current macro type of prediction is spatio-temporal prediction and pred_tpye, candidate motion vector is respectively:
The motion vector of the macro block identical with current macro coordinate in a reference frame.
The motion vector of the left neighbours' macro block of current macro in b present frame.
The motion vector of current macro top macro block in c present frame.
The motion vector of current macro the right macro block in d reference frame.
The motion vector of current macro bottom macro block in e reference frame.
If III current macro type of prediction is only for spatial prediction and pred_tpye equal 0, candidate motion vector is respectively (five candidate motion vectors are defaulted as zero):
The motion vector of current macro left side macro block in a present frame.
Current macro upper left quarter macroblock motion vector in b present frame.
Current macro upper right quarter macroblock motion vector in c present frame.
If IV current macro type of prediction is only for spatial prediction and pred_tpye equal 1, candidate motion vector is respectively (five candidate motion vectors are defaulted as zero):
The motion vector of this macro block left part macro block in a present frame
The motion vector of this macro block top macro block in b present frame.
The motion vector of this macro block right part macro block in c present frame.
The motion vector of this macro block bottom macro block in d present frame.
5, obtain the motion vectors of macro block:
Judge the whether satisfied left neighbours' macro block A (motion vector is pmvA_x) that exists of current macro in present frame or in reference frame, do not have the condition of top B (motion vector is pmvB_x) and upper right quarter neighbours macro block C (motion vector is pmvC_x) simultaneously.Motion vectors satisfied current macro is the motion vector of the left neighbours' macro block of current macro, be cmvx=pmvA_x, cmvy=pmvA_y: do not meet, the motion vectors of current macro is cmvx=MEDIAN (pmvA_x, pmvB_x, pmvC_x), cmvy=MEDIAN (pmvA_y, pmvB_y, pmvC_y).
6, obtain the optimum prediction motion vector of macro block:
Determined respectively the reference macroblock position of macroblock to be encoded correspondence in reference frame by candidate motion vector, by step 3, calculate current macro and the SAD of reference macroblock and the difference MV_COST of candidate motion vector and motion vectors, select the motion vector of SAD+MV_COST minimum, for optimum movement vector, the position that now can obtain reference macroblock, is designated as (imin, jmin).This coordinate is best initial predicted point.
7, search best matching blocks:
Start to carry out once little diamond search from best initial predicted point, calculate the value of SAD, if sad value is less than 1, account for motion object is larger, directly carries out hexagon search; If sad value is less than 2, account for motion object is less, continues little diamond search.In the time that cost function minimum is positioned at search center point, stop search.
By reference to the accompanying drawings the preferred embodiment for the present invention is explained in detail above, but the invention is not restricted to above-mentioned execution mode, in the ken possessing those of ordinary skill in the art, can also under the prerequisite that does not depart from aim of the present invention, make a variety of changes.
Do not depart from the spirit and scope of the present invention and can make many other changes and remodeling.Should be appreciated that and the invention is not restricted to specific execution mode, scope of the present invention is defined by the following claims.
Claims (2)
1. be applicable to a H.264 whole pixel motion estimating method for coding and decoding video, it is characterized in that, comprise the steps:
A. Boundary filling: decoded reference frame is carried out to border pixel values Boundary filling up and down, obtain the reference frame with border and efficiency frontier, make reference frame meet the size of 16*16 multiple;
B. scene detection: determine whether present frame is brand-new picture and definite present frame motion vector prediction types, it is variable type_pred that present frame motion vector prediction types is set, if it is brand-new picture that scene detection goes out this frame, this frame is made as to I frame, if scene detection go out the frame per second of this frame be less than 5 or current scene approach previous I frame, do not carry out scene detection, while not carrying out scene detection, present frame motion vector prediction types is 2, i.e. type_pred=2;
C. parallel computation absolute error and SAD: at every turn the macro block of 16*16 is carried out to estimation, and adopt SIMD technology to calculate, by displacement, with, or operation, each multiple pixels of parallel computation, if ref is the pointer that points to reference frame respective pixel, judge whether formula (uint32) ref & 0x3 equals zero, if (uint32) ref & 0x3 equals zero, illustrate that ref data pointed are word alignment, if (uint32) ref & 0x3 is not equal to zero, first pointer ref is moved to left behind (uint32) ref & 0x3 position and operated,
D. ask macro block candidate motion vector: the spatio-temporal prediction to current macro type of prediction and spatial prediction;
E. ask the motion vectors of macro block: judge the whether satisfied left neighbours' macro block A (motion vector is pmvA_x) that exists of current macro in present frame or in reference frame, there is not the condition of top B (motion vector is pmvB_x) and upper right quarter neighbours macro block C (motion vector is pmvC_x) simultaneously, motion vectors satisfied current macro is the motion vector of the left neighbours' macro block of current macro, be cmvx=pmvA_x, cmvy=pmvA_y; Not meeting the motion vectors of current macro is cmvx=MEDIAN (pmvA_x, pmvB_x, pmvC_x), cmvy=MEDIAN (pmvA_y, pmvB_y, pmvC_y);
F. ask the optimum prediction motion vector of macro block: the reference macroblock position of being determined respectively macroblock to be encoded correspondence in reference frame by candidate motion vector, by step c, calculate current macro and the SAD of reference macroblock and the difference MV_COST of candidate motion vector and motion vectors, select the motion vector of SAD+MV_COST minimum, for optimum movement vector, the position that now can obtain reference macroblock, is designated as (imin, jmin);
G. search best matching blocks: start to carry out once little diamond search from best initial predicted point, calculate the value of SAD, if sad value is less than 1, account for motion object is larger, directly carries out hexagon search; If sad value is less than 2, account for motion object is less, continues little diamond search, in the time that cost function minimum is positioned at search center point, stops search.
2. a kind of H.264 whole pixel motion estimating method of coding and decoding video that is applicable to according to claim 1, is characterized in that, described d. asks macro block candidate motion vector concrete steps to be:
Equal 0 if A current macro type of prediction is spatio-temporal prediction and pred_tpye, candidate motion vector is respectively:
A) motion vector of the macro block identical with current macro coordinate in reference frame,
B) macro block left neighbours identical with current macro coordinate or right neighbours' motion vector in reference frame,
C) the macro block top identical with current macro coordinate or bottom neighbours' motion vector in reference frame,
D) motion vector of the macro block upper left quarter macro block identical with current macro coordinate in reference frame,
E) motion vector of the macro block upper right quarter macro block identical with current macro coordinate in reference frame;
Equal 1 if B current macro type of prediction is spatio-temporal prediction and pred_tpye, candidate motion vector is respectively:
A) motion vector of the macro block identical with current macro coordinate in reference frame,
B) motion vector of the left neighbours' macro block of current macro in present frame,
C) motion vector of current macro top macro block in present frame,
D) motion vector of current macro the right macro block in reference frame,
E) motion vector of current macro bottom macro block in reference frame;
If C current macro type of prediction is only for spatial prediction and pred_tpye equal 0, candidate motion vector is respectively:
A) motion vector of current macro left side macro block in present frame,
B) current macro upper left quarter macroblock motion vector in present frame,
C) current macro upper right quarter macroblock motion vector in present frame;
If D current macro type of prediction is only for spatial prediction and pred_tpye equal 1, candidate motion vector is respectively:
A) motion vector of this macro block left part macro block in present frame,
B) motion vector of this macro block top macro block in present frame,
C) motion vector of this macro block right part macro block in present frame,
D) motion vector of this macro block bottom macro block in present frame.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310138420.1A CN104113756A (en) | 2013-04-22 | 2013-04-22 | Integer pixel motion estimation method suitable for H.264 video encoding and decoding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310138420.1A CN104113756A (en) | 2013-04-22 | 2013-04-22 | Integer pixel motion estimation method suitable for H.264 video encoding and decoding |
Publications (1)
Publication Number | Publication Date |
---|---|
CN104113756A true CN104113756A (en) | 2014-10-22 |
Family
ID=51710372
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310138420.1A Pending CN104113756A (en) | 2013-04-22 | 2013-04-22 | Integer pixel motion estimation method suitable for H.264 video encoding and decoding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104113756A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108271028A (en) * | 2016-12-30 | 2018-07-10 | 北京优朋普乐科技有限公司 | One sub-pixel all direction search method and device |
CN109831672A (en) * | 2019-01-09 | 2019-05-31 | 北京大学 | A kind of method for estimating of Space-time Pulse array |
CN110557631A (en) * | 2015-03-10 | 2019-12-10 | 华为技术有限公司 | Image prediction method and related device |
WO2020038232A1 (en) * | 2018-08-21 | 2020-02-27 | 华为技术有限公司 | Method and apparatus for predicting movement information of image block |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101227599A (en) * | 2008-01-24 | 2008-07-23 | 苏州科技学院 | Intelligent video monitor terminal |
CN102075748A (en) * | 2010-12-27 | 2011-05-25 | 北京自动测试技术研究所 | Search method for video coding motion estimation |
CN102263951A (en) * | 2011-07-06 | 2011-11-30 | 北京航空航天大学 | Quick fractal video compression and decompression method |
CN102447904A (en) * | 2011-10-24 | 2012-05-09 | 成都虢电智能电力科技有限公司 | Method for quick motion estimation of video sequences |
-
2013
- 2013-04-22 CN CN201310138420.1A patent/CN104113756A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101227599A (en) * | 2008-01-24 | 2008-07-23 | 苏州科技学院 | Intelligent video monitor terminal |
CN102075748A (en) * | 2010-12-27 | 2011-05-25 | 北京自动测试技术研究所 | Search method for video coding motion estimation |
CN102263951A (en) * | 2011-07-06 | 2011-11-30 | 北京航空航天大学 | Quick fractal video compression and decompression method |
CN102447904A (en) * | 2011-10-24 | 2012-05-09 | 成都虢电智能电力科技有限公司 | Method for quick motion estimation of video sequences |
Non-Patent Citations (2)
Title |
---|
刘娜 等: "H.264 SUMHexagonS运动估计算法的研究", 《2009年中国高校通信类院系学术研讨会论文集》 * |
薛冲冲: "视频压缩中运动估计算法及预测搜索起始点的研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 * |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110557631A (en) * | 2015-03-10 | 2019-12-10 | 华为技术有限公司 | Image prediction method and related device |
CN110557631B (en) * | 2015-03-10 | 2023-10-20 | 华为技术有限公司 | Image prediction method and related equipment |
CN108271028A (en) * | 2016-12-30 | 2018-07-10 | 北京优朋普乐科技有限公司 | One sub-pixel all direction search method and device |
WO2020038232A1 (en) * | 2018-08-21 | 2020-02-27 | 华为技术有限公司 | Method and apparatus for predicting movement information of image block |
CN109831672A (en) * | 2019-01-09 | 2019-05-31 | 北京大学 | A kind of method for estimating of Space-time Pulse array |
CN109831672B (en) * | 2019-01-09 | 2020-10-27 | 北京大学 | Motion estimation method of space-time pulse array, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI752341B (en) | Interaction between different dmvd models | |
CN113170181B (en) | Affine inheritance method in intra-block copy mode | |
CN111357294B (en) | Reduced entropy coding and decoding based on motion information lists of sub-blocks | |
US10841577B2 (en) | Method and apparatus for video encoding and video decoding based on neural network | |
US20200137416A1 (en) | Overlapped search space for bi-predictive motion vector refinement | |
TWI734147B (en) | Motion prediction based on updated motion vectors | |
CN116781928A (en) | Method and apparatus for image motion compensation | |
CN107409225A (en) | Movable information derivation pattern (DM) determines in video coding | |
TW201742465A (en) | Affine motion prediction for video coding | |
CN110121883A (en) | The method and apparatus that image is decoded in image encoding system | |
CN112292862A (en) | Memory access window and padding for motion vector modification and motion compensation | |
CN112292861B (en) | Sub-pixel accurate correction method based on error surface for decoding end motion vector correction | |
CN113545085A (en) | Enabling DMVR based on information in picture header | |
CN111818342B (en) | Inter-frame prediction method and prediction device | |
CN113796084B (en) | Motion vector and prediction sample refinement | |
CN111201795A (en) | Memory access window and padding for motion vector modification | |
CN109495738A (en) | A kind of decoding method and device of motion information | |
CN104113756A (en) | Integer pixel motion estimation method suitable for H.264 video encoding and decoding | |
CN113302916A (en) | Interpolation for bi-prediction with CU level weights | |
US20220191503A1 (en) | Method for deriving motion vector, and electronic device | |
CN112261413B (en) | Video encoding method, encoding device, electronic device, and storage medium | |
TW202021359A (en) | Extension of look-up table based motion vector prediction with temporal information | |
CN111670578B (en) | Video coding or decoding method, device, equipment and storage medium | |
JP6390275B2 (en) | Encoding circuit and encoding method | |
Ali et al. | A spatio-temporal recursive search based prediction scheme for efficient multi-frame and bidirectional motion estimation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20141022 |
|
WD01 | Invention patent application deemed withdrawn after publication |