Alternatively, a second candidate group may be rearranged to be positioned before a third candidate group. Through it, an intra prediction mode corresponding to a second candidate group may be encoded with a codeword which is shorter than a third candidate group. In other words, an intra prediction mode corresponding to a second candidate group may be encoded with a short codeword and a third candidate group may be encoded with a relatively long codeword.
In the above-described embodiment, only some of a third candidate group may be selectively arranged before or behind a second candidate group. For example, some of the third candidate group may mean a mode whose mode value is an even number or may mean a mode whose mode value is an odd number among intra prediction modes included in a third candidate group.