1. Field of the Invention
The present invention relates to a coding technique, and more particularly to a technique for performing coding by selecting an optimum one out of many types of predictive coding processes.
2. Description of the Background Art
An encoder compressively encodes uncompressed image data such as YCbCr or the like to output stream data. In order to compresses the image data, the encoder selects an optimum one out of various types of predictive coding processes. For intra-frame prediction, the encoder selects an optimum one out of a plurality of prediction modes. For inter-frame prediction, the encoder selects an optimum motion compensation block. Alternatively, the encoder selects which of the intra-frame prediction and the inter-frame prediction should be used.
In order to select a prediction mode in the intra-frame prediction or select a motion compensation block in the inter-frame prediction, conventionally, an evaluation value, i.e., SATD (sum of absolute transformed difference) has been used. The encoder uses a value of the SATD as a cost of coding.
Specifically, the encoder calculates a differential block from the difference between a coding object block and a prediction block. The encoder carries out frequency conversion of the differential block by performing Hadamard Transform on the differential block in vertical and horizontal directions. The encoder obtains the SATD by computing a sum of absolute values of frequency components in the frequency-converted differential block.
The encoder calculates the SATDs for all the prediction modes or all the motion compensation blocks to obtain coding costs for all the predictive coding processes. By selecting one of the predictive coding processes, of which the coding cost is minimum, the encoder can select a process in which less amount of codes are generated and thereby improve the coding efficiency.
In the H.264/AVC standard, in order to quantize a signal of orthogonally transformed frequency component, a quantization matrix is used. In other words, respective signals of frequency components are quantized with different quantization step values. For this reason, the proportional relation between the coding cost calculated by using the SATD and the amount of generated codes is broken. There arises a problem that an optimum predictive coding process by which the amount of generated codes becomes minimum cannot be selected by using the SATD. Not optimum allocation of the amount of generated codes in a stream may sometimes cause degradation of image quality.
Japanese Patent Application Laid Open Gazette No. 2000-078589 discloses a technique for reducing the amount of computation required for the calculation of the coding cost. In Japanese Patent Application Laid Open Gazette No. 2000-078589, a coding object block and a reference block are orthogonally transformed individually. Respective sums of absolute differences (SADs) are obtained by using only signals in a low frequency domain out of frequency components in these orthogonally transformed blocks. The calculated sums of absolute differences (SADs) are compared with each other, and a predictive coding process with less amount of generated codes is thereby selected.
Japanese Patent Application Laid Open Gazette No. 2004-241957 also discloses a technique for reducing the amount of computation required for the calculation of the coding cost. In Japanese Patent Application Laid Open Gazette No. 2004-241957, the coding cost is calculated by performing orthogonal transform so that only specific frequency components can be left.
Both Japanese Patent Application Laid Open Gazette Nos. 2000-078589 and 2004-241957 disclose a method of calculating the coding cost for limited specific frequency components. Though the amount of computation can be reduced by using the techniques disclosed in the above documents, there arises a problem of causing a reduction in the accuracy of computation of the coding cost.
The present invention is intended for an encoder. According to an aspect of the present invention, the encoder comprises a difference calculation part for calculating a differential block between a coding object block and a prediction block for each of a plurality of patterns of predictive coding processes, a frequency component calculation part for orthogonally transforming the differential block to calculate a frequency component block, a factor multiplication part for multiplying each of frequency components in the frequency component block by a conversion factor on which the magnitude relation of quantization steps is reflected, a cost calculation part for adding up said frequency components in the frequency component block, each of which is multiplied by the conversion factor, to obtain a coding cost, and a selection part for selecting a predictive coding process for which the coding cost is minimum.
By using the encoder of the present invention, the coding cost can be calculated with the information of a quantization matrix reflected thereon. It is thereby possible to maintain the proportional relation between the coding cost and the amount of generated codes and select an optimum predictive coding process. By selecting an optimum predictive coding process for each coding object block, the coding assignment for each picture is optimized and the image quality can be thereby improved.
It is an object of the present invention to provide a technique for improving the accuracy of computation of the coding cost and selecting an optimum predictive coding process.
These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.
Hereinafter, with reference to figures, the preferred embodiment of the present invention will be discussed.
The coding part 11 inputs uncompressed image data 41 therein. The uncompressed image data 41 is, for example, image data in the YCbCr space. The coding part 11 performs compressive coding on the uncompressed image data 41 to output stream data 42. The coding part 11 outputs the stream data 42 coded in, for example, the H.264/AVC coding system.
In order to perform the compressive coding, the coding part 11 uses various predictive coding process. For I picture (Intra Picture), the coding part 11 performs intra-frame prediction (intra prediction) to carry out the compressive coding.
For P picture (Predictive Picture), the coding part 11 performs forward predictive coding. Specifically, the coding part 11 performs inter-frame prediction (inter prediction) using a past reference image to carry out the compressive coding.
For B picture (Bi-direction Predictive Picture), the coding part 11 performs bidirectional predictive coding. Specifically, the coding part 11 performs inter-frame prediction (inter prediction) using past and future reference images to carry out the compressive coding.
The coding part 11 has a plurality of prediction modes for the intra prediction. In the H.264/AVC standard, for the intra prediction of a 4×4 block, the coding part 11 has nine prediction modes Prediction Mode 0 to Prediction Mode 8. In the H.264/AVC standard, for the intra prediction of a 16×16 block, the coding part 11 has four prediction modes Prediction Mode 0 to Prediction Mode 3.
The cost calculation part 12 calculates a coding cost for each of the plurality of prediction modes. The coding cost refers to an evaluation value used for estimating the magnitude relation of the amounts of generated codes. The method of calculating the coding cost will be discussed later in detail.
The mode selection part 13 compares the coding costs for those prediction modes, which are calculated by the cost calculation part 12, and selects a prediction mode for which the coding cost is minimum. The coding part 11 performs the intra prediction coding in accordance with the prediction mode selected by the mode selection part 13.
In order to perform the inter prediction, the coding part 11 switches and uses a plurality of block sizes as a motion compensation block. In the H.264/AVC standard, prepared are seven types of motion compensation blocks ranging from a 16×16 block to a 4×4 block. The coding part 11 obtains a reference picture and a motion vector for the selected motion compensation block and performs the compressive coding on the basis of the inter prediction.
The cost calculation part 12 selects a combination of the reference picture and the motion vector for each of the plurality of motion compensation blocks and calculates the coding cost for the compressive coding. The method of calculating the coding cost will be discussed later in detail.
The mode selection part 13 compares the respective coding costs calculated by the cost calculation part 12 for the combinations of the motion compensation block, the reference picture and the motion vector and selects a combination for which the coding cost is minimum. The coding part 11 performs the inter prediction coding in accordance with the combination of the motion compensation block, the reference picture and the motion vector selected by the mode selection part 13.
As the size of the motion compensation block becomes smaller, finer prediction can be performed. On the other hand, as the size of the motion compensation block becomes smaller, information on the motion vector increases. Therefore, by the calculation of the coding cost, the amount of information is overall evaluated and an optimum predictive coding process can be thereby selected.
In
In the intra prediction, the prediction block 52 is a pixel block obtained by prediction from surrounding pixels in the same frame as the coding object block 51 is included in. As discussed above, in the H.264/AVC standard, the prediction block is generated from the surrounding pixels by using the nine prediction modes.
In the inter prediction, the prediction block 52 is a pixel block in a past or future picture (frame) which is different from the picture (frame) including the coding object block 51.
As shown in
As shown in
In the H.264/AVC standard, in order to quantize a coded image, a quantization matrix is used. A quantization step is corrected by multiplying the quantization step by the quantization matrix. Quantization of a coded image is performed by using the corrected quantization step.
Eq. (1) is an arithmetic expression used for calculating the conversion factors T00 to T33 in the conversion factor matrix 56.
As expressed by Eq. (1), “1.00” is set to the conversion factor T00 for the DC component. In other words, no conversion is performed on the DC component.
As expressed by Eq. (1), the conversion factor T01 is a value obtained by dividing the correction factor B00 for the DC component by the correction factor B01 for the AC component. The conversion factor T02 is a value obtained by dividing the correction factor B00 for the DC component by the correction factor B02 for the AC component. As to the following conversion factors, similarly, the conversion factor for each frequency component is a ratio of the correction factor for the DC component to the correction factor for the corresponding frequency component. The same also applies to the conversion factor T00, which is a ratio B00/B00=1.00.
The conversion factors for the AC components each take a value smaller than 1.0 due to the ratio of the correction factors. Specifically, since the correction factor for the AC component is larger than that for the DC component, The conversion factors T01 to T33 each take a value smaller than 1.0. Therefore, the conversion factor needs several decimal digits accuracy.
As the frequency becomes higher, normally, the correction factors B00 to B33 in the quantization matrix 55 have larger values. Therefore, as the frequency becomes higher, the conversion factors T00 to T33 in the conversion factor matrix 56 have smaller values. More specifically, a smaller correction factor is set for a more important frequency component, and a larger correction factor is set for a frequency component which less affects the image quality even if some information is dropped out. Therefore, a larger conversion factor is set for a more important frequency component, and a smaller correction factor is set for a frequency component which less affects the image quality even if some information is dropped out.
The cost calculation part 12 calculates the coding cost by applying the conversion factor matrix 56 shown in
COST=(A00*T00)+(A01*T00)+(A02*T02)+ . . . +(A32*T32)+(A33*T33) (2)
As expressed by Eq. (2), the cost calculation part 12 calculates the coding cost (COST) by multiplying each of the frequency components in the frequency component block 54 by the conversion factor for the corresponding frequency component in the conversion factor matrix 56 and adding up the products. Specifically, the cost calculation part 12 calculates the coding cost by adding up the products each obtained by multiplying respective values for the same frequency component in the frequency component block 54 and the conversion factor matrix 56 by each other.
Thus, the cost calculation part 12 does not calculate the coding cost by directly evaluating the frequency components in the frequency component block 54. In other words, the cost calculation part 12 does not use the same SATD as has been used conventionally. The cost calculation part 12 calculates the coding cost by using the frequency components in the frequency component block 54 which are converted with the corresponding conversion factors. By multiplying each frequency component by the corresponding conversion factor, the information of the quantization matrix is reflected on the coding cost.
The cost calculation part 12 calculates the coding costs for all the predictive coding processes. The cost calculation part 12 calculates the coding costs for all the prediction modes in the intra prediction. The cost calculation part 12 calculates the coding costs for all the combinations of the motion compensation block, the reference picture, and the motion vector in the inter prediction.
The mode selection part 13 selects a process to be actually used for coding, from the coding costs for all the predictive coding processes, which are calculated by the cost calculation part 12. The mode selection part 13 notifies the coding part 11 of the selected predictive coding process. The coding part 11 performs the intra prediction coding or the inter prediction coding in accordance with the process selected by the mode selection part 13. Also as to P picture or B picture, depending on the block, the intra prediction coding is sometimes performed. The mode selection part 13 also selects which of the intra prediction coding and the inter prediction coding should be performed, from all the calculated coding costs.
The coding part 11 performs compressive coding to output the stream data 42. As discussed above, the stream data 42 is stream data compressed, for example, in the H.264/AVC standard coding system.
Thus, in the encoder 10 of the present preferred embodiment, the coding cost is calculated by using the conversion factor matrix 56 reflecting the information of the quantization matrix 55. Since the coding part 11 actually performs coding by using the quantization matrix, the coding cost can be used as an evaluation value approximating to the magnitude relation of the amounts of actually generated codes. With the coding cost, the magnitude relation of the amounts of generated codes can be estimated with high accuracy. The proportional relation between the amount of generated codes and the coding cost is thereby maintained, and it is therefore possible to select an optimum predictive coding process and reduce the amount of generated codes. Further, an optimum amount of generated codes is assigned to each picture and this ensures improvement of the image quality.
In the above-discussed preferred embodiment, as expressed by Eq. (1), the ratio of the DC component to each frequency component in the quantization matrix 55 is used as the conversion factor. As a variation, weighting may be given to each frequency component. Eq. (3) is an arithmetic expression used for obtaining the conversion factor by giving weighting to each frequency component.
In Eq. (3), the DC component is multiplied by a weighting factor of 1.50. Among the AC components, the component of B00/B01 is multiplied by a weighting factor of 1.40 and the component of B00/B02 is multiplied by a weighting factor of 1.30. Thus, as the frequency becomes higher, the weighting factor decreases. The final component of B00/B33 is multiplied by a weighting factor of 0.9.
Thus, by calculating the conversion factor with weighting given thereto, an optimum coding cost in accordance with the content of the image can be calculated, as well as with the information of the quantization matrix reflected thereon. For example, weighting may be adjusted in accordance with the scene of the image.
Though the conversion factor is calculated from the value obtained by dividing the correction factor for the DC component in the quantization matrix 55 by the correction factor for each frequency component in the above-discussed preferred embodiment, this conversion factor is only one example. Other methods may be used to obtain the conversion factor only if each frequency component in the quantization matrix 55 is reflected on the calculated conversion factor and the calculated conversion factor has a relation approximating the magnitude relation of the coding costs to the magnitude relation of the amounts of generated codes. It is preferable that the conversion factor should be calculated so that the proportional relation between the amount of generated codes and the coding cost can be maintained.
In the above-discussed preferred embodiment, the quantization matrix 55 is used in common for an intra block (a block on which the intra prediction is performed) and an inter block (a block on which the inter prediction is performed) without distinction. Different quantization matrices may be used, however, for the intra block and the inter block. In this case, respective conversion factors for these blocks are individually calculated and different conversion factor matrices are used. Further, a plurality of quantization matrices may be used depending on the block size.
In the case of using a plurality of quantization matrices, DC components of these quantization matrices are sometimes different from one another. If the conversion factors are individually obtained by using Eq. (1) and the costs are individually calculated by using Eq. (2), the difference of the DC components significantly affects the costs. In order to reduce the effect of the difference of the DC components on the costs, weighting may be given to suppress the difference. With reference to Eq. (3), discussion has been made on the exemplary method of calculating the conversion factors with weighting given thereto. By the same method as the above, weighting may be given so as to absorb the difference of the DC components. Alternatively, even when a plurality of quantization matrices are used, in the calculation of the conversion factors, a common DC component may be used. For example, the minimum value out of the plurality of DC components may be used as a common DC component.
Thus, the transcoder 30 converts the stream data 40 in, for example, MPEG4 into stream data in H.264 and outputs the converted stream data. In this case, the encoder 10 calculates the coding cost by using the conversion factor matrix 56 reflecting the information of the quantization matrix 55, as discussed above. The amount of generated codes in the encoding-converted stream data 42 can be thereby reduced. Further, the image quality of the encoding-converted stream data 42 can be improved.
The encoder 10 of the present preferred embodiment may be applied to a translator. Specifically, the encoder 10 of the present preferred embodiment may be applied to, for example, a translator which once decodes stream data in H.264 and encodes the decoded data into the stream data in H.264 again. Also in this case, the encoder 10 calculates the coding cost by using the conversion factor matrix 56 reflecting the information of the quantization matrix, as discussed above.
While the invention has been shown and described in detail, the foregoing description is in all aspects illustrative and not restrictive. It is therefore understood that numerous modifications and variations can be devised without departing from the scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2009-286804 | Dec 2009 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
5073820 | Nakagawa et al. | Dec 1991 | A |
5291282 | Nakagawa et al. | Mar 1994 | A |
5907636 | Nakahara | May 1999 | A |
6026356 | Yue et al. | Feb 2000 | A |
6687412 | Rao et al. | Feb 2004 | B1 |
6915018 | Tajime | Jul 2005 | B2 |
6990243 | Kuniba et al. | Jan 2006 | B1 |
7899261 | Takahashi | Mar 2011 | B2 |
20060133479 | Chen et al. | Jun 2006 | A1 |
20070217507 | Kazui et al. | Sep 2007 | A1 |
20090041122 | Kodama et al. | Feb 2009 | A1 |
20110032988 | Chiba et al. | Feb 2011 | A1 |
Number | Date | Country |
---|---|---|
2000-78589 | Mar 2000 | JP |
2004-241957 | Aug 2004 | JP |
Number | Date | Country | |
---|---|---|---|
20110150350 A1 | Jun 2011 | US |