Summary of the invention
Purpose of the present invention is intended to one of solve the aforementioned problems in the prior at least.
For this reason, embodiments of the invention propose a kind of I frame coding method and device that can improve code efficiency.
According to an aspect of the present invention, the embodiment of the invention has proposed a kind of I frame coding method, described I frame coding method may further comprise the steps: a) the I frame to be encoded to input video carries out down-sampling, obtains corresponding a plurality of subframes with the original resolution that reduces input video; B) from described a plurality of subframes, select a subframe to carry out intraframe coding, and obtain the basic subframe of reconstruction as basic subframe; C) by the basic subframe of described reconstruction remaining subframe is carried out inter prediction encoding, and obtain the corresponding non-basic subframe of reconstruction; And d) with basic subframe of described reconstruction and the synthetic reconstruction I frame that obtains original resolution of the non-basic subframe of described reconstruction, with reference frame as next frame to be encoded.
The further embodiment according to the present invention, described step b comprises: described basic subframe is carried out infra-frame prediction, conversion, quantification, inverse quantization, inverse transformation and infra-frame prediction compensation, obtain the basic subframe of described reconstruction.
The further embodiment according to the present invention, described step c comprises: c1) utilize remaining subframe and the basic subframe of described reconstruction to carry out the difference prediction, to obtain corresponding residual error; And c2) described residual error is carried out conversion, quantification, inverse quantization, inverse transformation and difference predictive compensation, obtain the non-basic subframe of described reconstruction.
According to the present invention again one the step embodiment, described step c1 comprises: the average of calculating described residue subframe; Respectively each residue subframe and described average are subtracted each other, to obtain first residual error of each corresponding subframe; And described average and the basic subframe of described reconstruction subtracted each other, to obtain the second corresponding residual error.Described step c2 comprises: described second residual error is carried out conversion, quantification, inverse quantization, inverse transformation, and carry out addition with the basic subframe of described reconstruction, rebuild non-basic subframe to obtain first; And with each described first residual error and the addition respectively of the non-basic subframe of described first reconstruction, to obtain the non-basic subframe of described reconstruction.
The further embodiment according to the present invention, described step a comprises: each pixel in the described I frame to be encoded is divided in 4 subframes, and that formation level and vertical resolution reduce by half is upper left, upper right, 4 subframes of lower-left, bottom right.
According to a further aspect in the invention, embodiments of the invention propose a kind of I frame code device, described I frame code device comprises: down sample module, described down sample module is used for the I frame to be encoded of input video is carried out down-sampling, obtains corresponding a plurality of subframes with the original resolution that reduces input video; First rebuilding module, described first rebuilding module select a subframe to carry out intraframe coding as basic subframe from described a plurality of subframes, with the basic subframe that obtains to rebuild; Second rebuilding module, described second rebuilding module is carried out inter prediction encoding by the basic subframe of described reconstruction to remaining subframe, obtains the corresponding non-basic subframe of reconstruction; And synthesis module, described synthesis module carries out the synthetic reconstruction I frame that obtains original resolution in spatial domain with the basic subframe of described reconstruction and the non-basic subframe of described reconstruction, with the reference frame as the P frame to be encoded of next frame.
The further embodiment according to the present invention, described first rebuilding module is carried out infra-frame prediction, conversion, quantification, inverse quantization, inverse transformation and infra-frame prediction compensation to described basic subframe, to obtain the basic subframe of described reconstruction.
The further embodiment according to the present invention, described second rebuilding module utilizes remaining subframe and the basic subframe of described reconstruction to carry out the difference prediction, to obtain corresponding residual error; And described residual error carried out conversion, quantification, inverse quantization, inverse transformation and difference predictive compensation, to obtain the non-basic subframe of described reconstruction.
According to the present invention again one the step embodiment, described second rebuilding module comprises: the residual computations unit, described residual computations unit calculates the average of described residue subframe; Respectively each residue subframe and described average are subtracted each other, to obtain first residual error of each corresponding subframe; And described average and the basic subframe of described reconstruction subtracted each other, to obtain the second corresponding residual error; And the subframe reconstruction unit, described subframe reconstruction unit carries out conversion, quantification, inverse quantization, inverse transformation with described second residual error, and carries out addition with the basic subframe of described reconstruction, rebuilds non-basic subframe to obtain first; And with each described first residual error and the addition respectively of the non-basic subframe of described first reconstruction, to obtain the non-basic subframe of described reconstruction.
The further embodiment according to the present invention, described down sample module is divided into each pixel in the described I frame to be encoded in 4 subframes, upper left, upper right, the lower-left that reduces by half with formation level and vertical resolution, 4 subframes of bottom right.
The further embodiment according to the present invention, described I frame code device also comprises the entropy coding module, described entropy coding module is used for described basic subframe and/or described residual error after quantizing are carried out entropy coding, and the corresponding compressed bit stream of output.
Problems such as the present invention can improve in the existing I frame coding method and removes a little less than the data redundancy ability, and the algorithm time overhead is big.Thereby can under the situation that keeps reconstruction quality not fall, reduce the I frame scramble time.
In addition, the present invention can also effectively weaken the blocking effect of conventional I frame coding, improves the subjective quality of reconstructed image.
Aspect that the present invention adds and advantage part in the following description provide, and part will become obviously from the following description, or recognize by practice of the present invention.
Embodiment
Describe embodiments of the invention below in detail, the example of described embodiment is shown in the drawings, and wherein identical from start to finish or similar label is represented identical or similar elements or the element with identical or similar functions.Below by the embodiment that is described with reference to the drawings is exemplary, only is used to explain the present invention, and can not be interpreted as limitation of the present invention.
The present invention proposes a kind of I frame code device and method, the I frame that obtains rebuilding, here can be referred to as a kind of novel down-sampling I frame, with solve remove the data redundancy ability in the existing I frame coding techniques a little less than, the problem that the algorithm time overhead is big and then code efficiency is low.
In one embodiment of the invention, I frame code device can comprise down sample module, first rebuilding module, second rebuilding module and synthesis module.
Specifically, down sample module is used for the I frame to be encoded of input video is carried out down-sampling, obtains corresponding a plurality of subframes with the original resolution that reduces input video.
First rebuilding module selects a subframe to carry out intraframe coding as basic subframe from a plurality of subframes, with the basic subframe that obtains to rebuild, second rebuilding module is carried out inter prediction encoding by rebuilding basic subframe to remaining subframe, obtains the corresponding non-basic subframe of reconstruction.
At last, to carry out the spatial domain synthetic with rebuilding non-basic subframe will to rebuild basic subframe by synthesis module, thereby obtain the reconstruction I frame of original resolution, with the reference frame as the P frame to be encoded of next frame.
With reference now to Fig. 2 and 3,, the I frame code device structure and the operation principle of the embodiment of the invention are described in detail below in conjunction with this figure.
As shown in Figure 2, the I frame to be encoded of input video at first is input in the down sample module 10, and I frame to be encoded is carried out down-sampling, and then reduces the original resolution of this I frame.Here, can obtain resolution and be 4 subframes of original resolution 1/4 size for example, and select one of them, all the other 3 subframes be predicted in subsequent step, being used for as basic subframe.
In one embodiment, the down-sampling that down sample module 10 is carried out can be as shown in Figure 3, for example according to interlacing, every the principle of row each pixel in the I frame to be encoded of original resolution is divided in 4 subframes, that formation level and vertical resolution reduce by half is upper left, upper right, lower-left, 4 subframes in bottom right (being down-sampling I frame).And, for example select upper left subframe as basic subframe.
For for example upper left basic subframe, according to the conventional frame intra coding method, it is carried out infra-frame prediction, conversion, quantification, inverse quantization, inverse transformation and infra-frame prediction compensation etc. by first rebuilding module, to obtain corresponding reconstruction basis subframe.In Fig. 2 embodiment, aforesaid operations can be carried out by intraprediction unit 12, converter unit 14, quantifying unit 16, inverse quantization unit 18 and inverse transformation unit 20 etc. are corresponding respectively.At last, shown in Fig. 1 dotted arrow, obtain the reconstructed value of basic subframe.
After obtaining the reconstructed value of basic subframe, second rebuilding module is utilized this to rebuild basic subframe remaining subframe is carried out inter-coded prediction, to obtain the reconstructed value of these residue subframe correspondences, promptly rebuilds non-basic subframe.
Specifically, second rebuilding module utilizes remaining subframe and basic subframe reconstructed value to carry out the difference prediction, to obtain corresponding residual error; Then, this residual error is carried out conversion, quantification, inverse quantization, inverse transformation and difference predictive compensation, to obtain the corresponding non-basic subframe of rebuilding.
In Fig. 2 embodiment, aforesaid operations can pass through corresponding respectively execution such as residual computations unit 26, converter unit 14, quantifying unit 16, inverse quantization unit 18 and inverse transformation unit 20.
Specifically, residual computations unit 26 calculates the average of these residue subframes, respectively each residue subframe and above-mentioned average is subtracted each other, to obtain first residual error of each residue subframe correspondence.Then, above-mentioned average is subtracted each other with basic subframe reconstructed value again, to obtain the second corresponding residual error.
Then, after second residual error that will obtain by converter unit 14, quantifying unit 16, inverse quantization unit 18 and inverse transformation unit 20 is carried out conversion, quantification, inverse quantization, inverse transformation, residual computations unit 26 carries out addition with residual values and basic subframe reconstructed value that correspondence obtains, then remain the subframe residual error corresponding again with each with its average, promptly first residual error is distinguished addition, so then obtains remaining the reconstructed value of subframe.
At last, it is synthetic that the reconstruction subframe that will be obtained by synthesis module 22 (comprise and rebuild basic subframe and rebuild non-basic subframe) is carried out the spatial domain, obtains the reconstruction I frame of original resolution size, and promptly novel down-sampling I frame is with the reference frame as next code.
In embodiments of the present invention, I frame code device can also comprise entropy coding module 24, quantifying unit 16 is carried out parallel processing, one tunnel residual error with the basic subframe exported after the quantization operation or non-basic subframe correspondence inputs to inverse quantization unit 18 and carries out subframe and rebuild, another road is input in the entropy coding module 24, to carry out entropy coding and to export compressed bit stream.
In addition, the invention allows for a kind of I frame coding method, this method may further comprise the steps: the I frame to be encoded to input video carries out down-sampling, obtains corresponding a plurality of subframes with the original resolution that reduces input video; From a plurality of subframes, select a subframe to carry out intraframe coding, and obtain the basic subframe of reconstruction as basic subframe; By rebuilding basic subframe remaining subframe is carried out inter prediction encoding, and obtain the corresponding non-basic subframe of reconstruction; And will rebuild basic subframe and rebuild the synthetic reconstruction I frame that obtains original resolution of non-basic subframe, with reference frame as the P frame to be encoded of next frame.
Below, in conjunction with Fig. 4 the concrete steps flow process of the I frame coding method of the embodiment of the invention is provided detailed description.
At first obtain the I frame to be encoded (step 102) of input video correspondence, and I frame to be encoded is carried out down-sampling (step 104), thus a plurality of subframes of the resolution that is reduced, and for example resolution is 4 subframes of original resolution 1/4 size.And select one of them as basic subframe, remaining non-basic subframe is predicted in subsequent step, being used for.
Then, judge whether the subframe when pre-treatment is basic subframe (step 106).If basic subframe then according to the conventional frame intra coding method, is at first carried out infra-frame prediction (step 108), conversion (step 110), is quantized (step 112).
In one embodiment, can carry out parallel processing (step 114) this moment to the data that obtain after quantizing, and a circuit-switched data is carried out entropy coding (step 134), and output compressed bit stream (step 136). and another road then forwards step 116 to and rebuilds to be used for follow-up subframe.That is, the basic subframe after quantizing is carried out inverse quantization (step 116), inverse transformation (step 118), and carry out the infra-frame prediction compensation and rebuild (step 122), and then obtain rebuilding basic subframe to realize basic subframe.
If in step 106, judge all the other subframes, then forward step 132 to and carry out the difference prediction when the right and wrong basis of pre-treatment subframe.In step 132, the difference prediction is an average of calculating these residue subframes, respectively each residue subframe and above-mentioned average is subtracted each other, to obtain each corresponding first residual error.Then, above-mentioned average is subtracted each other with basic subframe reconstructed value again, to obtain the second corresponding residual error.
Second residual error that will obtain is then carried out conversion (step 110), is quantized (step 112), and parallel processing (step 114).Similarly, the data one tunnel of parallel processing are here carried out entropy coding (step 134) and are exported compressed bit stream (step 136), and another road then forwards step 116 to and rebuilds.
Promptly, subframe residual error after quantizing is carried out inverse quantization (step 116), inverse transformation (step 118), residual values that correspondence is obtained and basic subframe reconstructed value are carried out addition then, then remain the subframe residual error corresponding again with each with its average, promptly first residual error is distinguished addition, so then obtains the reconstructed value (step 124) of current non-basic subframe.
After each current subframe reconstruction procedures, judge further whether the coding of subframe that all down-samplings are divided finishes (step 126).If also have subframe not encode, then forward step 106 to and continue coding; If all subframes (comprising basic subframe and non-basic subframe) are all encoded and finished, then forward step 128 to.
That is, it is synthetic that the reconstructed value that original resolution I frame down-sampling is divided a plurality of subframes obtain is carried out the spatial domain, to obtain the reconstruction I frame of original resolution size.Then, the I frame reconstructed value (step 130) that output is corresponding is with the reference frame as next code.
Wherein, the step of down-sampling described in the step 104 can according to interlacing, every row principle each pixel in the I frame to be encoded is divided in 4 subframes, that formation level and vertical resolution reduce by half is upper left, upper right, lower-left, bottom right subframe, and select upper left subframe as basic subframe, all the other 3 subframes are predicted.
Problems such as the present invention can effectively utilize inter prediction by realize obtaining a kind of novel down-sampling I frame by I frame coding as upper type, fully eliminates data redundancy, can improve in the existing I frame coding method and remove a little less than the data redundancy ability, and the algorithm time overhead is big.And the present invention can will reduce about about 70% the scramble time under the situation that keeps reconstruction quality not fall.
In addition, the present invention can also effectively weaken the blocking effect of conventional I frame coding, thereby has improved the subjective quality of reconstructed image.
Although illustrated and described embodiments of the invention, for the ordinary skill in the art, be appreciated that without departing from the principles and spirit of the present invention and can carry out multiple variation, modification, replacement and modification that scope of the present invention is by claims and be equal to and limit to these embodiment.