Summary of the invention
Technical problem to be solved by this invention is to provide a kind of intra-frame mode selection method, device and a kind of encoder, high to solve existing infra-frame prediction complexity, affects the problem of code efficiency.
In order to solve the problem, the invention discloses a kind of intra-frame mode selection method, comprising:
To 4 × 4 pieces, whole 16 in macroblock to be encoded, determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively;
The cost of 16 4 × 4 pieces is added, if sum is less than the first preset threshold value, then directly selects the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded;
Otherwise, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.
Preferably, describedly determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively, comprising: if current 4 × 4 pieces is the block in the image upper left corner, then the optimal prediction modes of this block is DC mode; If current 4 × 4 pieces is the block of image left edge, then the cost under vertical pattern and DC mode two kinds of patterns is calculated respectively to 16 pixels all in this block, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces; If current 4 × 4 pieces is the block of image top edge, then to the cost under 16 pixels all in this block respectively calculated level pattern and DC mode two kinds of patterns, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces.
Preferably, describedly determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively, also comprise: if current 4 × 4 pieces is not the block of left hand edge or top edge, then 16 pixels all in this block are divided into three groups, first group comprises the upper left corner, the lower left corner, the upper right corner, 4, lower right corner pixel, second group of 4 pixel comprising block center, the 3rd group comprises remaining 8 pixels in block; First group and second group of pixel are calculated to the cost under most possible pattern, if this cost is less than the second preset threshold value, then select most possible pattern as the optimal prediction modes of current 4 × 4 pieces; Otherwise, first the cost under vertical pattern, horizontal pattern, left diagonal model and right diagonal model is calculated respectively to first group of pixel, and selects two patterns adjacent on the pattern of Least-cost and direction thereof; Then, three selected patterns and the cost vertically under pattern, horizontal pattern, DC mode are calculated respectively to 16 pixels all in this block, if minimum cost is less than the 3rd preset threshold value, then select the pattern of Least-cost as the optimal prediction modes of current 4 × 4 pieces; Otherwise, the cost in 9 kind of 4 × 4 predictive mode under pattern of surplus is calculated respectively to 16 pixels all in this block, and under selecting 9 kind of 4 × 4 predictive mode the pattern of Least-cost as the optimal prediction modes of current 4 × 4 pieces.
Preferably, described the cost sum of 16 4 × 4 pieces and the cost of 16 × 16 predictive modes to be compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded, comprise: the quantity of adding up vertical pattern and horizontal pattern in the optimal prediction modes of 16 4 × 4 pieces, select the many pattern of quantity to treat lectotype as 16x16 block; Treat the cost of lectotype described in calculating, if this cost is more than or equal to the cost sum of 16 4 × 4 pieces, then select the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded; Otherwise, calculate the cost of all the other 3 kinds of 16x16 predictive modes, and compare with the cost sum of 16 4 × 4 pieces, select the optimal prediction modes of pattern as macroblock to be encoded of Least-cost.
Preferably, described first preset threshold value gets repeatedly average or the minimum value of 16 4x4 block cost sums in computing macro block; Described second preset threshold value gets the average or minimum value that repeatedly calculate first group and the cost of second group of pixel under most possible pattern; Described 3rd preset threshold value gets average or the minimum value of the cost repeatedly calculating optimal prediction modes.
Preferably, described cost is obtained by calculation rate distortion cost, or by the absolute error of computational prediction residual error with obtain.
Present invention also offers a kind of frame mode selecting device, comprising:
4 × 4 patterns choose unit, for 4 × 4 pieces, whole 16 in macroblock to be encoded, determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively;
Comparing unit, for the cost of 16 4 × 4 pieces being added, if sum is less than the first preset threshold value, then directly selects the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded;
16 × 16 patterns choose unit, for when described sum is more than or equal to the first preset threshold value, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.
Preferably, described 4 × 4 patterns are chosen unit and are comprised: upper left hand block pattern chooses subelement, if be the block in the image upper left corner for current 4 × 4 pieces, then the optimal prediction modes of this block is DC mode; Left hand edge block mode chooses subelement, if be the block of image left edge for current 4 × 4 pieces, then the cost under vertical pattern and DC mode two kinds of patterns is calculated respectively to 16 pixels all in this block, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces; Top edge block mode chooses subelement, if for current 4 × 4 pieces be the block of image top edge, then to the cost under 16 pixels difference calculated level patterns all in this block and DC mode two kinds of patterns, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces.
Preferably, described 4 × 4 patterns are chosen unit and are also comprised: grouping subelement, if for current 4 × 4 pieces be not the block of left hand edge or top edge, then 16 pixels all in this block are divided into three groups, first group comprises the upper left corner, the lower left corner, the upper right corner, 4, lower right corner pixel, second group of 4 pixel comprising block center, the 3rd group comprises remaining 8 pixels in block; Pattern chooses subelement, for calculating the cost under most possible pattern to first group and second group of pixel, if this cost is less than the second preset threshold value, then selects most possible pattern as the optimal prediction modes of current 4 × 4 pieces; Otherwise, first the cost under vertical pattern, horizontal pattern, left diagonal model and right diagonal model is calculated respectively to first group of pixel, and selects two patterns adjacent on the pattern of Least-cost and direction thereof; Then, three selected patterns and the cost vertically under pattern, horizontal pattern, DC mode are calculated respectively to 16 pixels all in this block, if minimum cost is less than the 3rd preset threshold value, then select the pattern of Least-cost as the optimal prediction modes of current 4 × 4 pieces; Otherwise, the cost in 9 kind of 4 × 4 predictive mode under pattern of surplus is calculated respectively to 16 pixels all in this block, and under selecting 9 kind of 4 × 4 predictive mode rate distortion for the optimal prediction modes of minimum pattern as current 4 × 4 pieces.
Preferably, described 16 × 16 patterns are chosen unit and are comprised: statistics subelement, for add up 16 4 × 4 pieces optimal prediction modes in the quantity of vertically pattern and horizontal pattern, select the many patterns of quantity to treat lectotype as 16x16 block; Pattern chooses subelement, for treating the cost of lectotype described in calculating, if this cost is more than or equal to the cost sum of 16 4 × 4 pieces, then selects the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded; Otherwise, calculate the cost of all the other 3 kinds of 16x16 predictive modes, and compare with the cost sum of 16 4 × 4 pieces, select the optimal prediction modes of pattern as macroblock to be encoded of Least-cost.
Present invention also offers a kind of encoder, comprise the frame mode selecting device described in above-mentioned any embodiment.
Compared with prior art, the present invention has the following advantages:
First, the present invention first determines the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence in 16 4 × 4 pieces, then 16 cost sums and the first preset threshold value are compared, directly selecting when being less than 4 × 4 block modes as the final coded system of macroblock to be encoded, no longer predicting in 16 × 16 modes; Otherwise, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.Therefore, the present invention can fast selecting partitioned mode and optimal prediction modes, reduces the complexity of infra-frame prediction, thus improves code efficiency.
Secondly, 16 pixels in a 4x4 block are divided three groups, position by the present invention, then adopt the point in different grouping to carry out calculation cost for different predictive modes, can effectively reduce the pixel number of calculation cost like this, improve code efficiency further.
Embodiment
For enabling above-mentioned purpose of the present invention, feature and advantage become apparent more, and below in conjunction with the drawings and specific embodiments, the present invention is further detailed explanation.
In the infra-frame prediction of Video coding H.264 standard, the block of encoding 4 × 4 will with reference to the adjacent data of reconstruct of encoding, by its left side, top, upper left side or upper right side decoded pixel value predict current block.Each macro block can be predicted by 16 × 16 or 4 × 4 two kinds of modes.With reference to Fig. 1, it is the pixel distribution schematic diagram of 4 × 4 pieces, pixel in one 4 × 4 pieces is a ~ p, be adjacent in left side sub-block, top sub-block, top left sub-block and upper right sub-block have A ~ L, M totally 13 pixels as with reference to pixel, in pixel a ~ p, each pixel can with 13 closest to previously encoded pixel (A ~ L, M) different weights and predicting, has 9 kinds of predictive modes, as shown in table 1.
4 × 4 predictive mode sequence numbers |
4 × 4 predictive mode titles |
0 |
Vertical (vertical pattern) |
1 |
Horizontal (horizontal pattern) |
2 |
DC (DC mode) |
3 |
Diagonal_Down_Left (left diagonal model) |
4 |
Diagonal_Down_Right (right diagonal model) |
5 |
Vertical_Right (vertical pattern to the right) |
6 |
Horizontal_Down (level pattern on the lower side) |
7 |
Vertical_Left (vertical pattern to the left) |
8 |
Horizontal_Up (level pattern on the upper side) |
Table 1
With reference to Fig. 2, be 4 × 4 luma prediction modes schematic diagrames, there is shown the predictive mode in 8 directions, also have one to be DC (direct current) pattern, adopt mean value to predict.During decoding, draw predicted value according to selected predictive mode and reference pixel, be then added with residual error and just obtain the view data after rebuilding.
16 × 16 predictive mode sequence numbers |
16 × 16 predictive mode titles |
0 |
Intra_16 × 16_Vertical (vertical pattern) |
1 |
Intra_16 × 16_Horizontal (horizontal pattern) |
2 |
Intra_16 × 16_DC (DC mode) |
3 |
Intra_16 × 16_Plane (plane mode) |
Table 2
For 16 × 16 predictions, provide 4 kinds of predictive modes as shown in table 2.
For a macroblock to be encoded, determine that employing 4 × 4 mode or 16 × 16 modes are encoded by luminance frame intra mode prediction technology, and concrete optimal prediction modes corresponding to partitioned mode.
In order to reduce the complexity of infra-frame prediction, improve code efficiency, the invention provides a kind of intra-frame mode selection method, its core concept is: first determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence in 16 4 × 4 pieces, then 16 cost sums and the first preset threshold value are compared, directly selecting when being less than 4 × 4 block modes as the final coded system of macroblock to be encoded, no longer predicting in 16 × 16 modes; Otherwise, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.I.e. prioritizing selection 4 × 4 mode of the present invention, because the coding accuracy of 4 × 4 is higher.Wherein, described cost can be obtained by calculation rate distortion cost, also by the absolute error of computational prediction residual error and can obtain.
Be described in detail below by embodiment.
With reference to Fig. 3, it is the flow chart of a kind of intra-frame mode selection method described in the embodiment of the present invention.
Step 31, first, to 4 × 4 pieces, whole 16 in macroblock to be encoded, determines the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively;
To each 4 × 4 pieces, the cost of kind of the predictive mode of 9 shown in computational chart 1 can be distinguished, then select the optimal prediction modes of pattern as this block of Least-cost.
Preferably, the present embodiment adopts the simpler method of one to process each 4 × 4 pieces, greatly reduces computation complexity.Concrete processing method is: by three groups, 16 pixel point positions in a 4x4 block, then adopts the point in different grouping to carry out calculation cost for different predictive modes, can effectively reduce the pixel number of calculation cost like this, improve code efficiency further.
Concrete, perform sub-step 311 ~ 314 to each 4 × 4 pieces, as follows:
Step 311, the process for boundary block:
If current 4 × 4 pieces is the block in the image upper left corner, then the optimal prediction modes of this block is DC mode 2;
If current 4 × 4 pieces is the block of image left edge, then the cost under vertical pattern 0 and DC mode 2 two kinds of patterns is calculated respectively to 16 pixels all in this block, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces;
If current 4 × 4 pieces is the block of image top edge, then to the cost under 16 pixels all in this block respectively calculated level pattern 1 and DC mode 2 two kinds of patterns, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces;
If current 4 × 4 pieces is not edge block, then enter step 312;
In the present embodiment, cost is obtained by computational prediction residual error, certainly, and also can by other Parametric Representations.
Absolute error and the computing formula of prediction residual are as follows:
Wherein, SAD represent prediction residual absolute error and, n represents number of pixels, and (x, y) represents pixel coordinate, and Orig (x, y) represents original pixel value, and Pred (x, y) represents predicted value, and i represents summation number.
16 pixels all in this block if current 4 × 4 pieces is not the block of left hand edge or top edge, are then divided into groups by step 312;
Packet mode has multiple, with reference to Fig. 4, is the group pixels schematic diagram of in the embodiment of the present invention one 4 × 4 pieces.
All 16 pixels are divided into three groups, and first group comprises the upper left corner, the lower left corner, the upper right corner, 4, lower right corner pixel, be respectively pixel a, m, d, p; Second group of 4 pixel comprising block center, is respectively pixel f, g, j, k; 3rd group comprises remaining 8 pixels in block, is respectively b, c, e, h, i, l, n, o.
This packet mode makes first group of pixel and second group of pixel have more representativeness, certainly, also can select other packet mode.
Step 313, calculates the cost under most possible pattern to first group and second group of pixel, if this cost is less than preset threshold value T1, then select most possible pattern as the optimal prediction modes of current 4 × 4 pieces; Otherwise, enter step 314;
The calculating of most possible pattern can have multiple method, and the present embodiment can adopt foregoing mode to calculate, namely by upper piece and the intra-mode prediction of left piece.
Concrete, with first group and second group of pixel in most possible model prediction Fig. 4, computational prediction residual error SAD
8, and compare with threshold value T1.The implication of described threshold value T1 is SAD
8a thresholding is set, if SAD
8be less than this thresholding, then think SAD
8enough little, most possible pattern can, as the optimal prediction modes of current block, not need to calculate one by one other 8 kinds of patterns again.
Threshold value T1 can get the average or minimum value that repeatedly calculate first group and the cost of second group of pixel under most possible pattern, but because this is first decision condition, therefore the setting of T1 should be very strict, can choose many group sample calculation repeatedly SAD in practical application
8, then therefrom get minimum value as threshold value T1.
In addition, selecting first group and second group of pixel to carry out calculating is because the distribution of these two groups of pixels is representative concerning whole 4 × 4 pieces most.
Step 314, first calculates the cost under vertical pattern 0, horizontal pattern 1, left diagonal model 3 and right diagonal model 4 respectively to first group of pixel, and selects two patterns adjacent on the pattern of Least-cost and direction thereof;
I.e. respectively first group of pixel in 0,1,3,4 prognostic charts 4 in mode, calculates the prediction residual SAD corresponding to often kind of pattern
4, and SAD is selected in these 4 kinds of patterns
4two patterns adjacent on minimum pattern and direction thereof, then enter step 315.Because in table 1, the sequence number of coding mode is successively decreased according to probability, what therefore select here is 4 patterns (pattern 2 is edge block using forestland, therefore gets rid of) that probability is the highest.
With reference to Fig. 5, be the schematic diagram of 9 kinds of directional prediction modes of 4 × 4 pieces, a kind of directional prediction modes of each numeral, wherein DC mode 2 adopts mean prediction, independent of direction, does not therefore mark in figure.Suppose SAD
4minimum pattern is pattern 4, be then pattern 5 and 6 with adjacent two patterns on its direction.
Step 315, then, three selected patterns and the cost vertically under pattern 0, horizontal pattern 1, DC mode 2 are calculated respectively to 16 pixels all in this block, if minimum cost is less than preset threshold value T2, then select the pattern of Least-cost as the optimal prediction modes of current 4 × 4 pieces; Otherwise, enter step 316;
It should be noted that, if there is no pattern 0 or pattern 1 in three patterns of step 314 selection, then add pattern 0 or pattern 1 in step 315; If comprised pattern 0 in above-mentioned three patterns, then need to add pattern 1, if comprised pattern 1, then needed to add pattern 0.
In addition, this step is whole 4 × 4 pieces of prediction, calculates corresponding prediction residual SAD
16and sort.If minimum SAD
16be less than threshold value T2, then select the pattern of its correspondence to be the optimal prediction modes of current 4 × 4 pieces, otherwise enter step 316.
Threshold value T2 can get average or the minimum value of the cost repeatedly calculating optimal prediction modes.In actual applications, many group sample calculation repeatedly SAD can be chosen
16, then therefrom get average or minimum value as threshold value T2, when selecting minimum value, condition is the harshest, and corresponding coding quality is the highest; During selection average, condition is comparatively loose, and coding quality is higher.
By step 314 and 315,4 ~ 6 kinds of patterns can be filtered out from 9 kinds of predictive modes residual computations is carried out to 16 pixels of whole 4 × 4 pieces, decrease the amount of calculation of nearly half than prior art.
Step 316, calculates the cost in 9 kind of 4 × 4 predictive mode under pattern of surplus respectively to 16 pixels all in this block, and under selecting 9 kind of 4 × 4 predictive mode rate distortion for the optimal prediction modes of minimum pattern as current 4 × 4 pieces.
Step 32, is added the cost of 16 4 × 4 pieces, if sum is less than preset threshold value T3, then directly selects 4 × 4 block modes as the final coded system of macroblock to be encoded; Otherwise, perform step 33;
Be added by 16 optimum prediction residual errors, and if be less than threshold value T3, then no longer predict in 16 × 16 macro block modes, directly select 4 × 4 block modes as the final luminance coding mode of macroblock to be encoded.Wherein, threshold value T3 can get repeatedly average or the minimum value of 16 4x4 block cost sums in computing macro block, in actual applications, can choose many group sample calculation repeatedly SAD
16, then therefrom get average or minimum value as threshold value T3.
Step 33, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.
For 16 × 16 pieces, can 4 kinds of predictive modes computational prediction residual errors respectively in his-and-hers watches 2, then the pattern selecting prediction residual minimum.
Preferably, the present embodiment adopts a kind of processing mode of optimization, can reduce computation complexity.Specifically comprise step 331 ~ 333, as follows:
Step 331, adds up the quantity of vertical pattern 0 and horizontal pattern 1 in the optimal prediction modes of 16 4 × 4 pieces, selects the many pattern of quantity to treat lectotype as 16x16 block;
It should be noted that, if vertically pattern 0 and horizontal pattern 1 does not all exist or the vertical pattern 0 of 16x16 block and horizontal pattern 1 unavailable, then that DC pattern 2 can be selected to be 16x16 block treats lectotype.
Step 332, treats the cost of lectotype described in calculating, if this cost is more than or equal to the cost sum of 16 4 × 4 pieces, then select the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded; Otherwise, if be less than, enter step 333;
Step 333, calculates the cost of all the other 3 kinds of 16x16 predictive modes, and compares with the cost sum of 16 4 × 4 pieces, selects the optimal prediction modes of pattern as macroblock to be encoded of Least-cost.
Such as, what draw 16x16 block by statistics treats that lectotype is vertical pattern 0, but the cost sum that the cost of 16x16 block under vertical pattern 0 is less than 16 4 × 4 pieces, then continue to calculate the cost of 16x16 block under predictive mode 1, predictive mode 2, predictive mode 3, then the cost of 4 of 16x16 kinds of predictive modes is all compared with the cost sum of 16 4 × 4 pieces, therefrom select the pattern of Least-cost.
In sum, embodiment of the present invention prioritizing selection 4 × 4 mode is encoded, and selects 16x16 mode again when not satisfying condition, compared with prior art, this can fast selecting partitioned mode and optimal prediction modes, reduces the complexity of infra-frame prediction, thus improves code efficiency.And, divide three groups, position by 16 pixels in a 4x4 block, then adopt the point in different grouping to carry out calculation cost for different predictive modes, the pixel number of calculation cost can be effectively reduced like this, improve code efficiency further.
Based on foregoing, present invention also offers corresponding device embodiment.
With reference to Fig. 6, it is the structure chart of a kind of frame mode selecting device described in the embodiment of the present invention.
Described frame mode selecting device comprises that 4 × 4 patterns choose unit 61, comparing unit 62 and 16 × 16 pattern chooses unit 63.Wherein, 4 × 4 patterns choose unit 61 for 4 × 4 pieces, whole 16 in macroblock to be encoded, determine the optimal prediction modes of each 4 × 4 pieces and the cost of correspondence respectively; Comparing unit 62, for the cost of 16 4 × 4 pieces being added, if sum is more than or equal to the first preset threshold value, then directly selects the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded; 16 × 16 patterns choose unit 63 for when described sum is more than or equal to the first preset threshold value, the cost sum of described 16 4 × 4 pieces and the cost of 16 × 16 predictive modes are compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded.
Preferably, in order to reduce prediction complexity further, improve code efficiency, described 4 × 4 patterns are chosen unit and are comprised:
Upper left hand block pattern chooses subelement, if be the block in the image upper left corner for current 4 × 4 pieces, then the optimal prediction modes of this block is DC mode;
Left hand edge block mode chooses subelement, if be the block of image left edge for current 4 × 4 pieces, then the cost under vertical pattern and DC mode two kinds of patterns is calculated respectively to 16 pixels all in this block, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces;
Top edge block mode chooses subelement, if for current 4 × 4 pieces be the block of image top edge, then to the cost under 16 pixels difference calculated level patterns all in this block and DC mode two kinds of patterns, and the pattern selecting cost little is as the optimal prediction modes of current 4 × 4 pieces.
Further, described 4 × 4 patterns are chosen unit and can also be comprised:
Grouping subelement, if for current 4 × 4 pieces be not the block of left hand edge or top edge, then 16 pixels all in this block are divided into three groups, first group comprises the upper left corner, the lower left corner, the upper right corner, 4, lower right corner pixel, second group of 4 pixel comprising block center, the 3rd group comprises remaining 8 pixels in block;
Pattern chooses subelement, for calculating the cost under most possible pattern to first group and second group of pixel, if this cost is less than the second preset threshold value, then selects most possible pattern as the optimal prediction modes of current 4 × 4 pieces; Otherwise, first the cost under vertical pattern, horizontal pattern, left diagonal model and right diagonal model is calculated respectively to first group of pixel, and selects two patterns adjacent on the pattern of Least-cost and direction thereof; Then, three selected patterns and the cost vertically under pattern, horizontal pattern, DC mode are calculated respectively to 16 pixels all in this block, if minimum cost is less than the 3rd preset threshold value, then select the pattern of Least-cost as the optimal prediction modes of current 4 × 4 pieces; Otherwise, the cost in 9 kind of 4 × 4 predictive mode under pattern of surplus is calculated respectively to 16 pixels all in this block, and under selecting 9 kind of 4 × 4 predictive mode rate distortion for the optimal prediction modes of minimum pattern as current 4 × 4 pieces.
Preferably, in order to reduce prediction complexity further, improve code efficiency, described 16 × 16 patterns are chosen unit and can be comprised:
Statistics subelement, for add up 16 4 × 4 pieces optimal prediction modes in the quantity of vertically pattern and horizontal pattern, select the many patterns of quantity to treat lectotype as 16x16 block;
Pattern chooses subelement, for treating the cost of lectotype described in calculating, if this cost is more than or equal to the cost sum of 16 4 × 4 pieces, then selects the pattern of 16 4 × 4 pieces as the optimal prediction modes of macroblock to be encoded; Otherwise, calculate the cost of all the other 3 kinds of 16x16 predictive modes, and compare with the cost sum of 16 4 × 4 pieces, select the optimal prediction modes of pattern as macroblock to be encoded of Least-cost.
In addition, the embodiment of the present invention additionally provides a kind of encoder, and this encoder comprises above-mentioned frame mode selecting device.
Above-mentioned frame mode selecting device and the encoder comprising this device can fast selecting partitioned mode and optimal prediction modes, reduce the complexity of infra-frame prediction, thus improve code efficiency.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Above to a kind of intra-frame mode selection method provided by the present invention, device and a kind of encoder, be described in detail, apply specific case herein to set forth principle of the present invention and execution mode, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.