An image decoding method comprising: obtaining intra prediction mode information for a current block from a bitstream; setting a first candidate intra prediction mode based on a left candidate block, wherein the first candidate intra prediction mode is set based on an availability or an intra prediction mode of the left candidate block adjacent to a left side of the current block; setting a second candidate intra prediction mode based on an upper candidate block, wherein the second candidate intra prediction mode is set based on an availability or an intra prediction mode of the upper candidate block adjacent to an upper portion of the current block; deriving an intra prediction mode of the current block based on candidate intra prediction modes and the intra prediction mode information, wherein the candidate intra prediction modes include at least one of the first candidate intra prediction mode and the second candidate intra prediction mode, and the intra prediction mode information indicates whether one of the candidate intra prediction modes is used as the intra prediction mode of the current block; performing an intra prediction on the current block based on the derived intra prediction mode to generate a predicted block of the current block; and generating a reconstructed block based on the predicted block, wherein the first candidate intra prediction mode is set to a DC mode when the left candidate block is not available, wherein the second candidate intra prediction mode is set to the DC mode when the upper candidate block is not available, and wherein the second candidate intra prediction mode is set to the DC mode when the upper candidate block is located outside of a current largest coding unit to which the current block belongs. obtaining intra prediction mode information for a current block from a bitstream; setting a first candidate intra prediction mode based on a left candidate block, wherein the first candidate intra prediction mode is set based on an availability or an intra prediction mode of the left candidate block adjacent to a left side of the current block; setting a second candidate intra prediction mode based on an upper candidate block, wherein the second candidate intra prediction mode is set based on an availability or an intra prediction mode of the upper candidate block adjacent to an upper portion of the current block; deriving an intra prediction mode of the current block based on candidate intra prediction modes and the intra prediction mode information, wherein the candidate intra prediction modes include at least one of the first candidate intra prediction mode and the second candidate intra prediction mode, and the intra prediction mode information indicates whether one of the candidate intra prediction modes is used as the intra prediction mode of the current block; performing an intra prediction on the current block based on the derived intra prediction mode to generate a predicted block of the current block; and generating a reconstructed block based on the predicted block, wherein the first candidate intra prediction mode is set to a DC mode when the left candidate block is not available, wherein the second candidate intra prediction mode is set to the DC mode when the upper candidate block is not available, and wherein the second candidate intra prediction mode is set to the DC mode when the upper candidate block is located outside of a current largest coding unit to which the current block belongs.