CN101527854A - Interframe mode selection method - Google Patents

Interframe mode selection method Download PDF

Info

Publication number
CN101527854A
CN101527854A CN 200910005620 CN200910005620A CN101527854A CN 101527854 A CN101527854 A CN 101527854A CN 200910005620 CN200910005620 CN 200910005620 CN 200910005620 A CN200910005620 A CN 200910005620A CN 101527854 A CN101527854 A CN 101527854A
Authority
CN
China
Prior art keywords
motion vector
subdivision
adjacent piece
vector predictor
cost function
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
Application number
CN 200910005620
Other languages
Chinese (zh)
Inventor
焦华龙
皮川
袁开智
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
VISIONFLOW TECHNOLOGY (SUZHOU) Co Ltd
VisionFlow Inc
Original Assignee
VISIONFLOW TECHNOLOGY (SUZHOU) Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by VISIONFLOW TECHNOLOGY (SUZHOU) Co Ltd filed Critical VISIONFLOW TECHNOLOGY (SUZHOU) Co Ltd
Priority to CN 200910005620 priority Critical patent/CN101527854A/en
Publication of CN101527854A publication Critical patent/CN101527854A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention relates to an interframe mode selection method which comprises the following steps: based on the acquisition of motion vector predictive values in large-scale subdivision modes, confirming a start searching point according to the motion vector predictive values in the large-scale subdivision modes; respectively adopting different ways to calculate match errors for the start searching point and each following non-start searching point and updating and storing match results according to the match errors until a search is finished; then, calculating cost functions of all the subdivision modes according to the match results and confirming a selected subdivision mode. The interframe mode selection method calculates the cost functions at two stages, carries out motion estimation search only to 16*16 subdivision and utilizes the match error of 4*4 subdivision to obtain the match errors of other parts so as to obtain an optimal mode, further reduce a great search frequency and calculation, save the calculation time and improve the encoding efficiency.

Description

