1. A method, performed by an image data encoding apparatus including a memory, of encoding image data, the method comprising: using at least one non-transitory hardware device spatially predicting pixel values of a one-dimensional block of an image received by the image data encoding apparatus using blocks spatially adjacent to the one-dimensional block or temporally predicting the pixel values of the one-dimensional block using a temporally previous frame when image data is input in line units; transforming and quantizing the pixel values of the one-dimensional block; and generating bit streams for a one-dimensional conversion block when the transformed and quantized one-dimensional block is defined as the one-dimensional conversion block, wherein the spatially or temporally predicting comprises: determining a spatial prediction direction using pixel values of blocks in a row above a row where the one-dimensional block is; filtering the pixel values of the blocks in the above row where the one-dimensional block is, and spatially predicting the pixel values of the one-dimensional block using only the blocks in the above row where the one-dimensional block is; wherein, in the determining a spatial prediction direction, a sum of differences between the pixel values of the one-dimensional block and the pixel values of the blocks in the above row where the one-dimensional block exists is calculated for each of R, G, and B components and a prediction direction having a minimum sum among sums of the sums of the differences for the R, G, and B components is determined as the spatial prediction direction.