1. Field of the Invention
Methods and apparatuses consistent with the present invention relate to encoding/decoding an image.
2. Description of the Related Art
In image compression methods such as MPEG-1, MPEG-2, and MPEG-4 H.264/MPEG-4 advanced video coding (AVC), one picture is divided into predetermined image processing units, for example, into macroblocks, so as to encode an image. Next, each macroblock is encoded by using inter prediction or intra prediction. Then, an optimum encoding mode is selected in consideration of the data size of an encoded macroblock and the degree of distortion of an original macroblock, and the macroblock is encoded.
When a prediction block of a current block is generated as a result of inter prediction or intra prediction, a residual block is generated by subtracting the prediction block from the current block.
Residual values of the residual block undergo discrete cosine transformation (DCT) and are converted into a frequency domain. Discrete cosine coefficients that are generated as a result of DCT are quantized. The quantized discrete cosine coefficients are entropy encoded by performing binarization and arithmetic encoding so that image data can be generated. In H.264/AVC encoding, entropy encoding is performed by context-adaptive variable length coding (CAVLC) or context-adaptive binary arithmetic coding (CABAC). Entropy encoding is performed by applying a discrete entropy encoding method to each syntax element.
DCT coefficients among a plurality of syntax elements are used to perform context-based binary arithmetic coding by run-level encoding. The case where the value of a DCT coefficient is ‘0’ is referred to as run, and the case where the value of a DCT coefficient is not ‘0’ is referred to as level. These DCT coefficients are divided into run and level and are binarized. Binary strings that are generated as a result of binarization are arithmetic coded by using a predetermined context model.
In this case, DCT coefficients which are not ‘0’, i.e., levels, are firstly binarized as variable length codes by using concatenated unary/k-th order exponential Golomb binarization, and binary strings that are generated as a result of binarization are arithmetic coded.
Some blocks do not undergo DCT, and residual values included in the residual block are directly entropy encoded. When it is determined that it is more efficient to entropy encode residual values than to perform DCT on the residual values as a result of the data size and the degree of distortion of an original macroblock, i.e., as a result of calculating an R-D cost, a DCT operation is omitted. Such an encoding mode is referred to as a by-pass mode. The case where encoding is performed in a by-pass mode and a quantization parameter (qP) is 0 is referred to as lossless encoding. Residual values during by-pass mode encoding are binarized using an exponential Golomb binarization method like in the case of DCT coefficients and are arithmetic coded.
USPTO Backgrounds
USPTO Backgrounds