In this case, a second candidate group may be configured with a mode derived based on a MPM and a third candidate group may be configured with remaining modes other than a second candidate group among the non-MPM. Alternatively, a second candidate group may be configured based on an intra prediction mode of a neighboring block and/or a mode neighboring an intra prediction mode of a neighboring block. In other words, a second candidate group may be derived in a method which is the same as/similar to the above-described first candidate group, but a second candidate group may not include a MPM belonging to a first candidate group. For example, a second candidate group may include at least one of modes that a difference of a mode value with an intra prediction mode of a neighboring block is +1, ?1, +2, ?2, +3, ?3, . . . , +L, ?L and hereinafter, it will be described on the assumption that a second candidate group is configured with 5 candidate modes. But, it is not limited thereto and the number of candidate modes belonging to a second candidate group may be an integer such as 1, 2, 3, 4, 6, or more.
Concretely, a second candidate group may be determined by considering at least one of whether an intra prediction mode of a left block (candIntraPredModeA) and an intra prediction mode of a top block (candIntraPredModeB) are the same or whether candIntraPredModeA and candIntraPredModeB are nondirectional modes.