Inter-frame mode selecting method
Technical field
The present invention relates to the video coding technique of information processing, particularly the inter-frame mode selecting method of tree coding.
Background technology
Vedio data has very strong temporal correlation, therefore has a large amount of redundant informations.Wherein redundant information can be divided into spatial domain redundant information and time domain redundant information.Video compression coding makes data volume obtain compression by removing the redundant information in the video data, thereby is convenient to the storage and the transmission of video data.Adopt inter-frame coding can remove the time domain redundant information.
In some video image, moving image seldom, block of pixels in every frame video is most of identical with the corresponding blocks of former frame, perhaps near identical, then can be poor by the frame between computing two frames, and otherness encoded, that is to say, predict, compensate current topography by previous topography, realize compression image.Compared to separately each two field picture being encoded, this motion compensation process can reduce needed coded data bit effectively.
But when having movement of objects in the video image, in every frame video image, each block of pixels will be no longer identical with corresponding blocks in the former frame, but with respect to corresponding blocks, produce an offset distance corresponding with the direction of motion.At this moment, adopt estimation and motion compensation, can remove interframe time domain redundancy effectively, realize higher compression ratio.
It is a kind of motion estimation algorithm commonly used that block matching motion is estimated, its basic thought is each frame video image is divided into the macro block of a plurality of non-overlapping copies.By contrast reference frame and present frame, according to certain matching algorithm, in reference frame, determine to present frame in the most similar piece of macro block, just find out match block.Wherein, reference frame is previous image encoded, and each macro block comprises the 16x16 pixel region, and the position of each macro block in present frame is the motion vector of this macro block with respect to the skew of its match block position in reference frame.
Go redundant efficient lower because the difference of the piece of fixed structure coupling moving object in to a frame changes, H.264 adopted the block matching method of tree in the standard.H.264 be the high compression digital video coding-coding device standard that proposes by the joint video team (JVT, Joint VideoTeam) that ITU-T video coding expert group and ISO/IEC dynamic image expert group constitute jointly.This coding techniques is also referred to as AVC, i.e. advanced video coding.H.264 in, allow macro block to select a plurality of previous reference frames, increase the estimation reference frame number of time shaft in the motion vector, thereby improve matching effect.
With reference to figure 1, in the block matching method of tree, the macro block of a 16x16 can have following subdivision pattern and estimation mode: 1 16x16 macro block subdivision, 2 sub-piece subdivisions of 16x8,2 sub-piece subdivisions of 8x16 or 4 8x8 piece subdivisions; Wherein, each 8x8 piece also can be split into: 1 8x8 piece subdivision, 2 8x4 piece subdivisions, 2 4x8 piece subdivisions or 4 4x4 piece subdivisions.Each macro block can be a large amount of according to these subdivision mode producing combination, because all macro block and sub-pieces all need to represent with an independent motion vector, and each motion vector all needs to be encoded and to transmit with the subdivision pattern that is adopted, therefore how to choose the partition mode of macro block, making code efficiency and computation complexity and memory capacity reach balance, is the key issue in the tree coding.
Prior art is in the standard H.264, and the system of selection of inter-frame mode also has some relevant researchs.Application number is 200610165565.0, name is called in the Chinese invention patent application of " a kind of H264 video coding fast schema selection method and device ", a kind of H264 video coding fast schema selection method is disclosed, by target macroblock being carried out the full search of 16x16 pixel size earlier, and a threshold value TV is set, compare with door threshold value TV by the absolute difference sum T-SAD that will search for entirely, judge whether to carry out the search once more of 8x8 pixel size, and a threshold value PV is set, compare with door threshold value PV by the absolute difference sum P-SAD that will search for once more, judge whether to carry out the fine search of 4x4 pixel size.Although this method is by being provided with the number of times that a threshold value has reduced a little needs search, pre-set threshold but is difficult to adapt to the video content that changes, and judges and makes mistakes easily, and then influence coding efficiency.
Application number is 200510086747.4, name is called in the Chinese invention patent application of " mode selecting method that a kind of interframe movement is H.264/AVC estimated ", the mode selecting method that a kind of interframe movement is estimated is also disclosed, by a threshold value is set, absolute difference sum between macroblock frame and door threshold value are compared, with macroblock partitions is large scale macro block (16x16,16x8,8x16), middle size macro block (8x8,8x4,4x8) and small size macro block (4x4), and adopts different searching methods to determine match point.Although this method was classified macro block before search, be divided into large scale, middle size and small size, still need very complicated computing and a large amount of internal storage access, and also exist the door threshold value that the inaccurate problem of makeing mistakes that causes judging is set.
Summary of the invention
The problem that the present invention solves is the tree type coding inter-frame mode selecting method of a kind of low complex degree, low operand to be provided, and then can to improve code efficiency, the reduction computation complexity.
For addressing the above problem, the invention provides a kind of inter-frame mode selecting method, comprising:, obtain the motion vector predictor of large scale subdivision pattern according to adjacent macroblocks information; According to the motion vector predictor of described large scale subdivision pattern, determine initial search point; At initial search point, calculate the matching error of all subdivision patterns, obtain and preserve matching result; After each non-initial search point, calculate the matching error of all subdivision patterns, and upgrade the matching result of described preservation; After search is finished,, calculate the cost function of all subdivision patterns according to described matching result; According to the cost function of each subdivision pattern, determine selected subdivision pattern.
Optionally, described matching result comprises the cost function of large scale subdivision pattern, the absolute difference sum and the corresponding motion vector of other subdivision pattern.
Optionally, described at initial search point, calculate the matching error of all subdivision patterns, obtain and preserve matching result to comprise: the absolute difference sum of calculating various subdivision patterns; Calculate the motion vector cost function of large scale subdivision pattern and the motion vector of other subdivision pattern; According to the motion vector cost function and the absolute difference sum of described large scale subdivision pattern, calculate the cost function of described large scale subdivision pattern; , preserve as matching result with the absolute difference sum of the cost function of described large scale subdivision pattern, other subdivision pattern and corresponding motion vector.
Optionally, the absolute difference sum of the various subdivision patterns of described calculating comprises: the absolute difference sum of calculating and preserving 16 4x4 pieces; According to the absolute difference sum of 4x4 piece, calculate the absolute difference sum of 8x4 piece and 4x8 piece; According to the absolute difference sum of 8 8x4 pieces that obtained, calculate the absolute difference sum of 4 8x8 pieces, and, calculate the absolute difference sum of 2 sub-pieces of 16x8 and 2 sub-pieces of 8x16 according to the absolute difference sum of 4 8x8 pieces that obtained; According to the absolute difference sum of 2 sub-pieces of 16x8 that obtained, calculate the absolute difference sum of 16x16 macro block.
Optionally, described non-initial search point is based on that the cost function of resulting 16x16 subdivision pattern determines.
Optionally, described cost function based on 16x16 subdivision pattern determines that non-initial search point comprises: with the point of the cost function minimum of 16x16 subdivision pattern, as next one search point.
Optionally, the matching result that described renewal is preserved comprises: to the cost function of the subdivision of large scale described in matching result pattern, the absolute difference sum and the corresponding motion vector of other subdivision pattern, upgrade respectively.
Optionally, described respectively the absolute difference sum of the cost function of large scale subdivision pattern in the matching result, other subdivision pattern and corresponding motion vector renewals comprises: with the cost function of the described large scale subdivision pattern in the matching result that is obtained, the absolute difference sum and the corresponding motion vector of other subdivision pattern, with cost function, the absolute difference sum of other subdivision pattern and the corresponding motion vector of described large scale subdivision pattern in the matching result of being preserved, compare respectively according to the subdivision pattern of correspondence; For every kind of subdivision pattern, if relatively be cost function, choose less one of cost function, preserve its cost function, and motion vector that will be corresponding with it is replaced the back and is preserved; If perhaps relatively be the absolute difference sum, choose less one of absolute difference sum, preserve its absolute difference sum, and motion vector that will be corresponding with it is replaced the back and is preserved.
Optionally, described large scale subdivision pattern comprises 16x16 subdivision, 16x8 subdivision and 8x16 subdivision.
Optionally, described according to adjacent block information, the motion vector predictor that obtains large scale subdivision pattern comprises: for the 16x16 subdivision, judge that upper left adjacent piece is whether in the effective range of image: when the effective range of described upper left adjacent piece piece at image, relatively whether the reference frame index of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent piece and current macro is identical respectively, judge according to identical number: if described identical number is greater than 1, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, the upper left adjacent block motion vector motion vector predictor as current macro; If described identical number is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of current macro with current macro; If the adjacent piece in the left side in the effective range of image and the adjacent piece in top not in the effective range of image, so with the motion vector of the adjacent piece in the left side motion vector predictor as current macro; Otherwise also with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current macro.When upper left adjacent piece is not in the effective range at image, replaces upper left adjacent piece with upper right adjacent piece and carry out above-mentioned judgement; For the 16x8 subdivision, when the 16x8 subdivision is the first half of macro block, whether the reference frame index of the adjacent piece in more described macro block top is identical with the reference frame index of described macro block: if identical, motion vector with the adjacent piece in described macro block top is its motion vector predictor, if different, would be its motion vector predictor with the motion vector predictor of described 16x16 subdivision; When the 16x8 subdivision is the latter half of macro block, with the integer pixel motion vector of the adjacent piece in the described macro block left side as its motion vector predictor; For the 8x16 subdivision, when the 8x16 subdivision is the left-half of macro block, be its motion vector predictor with the motion vector of the adjacent piece in the described macro block left side; When the 8x16 subdivision is the right half part of macro block, whether the reference frame index of the adjacent piece in more described macro block top is identical with the reference frame index of described macro block: if identical, motion vector with the adjacent piece in described macro block top is its motion vector predictor, if different, would be its motion vector predictor with the motion vector predictor of described 16x16 subdivision.
Optionally, described according to described matching result, the cost function that calculates all subdivision patterns comprises: according to described matching result, recomputate the motion vector predictor of each subdivision pattern; According to described motion vector predictor, obtain the motion vector cost function of each subdivision pattern; According to described motion vector cost function, obtain the cost function of each subdivision pattern.
Optionally, the described motion vector predictor that recomputates each subdivision pattern comprises: for the motion vector predictor of 16x16 subdivision, 16x8 subdivision and 8x16 subdivision left-half, do not calculate again; Recomputate the motion vector predictor of 8x16 subdivision right half part; Calculate the motion vector predictor of 8x8,8x4,4x8 and 4x4 subdivision.
Optionally, the described motion vector predictor that recomputates 8x16 subdivision right half part, comprise: relatively whether the reference frame index of the reference frame index of the adjacent piece in top and current block is identical: when the reference frame index of the reference frame index of the adjacent piece in top and current block is identical, motion vector with the adjacent piece in top is the motion vector predictor of described 8x16 subdivision, otherwise whether the reference frame index of then more upper left adjacent piece and current block is identical; When the reference frame index of upper left adjacent piece and current block is identical, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top and upper left adjacent piece motion vector predictor as described 8x16 subdivision; When the reference frame index of upper left adjacent piece and current block not simultaneously, be described 8x16 subdivision motion vector predictor with the motion vector of current block left-half 8x16 subdivision.
Optionally, the described motion vector predictor of calculating 8x8,8x4,4x8 and 4x4 subdivision, comprise: judge that upper left adjacent piece is whether in the effective range of image: if, relatively whether the reference frame index of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent piece and current block is identical respectively, judge according to identical number: if described identical number is greater than 1, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, the upper left adjacent block motion vector motion vector predictor as current block; If described identical number is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of current block with current block; If the adjacent piece in the left side in the effective range of image and the adjacent piece in top not in the effective range of image, so with the motion vector of the adjacent piece in the left side motion vector predictor as current block; Otherwise also with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current block.When upper left adjacent piece is not in the effective range at image, replaces upper left adjacent piece with upper right adjacent piece and carry out above-mentioned judgement.
Optionally, described cost function according to each subdivision pattern determines that selected subdivision pattern comprises: in the determined subdivision pattern, its cost function has minimum value.
Optionally, described motion vector predictor according to large scale subdivision pattern is determined initial search point, comprising: determine initial search point according to the motion vector predictor of 16x16 subdivision.
Optionally, described motion vector predictor according to the 16x16 subdivision is determined initial search point, comprising: will be apart from the nearest integer position of 16x16 subdivision motion vector predictor as initial search point.
Compared with prior art, the present invention is by relatively each searches for the cost function of some large scale subdivision pattern and the SAD of other pattern, the information that each subdivision pattern is searched for is a little preferably preserved respectively, for example Dui Ying cost function and/or SAD and motion vector, and after search is finished, recomputate cost function, determine the pattern of selection, thereby significantly reduced operand, saved operation time, improved code efficiency.
Description of drawings
Fig. 1 is in the block matching method of tree, the schematic diagram of pattern that the macro block of a 16x16 has and estimation mode;
Fig. 2 is the schematic flow sheet of inter-frame mode selecting method execution mode of the present invention;
Fig. 3 is in the inter-frame mode selecting method execution mode of the present invention, the structural representation of current macro and adjacent block position relation;
Fig. 4 is in the inter-frame mode selecting method execution mode of the present invention, first subdivision of 16x8 and adjacent block position view;
Fig. 5 is in the inter-frame mode selecting method execution mode of the present invention, second subdivision of 16x8 and adjacent block position view;
Fig. 6 is in the inter-frame mode selecting method execution mode of the present invention, a 8x16 left side half subdivision and adjacent block position view;
Fig. 7 is in the inter-frame mode selecting method execution mode of the present invention, right half subdivision of 8x16 and adjacent block position view;
Fig. 8 is the schematic flow sheet of step S3 embodiment among Fig. 2;
Fig. 9 is the schematic flow sheet of step S800 embodiment among Fig. 8.
Embodiment
H.264 in the standard, inter-frame mode selecting method is generally by setting a plurality of branches, select the branch block mode according to corresponding threshold value, judge whether to merge with big block splitting or with fritter, thereby the rejecting its Several Negotiable Modes, reaching the purpose that reduces amount of calculation, yet pre-set threshold but is difficult to adapt to the video content that changes, judge and make mistakes easily, and then influence coding efficiency.In addition, the amount of calculation that is reduced is more limited, to the requirement of system's computing and storage capacity than higher.
With reference to figure 2, the invention provides a kind of inter-frame mode selecting method, comprising: step S1 according to adjacent block information, obtains the motion vector predictor of large scale subdivision pattern; Step S2 according to the motion vector predictor of described large scale subdivision pattern, determines initial search point; Step S3 at initial search point, calculates the matching error of all subdivision patterns, obtains and preserve matching result; After each non-initial search point, calculate the matching error of all subdivision patterns, and upgrade the matching result of described preservation; Step S4 after search is finished, according to described matching result, calculates the cost function of all subdivision patterns; Step S5 according to the cost function of each subdivision pattern, determines selected subdivision pattern.
Below in conjunction with drawings and Examples, embodiment of the present invention is described in detail.
With reference to figure 3, wherein, E is a current macro, and A, B, C and D are respectively the left side of E, the adjacent block of last, upper right and upper left corresponding modes.Because when encoding, always according to from left to right and sequential encoding from top to bottom, describedly estimate the motion vector predictor of large scale subdivision pattern according to contiguous block information, can only estimate according to the adjacent block of the current block left side or top.
Particularly, can obtain the motion vector predictor of large scale subdivision pattern, that is to say that described adjacent block information can comprise adjacent piece reference frame index according to the reference frame index of contiguous block.Adjacent piece may have identical reference frame, also may quote different reference frames.The reference frame index of piece can be used for identifying the reference frame that this piece is quoted.Specifically, when the reference frame index of adjacent block is-2, represent that this piece is not in the effective range of image; When the reference frame index of adjacent block is-1, represent that this piece is the INTRA piece; When the reference frame index of adjacent block is 0, represent that this piece is reference with a nearest forward direction reconstruction frames; When the reference frame index of adjacent block is worth for other, represent that this piece is reference with other reconstruction frames.Therefore, by comparing the reference frame index of current block and adjacent block, it is for referencial use to determine whether both quote same two field picture, to obtain the motion vector predictor of described large scale subdivision pattern
Described large scale subdivision pattern can comprise 16x16 subdivision, 16x8 subdivision and 8x16 subdivision.
Specifically, for the 16x16 subdivision, judge that the C piece is whether in the effective range of image; When the effective range of C piece at image, A piece relatively respectively, the B piece, whether the reference frame index of C piece and macro block E is identical, judges according to identical number N; If N>1 is with the intermediate value of A piece, B piece, the C block motion vector motion vector predictor as macro block E; If N is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of macro block E with macro block E; If the A piece in the effective range of image and the B piece not in the effective range of image, so with the motion vector of A piece motion vector predictor as macro block E; Otherwise also with the intermediate value of A piece, B piece, C block motion vector motion vector predictor as macro block E.When the C piece is not in the effective range at image, replaces the C piece with the D piece and carry out above-mentioned judgement.
For the 16x8 subdivision, the 16x8 subdivision can be the first half of macro block or the latter half of macro block.With reference to figure 4, when the 16x8 subdivision was the first half 401 of macro block E, relatively whether the reference frame index of the reference frame index of B1 piece and macro block E was identical; When the reference frame index of the reference frame index of B1 piece and macro block E is identical, motion vector with the B1 piece is the motion vector predictor of this 16x8 subdivision 401, otherwise is the motion vector predictor of this 16x8 subdivision 401 with the motion vector predictor of described 16x16 subdivision then.With reference to figure 5, when the 16x8 subdivision is the latter half 501 of macro block E, with the motion vector of A2 piece motion vector predictor as this 16x8 subdivision 501.
For the 8x16 subdivision, the 8x16 subdivision can be the left-half of macro block or the right half part of macro block.With reference to figure 6, when this 8x16 subdivision is the left-half 601 of macro block E, with the motion vector of A3 piece motion vector predictor as this 8x16 subdivision 601.With reference to figure 7, when this 8x16 subdivision is the left-half 701 of macro block E, relatively whether the reference frame index of the reference frame index of B4 piece and macro block E is identical: when the reference frame index of the reference frame index of B4 piece and macro block E is identical, motion vector with the B4 piece is the motion vector predictor of this 8x16 subdivision, otherwise is the motion vector predictor of this 8x16 subdivision 701 with the motion vector predictor of described 16x16 subdivision then.
Step S2 can comprise: determine initial search point according to the motion vector predictor of 16x16 subdivision.Specifically, can comprise: will be apart from the nearest integer position of 16x16 subdivision motion vector predictor as initial search point.
Confirm after the described initial search point that execution in step S3 begins search.
Absolute difference sum SAD (Sums of absolute difference) is a kind of matching principle commonly used, is used to be illustrated under certain subdivision pattern the absolute error sum of current block and match block.Specifically, i.e. the absolute value sum of all correspondence position pixel differences of corresponding brightness piece in the luminance component of current macroblock to be encoded and the reference frame.
In addition, also can be with SAD and motion vector cost function MV_COST sum as the cost function ME_COST that weighs matching accuracy.The motion vector cost function is defined as:
MV_COST=λ[R(|MV x-PMV x|)+R(|MV y-PMV y|)];
Wherein, MV is a motion vector; PMV is a motion vector predictor; λ is only relevant with macroblock quantization parameter QP number, and QP is relevant with code stream and image quality, when the QP value more hour, corresponding image quality is good more, code stream is also big more, λ is also big more simultaneously; R is the code length of Glenn cloth (Exp_Golomb) coding.
Specifically, with reference to figure 8, step S3 can comprise: step S800, at initial search point, calculate the matching error of all subdivision patterns, and obtain and preserve matching result; Step S810 determines the direction of search, obtains next search point; Step S820 at each non-initial search point, calculates the matching error of all subdivision patterns, and upgrades the matching result of described preservation; Repeating step S810 and step S820 finish up to search.
Wherein, with reference to figure 9, step S800 can comprise: step S901, calculate the SAD of various subdivision patterns.Specifically, comprising: at first, calculate and preserve the SAD of 16 4x4 pieces.
Then, calculate the SAD of 8x4 piece and 4x8 piece, specifically, the SAD addition of diverse location 4x4 piece correspondence is obtained the SAD of 8 8x4 pieces and the SAD of 8 4x8 pieces according to the SAD of 4x4 piece.Then, similarly,, calculate the SAD of 4 8x8 pieces, and, calculate the SAD of 2 sub-pieces of 16x8 and 2 sub-pieces of 8x16 according to the SAD of 4 8x8 pieces that obtained according to the SAD of 8 8x4 pieces that obtained.At last, according to the SAD of 2 sub-pieces of 16x8 that obtained, calculate the SAD of 16x16 macro block.That is to say,, obtain 41 SAD altogether corresponding to various subdivision patterns.
Step S902 calculates the motion vector cost function of large scale subdivision pattern and the motion vector of other subdivision pattern.Specifically,, calculate the motion vector cost function of described large scale subdivision pattern respectively, just calculate 2 16x8 pieces, the motion vector cost function MV_COST of 2 8x16 pieces and 1 16x16 piece according to the described motion vector predictor that step S1 is obtained.For other subdivision pattern, do not determine because relevant adjacent block motion vector is last, can't estimate accurately the motion vector predictor of these subdivision patterns this moment, therefore do not calculate the motion vector cost function of these subdivision patterns, only calculate its corresponding motion vector and preserve.
Step S903 according to the motion vector cost function and the SAD of described large scale subdivision pattern, calculates the cost function of described large scale subdivision pattern, just, and ME_COST=SAD+MV_COST.
Because all macro block and sub-pieces need all to represent with an independent motion vector that in code stream, each motion vector all needs to be encoded and to transmit, the subdivision pattern also needs to be encoded and to transmit.Large scale (16x16,16x8,8x16) the subdivision pattern needs less coded data bit to represent subdivision pattern and motion vector, but when comprising a large amount of movable information in this two field picture, its motion vector is irregular will be very big, and small size (8x8,8x4,4x8,4x4) subdivision pattern, comparatively speaking, the irregular meeting of the motion vector that is produced is little, but needs more coded data bit to represent subdivision pattern and motion vector.Therefore, with motion vector cost function and SAD sum,, the quality of subdivision pattern is judged as cost function.
Step S904, with the cost function of described large scale subdivision pattern, the SAD and the corresponding motion vector of other subdivision pattern, promptly 5 ME_COST, other 36 SAD and corresponding motion vector as matching result, are preserved.
Next, with reference to figure 8, execution in step S810 determines the direction of search, continues search.Described definite direction of search can comprise, the cost function of the 16x16 subdivision pattern that obtains based on step S800 is determined next one search point.Specifically, with the point of the cost function minimum of 16x16 subdivision pattern, as next one search point.The inventor finds, by the traversal mode motion vector optimum under each subdivision pattern is calculated, optimum subdivision pattern has very big probability to appear in the motion vector of 16x16 subdivision, therefore determine next search point according to the cost function of 16x16 subdivision pattern, the cost function of 16x16 subdivision pattern is more little, then can think and approach optimum more.After determining the search point, can search for according to three-step approach or diamond search method etc.The method of concrete search does not limit to some extent to the enforcement of step S810.
Determine after the next search point, with reference to figure 8, execution in step S820.Wherein, search point at each non-initial search point, calculate the step of all subdivision pattern matching errors and the step of calculating all subdivision pattern matching errors in starting point, except final step, roughly the same, that is: at non-initial search point, at first, calculate the SAD of various subdivision patterns, then, calculate the motion vector cost function of large scale subdivision pattern and the motion vector of other subdivision pattern, then, according to the motion vector cost function and the SAD of described large scale subdivision pattern, calculate the cost function of described large scale subdivision pattern.
In step S820, upgrade the matching result of described preservation, can comprise specifically: after the motion vector of 5 ME_COST of a non-initial search point of every acquisition, other 36 SAD and correspondence, described matching result is upgraded.Specifically, obtain after the matching result of first non-initial search point, with the cost function of described large scale subdivision pattern, the SAD and the corresponding motion vector of other subdivision pattern, with the described matching result of the initial search point that is obtained from step S800, compare respectively according to the subdivision pattern of correspondence.For each subdivision pattern, that no matter compare is cost function or SAD, chooses wherein less one and preserves, and corresponding motion vector is replaced the original motion vector of preserving, and preserved.That is to say, for every kind of subdivision pattern: if relatively be cost function, choose less one of cost function, preserve its cost function, and preserve the motion vector corresponding with it; If perhaps relatively be the absolute difference sum, choose less one of absolute difference sum, preserve its absolute difference sum, and preserve the motion vector corresponding with it.
After this, after the matching result of a new non-initial search point of every acquisition, with the cost function of described large scale subdivision pattern, the SAD and the corresponding motion vector of other subdivision pattern, compare with the value of being preserved respectively, choose wherein less one and preserve, and the motion vector of correspondence is preserved.
Because SAD is used to represent the difference between current block and the match block, and the subdivision pattern that macro block is finally chosen is for can make a kind of of cost function minimum, so SAD is more little or cost function is more little, it is high more to mate accuracy, and selected subdivision pattern is good more.Therefore, the each renewal in the resulting described matching result in back will comprise the optimal match point of various subdivision patterns, corresponding to best cost function, SAD and corresponding motion vector.
Give an example, in the described matching result that is obtained, can comprise: the cost function of A point 16x16 subdivision pattern, the cost function of 1 16x8 subdivision of B point pattern and the cost function of 2 8x16 subdivision patterns, the cost function of 1 16x8 subdivision of C point pattern and the SAD of 2 8x8 subdivision patterns and corresponding motion vector, the SAD of 8 8x4 subdivisions of D point pattern and corresponding motion vector, 2 8x8 subdivisions of E point pattern, the SAD of 4 4x8 subdivision patterns and 7 4x4 subdivision patterns and corresponding motion vector, the SAD of F point 4 4x8 subdivisions pattern and 9 4x4 subdivision patterns and corresponding motion vector, wherein, A, B, C, D, E or F point can be initial search point, also can be non-initial search point.
After described motion estimation result of every acquisition, execution in step S810 determines the direction of search repeatedly, continues the next search of search point, according to the next one search point matching result is upgraded, and finishes up to search.Wherein, the condition of search end is relevant with concrete searching algorithm.
Search has obtained final matching result after finishing, and next, with reference to figure 2, according to described matching result, recomputates the motion vector predictor of each subdivision pattern in step S4.After search is finished, cost function or the SAD and the corresponding motion vector of every kind of subdivision pattern optimum have been preserved in the described matching result, therefore can calculate again the motion vector predictor of each subdivision pattern, and the cost function that recomputates each subdivision pattern is to obtain result more accurately.
In specific embodiment, the motion vector predictor that recomputates each subdivision pattern can comprise:
For 16x16 subdivision, 16x8 subdivision and 8x16 subdivision left-half, adopt the motion vector predictor that is obtained among the step S1, need not calculate again.
With reference to figure 7, when the 8x16 subdivision is the right half part 701 of macro block E, relatively whether the reference frame index of the reference frame index of B4 piece and macro block E is identical: when the reference frame index of the reference frame index of B4 piece and macro block E is identical, motion vector with the B4 piece is the motion vector predictor of this 8x16 subdivision 701, otherwise then relatively whether the reference frame index of C4 piece and macro block E is identical; When identical,, not simultaneously, be these 8x16 subdivision 701 motion vector predictor with the motion vector of macro block E left-half 8x16 subdivision with the intermediate value of A4 piece, B4 piece and C4 piece motion vector predictor as this 8x16 subdivision 701.
For 8x8,8x4,4x8 and 4x4 subdivision, carry out the following step respectively, to obtain the motion vector predicted value of current block: judge that upper left adjacent piece is whether in the effective range of image: if, relatively whether the reference frame index of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent piece and current block is identical respectively, judge according to identical number N: if N>1, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current block; If N is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of current block with current block; If the adjacent piece in the left side in the effective range of image and the adjacent piece in top not in the effective range of image, so with the motion vector of the adjacent piece in the left side motion vector predictor as current block; Otherwise also with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current block.When upper left adjacent piece is not in the effective range at image, replaces upper left adjacent piece with upper right adjacent piece and carry out above-mentioned judgement.
Obtain after the cost function of each subdivision pattern, with reference to figure 2, execution in step S5 according to the cost function of each subdivision pattern, determines selected subdivision pattern.Specifically, in the determined subdivision pattern, its cost function has minimum value.
H.264, the respective embodiments described above are being example, concrete enforcement of the present invention is described and explains, yet the present invention is not limited to only be applicable to H.264 standard, in fact, for all tree codings, can use the present invention and obtain preferable inter-frame mode fast, between code efficiency and operand and memory capacity, reach balance.
Compared to prior art, the respective embodiments described above of the present invention have adopted the method for calculation cost function stage by stage, promptly by relatively each searches for the cost function of some large scale subdivision pattern and the SAD of other pattern, the information that each subdivision pattern is searched for is a little preferably preserved respectively, for example Dui Ying cost function and/or SAD and motion vector, and after search is finished, recomputate cost function, determine the pattern of selection, thereby significantly reduced operand, save operation time, improved code efficiency.
And the above-mentioned execution mode of the present invention only need be according to the 16x16 subdivision, and need not search for again according to other subdivision pattern, thereby has reduced the number of times of actual match search, has reduced operand.
Though the present invention by the better embodiment explanation as above, these better embodiment are not in order to limit the present invention.Those skilled in the art without departing from the spirit and scope of the present invention, should have the ability these better embodiment are made various corrections and additional, and therefore, protection scope of the present invention is as the criterion with the scope of claims.

