DECODER, ENCODER, AND METHOD FOR STORING BIT STREAMS
Patent Information
- Authority / Receiving Office
- VN · VN
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2017-08-30
- Publication Date
- 2026-06-15
AI Technical Summary
High-resolution, high-quality video data requires efficient compression methods to reduce transmission and storage costs, as existing technologies struggle to effectively manage the increased bit rate associated with higher resolution video.
A video decoding method and device that performs intra prediction by deriving reference samples from neighboring samples and using them to generate prediction samples, improving prediction accuracy and overall coding efficiency.
The method enhances prediction accuracy and coding efficiency by utilizing reference samples derived from surrounding samples, specifically in the prediction direction, thereby reducing the bit rate and storage costs for high-resolution video data.
Smart Images

Figure VN1202603807_0
Abstract
Description
Method and device for decoding images based on intra prediction in an image coding system The present invention relates to image coding technology, and more specifically, to an image decoding method and device according to intra prediction in an image coding system. Recently, the demand for high-resolution, high-quality images such as HD (High Definition) images and UHD (Ultra High Definition) images is increasing in various fields. As the image data becomes higher in resolution and higher in quality, the amount of information or bits transmitted relative to existing image data increases. Therefore, when transmitting image data using media such as existing wired and wireless broadband lines or storing image data using existing storage media, the transmission and storage costs increase. Accordingly, highly efficient image compression technology is required to effectively transmit, store, and reproduce high-resolution, high-quality image information. The technical problem of the present invention is to provide a method and device for increasing image coding efficiency. Another technical object of the present invention is to provide a method and device for generating a reference sample based on a plurality of surrounding samples of a current block and performing intra prediction based on the reference sample. According to one embodiment of the present invention, a video decoding method performed by a decoding device is provided. The method is characterized by including the steps of: deriving an intra prediction mode for a current block; deriving upper peripheral samples of a plurality of rows and left peripheral samples of a plurality of columns for the current block; deriving upper reference samples of one row based on the upper peripheral samples; deriving left reference samples of one column based on the left peripheral samples; and generating a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode. According to another embodiment of the present invention, a decoding device that performs image decoding is provided. The decoding device is characterized by including an entropy decoding unit that obtains prediction information for a current block, and a prediction unit that derives an intra prediction mode for the current block, derives upper peripheral samples of a plurality of rows and left peripheral samples of a plurality of columns for the current block, derives upper reference samples of one row based on the upper peripheral samples, derives left reference samples of one column based on the left peripheral samples, and generates a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode. According to another embodiment of the present invention, a video encoding method performed by an encoding device is provided. The method is characterized by including the steps of determining an intra prediction mode for a current block, deriving upper peripheral samples of a plurality of rows and left peripheral samples of a plurality of columns for the current block, deriving upper reference samples of one row based on the upper peripheral samples, deriving left reference samples of one column based on the left peripheral samples, generating a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode, and generating, encoding, and outputting prediction information for the current block. According to another embodiment of the present invention, a video encoding device is provided. The encoding device is characterized by including a prediction unit which determines an intra prediction mode for a current block, derives upper peripheral samples of a plurality of rows and left peripheral samples of a plurality of columns for the current block, derives upper reference samples of one row based on the upper peripheral samples, derives left reference samples of one column based on the left peripheral samples, and generates a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode, and an entropy encoding unit which generates, encodes, and outputs prediction information for the current block. According to the present invention, a reference sample for a current block can be derived based on a plurality of surrounding samples, and intra prediction can be performed based on the reference sample to improve prediction accuracy for the current block, thereby improving overall coding efficiency. According to the present invention, a reference sample can be derived based on a plurality of surrounding samples located in the prediction direction of an intra prediction mode for a current block, and intra prediction can be performed based on the reference sample to improve the prediction accuracy for the current block, thereby improving the overall coding efficiency. According to the present invention, weights for a plurality of surrounding samples can be derived, a reference sample can be derived based on the weights and the surrounding samples, and intra prediction can be performed based on the reference sample to improve prediction accuracy for the current block, thereby improving overall coding efficiency. Figure 1 is a drawing schematically illustrating the configuration of a video encoding device to which the present invention can be applied. FIG. 2 is a drawing schematically illustrating the configuration of a video decoding device to which the present invention can be applied. Figure 3 exemplarily shows the left peripheral samples and upper peripheral samples used for intra prediction of the current block. Figure 4 shows an example of deriving a reference sample based on multiple surrounding samples for the current block. Figure 5 shows an example of deriving a reference sample based on multiple surrounding samples for the current block. Figure 6 illustrates an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. Figure 7 shows an example of deriving the surrounding samples located at the fractional sample positions. Figure 8 illustrates an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. Figure 9 shows an example of distinguishing intra prediction modes according to prediction direction. Figure 10 illustrates an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. Figure 11 schematically illustrates a video encoding method using an encoding device according to the present invention. Figure 12 schematically illustrates a video decoding method by a decoding device according to the present invention. The present invention can have various modifications and various embodiments, and thus specific embodiments are illustrated in the drawings and described in detail. However, this is not intended to limit the present invention to specific embodiments. The terms used herein are only used to describe specific embodiments, and are not intended to limit the technical idea of the present invention. The singular expression includes plural expressions unless the context clearly indicates otherwise. It should be understood that the terms "comprises" or "has" as used herein specify that a feature, number, step, operation, component, part, or combination thereof described in the specification is present, but do not exclude in advance the possibility of the presence or addition of one or more other features, numbers, steps, operations, components, parts, or combinations thereof. Meanwhile, each component in the drawings described in the present invention is independently depicted for the convenience of explaining different characteristic functions, and does not mean that each component is implemented with separate hardware or separate software. For example, two or more components among each component may be combined to form one component, or one component may be divided into multiple components. Embodiments in which each component is integrated and / or separated are also included in the scope of the present invention as long as they do not deviate from the essence of the present invention. Hereinafter, with reference to the attached drawings, a preferred embodiment of the present invention will be described in more detail. Hereinafter, the same reference numerals are used for the same components in the drawings, and redundant descriptions of the same components are omitted. In this specification, a picture generally means a unit representing one image of a specific time period, and a slice is a unit that constitutes a part of a picture in coding. A picture may be composed of multiple slices, and pictures and slices may be used interchangeably as needed. A pixel or pel can mean the smallest unit that constitutes a picture (or image). Also, a 'sample' can be used as a term corresponding to a pixel. A sample can generally represent a pixel or a pixel value, and can represent only a pixel / pixel value of a luminance component, or only a pixel / pixel value of a chroma component. A unit represents a basic unit of image processing. A unit may include at least one of a specific region of a picture and information related to the region. In some cases, a unit may be used interchangeably with terms such as block or area. In general, an MxN block may represent a set of samples or transform coefficients consisting of M columns and N rows. Figure 1 is a drawing schematically illustrating the configuration of a video encoding device to which the present invention can be applied. Referring to FIG. 1, a video encoding device (100) may include a picture segmentation unit (105), a prediction unit (110), a subtraction unit (115), a transformation unit (120), a quantization unit (125), a reordering unit (130), an entropy encoding unit (135), a residual processing unit (140), an addition unit (150), a filter unit (155), and a memory (160). The residual processing unit (140) may include an inverse quantization unit (141) and an inverse transformation unit (142). The picture division unit (105) can divide the input picture into at least one processing unit. For example, a processing unit may be called a coding unit (CU). In this case, the coding unit may be recursively split from a largest coding unit (LCU) according to a Quad-tree binary-tree (QTBT) structure. For example, one coding unit may be split into multiple coding units of deeper depth based on a quad-tree structure and / or a binary-tree structure. In this case, for example, the quad-tree structure may be applied first and the binary-tree structure may be applied later. Alternatively, the binary-tree structure may be applied first. The coding procedure according to the present invention may be performed based on a final coding unit that is no longer split. In this case, based on coding efficiency according to image characteristics, etc., the largest coding unit may be used as the final coding unit, or, if necessary, the coding unit may be recursively split into coding units of lower depth so that a coding unit of an optimal size may be used as the final coding unit. The coding procedure here may include procedures such as prediction, transformation, and restoration, which are described later. As another example, the processing unit may include a coding unit (CU), a prediction unit (PU), or a transform unit (TU). The coding unit may be split into coding units of deeper depth from a largest coding unit (LCU) along a quad tree structure. In this case, based on coding efficiency according to image characteristics, etc., the largest coding unit may be used as the final coding unit, or, if necessary, the coding unit may be recursively split into coding units of lower depth so that the coding unit of the optimal size may be used as the final coding unit. If the smallest coding unit (SCU) is set, the coding unit cannot be split into coding units smaller than the smallest coding unit. Here, the final coding unit means a coding unit that is the basis for partitioning or dividing into prediction units or transform units. The prediction unit is a unit partitioned from the coding unit and may be a unit of sample prediction. At this time, the prediction unit may be divided into sub blocks. The transform unit may be divided from the coding unit along a quad tree structure, and may be a unit that derives a transform coefficient and / or a unit that derives a residual signal from the transform coefficient. Hereinafter, the coding unit may be called a coding block (CB), the prediction unit may be called a prediction block (PB), and the transform unit may be called a transform block (TB). The prediction block or the prediction unit may mean a specific area in the form of a block within a picture, and may include an array of prediction samples.Additionally, a transform block or transform unit may mean a specific region in the form of a block within a picture and may include an array of transform coefficients or residual samples. The prediction unit (110) can perform a prediction on a block to be processed (hereinafter, referred to as a current block) and generate a predicted block including prediction samples for the current block. The unit of the prediction performed in the prediction unit (110) can be a coding block, a transformation block, or a prediction block. The prediction unit (110) can determine whether intra prediction or inter prediction is applied to the current block. For example, the prediction unit (110) can determine whether intra prediction or inter prediction is applied on a CU basis. In the case of intra prediction, the prediction unit (110) can derive a prediction sample for the current block based on a reference sample outside the current block in the picture to which the current block belongs (hereinafter, the current picture). At this time, the prediction unit (110) can derive the prediction sample (i) based on an average or interpolation of neighboring reference samples of the current block, and (ii) can also derive the prediction sample based on a reference sample existing in a specific (prediction) direction with respect to the prediction sample among the neighboring reference samples of the current block. The case of (i) can be called a non-directional mode or a non-angular mode, and the case of (ii) can be called a directional mode or an angular mode. In intra prediction, the prediction mode can have, for example, 33 directional prediction modes and at least 2 non-directional modes. The non-directional mode can include a DC prediction mode and a planar mode. The prediction unit (110) can also determine the prediction mode to be applied to the current block by using the prediction mode applied to the surrounding blocks. In the case of inter prediction, the prediction unit (110) can derive a prediction sample for the current block based on a sample specified by a motion vector on a reference picture. The prediction unit (110) can derive a prediction sample for the current block by applying any one of a skip mode, a merge mode, and an MVP (motion vector prediction) mode. In the case of the skip mode and the merge mode, the prediction unit (110) can use the motion information of the surrounding blocks as the motion information of the current block. In the case of the skip mode, unlike the merge mode, the difference (residual) between the prediction sample and the original sample is not transmitted. In the case of the MVP mode, the motion vector of the current block can be derived by using the motion vector of the surrounding blocks as a motion vector predictor and as a motion vector predictor of the current block. In the case of inter prediction, neighboring blocks may include spatial neighboring blocks existing in the current picture and temporal neighboring blocks existing in the reference picture. The reference picture including the temporal neighboring blocks may be called a collocated picture (colPic). Motion information may include a motion vector and a reference picture index. Information such as prediction mode information and motion information may be (entropy) encoded and output in the form of a bitstream. In case the motion information of temporal surrounding blocks is used in skip mode and merge mode, the top picture in the reference picture list may be used as a reference picture. The reference pictures included in the reference picture list (Picture Order Count) may be sorted based on the POC (Picture order count) difference between the current picture and the corresponding reference picture. The POC corresponds to the display order of the pictures and can be distinguished from the coding order. The subtraction unit (115) generates a residual sample, which is the difference between the original sample and the predicted sample. When the skip mode is applied, the residual sample may not be generated as described above. The transform unit (120) transforms the residual sample in units of transform blocks to generate transform coefficients. The transform unit (120) can perform the transform according to the size of the corresponding transform block and the prediction mode applied to the coding block or prediction block spatially overlapping with the corresponding transform block. For example, if intra prediction is applied to the coding block or prediction block overlapping with the transform block and the transform block is a 4×4 residual array, the residual sample can be transformed using a DST (Discrete Sine Transform), and in other cases, the residual sample can be transformed using a DCT (Discrete Cosine Transform). The quantization unit (125) can quantize transform coefficients to generate quantized transform coefficients. The rearrangement unit (130) rearranges the quantized transform coefficients. The rearrangement unit (130) can rearrange the block-shaped quantized transform coefficients into a one-dimensional vector form through a coefficient scanning method. Although the rearrangement unit (130) is described as a separate configuration here, the rearrangement unit (130) may be a part of the quantization unit (125). The entropy encoding unit (135) can perform entropy encoding on quantized transform coefficients. The entropy encoding can include encoding methods such as exponential Golomb, context-adaptive variable length coding (CAVLC), context-adaptive binary arithmetic coding (CABAC), etc. The entropy encoding unit (135) can encode information necessary for video restoration (e.g., values of syntax elements, etc.) together or separately in addition to the quantized transform coefficients. The entropy-encoded information can be transmitted or stored in a bitstream format as a network abstraction layer (NAL) unit. The inverse quantization unit (141) inversely quantizes the values (quantized transform coefficients) quantized in the quantization unit (125), and the inverse transform unit (142) inversely transforms the values inversely quantized in the inverse quantization unit (141) to generate residual samples. The addition unit (150) restores the picture by combining the residual sample and the prediction sample. The residual sample and the prediction sample can be added in block units to generate a restoration block. Although the addition unit (150) is described as a separate configuration here, the addition unit (150) can be a part of the prediction unit (110). Meanwhile, the addition unit (150) can also be called a restoration unit or a restoration block generation unit. The filter unit (155) can apply a deblocking filter and / or a sample adaptive offset to the reconstructed picture. Through the deblocking filtering and / or the sample adaptive offset, artifacts at the block boundary in the reconstructed picture or distortions during the quantization process can be corrected. The sample adaptive offset can be applied on a sample basis and can be applied after the deblocking filtering process is completed. The filter unit (155) can also apply an ALF (Adaptive Loop Filter) to the reconstructed picture. The ALF can be applied to the reconstructed picture after the deblocking filter and / or the sample adaptive offset are applied. The memory (160) can store a restored picture (decoded picture) or information required for encoding / decoding. Here, the restored picture can be a restored picture for which a filtering procedure has been completed by the filter unit (155). The stored restored picture can be used as a reference picture for (inter) prediction of another picture. For example, the memory (160) can store (reference) pictures used for inter prediction. At this time, the pictures used for inter prediction can be specified by a reference picture set or a reference picture list. FIG. 2 is a drawing schematically illustrating the configuration of a video decoding device to which the present invention can be applied. Referring to FIG. 2, a video decoding device (200) may include an entropy decoding unit (210), a residual processing unit (220), a prediction unit (230), an addition unit (240), a filter unit (250), and a memory (260). Here, the residual processing unit (220) may include a rearrangement unit (221), an inverse quantization unit (222), and an inverse transformation unit (223). When a bitstream containing video information is input, the video decoding device (200) can restore the video corresponding to the process in which the video information is processed in the video encoding device. For example, the video decoding device (200) can perform video decoding using a processing unit applied in the video encoding device. Accordingly, the processing unit block of the video decoding can be, for example, a coding unit, and can be, for example, a coding unit, a prediction unit, or a transformation unit. The coding unit can be divided from the largest coding unit according to a quad tree structure and / or a binary tree structure. Prediction units and transform units may be further used in some cases, in which case the prediction block is a block derived or partitioned from a coding unit, and may be a unit of sample prediction. At this time, the prediction unit may be divided into sub-blocks. The transform unit may be divided from the coding unit along a quad tree structure, and may be a unit for deriving transform coefficients or a unit for deriving residual signals from transform coefficients. The entropy decoding unit (210) can parse the bitstream to output information necessary for video restoration or picture restoration. For example, the entropy decoding unit (210) can decode information in the bitstream based on a coding method such as exponential Golomb coding, CAVLC, or CABAC, and output values of syntax elements necessary for video restoration and quantized values of transform coefficients for residuals. In more detail, the CABAC entropy decoding method receives a bin corresponding to each syntax element from a bitstream, determines a context model by using information of a syntax element to be decoded and decoding information of surrounding and decoding target blocks or information of symbols / bins decoded in a previous step, and predicts an occurrence probability of a bin according to the determined context model to perform arithmetic decoding of the bin to generate a symbol corresponding to the value of each syntax element. At this time, the CABAC entropy decoding method can update the context model by using information of the decoded symbol / bin for the context model of the next symbol / bin after determining the context model. Information regarding prediction among the information decoded in the entropy decoding unit (210) is provided to the prediction unit (230), and the residual value on which entropy decoding is performed in the entropy decoding unit (210), i.e., the quantized transform coefficient, can be input to the rearrangement unit (221). The rearrangement unit (221) can rearrange the quantized transform coefficients into a two-dimensional block form. The rearrangement unit (221) can perform rearrangement in response to coefficient scanning performed in the encoding device. Although the rearrangement unit (221) is described as a separate configuration here, the rearrangement unit (221) can be a part of the dequantization unit (222). The inverse quantization unit (222) can inversely quantize quantized transform coefficients based on (inverse) quantization parameters to output transform coefficients. At this time, information for deriving the quantization parameters can be signaled from the encoding device. The inverse transform unit (223) can inversely transform the transform coefficients to derive residual samples. The prediction unit (230) can perform a prediction for the current block and generate a predicted block including prediction samples for the current block. The unit of the prediction performed in the prediction unit (230) may be a coding block, a transformation block, or a prediction block. The prediction unit (230) can determine whether to apply intra prediction or inter prediction based on the information about the prediction. At this time, the unit for determining whether to apply intra prediction or inter prediction and the unit for generating the prediction sample may be different. In addition, the unit for generating the prediction sample in inter prediction and intra prediction may also be different. For example, whether to apply inter prediction or intra prediction may be determined in units of CUs. In addition, for example, in inter prediction, the prediction mode may be determined in units of PUs and the prediction sample may be generated, and in intra prediction, the prediction mode may be determined in units of PUs and the prediction sample may be generated in units of TUs. In the case of intra prediction, the prediction unit (230) can derive a prediction sample for the current block based on surrounding reference samples within the current picture. The prediction unit (230) can derive a prediction sample for the current block by applying a directional mode or a non-directional mode based on surrounding reference samples of the current block. At this time, the prediction mode to be applied to the current block can also be determined using the intra prediction mode of the surrounding block. In the case of inter prediction, the prediction unit (230) can derive a prediction sample for the current block based on a sample specified on the reference picture by a motion vector on the reference picture. The prediction unit (230) can derive a prediction sample for the current block by applying any one of the skip mode, the merge mode, and the MVP mode. At this time, information on motion information required for inter prediction of the current block provided by the video encoding device, such as a motion vector, a reference picture index, etc., can be acquired or derived based on the information on the prediction. In the case of skip mode and merge mode, the motion information of the surrounding blocks can be used as the motion information of the current block. At this time, the surrounding blocks can include spatial surrounding blocks and temporal surrounding blocks. The prediction unit (230) can construct a merge candidate list with the motion information of available surrounding blocks, and can use the information indicated by the merge index on the merge candidate list as the motion vector of the current block. The merge index can be signaled from the encoding device. The motion information can include a motion vector and a reference picture. When the motion information of temporal surrounding blocks is used in the skip mode and the merge mode, the top picture on the reference picture list can be used as the reference picture. In skip mode, unlike merge mode, the difference (residual) between the predicted sample and the original sample is not transmitted. In the MVP mode, the motion vector of the current block can be derived using the motion vector of the surrounding block as a motion vector predictor. At this time, the surrounding block can include spatial surrounding blocks and temporal surrounding blocks. For example, when the merge mode is applied, a merge candidate list can be generated using a motion vector of a restored spatial neighboring block and / or a motion vector corresponding to a Col block, which is a temporal neighboring block. In the merge mode, a motion vector of a candidate block selected from the merge candidate list is used as a motion vector of the current block. The information about the prediction can include a merge index indicating a candidate block having an optimal motion vector selected from among the candidate blocks included in the merge candidate list. At this time, the prediction unit (230) can derive a motion vector of the current block using the merge index. As another example, when the MVP (Motion Vector Prediction) mode is applied, a motion vector predictor candidate list can be generated using the motion vector of the restored spatial neighboring block and / or the motion vector corresponding to the Col block which is the temporal neighboring block. That is, the motion vector of the restored spatial neighboring block and / or the motion vector corresponding to the Col block which is the temporal neighboring block can be used as the motion vector candidate. The information about the prediction can include a predicted motion vector index indicating an optimal motion vector selected from among the motion vector candidates included in the list. At this time, the prediction unit (230) can select the predicted motion vector of the current block from among the motion vector candidates included in the motion vector candidate list using the motion vector index. The prediction unit of the encoding device can obtain a motion vector difference (MVD) between the motion vector of the current block and the motion vector predictor, and can encode and output the same in the form of a bitstream. That is, the MVD can be obtained as a value obtained by subtracting the motion vector predictor from the motion vector of the current block. At this time, the prediction unit (230) can obtain the motion vector difference included in the information about the prediction, and derive the motion vector of the current block through the addition of the motion vector difference and the motion vector predictor. The prediction unit can also obtain or derive a reference picture index indicating a reference picture, etc. from the information about the prediction. The addition unit (240) can restore the current block or the current picture by adding the residual sample and the prediction sample. The addition unit (240) can also restore the current picture by adding the residual sample and the prediction sample in block units. When the skip mode is applied, the residual is not transmitted, so the prediction sample can become the restoration sample. Although the addition unit (240) is described as a separate configuration here, the addition unit (240) can also be a part of the prediction unit (230). Meanwhile, the addition unit (240) can also be called a restoration unit or a restoration block generation unit. The filter unit (250) may apply deblocking filtering, sample adaptive offset, and / or ALF to the restored picture. At this time, the sample adaptive offset may be applied on a sample basis and may be applied after deblocking filtering. The ALF may be applied after deblocking filtering and / or sample adaptive offset. The memory (260) can store a restored picture (decoded picture) or information required for decoding. Here, the restored picture may be a restored picture for which a filtering procedure has been completed by the filter unit (250). For example, the memory (260) can store pictures used for inter prediction. At this time, the pictures used for inter prediction may be designated by a reference picture set or a reference picture list. The restored picture may be used as a reference picture for another picture. In addition, the memory (260) may output the restored pictures according to the output order. As described above, when intra prediction is performed on a current block, the intra prediction can be performed based on surrounding samples that have already been encoded / decoded at the time of decoding the current block. That is, the prediction sample of the current block can be reconstructed using the left surrounding samples and the upper surrounding samples of the current block that have already been reconstructed. The left surrounding samples and the upper surrounding samples can be represented as shown in the following Figure 3. FIG. 3 exemplarily shows the left peripheral samples and the upper peripheral samples used for intra prediction of the current block. When intra prediction is performed on the current block, an intra prediction mode for the current block can be derived, and a prediction sample for the current block can be generated using at least one of the left peripheral samples and the upper peripheral samples according to the intra prediction mode. Here, the intra prediction modes can include, for example, two non-directional intra prediction modes and 33 directional intra prediction modes. Here, intra prediction modes 0 to 1 are the non-directional intra prediction modes, intra prediction mode 0 represents an intra planar mode, and intra prediction mode 1 represents an intra DC mode. The remaining intra prediction modes 2 to 34 are directional intra prediction modes, each of which has a prediction direction. The directional intra prediction mode can be called an intra angular mode. The predicted sample value of the current sample of the current block can be derived based on the intra prediction mode for the current block. For example, if the intra prediction mode for the current block is one of the directional intra modes, a value of a neighboring sample located in a prediction direction of the intra prediction mode for the current block with respect to the current sample in the current block can be derived as a prediction sample value of the current sample. If there is no neighboring sample of integer sample unit located in the prediction direction with respect to the current sample, a sample of fractional sample unit can be derived at a location in the prediction direction based on interpolation of neighboring samples of integer sample unit located in the periphery of the prediction direction, and a sample value of the fractional sample unit can be derived as a prediction sample value of the current sample. Meanwhile, when a prediction sample for the current block is generated using at least one of the left peripheral samples and the upper peripheral samples as described above, the prediction accuracy may deteriorate as the distance between the prediction sample and the peripheral samples increases. In addition, since the prediction sample is generated by referring to only the peripheral samples of one row or column, when noise information is included in samples adjacent to the current block, the prediction accuracy for the current block may be significantly deteriorated, and thus the overall coding efficiency may be deteriorated. Therefore, the present invention proposes a method of generating reference samples based on a plurality of left peripheral samples and upper peripheral samples, that is, left peripheral samples of multiple columns and upper peripheral samples of multiple rows, and performing intra prediction based on the generated reference samples in order to improve the prediction accuracy of intra prediction and enhance coding efficiency. Meanwhile, although the methods for generating one left reference sample (or upper reference sample) based on four left peripheral samples (or upper peripheral samples) are described in the embodiments described below, any N (N>1) of the left peripheral samples (or upper peripheral samples) may be used to generate the left reference sample (or upper reference sample). FIG. 4 illustrates an example of deriving a reference sample based on multiple surrounding samples for a current block. Referring to FIG. 4, when the size of the current block is NxN, 2N upper reference samples can be generated based on upper surrounding samples in an area having a size of 2Nx4, and 2N left reference samples can be generated based on left surrounding samples in an area having a size of 4x2N. Specifically, one upper reference sample located in a specific column can be generated based on four upper surrounding samples located in a specific column among the upper surrounding samples, and one left reference sample located in a specific row can be generated based on four left surrounding samples located in a specific row among the left surrounding samples. For example, an average value of the sample values of four upper surrounding samples located in an x column among the upper surrounding samples can be derived as the sample value of the upper reference sample in the x column. Additionally, the average value of the sample values of the four left peripheral samples located in the y column among the left peripheral samples can be derived as the sample value of the left reference sample of the y column. Meanwhile, as described above, the same weights {1 / 4, 1 / 4, 1 / 4, 1 / 4} may be assigned to the surrounding samples used to generate the reference sample, but in other words, the weights for the surrounding samples for generating the reference sample may be the same as 1 / 4, but the prediction accuracy may decrease in proportion to the distance between the current block to be encoded and the surrounding samples. Accordingly, when the four upper surrounding samples are expressed as the upper surrounding samples of the first row, the upper surrounding samples of the second row, the upper surrounding samples of the third row, and the upper surrounding samples of the fourth row from the bottom to the top, the weight of the upper surrounding samples of the first row may be assigned as 1 / 2, the weight of the upper surrounding samples of the second row may be assigned as 1 / 4, and the weights of the upper surrounding samples of the third row and the upper surrounding samples of the fourth row may be assigned as 1 / 8. Through this, among the upper surrounding samples, samples that are closer to the current block may be used with a greater proportion in generating the upper reference sample. In addition, when the four left peripheral samples are represented as the left peripheral sample of the first column, the left peripheral sample of the second column, the left peripheral sample of the third column, and the left peripheral sample of the fourth column from right to left, the weight of the left peripheral sample of the first column can be assigned as 1 / 2, the weight of the left peripheral sample of the second column can be assigned as 1 / 4, and the weights of the left peripheral sample of the third column and the left peripheral sample of the fourth column can be assigned as 1 / 8. Also, as another example, the weights of the upper peripheral samples of the first row and the upper peripheral samples of the second row may be assigned as 2 / 5, the weights of the upper peripheral samples of the third row and the upper peripheral samples of the fourth row may be assigned as 1 / 10, and the weights of the left peripheral samples of the first column may be assigned as 1 / 2, the weights of the left peripheral samples of the second column may be assigned as 1 / 4, and the weights of the left peripheral samples of the third column and the left peripheral samples of the fourth column may be assigned as 1 / 8. In addition, there may be various methods other than the examples described above for assigning weights to each peripheral sample. For example, the weight of each peripheral sample may be assigned according to the distance between each peripheral sample and the current block, the weight of each peripheral sample may be assigned according to the size of the current block, and the weight of each peripheral sample may be assigned according to the quantization parameter (QP) of the current block. In addition, the weight of each peripheral sample may be assigned based on various criteria. The upper reference sample may be derived based on the weights assigned to each of the upper peripheral samples and the upper peripheral samples. In addition, the left reference sample may be derived based on the weights assigned to each of the left peripheral samples and the left peripheral samples. In addition, the upper reference sample or the left reference sample may be derived based on the following mathematical formula. Here, D' may represent the upper reference sample (or the left reference sample), w1 may represent a weight of the upper peripheral sample of the first row (or the left peripheral sample of the first column), w2 may represent a weight of the upper peripheral sample of the second row (or the left peripheral sample of the second column), w3 may represent a weight of the upper peripheral sample of the third row (or the left peripheral sample of the third column), and w4 may represent a weight of the upper peripheral sample of the fourth row (or the left peripheral sample of the fourth column). In addition, D may represent the upper peripheral sample of the first row (or the left peripheral sample of the first column), C may represent the upper peripheral sample of the second row (or the left peripheral sample of the second column), B may represent the upper peripheral sample of the third row (or the left peripheral sample of the third column), and A may represent the upper peripheral sample of the fourth row (or the left peripheral sample of the fourth column). Meanwhile, as described above, reference samples of the current block can be derived based on 2N surrounding samples of multiple columns or rows, but the reference samples can be derived based on more than 2N surrounding samples of multiple columns or rows depending on the prediction direction of the current block. FIG. 5 illustrates an example of deriving a reference sample based on multiple surrounding samples for a current block. Referring to FIG. 5, an intra prediction mode of the current block can be derived, and a prediction direction according to the intra prediction mode can be derived. The reference samples of the current block can be generated based on surrounding samples located in the prediction direction. In this case, as illustrated in FIG. 5, the prediction direction of the current block may be from the upper right to the lower left, and upper surrounding samples located in the additional region (510) illustrated in FIG. 5 may be required for prediction of the current block. In other words, in addition to the 2N upper surrounding samples located in the first row, L upper surrounding samples may be required for prediction of the current block. In addition to the 2N upper surrounding samples located in the fourth row, M upper surrounding samples may be required for prediction of the current block. Accordingly, surrounding samples located in the additional area (510) are generated, and reference samples of the current block can be generated based on surrounding samples located in the prediction direction of the current block among the surrounding samples including the additional area (510). The samples located in the additional area (510) can be generated by padding the sample value of the rightmost upper surrounding sample among the upper surrounding samples of each row. That is, the sample value of the samples located in the additional area (510) can be derived to be the same as the sample value of the rightmost upper surrounding sample among the upper surrounding samples of each row. Meanwhile, although an example of generating samples located in the additional area for the left surrounding samples is not illustrated in the drawing, samples located in the additional area for the left surrounding samples can be generated similarly to the example of generating samples located in the additional area (510).Specifically, samples located in the additional region for the left peripheral samples can be generated by padding the sample value of the lowermost left peripheral sample among the left peripheral samples of each column. Meanwhile, when upper peripheral samples including upper peripheral samples of the additional area (510) are derived, upper reference samples of the current block can be generated based on the upper peripheral samples. An embodiment in which the upper reference samples are generated can be as illustrated in the following drawing. FIG. 6 illustrates an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. FIG. 6 (b) may represent a position of a newly generated upper reference sample. In this case, the upper peripheral samples at a position corresponding to a prediction direction of the current block at the position of the upper reference sample (610) may be used to generate the upper reference sample (610). For example, as illustrated in FIG. 6 (a), upper peripheral sample A, upper peripheral sample B, upper peripheral sample C, and upper peripheral sample D, which are upper peripheral samples at a position corresponding to a prediction direction of the current block at the position of the upper reference sample (610), may be used to generate the upper reference sample (610). If the positions of the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, and the upper peripheral sample D are all integer sample positions, that is, if the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, and the upper peripheral sample D are all integer samples, the upper reference sample (610) can be generated based on the sample values of the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, and the upper peripheral sample D. Similarly, left peripheral samples located in the prediction direction of the current block can be derived based on the position of the left reference sample, and the left reference sample can be generated based on the left peripheral samples. Meanwhile, if there is a position among the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, and the upper peripheral sample D that is not an integer sample position, that is, if there is a fractional sample among the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, and the upper peripheral sample D, the fractional sample can be derived as illustrated in the following drawing. Fig. 7 shows an example of deriving the peripheral sample located at the fractional sample position. Referring to Fig. 7, the sample value of the peripheral sample X, which is a fractional sample, can be generated by linearly interpolating the sample values of the integer samples D1 and D2 adjacent to the left and right of the peripheral sample. That is, when the upper peripheral sample A, the upper peripheral sample B, the upper peripheral sample C, or the upper peripheral sample D is the fractional sample, the fractional sample can be derived based on the upper peripheral samples at the integer sample position adjacent to the fractional sample. The fractional sample can be derived based on the following mathematical formula. Here, X may represent the fractional sample, D1 may represent an integer sample adjacent to the left of the fractional sample, D2 may represent an integer sample adjacent to the right of the fractional sample, d1 may represent the distance between D2 and X, and d2 may represent the distance between D1 and X. The values of each of the upper peripheral samples for generating the upper reference sample can be derived through the above-described method. When the upper peripheral samples of the integer sample position or the fractional sample position are derived, the upper reference sample can be generated based on the upper peripheral samples. The upper reference sample can be generated by assigning the same weight to each upper reference sample as described above. Alternatively, a weight can be assigned to each upper reference sample in consideration of the distance between the current block and each upper reference sample, and the upper reference sample can be generated based on each upper reference sample and the weight. Alternatively, a weight can be assigned to each upper reference sample based on various criteria such as the size or QP of the current block, and the upper reference sample can be generated based on each upper reference sample and the weight. In addition, the upper reference sample can be generated by substituting the weights assigned to each of the upper peripheral samples and the upper peripheral samples into the above-described mathematical expression 1. Additionally, if the fractional sample exists among the left peripheral samples, the fractional sample can be derived similarly to the above-described, and the left reference sample can be derived based on the fractional sample. Meanwhile, when a reference sample is generated based on surrounding samples located in the prediction direction of the current block, the same weight {1 / 4, 1 / 4, 1 / 4, 1 / 4} may be assigned to the surrounding samples used to generate the reference sample as described above, or the weight of each surrounding sample may be assigned according to the distance between each surrounding sample and the current block. Alternatively, the weight of each surrounding sample may be assigned according to the size of the current block or the quantization parameter (QP) of the current block. In addition, the weight of each surrounding sample may be assigned based on various criteria. The upper reference sample may be derived based on the weights assigned to each of the upper surrounding samples and the upper surrounding samples. In addition, the left reference sample may be derived based on the weights assigned to each of the left surrounding samples and the left surrounding samples. Meanwhile, if the reference samples are derived based on 2N surrounding samples of multiple columns or rows and surrounding samples included in the additional area described above according to the prediction direction of the current block as described above, the samples located in the additional area can be generated through padding as described above, but if the surrounding samples located in the additional area have already been restored, the restored surrounding samples of the additional area can be used, and if the surrounding samples located in the additional area have not been restored, the surrounding samples can be generated through the padding described above. FIG. 8 illustrates an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. As described above, the intra prediction mode of the current block can be derived, and the reference samples of the current block can be generated based on peripheral samples located in the prediction direction. In this case, as illustrated in (a) of FIG. 8, the prediction direction of the current block can be from the upper right to the lower left, and upper peripheral samples located in the additional area (810) illustrated in (a) of FIG. 8 may be required for prediction of the current block. If the upper peripheral samples included in the additional area (810) have already been restored, the restored upper peripheral samples can be used to generate the upper reference samples. Meanwhile, if the upper peripheral samples located in the additional area (820) as illustrated in (b) of FIG. 8 are not restored, the samples located in the additional area (820) may be generated by padding the sample value of the upper peripheral sample on the far right among the upper peripheral samples in each row. That is, the sample value of the samples located in the additional area (820) may be derived identically to the sample value of the upper peripheral sample on the far right among the upper peripheral samples in each row. Although the drawing does not illustrate the additional area for the left peripheral samples, the left peripheral samples included in the additional area for the left peripheral samples may be derived similarly to the method of deriving the upper peripheral samples included in the additional area (810) described above. Meanwhile, the embodiments for generating the above-described reference samples can be selected based on the prediction direction of the current block. That is, the reference samples of the current block can be generated through different methods depending on the intra prediction modes. FIG. 9 shows an example of distinguishing intra prediction modes according to a prediction direction. Referring to FIG. 9, the intra prediction modes can be distinguished into four regions according to a prediction direction. As illustrated in FIG. 9, the intra prediction modes can be included in region A, region B, region C, or region D according to a prediction direction. Specifically, for example, intra prediction modes 2 to 9 among the intra prediction modes can be included in region A, intra prediction modes 10 to 17 can be included in region B, intra prediction modes 18 to 26 can be included in region C, and intra prediction modes 27 to 34 can be included in region D. A method of deriving reference samples of a current block can be determined based on an intra prediction mode applied to the current block. For example, when the intra prediction mode included in the D region is applied to the current block, the reference samples of the current block can be derived through the method illustrated in the above-described FIG. 8. In other words, 2N upper peripheral samples of multiple rows of the current block and upper peripheral samples of an additional region can be generated, and the upper reference sample of the current block can be generated based on peripheral samples located in a prediction direction from the position of the upper reference sample of the current block among the 2N upper peripheral samples of the multiple rows and the upper peripheral samples of the additional region. When the upper peripheral samples of the additional region have already been restored, the restored upper peripheral samples can be used to generate the reference samples of the current block, and when the upper peripheral samples of the additional region have not been restored, the sample value of the rightmost upper peripheral sample among the 2N upper peripheral samples of each row can be generated by padding. As another example, when the intra prediction mode included in the C region is applied to the current block, reference samples of the current block can be generated as illustrated in FIG. 10 described below. Fig. 10 shows an example of generating upper reference samples of the current block based on upper peripheral samples including additionally generated upper peripheral samples. When the upper reference sample D' illustrated in (b) of Fig. 10 is generated, the D' can be generated based on upper peripheral samples A, B, C, and D at positions corresponding to the prediction direction of the current block at the position of the D' illustrated in (a) of Fig. 10. When the positions of the upper peripheral samples A, B, C, and D are all integer sample positions, that is, when the A, B, C, and D are all integer samples, the D' can be generated based on the sample values of the A, B, C, and D. If there is a sample at a fractional sample position among the positions of the upper peripheral samples A, B, C, and D, that is, if there is a fractional sample among A, B, C, and D, as described above, the fractional sample can be generated by linearly interpolating sample values of integer samples adjacent to the left and right of the fractional sample, and the D' can be generated based on the generated fractional sample. In addition, the H' can be generated based on the upper peripheral samples E, F, G, and H at positions corresponding to the prediction direction of the current block at the position of the H' shown in (a) of FIG. 10. If the positions of the upper peripheral samples E, F, G, and H are all integer sample positions, that is, if the E, F, G, and H are all integer samples, the H' can be generated based on the sample values of the E, F, G, and H.If there is a sample at a fractional sample position among the positions of the upper peripheral samples E, F, G, and H, that is, if there is a fractional sample among the E, F, G, and H, as described above, the fractional sample can be generated by linear interpolation of sample values of integer samples adjacent to the left and right of the fractional sample, and the H' can be generated based on the generated fractional sample. Meanwhile, when the intra prediction mode included in the B region is applied to the current block, reference samples of the current block can be generated through the same method as the method for deriving reference samples of the current block when the intra prediction mode included in the C region is applied to the current block described above. In addition, when the intra prediction mode included in the A region is applied to the current block, reference samples of the current block can be generated through the same method as the method for deriving reference samples of the current block when the intra prediction mode included in the D region is applied to the current block described above. FIG. 11 schematically illustrates a video encoding method by an encoding device according to the present invention. The method disclosed in FIG. 11 can be performed by the encoding device disclosed in FIG. 1. Specifically, for example, S1100 to S1140 of FIG. 11 can be performed by a prediction unit of the encoding device, and S1150 can be performed by an entropy encoding unit of the encoding device. An encoding device determines an intra prediction mode for a current block (S1100). The encoding device can perform various intra prediction modes to derive an intra prediction mode having an optimal RD cost as an intra prediction mode for the current block. The intra prediction mode can be one of two non-directional prediction modes and 33 directional prediction modes. As described above, the two non-directional prediction modes can include an intra DC mode and an intra planar mode. The encoding device derives upper peripheral samples of multiple rows and left peripheral samples of multiple columns for the current block (S1110). The encoding device can derive upper peripheral samples of multiple rows for the current block. For example, the encoding device can derive upper peripheral samples of four rows for the current block. In addition, for example, when the size of the current block is NxN, the encoding device can derive 2N upper peripheral samples for each row of the multiple rows. The 2N upper peripheral samples for each row can be called first upper peripheral samples. Meanwhile, as described below, the upper reference sample may be derived based on specific upper surrounding samples derived based on the location of the upper reference sample and the prediction direction of the intra prediction mode for the current block. In this case, upper surrounding samples other than the first upper surrounding samples may be used to derive the upper reference sample depending on the prediction direction of the current block. For example, when the size of the current block is NxN, the number of upper peripheral samples of the nth row among the upper peripheral samples of the plurality of rows may be more than 2N. As another example, when the nth row is the 1st row, the number of upper peripheral samples of the nth row may be 2N, and the number of upper peripheral samples of the n+1th row may be more than 2N. In addition, the number of upper peripheral samples of the nth row among the upper peripheral samples of the plurality of rows for the current block may be less than the number of upper peripheral samples of the n+1th row. Specifically, the number of upper peripheral samples of the n+1th row may be more than 2N, and the upper peripheral samples after the 2Nth among the upper peripheral samples of the n+1th row may be derived by padding the 2Nth upper peripheral sample of the upper peripheral samples of the n+1th row. Alternatively, if reconstructed samples corresponding to the 2Nth and subsequent upper peripheral samples among the upper peripheral samples of the n+1th row are generated before the prediction sample for the current block is generated, the reconstructed samples can be derived from the 2Nth and subsequent upper peripheral samples. As another example, when the size of the current block is NxN, the encoding device may derive a second upper peripheral sample for each row based on a prediction direction of the current block. Here, the second upper peripheral sample may represent an upper peripheral sample other than the first upper peripheral sample for each row. The number of second upper peripheral samples for each row may be determined based on the prediction direction. The second upper peripheral sample for each row may be derived by padding a second upper peripheral sample located at the rightmost position among the first upper peripheral samples for each row. Alternatively, if a reconstruction sample for the second upper peripheral sample is generated before a prediction sample for the current block is generated, the reconstruction sample may be derived from the second upper peripheral sample, and if a reconstruction sample for the second upper peripheral sample is not generated before the prediction sample for the current block is generated, the second upper peripheral sample for each row may be derived by padding the second upper peripheral sample located at the rightmost position among the first upper peripheral samples for each row. In another example, the encoding device may derive left marginal samples of multiple columns for the current block. For example, the encoding device may derive left marginal samples of four columns for the current block. In addition, for example, when the size of the current block is NxN, the encoding device may derive 2N left marginal samples for each column of the multiple columns. The 2N left marginal samples for each column may be referred to as first left marginal samples. Meanwhile, as described below, the left reference sample may be derived based on specific left peripheral samples derived based on the location of the left reference sample and the prediction direction of the intra prediction mode for the current block. In this case, left peripheral samples other than the first left peripheral samples may be used to derive the left reference sample depending on the prediction direction of the current block. For example, when the size of the current block is NxN, the number of left peripheral samples of the nth column among the left peripheral samples of the multiple columns may be more than 2N. As another example, when the nth column is the 1st column, the number of left peripheral samples of the nth column may be 2N, and the number of left peripheral samples of the n+1th column may be more than 2N. In addition, the number of left peripheral samples of the nth column among the left peripheral samples of the multiple columns for the current block may be less than the number of left peripheral samples of the n+1th column. Specifically, the number of left peripheral samples of the n+1th column may be more than 2N, and the left peripheral samples after the 2Nth among the left peripheral samples of the n+1th column may be derived by padding the 2Nth left peripheral sample of the left peripheral samples of the n+1th column. Alternatively, if the reconstructed samples corresponding to the 2Nth and subsequent left peripheral samples among the left peripheral samples of the n+1th column are generated before the prediction sample for the current block is generated, the reconstructed samples can be derived from the 2Nth and subsequent left peripheral samples. As another example, when the size of the current block is NxN, the encoding device may derive a second left marginal sample for each column based on a prediction direction of the current block. Here, the second left marginal sample may represent a left marginal sample other than the first left marginal sample for each row. The number of second left marginal samples for each column may be determined based on the prediction direction. The second left marginal sample for each column may be derived by padding a second left marginal sample located at the lowermost side among the first left marginal samples for each column. Alternatively, if a reconstruction sample for the second left peripheral sample is generated before a prediction sample for the current block is generated, the reconstruction sample may be derived from the second left peripheral sample, and if a reconstruction sample for the second left peripheral sample is not generated before the prediction sample for the current block is generated, the second left peripheral sample for each column may be derived by padding the second left peripheral sample located at the lowermost side among the first left peripheral samples for each column. The encoding device derives upper reference samples of one row based on the upper peripheral samples (S1120). The encoding device can derive the upper reference samples of one row based on the upper peripheral samples of the plurality of rows. For example, an upper reference sample located in the x column among the upper reference samples can be derived based on upper peripheral samples located in the x column among the upper peripheral samples. In this case, an average value of the sample values of the upper peripheral samples located in the x column can be derived as the sample value of the upper reference sample located in the x column. In addition, weights for the upper peripheral samples located in the x column can be derived, and the upper reference sample located in the x column can be derived based on the weights and the upper peripheral samples located in the x column. When the weights for the upper peripheral samples located in the x column are derived, the upper reference sample can be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the upper peripheral samples and the upper reference sample located in the x column. That is, the weight for the upper peripheral sample among the upper peripheral samples located in the x column may be derived based on the distance between the upper peripheral sample and the upper reference sample, for example, the weight of the upper peripheral sample may be inversely proportional to the distance between the upper peripheral sample and the upper reference sample. Specifically, when four rows of upper peripheral samples are derived, the weights of the upper peripheral samples may be derived as 1 / 2, 1 / 4, 1 / 8, 1 / 8 from the bottom to the top. Alternatively, the weights of the upper peripheral samples may be derived as 2 / 5, 2 / 5, 1 / 10, 1 / 10 from the bottom to the top. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. As another example, the first upper reference sample among the upper reference samples may be derived based on specific upper peripheral samples derived based on the position of the first upper reference sample and the prediction direction of the current block. Specifically, specific upper peripheral samples located in the prediction direction of the current block based on the position of the upper reference sample may be derived, and the upper reference sample may be derived based on the specific upper peripheral samples. In this case, an average value of the sample values of the specific upper peripheral samples may be derived as the sample value of the first upper reference sample. In addition, weights for the specific upper peripheral samples may be derived, and the first upper reference sample may be derived based on the weights and the specific upper peripheral samples. When the weights for the specific upper peripheral samples are derived, the first upper reference sample may be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the specific upper peripheral samples and the first upper reference sample. That is, the weight for a specific upper peripheral sample among the specific upper peripheral samples may be derived based on the distance between the specific upper peripheral sample and the first upper reference sample, for example, the weight of the specific upper peripheral sample may be inversely proportional to the distance between the specific upper peripheral sample and the first upper reference sample. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. Meanwhile, if the specific upper peripheral samples derived based on the prediction direction of the current block include an upper peripheral sample which is a fractional sample, the sample value of the upper peripheral sample which is the fractional sample can be derived through linear interpolation between the sample values of integer samples adjacent to the left and right of the upper peripheral sample which is the fractional sample. For example, the sample value of the upper peripheral sample which is the fractional sample can be derived based on the mathematical expression 2 described above. Meanwhile, a method for deriving the upper reference samples may be determined based on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a mode having a prediction angle greater than a vertical mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 27 to 34, the corresponding upper reference sample of the upper reference samples may be derived based on specific upper surrounding samples located in the prediction direction of the current block based on the position of the corresponding upper reference sample. Here, the vertical mode may correspond to intra prediction mode 26. In addition, if the intra prediction mode of the current block is a mode having a prediction angle less than or equal to a vertical mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 18 to 26, the corresponding upper reference sample of the upper reference samples may be derived based on upper surrounding samples located in the same row as the corresponding upper reference sample. The encoding device derives left reference samples of the first column based on the left peripheral samples (S1130). The encoding device can derive the left reference samples of the first column based on the left peripheral samples of the plurality of columns. For example, a left reference sample located in the y row among the left reference samples can be derived based on the left peripheral samples located in the y row among the left peripheral samples. In this case, an average value of the sample values of the left peripheral samples located in the y row can be derived as the sample value of the left reference sample located in the y row. In addition, weights for the left peripheral samples located in the y row can be derived, and the left reference sample located in the y row can be derived based on the weights and the left peripheral samples located in the y row. When the weights for the left peripheral samples located in the y row are derived, the left reference sample can be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the left peripheral samples and the left reference sample located in the y row. That is, the weight for a left peripheral sample among the left peripheral samples located in the y row may be derived based on the distance between the left peripheral sample and the left reference sample, for example, the weight of the left peripheral sample may be inversely proportional to the distance between the left peripheral sample and the left reference sample. Specifically, when left peripheral samples of four columns are derived, the weights of the left peripheral samples may be derived as 1 / 2, 1 / 4, 1 / 8, 1 / 8 in order from right to left. Alternatively, the weights of the left peripheral samples may be derived as 2 / 5, 2 / 5, 1 / 10, 1 / 10 in order from right to left. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. As another example, the first left reference sample among the left reference samples may be derived based on specific left peripheral samples derived based on the position of the first left reference sample and the prediction direction of the current block. Specifically, specific left peripheral samples located in the prediction direction of the current block based on the position of the left reference sample may be derived, and the left reference sample may be derived based on the specific left peripheral samples. In this case, an average value of the sample values of the specific left peripheral samples may be derived as the sample value of the first left reference sample. In addition, weights for the specific left peripheral samples may be derived, and the first left reference sample may be derived based on the weights and the specific left peripheral samples. When the weights for the specific left peripheral samples are derived, the first left reference sample may be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the specific left peripheral samples and the first left reference sample. That is, the weight for a specific left peripheral sample among the specific left peripheral samples may be derived based on the distance between the specific left peripheral sample and the first left reference sample, for example, the weight of the specific left peripheral sample may be inversely proportional to the distance between the specific left peripheral sample and the first left reference sample. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. Meanwhile, if the specific left peripheral samples derived based on the prediction direction of the current block include a left peripheral sample, which is a fractional sample, the sample value of the left peripheral sample, which is a fractional sample, can be derived through linear interpolation between the sample values of integer samples adjacent to the left and right of the left peripheral sample, which is a fractional sample. For example, the sample value of the left peripheral sample, which is a fractional sample, can be derived based on the mathematical expression 2 described above. Meanwhile, a method for deriving the left reference samples may be determined based on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a mode having a prediction angle greater than a horizontal mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 2 to 9, the corresponding left reference sample of the left reference samples may be derived based on specific left peripheral samples located in the prediction direction of the current block with respect to the position of the corresponding left reference sample. Here, the horizontal mode may correspond to intra prediction mode 10. In addition, if the intra prediction mode of the current block is a mode having a prediction angle less than or equal to a horizontal mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 10 to 17, the corresponding left reference sample of the left reference samples may be derived based on left peripheral samples located in the same row as the corresponding left reference sample. The encoding device generates a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode (S1140). The encoding device can generate the prediction sample based on an upper reference sample or a left reference sample located in a prediction direction of the intra prediction mode based on a position of the prediction sample. The encoding device generates, encodes, and outputs prediction information for the current block (S1150). The encoding device can encode information about an intra prediction mode for the current block and output it in the form of a bitstream. The encoding device can generate, encode, and output information about an intra prediction mode indicating the intra prediction mode in the form of a bitstream. The information about the intra prediction mode may include information directly indicating the intra prediction mode for the current block, or may include information indicating any one candidate from a list of intra prediction mode candidates derived based on the intra prediction mode of a block to the left or above the current block. Fig. 12 schematically illustrates a video decoding method by a decoding device according to the present invention. The method disclosed in Fig. 12 can be performed by the decoding device disclosed in Fig. 2. Specifically, for example, S1200 to S1240 of Fig. 12 can be performed by a prediction unit of the decoding device of the decoding device. A decoding device derives an intra prediction mode for a current block (S1200). The decoding device can obtain prediction information for the current block through a bitstream. The prediction information may include information directly indicating an intra prediction mode for the current block, or may include information indicating any one candidate from a list of intra prediction mode candidates derived based on an intra prediction mode of a block to the left or above the current block. The decoding device can derive an intra prediction mode for the current block based on the obtained prediction information. The intra prediction mode may be one of two non-directional prediction modes and 33 directional prediction modes. As described above, the two non-directional prediction modes may include an intra DC mode and an intra planar mode. The decoding device derives upper peripheral samples of multiple rows and left peripheral samples of multiple columns for the current block (S1210). The decoding device can derive upper peripheral samples of multiple rows for the current block. For example, the decoding device can derive upper peripheral samples of four rows for the current block. In addition, for example, when the size of the current block is NxN, the decoding device can derive 2N upper peripheral samples for each row of the multiple rows. The 2N upper peripheral samples for each row can be called first upper peripheral samples. Meanwhile, as described below, the upper reference sample may be derived based on specific upper surrounding samples derived based on the location of the upper reference sample and the prediction direction of the intra prediction mode for the current block. In this case, upper surrounding samples other than the first upper surrounding samples may be used to derive the upper reference sample depending on the prediction direction of the current block. For example, when the size of the current block is NxN, the number of upper peripheral samples of the nth row among the upper peripheral samples of the plurality of rows may be more than 2N. As another example, when the nth row is the 1st row, the number of upper peripheral samples of the nth row may be 2N, and the number of upper peripheral samples of the n+1th row may be more than 2N. In addition, the number of upper peripheral samples of the nth row among the upper peripheral samples of the plurality of rows for the current block may be less than the number of upper peripheral samples of the n+1th row. Specifically, the number of upper peripheral samples of the n+1th row may be more than 2N, and the upper peripheral samples after the 2Nth among the upper peripheral samples of the n+1th row may be derived by padding the 2Nth upper peripheral sample of the upper peripheral samples of the n+1th row. Alternatively, if reconstructed samples corresponding to the 2Nth and subsequent upper peripheral samples among the upper peripheral samples of the n+1th row are generated before the prediction sample for the current block is generated, the reconstructed samples can be derived from the 2Nth and subsequent upper peripheral samples. As another example, when the size of the current block is NxN, the decoding device may derive the second upper peripheral sample for each row based on the prediction direction of the current block. Here, the second upper peripheral sample may represent an upper peripheral sample for each row other than the first upper peripheral sample. The number of second upper peripheral samples for each row may be determined based on the prediction direction. The second upper peripheral sample for each row may be derived by padding the first upper peripheral sample located at the rightmost position among the first upper peripheral samples for each row. Alternatively, if a reconstruction sample for the second upper peripheral sample is generated before a prediction sample for the current block is generated, the reconstruction sample may be derived from the second upper peripheral sample, and if a reconstruction sample for the second upper peripheral sample is not generated before the prediction sample for the current block is generated, the second upper peripheral sample for each row may be derived by padding a first upper peripheral sample located at the rightmost position among the first upper peripheral samples for each row. In another example, the decoding device may derive left peripheral samples of multiple columns for the current block. For example, the decoding device may derive left peripheral samples of four columns for the current block. In addition, for example, when the size of the current block is NxN, the decoding device may derive 2N left peripheral samples for each column of the multiple columns. The 2N left peripheral samples for each column may be referred to as first left peripheral samples. Meanwhile, as described below, the left reference sample may be derived based on specific left peripheral samples derived based on the location of the left reference sample and the prediction direction of the intra prediction mode for the current block. In this case, left peripheral samples other than the first left peripheral samples may be used to derive the left reference sample depending on the prediction direction of the current block. For example, when the size of the current block is NxN, the number of left peripheral samples of the nth column among the left peripheral samples of the multiple columns may be more than 2N. As another example, when the nth column is the 1st column, the number of left peripheral samples of the nth column may be 2N, and the number of left peripheral samples of the n+1th column may be more than 2N. In addition, the number of left peripheral samples of the nth column among the left peripheral samples of the multiple columns for the current block may be less than the number of left peripheral samples of the n+1th column. Specifically, the number of left peripheral samples of the n+1th column may be more than 2N, and the left peripheral samples after the 2Nth among the left peripheral samples of the n+1th column may be derived by padding the 2Nth left peripheral sample of the left peripheral samples of the n+1th column. Alternatively, if the reconstructed samples corresponding to the 2Nth and subsequent left peripheral samples among the left peripheral samples of the n+1th column are generated before the prediction sample for the current block is generated, the reconstructed samples can be derived from the 2Nth and subsequent left peripheral samples. As another example, when the size of the current block is NxN, the decoding device can derive the second left peripheral sample for each column based on the prediction direction of the current block. The number of second left peripheral samples for each column can be determined based on the prediction direction. The second left peripheral sample for each column can be derived by padding the first left peripheral sample located at the lowermost position among the first left peripheral samples for each column. Alternatively, when a reconstruction sample for the second left peripheral sample is generated before the prediction sample for the current block is generated, the reconstruction sample can be derived as the second left peripheral sample, and when a reconstruction sample for the second left peripheral sample is not generated before the prediction sample for the current block is generated, the second left peripheral sample for each column can be derived by padding the first left peripheral sample located at the lowermost position among the first left peripheral samples for each column. The decoding device derives upper reference samples of one row based on the upper peripheral samples (S1220). The decoding device can derive the upper reference samples of one row based on the upper peripheral samples of the plurality of rows. For example, an upper reference sample located in the x column among the upper reference samples can be derived based on upper peripheral samples located in the x column among the upper peripheral samples. In this case, an average value of the sample values of the upper peripheral samples located in the x column can be derived as the sample value of the upper reference sample located in the x column. In addition, weights for the upper peripheral samples located in the x column can be derived, and the upper reference sample located in the x column can be derived based on the weights and the upper peripheral samples located in the x column. When the weights for the upper peripheral samples located in the x column are derived, the upper reference sample can be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the upper peripheral samples and the upper reference sample located in the x column. That is, the weight for the upper peripheral sample among the upper peripheral samples located in the x column may be derived based on the distance between the upper peripheral sample and the upper reference sample, for example, the weight of the upper peripheral sample may be inversely proportional to the distance between the upper peripheral sample and the upper reference sample. Specifically, when four rows of upper peripheral samples are derived, the weights of the upper peripheral samples may be derived as 1 / 2, 1 / 4, 1 / 8, 1 / 8 from the bottom to the top. Alternatively, the weights of the upper peripheral samples may be derived as 2 / 5, 2 / 5, 1 / 10, 1 / 10 from the bottom to the top. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. As another example, the first upper reference sample among the upper reference samples may be derived based on specific upper peripheral samples derived based on the position of the first upper reference sample and the prediction direction of the current block. Specifically, specific upper peripheral samples located in the prediction direction of the current block based on the position of the upper reference sample may be derived, and the upper reference sample may be derived based on the specific upper peripheral samples. In this case, an average value of the sample values of the specific upper peripheral samples may be derived as the sample value of the first upper reference sample. In addition, weights for the specific upper peripheral samples may be derived, and the first upper reference sample may be derived based on the weights and the specific upper peripheral samples. When the weights for the specific upper peripheral samples are derived, the first upper reference sample may be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the specific upper peripheral samples and the first upper reference sample. That is, the weight for a specific upper peripheral sample among the specific upper peripheral samples may be derived based on the distance between the specific upper peripheral sample and the first upper reference sample, for example, the weight of the specific upper peripheral sample may be inversely proportional to the distance between the specific upper peripheral sample and the first upper reference sample. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. Meanwhile, if the specific upper peripheral samples derived based on the prediction direction of the current block include an upper peripheral sample which is a fractional sample, the sample value of the upper peripheral sample which is the fractional sample can be derived through linear interpolation between the sample values of integer samples adjacent to the left and right of the upper peripheral sample which is the fractional sample. For example, the sample value of the upper peripheral sample which is the fractional sample can be derived based on the mathematical expression 2 described above. Meanwhile, a method for deriving the upper reference samples may be determined based on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a mode having a prediction angle greater than a vertical mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 27 to 34, the corresponding upper reference sample of the upper reference samples may be derived based on specific upper surrounding samples located in the prediction direction of the current block based on the position of the corresponding upper reference sample. Here, the vertical mode may correspond to intra prediction mode 26. In addition, if the intra prediction mode of the current block is a mode having a prediction angle less than or equal to a vertical mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 18 to 26, the corresponding upper reference sample of the upper reference samples may be derived based on upper surrounding samples located in the same row as the corresponding upper reference sample. The decoding device derives left reference samples of the first column based on the left peripheral samples (S1230). The decoding device can derive the left reference samples of the first column based on the left peripheral samples of the multiple columns. For example, a left reference sample located in the y row among the left reference samples can be derived based on the left peripheral samples located in the y row among the left peripheral samples. In this case, an average value of the sample values of the left peripheral samples located in the y row can be derived as the sample value of the left reference sample located in the y row. In addition, weights for the left peripheral samples located in the y row can be derived, and the left reference sample located in the y row can be derived based on the weights and the left peripheral samples located in the y row. When the weights for the left peripheral samples located in the y row are derived, the left reference sample can be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the left peripheral samples and the left reference sample located in the y row. That is, the weight for a left peripheral sample among the left peripheral samples located in the y row may be derived based on the distance between the left peripheral sample and the left reference sample, for example, the weight of the left peripheral sample may be inversely proportional to the distance between the left peripheral sample and the left reference sample. Specifically, when left peripheral samples of four columns are derived, the weights of the left peripheral samples may be derived as 1 / 2, 1 / 4, 1 / 8, 1 / 8 in order from right to left. Alternatively, the weights of the left peripheral samples may be derived as 2 / 5, 2 / 5, 1 / 10, 1 / 10 in order from right to left. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. As another example, the first left reference sample among the left reference samples may be derived based on specific left peripheral samples derived based on the position of the first left reference sample and the prediction direction of the current block. Specifically, specific left peripheral samples located in the prediction direction of the current block based on the position of the left reference sample may be derived, and the left reference sample may be derived based on the specific left peripheral samples. In this case, an average value of the sample values of the specific left peripheral samples may be derived as the sample value of the first left reference sample. In addition, weights for the specific left peripheral samples may be derived, and the first left reference sample may be derived based on the weights and the specific left peripheral samples. When the weights for the specific left peripheral samples are derived, the first left reference sample may be derived based on the above-described Mathematical Expression 1. Meanwhile, for example, the weights may be derived based on the distance between the specific left peripheral samples and the first left reference sample. That is, the weight for a specific left peripheral sample among the specific left peripheral samples may be derived based on the distance between the specific left peripheral sample and the first left reference sample, for example, the weight of the specific left peripheral sample may be inversely proportional to the distance between the specific left peripheral sample and the first left reference sample. Additionally, as another example, the weights may be derived based on the size or quantization parameter (QP) of the current block. Additionally, the weights may be derived based on various criteria. Meanwhile, if the specific left peripheral samples derived based on the prediction direction of the current block include a left peripheral sample, which is a fractional sample, the sample value of the left peripheral sample, which is a fractional sample, can be derived through linear interpolation between the sample values of integer samples adjacent to the left and right of the left peripheral sample, which is a fractional sample. For example, the sample value of the left peripheral sample, which is a fractional sample, can be derived based on the mathematical expression 2 described above. Meanwhile, a method for deriving the left reference samples may be determined based on the intra prediction mode of the current block. For example, if the intra prediction mode of the current block is a mode having a prediction angle greater than a horizontal mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 2 to 9, the corresponding left reference sample of the left reference samples may be derived based on specific left peripheral samples located in the prediction direction of the current block with respect to the position of the corresponding left reference sample. Here, the horizontal mode may correspond to intra prediction mode 10. In addition, if the intra prediction mode of the current block is a mode having a prediction angle less than or equal to a horizontal mode, that is, if the intra prediction mode of the current block is one of intra prediction modes 10 to 17, the corresponding left reference sample of the left reference samples may be derived based on left peripheral samples located in the same row as the corresponding left reference sample. The decoding device generates a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode (S1240). The decoding device can generate the prediction sample based on the upper reference sample or the left reference sample located in the prediction direction of the intra prediction mode based on the position of the prediction sample. Meanwhile, although not shown in the drawing, the decoding device may directly use the prediction sample as a restoration sample, or may generate a restoration sample by adding a residual sample to the prediction sample, depending on the prediction mode. The decoding device may receive information about the residual for the target block, if there is a residual sample for the target block, and the information about the residual may be included in the information about the face. The information about the residual may include a transform coefficient about the residual sample. The decoding device may derive the residual sample (or the residual sample array) for the target block based on the residual information. The decoding device may generate a restoration sample based on the prediction sample and the residual sample, and may derive a restoration block or a restoration picture based on the restoration sample. As described above, the decoding device may then apply an in-loop filtering procedure, such as deblocking filtering and / or SAO procedure, to the reconstructed picture to improve subjective / objective picture quality as needed. According to the present invention described above, a reference sample for a current block can be derived based on a plurality of surrounding samples, and intra prediction can be performed based on the reference sample to improve prediction accuracy for the current block, thereby improving overall coding efficiency. In addition, according to the present invention, a reference sample can be derived based on a plurality of surrounding samples located in the prediction direction of an intra prediction mode for a current block, and intra prediction can be performed based on the reference sample to improve the prediction accuracy for the current block, thereby improving the overall coding efficiency. In addition, according to the present invention, weights for a plurality of surrounding samples can be derived, a reference sample can be derived based on the weights and the surrounding samples, and intra prediction can be performed based on the reference sample to improve the prediction accuracy for the current block, thereby improving the overall coding efficiency. In the above-described embodiments, the methods are described based on a flow chart as a series of steps or blocks, but the present invention is not limited to the order of the steps, and some steps may occur in a different order or simultaneously with other steps than those described above. Furthermore, those skilled in the art will understand that the steps depicted in the flow chart are not exclusive, and other steps may be included or one or more steps of the flow chart may be deleted without affecting the scope of the present invention. The method according to the present invention described above can be implemented in the form of software, and the encoding device and / or decoding device according to the present invention can be included in a device that performs image processing, such as a TV, a computer, a smartphone, a set-top box, a display device, etc. When the embodiments of the present invention are implemented as software, the above-described method can be implemented as a module (process, function, etc.) that performs the above-described function. The module can be stored in a memory and executed by a processor. The memory can be inside or outside the processor and can be connected to the processor by various well-known means. The processor can include an application-specific integrated circuit (ASIC), another chipset, a logic circuit, and / or a data processing device. The memory can include a read-only memory (ROM), a random access memory (RAM), a flash memory, a memory card, a storage medium, and / or other storage devices.
Claims
1. A video decoding method performed by a decoding device, A step of deriving an intra prediction mode for the current block; A step of deriving upper peripheral samples of multiple rows and left peripheral samples of multiple columns for the current block; A step of deriving upper reference samples of one row based on the upper peripheral samples; A step of deriving left reference samples of the first row based on the left peripheral samples; and An image decoding method, characterized by comprising a step of generating a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode.
2. In paragraph 1, An image decoding method, characterized in that an upper reference sample located in the x column among the upper reference samples is derived based on upper surrounding samples located in the x column among the upper surrounding samples.
3. In paragraph 2, Weights for the upper peripheral samples located in the above x column are derived, An image decoding method, characterized in that the upper reference sample located in the x-column is derived based on the above weights and the upper surrounding samples located in the x-column.
4. In paragraph 1, An image decoding method, characterized in that a first upper reference sample among the above upper reference samples is derived based on specific upper surrounding samples derived based on a position of the first upper reference sample and a prediction direction of the current block.
5. In paragraph 4, Weights for the specific upper surrounding samples are derived based on the predicted direction of the current block, An image decoding method, characterized in that the first upper reference sample is derived based on the above weights and the specific upper surrounding samples.
6. In paragraph 5, An image decoding method, characterized in that the above weights are derived based on the distance between the specific upper surrounding samples and the first upper reference sample.
7. In paragraph 4, If the size of the current block above is NxN, An image decoding method, characterized in that the number of upper peripheral samples of the nth row among the upper peripheral samples of multiple rows for the current block is less than the number of upper peripheral samples of the n+1th row.
8. In paragraph 7, The number of upper surrounding samples of the n+1th row is more than 2N, An image decoding method, characterized in that the 2Nth and subsequent upper peripheral samples among the upper peripheral samples of the n+1th row are derived by padding the 2Nth upper peripheral sample among the upper peripheral samples of the n+1th row.
9. In paragraph 7, An image decoding method, characterized in that, if reconstructed samples corresponding to the 2Nth and subsequent upper peripheral samples among the upper peripheral samples of the n+1th row are generated before the prediction sample for the current block is generated, the reconstructed samples are derived from the 2Nth and subsequent upper peripheral samples.
10. In paragraph 4, If the upper peripheral samples derived based on the prediction direction of the current block above include an upper peripheral sample that is a fractional sample, An image decoding method, characterized in that the sample value of the upper peripheral sample, which is the fractional sample, is derived through linear interpolation between the sample values of the integer samples adjacent to the left and right of the upper peripheral sample, which is the fractional sample.
11. In a decoding device that performs image decoding, An entropy decoding unit that obtains prediction information for the current block; and A decoding device, characterized by including a prediction unit which derives an intra prediction mode for a current block, derives upper peripheral samples of multiple rows and left peripheral samples of multiple columns for the current block, derives upper reference samples of one row based on the upper peripheral samples, derives left reference samples of one column based on the left peripheral samples, and generates a prediction sample for the current block using at least one of the upper reference samples and the left reference samples according to the intra prediction mode.
12. In paragraph 11, A decoding device, characterized in that the upper reference sample located in the x column among the upper reference samples is derived based on the upper peripheral samples located in the x column among the upper peripheral samples.
13. In paragraph 11, A decoding device, characterized in that the first upper reference sample among the above upper reference samples is derived based on specific upper surrounding samples derived based on the position of the first upper reference sample and the prediction direction of the current block.
14. In paragraph 13, If the size of the current block above is NxN, A decoding device, characterized in that the number of upper peripheral samples of the nth row among the upper peripheral samples of the plurality of rows for the current block is less than the number of upper peripheral samples of the n+1th row.
15. In paragraph 14, The number of upper surrounding samples of the n+1th row is more than 2N, If restoration samples corresponding to the 2Nth and subsequent surrounding samples among the upper surrounding samples of the n+1th row are generated before the prediction sample for the current block is generated, the restoration samples are derived from the 2Nth and subsequent surrounding samples, A decoding device, characterized in that if restoration samples corresponding to the 2Nth and subsequent surrounding samples among the upper surrounding samples of the n+1th row are not generated before the prediction sample for the current block is generated, the 2Nth and subsequent upper surrounding samples among the upper surrounding samples of the n+1th row are derived by padding the 2Nth upper surrounding sample among the upper surrounding samples of the n+1th row.