Subsequently, the intra predictor 110 performs prediction onto the inputted image based on the selected prediction mode at step S530, and creates a residue signal block having a difference value between a pixel value in a macro block of a current frame to be encoded and a predicted pixel value at step S540.
At step S550, the DCT/quantization unit 130 performs DCT onto the residue signal block and quantizes the transformed residue signal block.
Subsequently, the entropy encoder 140 adaptively scans the quantized residue signal block based on the prediction mode at step S560, performs entropy encoding onto the scanned coefficients, and outputs the entropy-encoded coefficients at step S570.
When the prediction mode is the horizontal mode, vertical preference scanning is carried out at step S640. When it is not the horizontal mode, zigzag scanning is carried out at step S650.