CN101969561B - A kind of intra-frame mode selection method, device and a kind of encoder - Google Patents

A kind of intra-frame mode selection method, device and a kind of encoder Download PDF

Info

Publication number
CN101969561B
CN101969561B CN201010527456.5A CN201010527456A CN101969561B CN 101969561 B CN101969561 B CN 101969561B CN 201010527456 A CN201010527456 A CN 201010527456A CN 101969561 B CN101969561 B CN 101969561B
Authority
CN
China
Prior art keywords
cost
pattern
pieces
block
prediction modes
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.)
Active
Application number
CN201010527456.5A
Other languages
Chinese (zh)
Other versions
CN101969561A (en
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.)
Mid Star Technology Ltd By Share Ltd
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CN201010527456.5A priority Critical patent/CN101969561B/en
Publication of CN101969561A publication Critical patent/CN101969561A/en
Application granted granted Critical
Publication of CN101969561B publication Critical patent/CN101969561B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention provides a kind of intra-frame mode selection method, device and a kind of encoder, high to solve existing infra-frame prediction complexity, affect the problem of code efficiency.Described method comprises: 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.The present invention can fast selecting partitioned mode and optimal prediction modes, reduces the complexity of infra-frame prediction, thus improves code efficiency.

Description

A kind of intra-frame mode selection method, device and a kind of encoder
Technical field
The present invention relates to encoding and decoding technique, particularly relate to a kind of intra-frame mode selection method, device and a kind of encoder.
Background technology
In the infra-frame prediction of Video coding H.264 standard, can intra-mode prediction technology be passed through, in advance the frame mode of block to be encoded be made prediction, predict that the frame mode obtained is called most possible pattern.When most possible pattern is different from the optimal prediction modes by calculating, the coding mode information transmitting 4 bits to decoding end is needed altogether in code stream, wherein, 1 bit represents the flag bit whether most possible pattern is identical with optimal prediction modes, and 3 bits represent the mode index of optimal prediction modes; When most possible pattern is identical with the optimal prediction modes by calculating, in code stream, then only need the zone bit information transmitting 1 bit to decoding end, decrease a lot when code word used of now encoding is more different from optimal prediction modes than most possible pattern.
Determine that the mode of most possible pattern is at present:
According to block to be encoded adjacent upper piece and the optimal prediction modes of adjacent left piece, by adjacent upper piece and the optimal prediction modes of adjacent left piece in the little most possible pattern being defined as block to be encoded of mode index.Such as: suppose that adjacent upper piece optimal prediction modes is pattern 1, the optimal prediction modes of adjacent left piece is mode 3, then the most possible pattern of current block to be encoded is pattern 1.As with reference to block adjacent upper piece and adjacent left piece in, when having at least one unavailable, such as: at current band outer or be not based on 4 × 4 pieces of prediction mode time, specify that the most possible pattern of current block to be encoded is pattern 2.
The mode of current calculating optimal prediction modes is:
H.264 the luma intra prediction technology in standard is divided into 4 × 4 pieces with to 16 × x16 block two kinds, H.264 standard pin to 4 × 4 block to provide 9 kinds of predictive coding patterns selective, and provide 4 kinds of predictive coding patterns for the block of 16 × 16.Calculating the method for optimal prediction modes is: calculate the rate distortion costs of 9 kinds of predictive coding patterns to the block of each 4 × 4 respectively, for the minimum pattern of each block selection rate distortion cost of 4 × 4 as this optimal prediction modes of 4 × 4 pieces; Calculate the rate distortion costs of 4 kinds of predictive coding patterns of 16 × 16 pieces, the minimum pattern of selection rate distortion cost is as this optimal prediction modes of 16 × 16 pieces; Then compare the rate distortion costs sum of 16 4 × 4 pieces and the rate distortion costs of 16 × 16 pieces, the minimum macroblock mode of selection rate distortion cost is as the final coded system of current macro.
As can be seen from the method for above-mentioned calculating optimal prediction modes, the complexity of infra-frame prediction is mainly on the rate distortion costs of all predictive coding patterns calculating often kind of piecemeal, as for the block of 4 × 4, calculate the rate distortion costs of 16 pixels in 9 kinds of different intra-prediction code mode, complexity is very high.Therefore, the calculating of above-mentioned optimal prediction modes have impact on the speed of infra-frame prediction, and then have impact on code efficiency.
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.
Accompanying drawing explanation
Fig. 1 is the pixel distribution schematic diagram of in the present invention one 4 × 4 pieces;
Fig. 2 is 4 × 4 luma prediction modes schematic diagrames in the present invention;
Fig. 3 is the flow chart of a kind of intra-frame mode selection method described in the embodiment of the present invention;
Fig. 4 is the group pixels schematic diagram of in the embodiment of the present invention one 4 × 4 pieces;
Fig. 5 is the schematic diagram of 9 kinds of directional prediction modes of in the embodiment of the present invention 4 × 4 pieces;
Fig. 6 is the structure chart of a kind of frame mode selecting device described in the embodiment of the present invention.
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:
SA D n = Σ i = 1 . . . n | P E i ( x , y ) = Ori g i ( x , y ) - Pre d i ( x , y ) |
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.

