主权项 |
1. A method of decoding an image, the method comprising:
extracting an intra prediction mode of a current block from a bitstream, the intra prediction mode indicating a particular direction among a plurality of directions, wherein the particular direction is indicated by using one of a dx number in a horizontal direction and a fixed number in a vertical direction, or a dy number in the vertical direction and a fixed number in the horizontal direction, wherein dx and dy are integers; determining a number of neighboring pixels located on a left side of the current block or an upper side of the current block; determining a location of one or more neighboring pixels among the neighboring pixels located on the left side of the current block or the upper side of the current block using a bitwise shift operation based on a position of a current pixel (j, i) and one of the dx or dy numbers indicating the particular direction, where j and i are integers; and performing intra prediction on the current block using the number of neighboring pixels and the location of the one or more neighboring pixels, wherein the performing of the intra prediction comprises calculating a value of the current pixel using the number of neighboring pixels, and the location of the one or more neighboring pixels; wherein: the location of the one or more neighboring pixels located on the upper side of the current block is determined based on i*dx>>m, where i is a position of the current pixel in the vertical direction, dx is the dx number in the horizontal direction, m is related to the fixed number in the vertical direction, and >> is the bitwise shift operation, and the location of the one or more neighboring pixels located on the left side of the current block is determined based on j*dy>>n, where j is a position of the current pixel in the horizontal direction, dy is the dy number in the vertical direction, and n is related to the fixed number in the horizontal direction, wherein the bitwise shift operation operates on a binary representation of i*dx and j*dy. |