According to the embodiment of the present invention, the entropy encoder 140 uses the horizontal preference scanning method shown in FIG. 6 when the intra prediction mode is a vertical mode. When the intra prediction mode is a horizontal mode, the entropy encoder 140 uses the vertical preference scanning method shown in FIG. 7. In the other cases, the entropy encoder 140 uses the conventional zigzag scanning, arranges coefficients, performs entropy encoding, and outputs encoded signals.
According to the horizontal preference scanning method illustrated in FIG. 6, all the blocks of the first row are scanned and then the subsequent scanning is performed in a sequence from all the blocks of the first row, followed by the first to third blocks in the second row, the second block and the first block in the third row, the first and second blocks in the fourth row, the third block in the third row, the fourth block in the second row, the fourth block in the third row, and the third and fourth blocks in the fourth row. Therefore, since the horizontal preference scanning of the present invention scans all the blocks in the first row prior to the other rows, it has a high correlation in the row direction and it is appropriate for the vertical mode where the significant coefficients are mainly positioned in the first row or so.