Claims (6)

1. an intra-frame mode selection method, is characterized in that, 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;
Wherein, 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;
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, and 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;
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.
2. method according to claim 1, is characterized in that, describedly the cost sum of 16 4 × 4 pieces and the cost of 16 × 16 predictive modes is compared, and the pattern selecting cost little is as the optimal prediction modes of macroblock to be encoded, comprising:
Add up the quantity of 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.
3. method according to claim 1, is characterized in that:
Described cost is obtained by calculation rate distortion cost, or by the absolute error of computational prediction residual error with obtain.
4. a frame mode selecting device, is characterized in that, 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;
Wherein, 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;
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;
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.
5. device according to claim 4, is characterized in that, described 16 × 16 patterns are chosen unit and 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.
6. an encoder, is characterized in that, comprises the frame mode selecting device described in the arbitrary claim of claim 4 to 5.
CN201010527456.5A 2010-10-27 2010-10-27 A kind of intra-frame mode selection method, device and a kind of encoder Active CN101969561B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010527456.5A CN101969561B (en) 2010-10-27 2010-10-27 A kind of intra-frame mode selection method, device and a kind of encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010527456.5A CN101969561B (en) 2010-10-27 2010-10-27 A kind of intra-frame mode selection method, device and a kind of encoder

Publications (2)

Publication Number Publication Date
CN101969561A CN101969561A (en) 2011-02-09
CN101969561B true CN101969561B (en) 2016-03-30

Family

ID=43548644

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010527456.5A Active CN101969561B (en) 2010-10-27 2010-10-27 A kind of intra-frame mode selection method, device and a kind of encoder

Country Status (1)

Country Link
CN (1) CN101969561B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102420989B (en) * 2011-12-07 2014-03-19 中国航空无线电电子研究所 Intra-frame prediction method and device
CN104093026B (en) * 2012-01-20 2018-04-10 华为技术有限公司 Decoding method and device
CN104093025B (en) * 2012-01-20 2017-09-19 华为技术有限公司 Decoding method and device
CN103220508B (en) 2012-01-20 2014-06-11 华为技术有限公司 Coding and decoding method and device
CN104093024B (en) * 2012-01-20 2017-08-04 华为技术有限公司 Decoding method and device
CN103237216B (en) * 2013-04-12 2017-09-12 华为技术有限公司 The decoding method and coding and decoding device of depth image
CN106791859B (en) * 2015-11-24 2019-08-20 龙芯中科技术有限公司 Method for video coding and video encoder
CN106231303B (en) * 2016-07-22 2020-06-12 上海交通大学 Method for controlling complexity by using prediction mode in HEVC (high efficiency video coding)
CN107241598B (en) * 2017-06-29 2020-03-24 贵州电网有限责任公司 GPU (graphics processing Unit) decoding method for multi-channel h.264 video conference
CN111277824B (en) * 2020-02-12 2023-07-25 腾讯科技(深圳)有限公司 Image prediction processing method, device, terminal and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101179728A (en) * 2007-12-13 2008-05-14 北京中星微电子有限公司 Method and apparatus for determining interframe encoding mode
CN101350927A (en) * 2008-07-29 2009-01-21 北京中星微电子有限公司 Method and apparatus for forecasting and selecting optimum estimation mode in a frame
WO2009015553A1 (en) * 2007-07-31 2009-02-05 Peking University Founder Group Co., Ltd. A method and device selecting intra-frame predictive coding best mode for video coding

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20090095316A (en) * 2008-03-05 2009-09-09 삼성전자주식회사 Method and apparatus for image intra prediction

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009015553A1 (en) * 2007-07-31 2009-02-05 Peking University Founder Group Co., Ltd. A method and device selecting intra-frame predictive coding best mode for video coding
CN101179728A (en) * 2007-12-13 2008-05-14 北京中星微电子有限公司 Method and apparatus for determining interframe encoding mode
CN101350927A (en) * 2008-07-29 2009-01-21 北京中星微电子有限公司 Method and apparatus for forecasting and selecting optimum estimation mode in a frame

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于递推模式的帧内预测快速算法;尹宝才,孙磊,孔德慧,季鹏飞;《北京工业大学学报》;20060331;第32卷(第3期);第254页第6-34行,第255页第1-7行,第21-26行 *