Claims (17)

1. an inter-frame mode selecting method is characterized in that, comprising:
According to adjacent macroblocks information, obtain the motion vector predictor of large scale subdivision pattern;
According to the motion vector predictor of described large scale subdivision pattern, determine initial search point;
At initial search point, calculate the matching error of all subdivision patterns, obtain and preserve matching result;
After each non-initial search point, calculate the matching error of all subdivision patterns, and upgrade the matching result of described preservation;
After search is finished,, calculate the cost function of all subdivision patterns according to described matching result;
According to the cost function of each subdivision pattern, determine selected subdivision pattern.
2. inter-frame mode selecting method as claimed in claim 1 is characterized in that, described matching result comprises the cost function of large scale subdivision pattern, the absolute difference sum and the corresponding motion vector of other subdivision pattern.
3. inter-frame mode selecting method as claimed in claim 2 is characterized in that, and is described at initial search point, calculates the matching error of all subdivision patterns, obtains and preserve matching result to comprise:
Calculate the absolute difference sum of various subdivision patterns;
Calculate the motion vector cost function of large scale subdivision pattern and the motion vector of other subdivision pattern;
According to the motion vector cost function and the absolute difference sum of described large scale subdivision pattern, calculate the cost function of described large scale subdivision pattern;
, preserve as matching result with the absolute difference sum of the cost function of described large scale subdivision pattern, other subdivision pattern and corresponding motion vector.
4. inter-frame mode selecting method as claimed in claim 3 is characterized in that, the absolute difference sum of the various subdivision patterns of described calculating comprises:
The absolute difference sum of calculating and preserving 16 4 * 4 sub-pieces;
According to the absolute difference sum of 4 * 4 sub-pieces, calculate the absolute difference sum of 8 * 4 sub-pieces and 4 * 8 sub-pieces;
According to the absolute difference sum of 88 * 4 sub-pieces that obtained, calculate the absolute difference sum of 48 * 8 sub-pieces, and, calculate the absolute difference sum of 2 16 * 8 sub-pieces and 28 * 16 sub-pieces according to the absolute difference sum of 48 * 8 sub-pieces that obtained;
According to the absolute difference sum of 2 16 * 8 sub-pieces that obtained, calculate the absolute difference sum of 16 * 16 macro blocks.
5. inter-frame mode selecting method as claimed in claim 2 is characterized in that, described non-initial search point is based on that the cost function of resulting 16 * 16 subdivision patterns determines.
6. inter-frame mode selecting method as claimed in claim 5 is characterized in that, described cost function based on 16 * 16 subdivision patterns determines that described non-initial search point comprises: with the point of the cost function minimum of 16 * 16 subdivision patterns, as next one search point.
7. inter-frame mode selecting method as claimed in claim 1, it is characterized in that, the matching result that described renewal is preserved comprises: to the cost function of the subdivision of large scale described in matching result pattern, the absolute difference sum and the corresponding motion vector of other subdivision pattern, upgrade respectively.
8. inter-frame mode selecting method as claimed in claim 7 is characterized in that, described respectively the absolute difference sum of the cost function of large scale subdivision pattern in the matching result, other subdivision pattern and corresponding motion vector renewals comprises:
With the cost function of the described large scale subdivision pattern in the matching result that is obtained, the absolute difference sum and the corresponding motion vector of other subdivision pattern, with cost function, the absolute difference sum of other subdivision pattern and the corresponding motion vector of described large scale subdivision pattern in the matching result of being preserved, compare respectively according to the subdivision pattern of correspondence;
For every kind of subdivision pattern, if relatively be cost function, choose less one of cost function, preserve its cost function, and motion vector that will be corresponding with it is replaced the back and is preserved; If perhaps relatively be the absolute difference sum, choose less one of absolute difference sum, preserve its absolute difference sum, and motion vector that will be corresponding with it is replaced the back and is preserved.
9. inter-frame mode selecting method as claimed in claim 1 is characterized in that, described large scale subdivision pattern comprises 16 * 16 subdivisions, 16 * 8 subdivisions and 8 * 16 subdivisions.
10. inter-frame mode selecting method as claimed in claim 9 is characterized in that, and is described according to adjacent block information, and the motion vector predictor that obtains large scale subdivision pattern comprises:
For 16 * 16 subdivisions, judge that upper left adjacent piece is whether in the effective range of image; When the effective range of described upper left adjacent piece at image, relatively whether the reference frame index of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent piece and current macro is identical respectively, judge according to identical number: if described identical number is greater than 1, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, the upper left adjacent block motion vector motion vector predictor as current macro; If described identical number is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of current macro with current macro; If the adjacent piece in the left side in the effective range of image and the adjacent piece in top not in the effective range of image, so with the motion vector of the adjacent piece in the left side motion vector predictor as current macro; Otherwise also with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current macro.When upper left adjacent piece is not in the effective range at image, replaces upper left adjacent piece with upper right adjacent piece and carry out above-mentioned judgement;
For 16 * 8 subdivisions, when 16 * 8 subdivisions are the first half of macro block, whether the reference frame index of the adjacent piece in more described macro block top is identical with the reference frame index of described macro block: if identical, motion vector with the adjacent piece in described macro block top is its motion vector predictor, if different, would be its motion vector predictor with the motion vector predictor of described 16 * 16 subdivisions; When 16 * 8 subdivisions are the latter half of macro block, with the integer pixel motion vector of the adjacent piece in the described macro block left side as its motion vector predictor;
For 8 * 16 subdivisions, when 8 * 16 subdivisions are the left-half of macro block, be its motion vector predictor with the motion vector of the adjacent piece in the described macro block left side; When 8 * 16 subdivisions are the right half part of macro block, whether the reference frame index of the adjacent piece in more described macro block top is identical with the reference frame index of described macro block: if identical, motion vector with the adjacent piece in described macro block top is its motion vector predictor, if different, would be its motion vector predictor with the motion vector predictor of described 16 * 16 subdivisions.
11. inter-frame mode selecting method as claimed in claim 1 is characterized in that, described according to described matching result, the cost function that calculates all subdivision patterns comprises:
According to described matching result, recomputate the motion vector predictor of each subdivision pattern;
According to described motion vector predictor, obtain the motion vector cost function of each subdivision pattern;
According to described motion vector cost function, obtain the cost function of each subdivision pattern.
12. inter-frame mode selecting method as claimed in claim 11 is characterized in that, the described motion vector predictor that recomputates each subdivision pattern comprises:
For the motion vector predictor of 16 * 16 subdivisions, 16 * 8 subdivisions and 8 * 16 subdivision left-half, do not calculate again;
Recomputate the motion vector predictor of 8 * 16 subdivision right half parts;
Calculate the motion vector predictor of 8 * 8,8 * 4,4 * 8 and 4 * 4 subdivisions.
13. inter-frame mode selecting method as claimed in claim 12 is characterized in that, the described motion vector predictor that recomputates 8 * 16 subdivision right half parts comprises:
Relatively whether the reference frame index of the reference frame index of the adjacent piece in top and current block is identical; When the reference frame index of the reference frame index of the adjacent piece in top and current block is identical, be the motion vector predictor of described 8 * 16 subdivisions with the motion vector of the adjacent piece in top, otherwise whether the reference frame index of then more upper left adjacent piece and current block is identical;
When the reference frame index of upper left adjacent piece and current block is identical, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top and upper left adjacent piece motion vector predictor as described 8 * 16 subdivisions; When the reference frame index of upper left adjacent piece and current block not simultaneously, be described 8 * 16 subdivision motion vector predictor with the motion vector of current block left-half 8 * 16 subdivisions.
14. inter-frame mode selecting method as claimed in claim 12, it is characterized in that, the motion vector predictor of described calculating 8 * 8,8 * 4,4 * 8 and 4 * 4 subdivisions, comprise: judge that upper left adjacent piece is whether in the effective range of image: if, relatively whether the reference frame index of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent piece and current block is identical respectively, judge according to identical number: if described identical number is greater than 1, with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, the upper left adjacent block motion vector motion vector predictor as current block; If described identical number is 1, the motion vector of corresponding blocks of same reference frame index to be arranged as the motion vector predictor of current block with current block; If the adjacent piece in the left side in the effective range of image and the adjacent piece in top not in the effective range of image, so with the motion vector of the adjacent piece in the left side motion vector predictor as current block; Otherwise also with the intermediate value of the adjacent piece in the left side, the adjacent piece in top, upper left adjacent block motion vector motion vector predictor as current block.When upper left adjacent piece is not in the effective range at image, replaces upper left adjacent piece with upper right adjacent piece and carry out above-mentioned judgement.
15. inter-frame mode selecting method as claimed in claim 1 is characterized in that, described cost function according to each subdivision pattern determines that selected subdivision pattern comprises: in the determined subdivision pattern, its cost function has minimum value.
16. inter-frame mode selecting method as claimed in claim 1 is characterized in that, described motion vector predictor according to large scale subdivision pattern is determined initial search point, comprising: determine initial search point according to the motion vector predictor of 16 * 16 subdivisions.
17. inter-frame mode selecting method as claimed in claim 16, described motion vector predictor according to 16 * 16 subdivisions are determined initial search point, comprising: will be apart from the nearest integer position of 16 * 16 subdivision motion vector predictor as initial search point.
CN 200910005620 2009-01-20 2009-01-20 Interframe mode selection method Pending CN101527854A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200910005620 CN101527854A (en) 2009-01-20 2009-01-20 Interframe mode selection method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200910005620 CN101527854A (en) 2009-01-20 2009-01-20 Interframe mode selection method

