In an example, it is assumed that the number of a second candidate group is 5 and a second candidate group is positioned before a third candidate group.
When the remaining mode information has a value of 0 to 4, a decoding device may determine an intra prediction mode corresponding to a value of remaining mode information among a second candidate group. The determined intra prediction mode may be set as an intra prediction mode of a current block.
On the other hand, when the remaining mode information has a value of 5 to 60, a decoding device may rearrange the MPM of a candidate mode list in an ascending order. The rearranged MPM may be compared with remaining mode information. As a result of the comparison, when remaining mode information is greater than or equal to the MPM, a first process which adds 1 to remaining mode information may be performed. The first process may be sequentially performed for each of rearranged MPM. In addition, a second candidate group belonging to a first group of the non-MPM may be rearranged in an ascending order. A rearranged second candidate group may be compared with a mode value obtained through the first process. As a result of the comparison, when a mode value is greater than or equal to a second candidate group, a second process which adds 1 to a mode value may be performed. The second process may be sequentially performed for each of the rearranged second candidate group. A decoding device may set a mode value obtained through the first process and second process as an intra prediction mode of a current block.