A kind of luma prediction coding method of I picture
Technical field
The invention belongs to video and image coding and decoding field, particularly the interior image of frame of video is based on the encoding and decoding technique of spatial domain prediction.
Background technology
Video coding is the hot issue of computer science, and it is intended to find the efficient coding form of digital video.In video coding, often video image is divided into two kinds of I picture and inter frame images.Wherein, the information that the video coding of I picture only uses image self to provide is carried out the prediction on the space, and its encoding and decoding do not rely on other images, can decode separately; And the coding of inter frame image will be eliminated is the redundant information of video on time-domain, and its encoding and decoding depend on the one or more images before its.When I picture was carried out video coding, because in I picture, the pixel of adjacent image piece had very big spatial correlation, so need to adopt the spatial domain prediction coding method to improve code efficiency.The spatial domain prediction coding method comprises colorimetric prediction coding and the interior luma prediction coding of frame in the frame, its main thought is as the reference pixel with adjacent block current to be predicted in the image, and according to the value of the reference image vegetarian refreshments pixel value with to be predicted of different direction prediction, wherein to be predicted is meant the original data block that does not carry out compressed encoding.
At MPEG-4 Part10, promptly in the video encoding standard H.264, with the macro block is that unit encodes, and being carried out in the frame luma prediction coding, macro block comprises 4 * 4 predictive coding patterns of a class, be about to the sub-piece that macroblock partitions is a plurality of 4 * 4 pixel sizes, with each height piece respectively as to be predicted.In video encoding standard H.264,4 * 4 predictive coding patterns specifically comprise 9 kinds of predictive modes: 8 kinds of prediction and DC predictions based on direction.In Fig. 1, with except that 2,0~8 having identified 8 prediction direction, prediction based on these 8 directions is respectively: VERT_4 * 4_PRED, HOR_4 * 4_PRED, DOWN_LEFT_4 * 4_PRED, DOWN_RIGHT_4 * 4_PRED, VERT_RIGHT_4 * 4_PRED, HOR_DOWN_4 * 4_PRED, VER_LEFT_4 * 4PRED, HOR_UP_4 * 4_PRED, and the DC prediction is called DC_4 * 4_PRED in H.264.
The luma prediction coding method of I picture can be divided into two parts generally: a part is to set up to be predicted reference image vegetarian refreshments, and another part is to treat the prediction piece according to the reference image vegetarian refreshments of being set up to carry out predictive coding.As shown in Figure 2, represent one 4 * 4 size with lowercase a~p to be predicted, then for this to be predicted, aforesaid H.264 in 9 kinds of predictive modes in 4 * 4 block modes the reference image vegetarian refreshments that might use have 17, illustrate with capitalization A~P and X.These 17 reference image vegetarian refreshments can be divided into five classes, comprising: upper left corner reference image vegetarian refreshments (X), just go up piece reference image vegetarian refreshments (A, B, C, D), upper right reference image vegetarian refreshments (E, F, G, H), positive left piece reference image vegetarian refreshments (I, J, K, L), lower-left piece reference image vegetarian refreshments (M, N, O, P).
In fact, when one to be predicted was predicted, aforesaid 17 reference image vegetarian refreshments might not all be available.Fig. 3 shows one 16 * 16 macro block in the image, wherein 1~16 identifies 16 4 * 4 sub-pieces to be predicted with numeral, and existing video coding is to encode according to the order of the sub-piece piece shown in Fig. 3 number 1~16 in macro-block level.With reference to figure 2, existing reference image vegetarian refreshments is set up and is generally included following steps:
1) according to be predicted positional information, judge whether its reference image vegetarian refreshments of just going up piece (being " A " among Fig. 2, " B ", " C ", " D " position) is available, if just going up piece reference image vegetarian refreshments can use, then obtain the value of these reference image vegetarian refreshments.Then, to be predicted just going up piece reference image vegetarian refreshments can with judge upper right (being " E " among Fig. 3, " F ", " G ", " H " position) reference image vegetarian refreshments of to be predicted of situation whether available, if it is available, directly obtain the value of these reference image vegetarian refreshments, if unavailable, then expand the pixel that obtains upper right reference image vegetarian refreshments with the value that just goes up piece reference image vegetarian refreshments.
2) according to be predicted positional information, judge whether the reference image vegetarian refreshments of its positive left piece (being " I " among Fig. 2, " J ", " K ", " L " position) is available, if positive left piece reference image vegetarian refreshments can be used, then obtain the value of these reference image vegetarian refreshments.Then, to be predicted positive left piece reference image vegetarian refreshments can with judge to be predicted lower-left piece (being " M " among Fig. 2, " N ", " O ", " P " position) reference image vegetarian refreshments of situation whether available, if it is available, directly obtain the value of these reference image vegetarian refreshments, if unavailable, then expand the pixel that obtains lower-left piece reference image vegetarian refreshments with the value of positive left piece reference image vegetarian refreshments.
From foregoing description as can be known, when the reference image vegetarian refreshments of setting up to be predicted, need to judge the available situation of to be predicted upper right reference image vegetarian refreshments and lower-left piece reference image vegetarian refreshments, but this judgement is normally very complicated.Come upper right and the available situation of lower-left piece reference image vegetarian refreshments of analysis chart 3 neutron pieces below in conjunction with Fig. 2.Consider upper right reference image vegetarian refreshments, for the sub-piece that is positioned at the macro block coboundary, promptly be numbered 1,2,5 and 6 sub-piece among Fig. 3, whether its upper right reference image vegetarian refreshments available depends on the edge whether macro block itself is in image top edge or sheet.Wherein, piece image can be divided into multi-disc encodes, and the pixel when coding between the sheet can not be carried out reference each other, and the edge of sheet is exactly that the both sides pixel does not belong to those positions of same.Whether upper right of this my husband's piece 6 available will see also whether macro block is in the edge of image right hand edge or sheet; And the upper right reference image vegetarian refreshments that is numbered 4,8,12,14,16 sub-pieces in the macro block is always disabled, this is because according to the coded sequence of sub-piece, and this upper right pixel of a little is always just being encoded thereafter.Consider lower-left reference image vegetarian refreshments, for the sub-piece that is positioned on the macro block left margin, promptly be numbered 1,3 and 9 sub-piece among Fig. 4, whether its lower-left reference pixel available depends on the edge whether macro block itself is in image left hand edge or sheet; And the lower-left piece reference image vegetarian refreshments that is numbered 2,6,10,11,12,14,15 and 16 sub-piece in the macro block is always disabled, this is because according to the coded sequence of sub-piece, and this lower-left piece pixel of a little is always just being encoded thereafter.
According to aforementioned analysis as can be known, whether to be predicted upper right reference image vegetarian refreshments and lower-left piece reference image vegetarian refreshments be available, need carry out a series of judgement, for example need to judge to be predicted position and the position of macro block in entire image, place to be predicted or the like in macro block.These judgements make that the process of luma prediction coding is very complicated, especially when realizing the luma prediction coding with hardware, can make that the complexity of coding chip is very high.
Summary of the invention
The purpose of this invention is to provide a kind of luma prediction coding method of I picture, to simplify the process of setting up of to be predicted reference image vegetarian refreshments.
To achieve these goals, the luma prediction coding method of a kind of I picture provided by the invention comprises the reference image vegetarian refreshments step of setting up to be predicted and carries out to be predicted luma prediction step according to described reference image vegetarian refreshments; Set up in the to be predicted reference image vegetarian refreshments step described:
When described to be predicted just go up piece reference image vegetarian refreshments and can use, directly obtain the pixel value of upper right described to be predicted reference image vegetarian refreshments with described pixel value expansion of just going up piece reference image vegetarian refreshments;
When described to be predicted positive left piece reference image vegetarian refreshments can be used, directly obtain the pixel value of described to be predicted lower-left piece reference image vegetarian refreshments with the pixel value expansion of described positive left piece reference image vegetarian refreshments.
In the technique scheme, the pixel value expansion that described usefulness is just going up piece reference image vegetarian refreshments is the pixel value that will just go up upper right reference image vegetarian refreshments of to be predicted of the pixel value of the rightmost reference image vegetarian refreshments of piece replacement.
In the technique scheme, the expansion of the pixel value of the positive left piece reference image vegetarian refreshments of described usefulness is the pixel value that the pixel value of positive left piece reference image vegetarian refreshments is bottom replaced to be predicted lower-left piece reference image vegetarian refreshments.
The luma prediction coding method is when setting up reference image vegetarian refreshments to be predicted in the frame of the present invention, saved to be predicted upper right availability with the reference image vegetarian refreshments of lower-left piece judged, reduced the operand and the complexity of coding, this is particularly conducive to hardware and realizes the luma prediction coding.And in fact, to be predicted upper right reference image vegetarian refreshments with the lower-left piece is only available under situation seldom, and the inventive method has directly been cast out the judgement to this low possibility, and is very little to the influence of coding efficiency, can obviously not reduce video quality.
Description of drawings
Fig. 1 is 8 prediction direction of luma prediction modes in 4 * 4 frames;
Fig. 2 is to be predicted of 4 * 4 whens prediction and the position of reference image vegetarian refreshments;
Order when Fig. 3 is 4 * 4 predictive codings of macro block brightness component;
Fig. 4 is the position of to be predicted of 4 * 4 whens prediction and reference image vegetarian refreshments in the inventive method;
Fig. 5 is for treating the flow chart that the prediction piece carries out luma prediction in the frame according to the reference image vegetarian refreshments.
Embodiment
With embodiment the present invention is elaborated with reference to the accompanying drawings.
The luma prediction coding method comprises generally in the frame: set up to be predicted reference image vegetarian refreshments step and carry out to be predicted luma prediction step according to the reference image vegetarian refreshments.The present invention will improve the foundation of reference image vegetarian refreshments, and in conjunction with Fig. 4, in one embodiment of the invention, the reference image vegetarian refreshments step of setting up to be predicted may further comprise the steps:
A) according to be predicted positional information, judge to be predicted whether just go up piece reference image vegetarian refreshments (pixel of " A ", " B ", " C ", " D " position among Fig. 4) available.
Can use if just going up piece reference image vegetarian refreshments, the value that obtains the relevant position pixel obtains the pixel value of to be predicted upper right reference image vegetarian refreshments simultaneously as the reference pixel with the pixel value expansion of just going up piece reference image vegetarian refreshments.Among the embodiment as shown in Figure 4, the pixel value of to be predicted upper right reference image vegetarian refreshments directly replaces with the pixel value of just going up piece reference image vegetarian refreshments rightmost pixel " D ".As can be seen, unlike the prior art, in the present invention, when just going up piece reference image vegetarian refreshments and can use, do not go to judge the availability of to be predicted upper right reference image vegetarian refreshments, but directly expand the pixel value that obtains upper right reference image vegetarian refreshments with just going up piece reference image vegetarian refreshments.
If to be predicted just to go up piece reference image vegetarian refreshments unavailable, then its upper right reference image vegetarian refreshments is also unavailable.In one embodiment, just going up piece reference image vegetarian refreshments when unavailable, can be set at the pixel value of just going up piece reference image vegetarian refreshments " A ", " B ", " C ", " D " with 128, this setting is convenient to adopt the DC prediction when unavailable just going up piece reference image vegetarian refreshments, and this is that those skilled in the art is known.
B), judge whether to be predicted positive left piece reference image vegetarian refreshments (pixel of " I ", " J ", " K ", " L " position among Fig. 4) is available according to be predicted positional information.
If positive left piece reference image vegetarian refreshments can be used, the value that obtains the relevant position pixel obtains the pixel value of to be predicted lower-left piece reference image vegetarian refreshments simultaneously as the reference pixel with the pixel value expansion of positive left piece reference image vegetarian refreshments.Among the embodiment as shown in Figure 4, the pixel value of to be predicted lower-left piece reference image vegetarian refreshments directly replaces with the pixel value of the lower pixel point " L " of positive left piece reference image vegetarian refreshments.As can be seen, unlike the prior art, in the present invention, when positive left piece reference image vegetarian refreshments can be used, do not go to judge the availability of to be predicted lower-left piece reference image vegetarian refreshments, but directly obtain the pixel value of lower-left piece reference image vegetarian refreshments with positive left piece reference image vegetarian refreshments expansion.
If to be predicted positive left piece reference image vegetarian refreshments is unavailable, then its lower-left piece reference image vegetarian refreshments is also unavailable.In one embodiment, when positive left piece reference image vegetarian refreshments is unavailable, can be with 128 pixel values that are set at positive left piece reference image vegetarian refreshments " A ", " B ", " C ", " D ", this setting is convenient to adopt the DC prediction when positive left piece reference image vegetarian refreshments is unavailable, and this is that those skilled in the art is known.
After obtaining to be predicted reference image vegetarian refreshments, then can carry out each subsequent step of to be predicted luma prediction according to the reference image vegetarian refreshments, this is the known conventional method of those skilled in the art, below with reference to Fig. 5 these subsequent steps is carried out brief description.
As shown in Figure 5, step 10, utilize a certain luma prediction modes to luminance block carry out 4 * 4 the prediction, if this luma prediction modes required reference image vegetarian refreshments when doing luma prediction is unavailable, then stop this luma prediction modes, jump to step 50, otherwise after finishing luma prediction, enter next step.
Step 20, calculating prediction residual.Residual error is meant makes the resulting result of difference with to be predicted pixel value with the pixel value of prediction piece.
Step 30, residual error is carried out dct transform and quantification treatment, obtain residual error coefficient.
Step 40, residual error coefficient is done entropy coding.
Step 50, judge whether to do all possible predictive mode that is over,,, then enter next step if no longer include new possible predictive mode if also possible predictive mode then jumps to step 10.
Step 60, all results are done rate-distortion optimization select the coding of output optimal mode and residual error coefficient.
The present invention has saved when the reference image vegetarian refreshments of setting up to be predicted upper right complicated deterministic process with the reference pixel point availability of lower-left piece, and the necessary operations number when having reduced the luma prediction coding thus is operand in other words.The difference of table 1 shows in one embodiment respectively method for building up with prior art and reference image vegetarian refreshments of the present invention when two sub-pictures are carried out luma prediction coding action required number of times.In table 1, two sub-pictures are respectively the Qcif of 176 * 144 pixel sizes and the Cif of 352 * 288 pixel sizes; The 2nd row of table 1 show the ratio that the diverse location macro block accounts for entire image macro block sum that is in; Necessary operations number of times when the 3rd row of table 1 show in the prior art macro block of all places encoded; Necessary operations number of times when the 4th row of table 1 show the present invention macro block is encoded; Necessary operations number of times ratio compared with prior art when adopting method of the present invention to encode that the 5th row of table 1 show macro block for all places; The 6th row of table 1 show for a whole sub-picture, and the present invention and prior art are carried out the ratio of luma prediction coding action required number of times.
Table 1
As can be seen from Table 1, when adopting method of the present invention to carry out the luma prediction coding, its necessary operations number of times obviously reduces, and greatly reduces the number of operations operand and the complexity of luma prediction video in the frame.It can also be seen that from table 1 image resolution ratio is high more, the number of operations ratio that method of the present invention reduced is just high more.
Be to be understood that, the luma prediction coding method of I picture of the present invention not only can be used for H.264 video encoding standard, also can be used for other such as video encoding standards such as AVS, those skilled in the art is easy to simplify with method of the present invention the foundation of reference image vegetarian refreshments in other video encoding standards.