An apparatus for decoding, the apparatus comprising: an entropy decoder configured to restore quantized residual coefficients and intra prediction information; a prediction mode decoder configured to restore an intra prediction mode on the basis of the intra prediction information; a residual signal decoder configured to restore a residual signal using the intra prediction mode; a reference pixel generator configured to generate reference pixels corresponding to unavailable reference pixels and to adaptively filter the reference pixels according to the intra prediction mode; a prediction block generator configured to generate prediction pixels using the reference pixels determined by the intra prediction mode; a prediction block filter configured to adaptively filter some of the prediction pixels using the intra prediction mode; and an image reconstructor configured to generate a reconstructed image using the prediction pixels and the residual signal, wherein, the reference pixel generator adaptively filters the reference pixels according to a size of a prediction block for intra prediction modes existing between a horizontal mode and an intra prediction mode having a direction of 45° with respect to the horizontal mode, wherein the filter is applied to the intra prediction mode having a direction of 45° with respect to the horizontal mode and is not applied to the vertical and horizontal modes, wherein, when the reference pixels are filtered for a second directional intra prediction mode, the reference pixels are also filtered for a first directional intra prediction mode that is closer to the intra prediction mode having the direction of 45° with respect to the horizontal mode than the second directional mode is, wherein the second and the first directional intra prediction modes exist between the horizontal mode and the intra prediction mode having the direction of 45° with respect to the horizontal mode, wherein the number of directional modes in which the filter is applied increases as the size of the prediction unit increases, wherein, the reference pixel generator does not filter the reference pixels of a current block which is smaller than a predetermined size. an entropy decoder configured to restore quantized residual coefficients and intra prediction information; a prediction mode decoder configured to restore an intra prediction mode on the basis of the intra prediction information; a residual signal decoder configured to restore a residual signal using the intra prediction mode; a reference pixel generator configured to generate reference pixels corresponding to unavailable reference pixels and to adaptively filter the reference pixels according to the intra prediction mode; a prediction block generator configured to generate prediction pixels using the reference pixels determined by the intra prediction mode; a prediction block filter configured to adaptively filter some of the prediction pixels using the intra prediction mode; and an image reconstructor configured to generate a reconstructed image using the prediction pixels and the residual signal, wherein, the reference pixel generator adaptively filters the reference pixels according to a size of a prediction block for intra prediction modes existing between a horizontal mode and an intra prediction mode having a direction of 45° with respect to the horizontal mode, wherein the filter is applied to the intra prediction mode having a direction of 45° with respect to the horizontal mode and is not applied to the vertical and horizontal modes, wherein, when the reference pixels are filtered for a second directional intra prediction mode, the reference pixels are also filtered for a first directional intra prediction mode that is closer to the intra prediction mode having the direction of 45° with respect to the horizontal mode than the second directional mode is, wherein the second and the first directional intra prediction modes exist between the horizontal mode and the intra prediction mode having the direction of 45° with respect to the horizontal mode, wherein the number of directional modes in which the filter is applied increases as the size of the prediction unit increases, wherein, the reference pixel generator does not filter the reference pixels of a current block which is smaller than a predetermined size.