摘要 |
Disclosed is an apparatus for decoding an image. The apparatus comprises an entropy decoder, an intra prediction performer, an adder and a loop filter. The entropy decoder obtains information about an intra prediction mode of a current block and residual of the current block from a bitstream. The intra prediction mode indicates a particular direction among a plurality of directions. The particular direction is indicated by one of dx number in a horizontal direction and a fixed number in a vertical direction, and dy number in the vertical direction and a fixed number in the horizontal direction. The intra prediction performer determines a number of neighboring pixels located on a left side of the current block or an upper side of the current block, and determines location of neighboring pixel located on the left side of the current block or the upper side of the current block based on a position of a current pixel and one of the dx and dy indicating the particular direction. It also performs intra prediction on the current block using the number of neighboring pixel and the location of neighboring pixel. The adder restores the current block by adding a result of the intra prediction and the residual of the current block. The loop filter performs loop-filtering on the restored current block. When the number of neighboring pixels is 1, a prediction value of the current pixel is obtained based on the neighboring pixel. When the number of the neighboring pixels is 2, the prediction value of the current pixel is obtained based on a weighted average of the neighboring pixels. |