Publications (1)

Publication Number Publication Date
CN101527854A true CN101527854A (en) 2009-09-09

Family

ID=41095512

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200910005620 Pending CN101527854A (en) 2009-01-20 2009-01-20 Interframe mode selection method

Country Status (1)

Country Link
CN (1) CN101527854A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101783951A (en) * 2010-03-02 2010-07-21 西安交通大学 Method for rapidly confirming video coding inter-frame predicting mode based on human vision system
CN102647587A (en) * 2011-02-16 2012-08-22 富士通株式会社 Motion estimation method and motion estimation device
CN102907098A (en) * 2009-10-01 2013-01-30 Sk电信有限公司 Method and apparatus for encoding/decoding image using variable-size macroblocks
CN107197299A (en) * 2017-05-12 2017-09-22 武汉斗鱼网络科技有限公司 A kind of motion estimation implementing method and electronic equipment
CN107197281A (en) * 2017-05-12 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method and electronic equipment for realizing estimation
CN113596456A (en) * 2019-09-23 2021-11-02 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105007491A (en) * 2009-10-01 2015-10-28 Sk电信有限公司 Video decoding apparatus
CN105049865A (en) * 2009-10-01 2015-11-11 Sk电信有限公司 Video decoding apparatus
CN105007492B (en) * 2009-10-01 2018-02-06 Sk电信有限公司 The video encoding/decoding method performed by video decoder
CN102907098A (en) * 2009-10-01 2013-01-30 Sk电信有限公司 Method and apparatus for encoding/decoding image using variable-size macroblocks
CN102907098B (en) * 2009-10-01 2016-04-20 Sk电信有限公司 Variable-sized macro block is used to carry out the method and apparatus of coding/decoding to image
CN105007492A (en) * 2009-10-01 2015-10-28 Sk电信有限公司 Video decoding method executed by video decoding apparatus
CN101783951A (en) * 2010-03-02 2010-07-21 西安交通大学 Method for rapidly confirming video coding inter-frame predicting mode based on human vision system
CN101783951B (en) * 2010-03-02 2012-01-04 西安交通大学 Method for rapidly confirming video coding inter-frame predicting mode based on human vision system
CN102647587B (en) * 2011-02-16 2015-01-21 富士通株式会社 Motion estimation method and motion estimation device
CN102647587A (en) * 2011-02-16 2012-08-22 富士通株式会社 Motion estimation method and motion estimation device
CN107197281A (en) * 2017-05-12 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method and electronic equipment for realizing estimation
CN107197299A (en) * 2017-05-12 2017-09-22 武汉斗鱼网络科技有限公司 A kind of motion estimation implementing method and electronic equipment
WO2018205780A1 (en) * 2017-05-12 2018-11-15 武汉斗鱼网络科技有限公司 Motion estimation method and electronic device
CN113596456A (en) * 2019-09-23 2021-11-02 杭州海康威视数字技术股份有限公司 Encoding and decoding method, device and equipment

