A non-transitory computer-readable recording medium storing a bitstream that is generated by a method of encoding a video signal, wherein the method comprises
- determining an intra-prediction mode of a current block;
- deriving a first neighbor intra prediction mode based on a first neighbor block adjacent to the current block;
- deriving a second neighbor intra prediction mode based on a second neighbor block adjacent to the current block;
- deriving a first candidate intra-prediction mode and a second candidate intra-prediction mode of the current block based on the first neighbor intra prediction mode and the second neighbor intra prediction mode;
- and
- encoding the intra prediction mode of the current block based on the first candidate intra prediction mode and the second candidate intra prediction mode,
- wherein when the first neighbor block is available and the second neighbor block is unavailable, the first candidate intra prediction mode is set to the first neighbor intra prediction mode and the second candidate intra prediction mode is set to a DC mode or a planar mode, and
- wherein when the first neighbor block is unavailable and the second neighbor block is available, the first candidate intra prediction mode is set to the DC mode or the planar mode and the second candidate intra prediction mode is set to the second neighbor intra prediction mode.