A method for coding, on a block-by-block basis, image data partitioned into a plurality of blocks, said method comprising the steps of: detecting location and direction of a dominant edge within each image data of a plurality of previously coded blocks spatially adjacent to a current block, the edge intersecting the current block and the plurality of the previously coded blocks being used for intra prediction of the current block; deciding on the basis of the detected dominant edge whether either a first filtering or a second filtering is to be applied to pixels of the previously coded blocks to be used as reference pixels for intra-prediction depending on the proximity of said pixels of the previously coded blocks relative to the detected dominant edge; and predicting the current block from the image data of the previously coded blocks by intra prediction, wherein in said predicting of the current block, intra prediction is performed using filtered image data of the previously coded blocks to which the first filtering is applied as reference for the prediction, when it is decided in said deciding that the first filtering is to be applied, and wherein in said predicting of the current block, intra prediction is performed using filtered image data of the previously coded blocks to which the second filtering is applied as reference for the prediction, when it is decided in said deciding that the first filtering is not to be applied, the second filtering being edge-sharpening filtering applied to n pixels to be used as reference pixels for intra-prediction of the current block around the edge intersection with the current block and the first filtering being low-pass filtering applied to the remaining pixels to be used as reference pixels for intra-prediction of the current block. detecting location and direction of a dominant edge within each image data of a plurality of previously coded blocks spatially adjacent to a current block, the edge intersecting the current block and the plurality of the previously coded blocks being used for intra prediction of the current block; deciding on the basis of the detected dominant edge whether either a first filtering or a second filtering is to be applied to pixels of the previously coded blocks to be used as reference pixels for intra-prediction depending on the proximity of said pixels of the previously coded blocks relative to the detected dominant edge; and predicting the current block from the image data of the previously coded blocks by intra prediction, wherein in said predicting of the current block, intra prediction is performed using filtered image data of the previously coded blocks to which the first filtering is applied as reference for the prediction, when it is decided in said deciding that the first filtering is to be applied, and wherein in said predicting of the current block, intra prediction is performed using filtered image data of the previously coded blocks to which the second filtering is applied as reference for the prediction, when it is decided in said deciding that the first filtering is not to be applied, the second filtering being edge-sharpening filtering applied to n pixels to be used as reference pixels for intra-prediction of the current block around the edge intersection with the current block and the first filtering being low-pass filtering applied to the remaining pixels to be used as reference pixels for intra-prediction of the current block.