Similar Documents

Publication Publication Date Title
CN103517069B (en) A kind of HEVC intra-frame prediction quick mode selection method based on texture analysis
RU2677588C1 (en) Predictive video encoding device, predictive video encoding method, predictive video encoding software, predictive video decoding device, predictive video decoding method and predictive video decoding software
CN101933329B (en) Methods and apparatus for implicit block segmentation in video encoding and decoding
KR102013093B1 (en) Dynamic image decoding device, dynamic image decoding method, dynamic image encoding device, dynamic image encoding method, and recoding medium
CN103339938B (en) Perform the motion vector prediction of video coding
CN103248895B (en) A kind of quick mode method of estimation for HEVC intraframe coding
CN107846593B (en) Rate distortion optimization method and device
CN103546758B (en) A kind of fast deep graphic sequence inter mode decision fractal coding
CN102090065A (en) Image encoding device, image decoding device, image encoding method, and image decoding method
CN101527854A (en) Interframe mode selection method
KR100901874B1 (en) Inter mode decision Method for video encoding
CN101404774A (en) Macro-block partition mode selection method in movement search
CN101888546B (en) A kind of method of estimation and device
CN103188496A (en) Fast motion estimation video encoding method based on motion vector distribution forecast
KR20050119422A (en) Method and apparatus for estimating noise of input image based on motion compenstion and, method for eliminating noise of input image and for encoding video using noise estimation method, and recording medium for storing a program to implement the method
CN101820547A (en) Inter-frame mode selecting method
CN100401779C (en) Method for hierarchical motion estimation
CN110446052A (en) The quick CU depth selection method of depth map in a kind of 3D-HEVC frame
KR100947447B1 (en) Method and its apparatus for fast mode decision in multi-view video coding
CN104333755B (en) The CU based on SKIP/Merge RD Cost of B frames shifts to an earlier date terminating method in HEVC
CN101883275B (en) Video coding method
EP1921865A2 (en) Obtaining a motion vector in block-based motion estimation
CN101179729A (en) Interframe mode statistical classification based H.264 macroblock mode selecting method
CN102917233A (en) Stereoscopic video coding optimization method in space teleoperation environment
CN101931739A (en) Absolute error sum estimation system and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Open date: 20090909