Also Published As

Publication number Publication date
CN101969561A (en) 2011-02-09

Similar Documents

Publication Publication Date Title
CN101969561B (en) A kind of intra-frame mode selection method, device and a kind of encoder
CN101945280B (en) Method and device for selecting encoding types and predictive modes for encoding video data
CN100586184C (en) Infra-frame prediction method
CN101540912B (en) Selection of coding type for coding video data and of predictive mode
CN104796693A (en) Rapid HEVC CU deep partition coding method
CN101170688B (en) A quick selection method for macro block mode
CN101877792B (en) Intra mode prediction method and device and coder
CN104320658B (en) A kind of HEVC fast encoding methods
CN106131547A (en) The high-speed decision method of intra prediction mode in Video coding
CN103096068A (en) Method of generating quantized block
CN104954788A (en) HEVC (High Efficiency Video Coding) intra-frame prediction mode selection method and device
CN104837019B (en) AVS to HEVC optimization video transcoding methods based on SVMs
CN102651816B (en) Method and device for scanning transformation coefficient block
CN103957414A (en) HEVC intra-frame prediction coding method and system
CN105898332B (en) For the fast deep figure frame mode decision method of 3D-HEVC coding standards
CN101309421A (en) Intra-frame prediction mode selection method
CN101572818A (en) Intra-frame prediction mode prediction method
CN101304529A (en) Method and device for selecting macro block pattern
CN109510987A (en) The determination method, apparatus and encoding device of code tree node division mode
CN103596003A (en) Interframe predication quick mode selecting method for high-performance video coding
CN101883275B (en) Video coding method
CN101867818B (en) Selection method and device of macroblock mode
CN115941960A (en) Method for skipping CU partition between VVC frames in advance based on lightweight neural network
CN105847794A (en) HEVC intra-frame prediction mode rapid selection method
CN105791863B (en) 3D-HEVC depth map intra-frame predictive encoding method based on layer

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20171222

Address after: 100083 Haidian District, Xueyuan Road, No. 35, the world building, the second floor of the building on the ground floor, No. 16

Patentee after: Zhongxing Technology Co., Ltd.

Address before: 100083 Haidian District, Xueyuan Road, No. 35, the world building, the second floor of the building on the ground floor, No. 16

Patentee before: Beijing Vimicro Corporation

TR01 Transfer of patent right
CP01 Change in the name or title of a patent holder

Address after: 100083 Haidian District, Xueyuan Road, No. 35, the world building, the second floor of the building on the ground floor, No. 16

Patentee after: Mid Star Technology Limited by Share Ltd

Address before: 100083 Haidian District, Xueyuan Road, No. 35, the world building, the second floor of the building on the ground floor, No. 16

Patentee before: Zhongxing Technology Co., Ltd.

CP01 Change in the name or title of a patent holder